Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Commit 6fb1a4c

Browse files
committed
split out SymbolGraphs, PackageLoader, PackageResolution, and Versions modules
1 parent 8f0fc4c commit 6fb1a4c

File tree

76 files changed

+2007
-1801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2007
-1801
lines changed

Diff for: Package.swift

+46-9
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ let package = Package(
55
name: "swift-biome",
66
products:
77
[
8-
.library(name: "Biome", targets: ["Biome"]),
9-
.library(name: "PackageCatalog", targets: ["PackageCatalog"]),
8+
.library(name: "Versions", targets: ["Versions"]),
9+
.library(name: "SymbolGraphs", targets: ["SymbolGraphs"]),
10+
.library(name: "Biome", targets: ["Biome"]),
11+
.library(name: "PackageResolution", targets: ["PackageResolution"]),
12+
.library(name: "PackageCatalogs", targets: ["PackageCatalogs"]),
13+
.library(name: "PackageLoader", targets: ["PackageLoader"]),
1014

11-
.executable(name: "preview", targets: ["Preview"]),
15+
.executable(name: "preview", targets: ["Preview"]),
1216
],
1317
dependencies:
1418
[
19+
.package(url: "https://github.com/kelvin13/swift-grammar", exact: "0.1.5"),
1520
.package(url: "https://github.com/kelvin13/swift-json", branch: "master"),
1621
.package(url: "https://github.com/kelvin13/swift-highlight", exact: "0.1.4"),
1722
.package(url: "https://github.com/kelvin13/swift-resource", exact: "0.3.2"),
@@ -30,9 +35,26 @@ let package = Package(
3035
],
3136
targets:
3237
[
38+
.target(name: "Versions",
39+
dependencies:
40+
[
41+
.product(name: "Grammar", package: "swift-grammar"),
42+
]),
43+
44+
.target(name: "SymbolGraphs",
45+
dependencies:
46+
[
47+
.target(name: "Versions"),
48+
49+
.product(name: "JSON", package: "swift-json"),
50+
.product(name: "Notebook", package: "swift-highlight"),
51+
]),
52+
3353
.target(name: "Biome",
3454
dependencies:
3555
[
56+
.target(name: "SymbolGraphs"),
57+
3658
.product(name: "DOM", package: "swift-dom"),
3759
.product(name: "JSON", package: "swift-json"),
3860
.product(name: "Resources", package: "swift-resource"),
@@ -43,20 +65,35 @@ let package = Package(
4365
.product(name: "Markdown", package: "swift-markdown"),
4466
]),
4567

46-
.target(name: "PackageCatalog",
68+
.target(name: "PackageResolution",
4769
dependencies:
4870
[
49-
.target(name: "Biome"),
50-
71+
.target(name: "SymbolGraphs"),
72+
5173
.product(name: "JSON", package: "swift-json"),
52-
.product(name: "SystemExtras", package: "swift-resource"),
5374
]),
5475

55-
.executableTarget(name: "Preview",
76+
.target(name: "PackageCatalogs",
77+
dependencies:
78+
[
79+
.target(name: "SymbolGraphs"),
80+
81+
.product(name: "JSON", package: "swift-json"),
82+
.product(name: "SystemExtras", package: "swift-system-extras"),
83+
]),
84+
85+
.target(name: "PackageLoader",
5686
dependencies:
5787
[
88+
.target(name: "PackageResolution"),
89+
.target(name: "PackageCatalogs"),
5890
.target(name: "Biome"),
59-
.target(name: "PackageCatalog"),
91+
]),
92+
93+
.executableTarget(name: "Preview",
94+
dependencies:
95+
[
96+
.target(name: "PackageLoader"),
6097

6198
.product(name: "NIO", package: "swift-nio"),
6299
.product(name: "NIOHTTP1", package: "swift-nio"),

Diff for: Sources/Biome/Article/Article.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import struct SymbolGraphs.Path
12
import HTML
23

34
@usableFromInline

Diff for: Sources/Biome/Article/Extension.Metadata.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import struct SymbolGraphs.Path
12
import Markdown
23

34
extension Extension

Diff for: Sources/Biome/Article/Extension.Renderer.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import enum SymbolGraphs.Highlight
12
import Markdown
23
import HTML
34

Diff for: Sources/Biome/Article/Extension.swift

-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Markdown
22
import Resources
33
import HTML
44

5-
public
65
struct Extension:Sendable
76
{
87
enum Node
@@ -36,17 +35,6 @@ struct Extension:Sendable
3635
}
3736
}
3837

39-
public
40-
init(parsing markdown:String, name:String)
41-
{
42-
self.init(markdown: markdown)
43-
if case nil = self.metadata.path
44-
{
45-
// replace spaces in the article name with hyphens
46-
self.metadata.path = .init(last: .init(name.map { $0 == " " ? "-" : $0 }))
47-
}
48-
}
49-
public
5038
init(markdown string:String)
5139
{
5240
let root:Markdown.Document = .init(parsing: string,

Diff for: Sources/Biome/Article/SwiftSyntax.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import SwiftSyntax
1+
import enum SymbolGraphs.Highlight
22
import SwiftSyntaxParser
3+
import SwiftSyntax
34

45
extension Extension.Renderer
56
{

Diff for: Sources/Biome/Ecosystem/Cache.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension Ecosystem
2222
let index:Symbol.Index = .init($0.index, offset: offset)
2323

2424
let symbol:Symbol = current.package[local: index]
25-
switch symbol.color
25+
switch symbol.community
2626
{
2727
case .protocol, .typealias, .concretetype(_), .global(_):
2828
break

Diff for: Sources/Biome/Ecosystem/Ecosystem.Resolution.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Versions
12
import Resources
23
import DOM
34

Diff for: Sources/Biome/Ecosystem/Ecosystem.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import DOM
1+
@_exported import SymbolGraphs
2+
@_exported import Versions
23
import Resources
4+
import DOM
35

46
public
57
struct Ecosystem:Sendable
@@ -138,7 +140,7 @@ extension Ecosystem
138140

139141
@discardableResult
140142
public mutating
141-
func updatePackage(_ graph:Package.Graph, pins era:[Package.ID: MaskedVersion])
143+
func updatePackage(_ graph:PackageGraph, pins era:[Package.ID: MaskedVersion])
142144
throws -> Package.Index
143145
{
144146
try Task.checkCancellation()

Diff for: Sources/Biome/Ecosystem/Error.swift

+7-29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import SymbolGraphs
2+
13
extension Ecosystem
24
{
35
struct LinkResolutionError:Error
@@ -36,36 +38,12 @@ extension Packages
3638
}
3739
}
3840
}
39-
extension Module
40-
{
41-
public
42-
enum SubgraphDecodingError:Error, CustomStringConvertible
43-
{
44-
case duplicateAvailabilityDomain(Availability.Domain)
45-
case invalidFragmentColor(String)
46-
case mismatchedCulture(ID, expected:ID)
47-
48-
public
49-
var description:String
50-
{
51-
switch self
52-
{
53-
case .duplicateAvailabilityDomain(let domain):
54-
return "duplicate entries for availability domain '\(domain.rawValue)'"
55-
case .mismatchedCulture(let id, expected: let expected):
56-
return "subgraph culture is '\(id)', expected '\(expected)'"
57-
case .invalidFragmentColor(let string):
58-
return "invalid fragment color '\(string)'"
59-
}
60-
}
61-
}
62-
}
6341
extension Symbol
6442
{
6543
public
6644
enum PoliticalError<Target>:Error, CustomStringConvertible
6745
{
68-
case miscegenation(is:Color, and:Edge.Kind?, of:(adjective:Color, noun:Target))
46+
case miscegenation(is:Community, and:Edge.Kind?, of:(adjective:Community, noun:Target))
6947
case conflict(is:Role<Target>, and:Role<Target>)
7048

7149
func map<T>(_ transform:(Target) throws -> T) rethrows -> PoliticalError<T>
@@ -75,8 +53,8 @@ extension Symbol
7553
case .conflict(is: let first, and: let second):
7654
return .conflict(is: try first.map(transform),
7755
and: try second.map(transform))
78-
case .miscegenation(is: let color, and: let relation, of: let object):
79-
return .miscegenation(is: color, and: relation,
56+
case .miscegenation(is: let community, and: let relation, of: let object):
57+
return .miscegenation(is: community, and: relation,
8058
of: (object.adjective, try transform(object.noun)))
8159
}
8260
}
@@ -87,8 +65,8 @@ extension Symbol
8765
{
8866
case .conflict(is: let first, and: let second):
8967
return "is \(first) and \(second)"
90-
case .miscegenation(is: let color, and: let relation, of: let object):
91-
return "is \(color) and \(relation?.description ?? "feature") of \(object.adjective) '\(object.noun)'"
68+
case .miscegenation(is: let community, and: let relation, of: let object):
69+
return "is \(community) and \(relation?.description ?? "feature") of \(object.adjective) '\(object.noun)'"
9270
}
9371
}
9472
}

0 commit comments

Comments
 (0)