Skip to content

Commit 59a8290

Browse files
committed
Rename documentation bundle to documentation inputs
1 parent 3c67f9a commit 59a8290

File tree

166 files changed

+1744
-1662
lines changed

Some content is hidden

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

166 files changed

+1744
-1662
lines changed

Sources/SwiftDocC/Converter/DocumentationContextConverter.swift

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public class DocumentationContextConverter {
2020
/// The context the converter uses to resolve references it finds in the documentation node's content.
2121
let context: DocumentationContext
2222

23-
/// The bundle that contains the content from which the documentation node originated.
24-
let bundle: DocumentationBundle
23+
/// The input files that contains the content from which the documentation node originated.
24+
let inputs: DocumentationContext.Inputs
2525

2626
/// A context that contains common pre-rendered pieces of content.
2727
let renderContext: RenderContext
@@ -48,7 +48,7 @@ public class DocumentationContextConverter {
4848
/// The converter uses bundle and context to resolve references to other documentation and describe the documentation hierarchy.
4949
///
5050
/// - Parameters:
51-
/// - bundle: The bundle that contains the content from which the documentation node originated.
51+
/// - inputs: The inputs files that the documentation node originated from.
5252
/// - context: The context that the converter uses to to resolve references it finds in the documentation node's content.
5353
/// - renderContext: A context that contains common pre-rendered pieces of content.
5454
/// - emitSymbolSourceFileURIs: Whether the documentation converter should include
@@ -61,15 +61,15 @@ public class DocumentationContextConverter {
6161
/// - sourceRepository: The source repository where the documentation's sources are hosted.
6262
/// - symbolIdentifiersWithExpandedDocumentation: A list of symbol IDs that have version of their documentation page with more content that a renderer can link to.
6363
public init(
64-
bundle: DocumentationBundle,
64+
inputs: DocumentationContext.Inputs,
6565
context: DocumentationContext,
6666
renderContext: RenderContext,
6767
emitSymbolSourceFileURIs: Bool = false,
6868
emitSymbolAccessLevels: Bool = false,
6969
sourceRepository: SourceRepository? = nil,
7070
symbolIdentifiersWithExpandedDocumentation: [String]? = nil
7171
) {
72-
self.bundle = bundle
72+
self.inputs = inputs
7373
self.context = context
7474
self.renderContext = renderContext
7575
self.shouldEmitSymbolSourceFileURIs = emitSymbolSourceFileURIs
@@ -78,6 +78,27 @@ public class DocumentationContextConverter {
7878
self.symbolIdentifiersWithExpandedDocumentation = symbolIdentifiersWithExpandedDocumentation
7979
}
8080

81+
@available(*, deprecated, renamed: "init(inputs:context:renderContext:emitSymbolSourceFileURIs:emitSymbolAccessLevels:sourceRepository:symbolIdentifiersWithExpandedDocumentation:)", message: "Use 'init(inputs:context:renderContext:emitSymbolSourceFileURIs:emitSymbolAccessLevels:sourceRepository:symbolIdentifiersWithExpandedDocumentation:)' instead. This deprecated API will be removed after 6.3 is released")
82+
public convenience init(
83+
bundle: DocumentationBundle,
84+
context: DocumentationContext,
85+
renderContext: RenderContext,
86+
emitSymbolSourceFileURIs: Bool = false,
87+
emitSymbolAccessLevels: Bool = false,
88+
sourceRepository: SourceRepository? = nil,
89+
symbolIdentifiersWithExpandedDocumentation: [String]? = nil
90+
) {
91+
self.init(
92+
inputs: bundle,
93+
context: context,
94+
renderContext: renderContext,
95+
emitSymbolSourceFileURIs: emitSymbolSourceFileURIs,
96+
emitSymbolAccessLevels: emitSymbolAccessLevels,
97+
sourceRepository: sourceRepository,
98+
symbolIdentifiersWithExpandedDocumentation: symbolIdentifiersWithExpandedDocumentation
99+
)
100+
}
101+
81102
/// Converts a documentation node to a render node.
82103
///
83104
/// Convert a documentation node into a render node to get a self-contained, persist-able representation of a given topic's data, so you can write it to disk, send it over a network, or otherwise process it.
@@ -91,7 +112,7 @@ public class DocumentationContextConverter {
91112

92113
var translator = RenderNodeTranslator(
93114
context: context,
94-
bundle: bundle,
115+
inputs: inputs,
95116
identifier: node.reference,
96117
renderContext: renderContext,
97118
emitSymbolSourceFileURIs: shouldEmitSymbolSourceFileURIs,

Sources/SwiftDocC/Converter/DocumentationNodeConverter.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,34 @@ public struct DocumentationNodeConverter {
1515
/// The context the converter uses to resolve references it finds in the documentation node's content.
1616
let context: DocumentationContext
1717

18-
/// The bundle that contains the content from which the documentation node originated.
19-
let bundle: DocumentationBundle
18+
/// The input files that contains the content from which the documentation node originated.
19+
let inputs: DocumentationContext.Inputs
2020

2121
/// Creates a new node converter for the given bundle and context.
2222
///
2323
/// The converter uses bundle and context to resolve references to other documentation and describe the documentation hierarchy.
2424
///
2525
/// - Parameters:
26-
/// - bundle: The bundle that contains the content from which the documentation node originated.
26+
/// - inputs: The input files that contains the content from which the documentation node originated.
2727
/// - context: The context that the converter uses to to resolve references it finds in the documentation node's content.
28-
public init(bundle: DocumentationBundle, context: DocumentationContext) {
29-
self.bundle = bundle
28+
public init(inputs: DocumentationContext.Inputs, context: DocumentationContext) {
29+
self.inputs = inputs
3030
self.context = context
3131
}
3232

33+
@available(*, deprecated, renamed: "init(inputs:context:)", message: "Use 'init(inputs:context:)' instead. This deprecated API will be removed after 6.3 is released")
34+
public init(bundle: DocumentationBundle, context: DocumentationContext) {
35+
self.init(inputs: bundle, context: context)
36+
}
37+
3338
/// Converts a documentation node to a render node.
3439
///
3540
/// Convert a documentation node into a render node to get a self-contained, persistable representation of a given topic's data, so you can write it to disk, send it over a network, or otherwise process it.
3641
/// - Parameters:
3742
/// - node: The documentation node to convert.
3843
/// - Returns: The render node representation of the documentation node.
3944
public func convert(_ node: DocumentationNode) -> RenderNode {
40-
var translator = RenderNodeTranslator(context: context, bundle: bundle, identifier: node.reference)
45+
var translator = RenderNodeTranslator(context: context, inputs: inputs, identifier: node.reference)
4146
return translator.visit(node.semantic) as! RenderNode
4247
}
4348
}

Sources/SwiftDocC/DocumentationService/Convert/ConvertService+DataProvider.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -12,7 +12,7 @@ import Foundation
1212

1313
extension ConvertService {
1414
/// Creates a bundle and an associated in-memory data provider from the information of a given convert request
15-
static func makeBundleAndInMemoryDataProvider(_ request: ConvertRequest) -> (bundle: DocumentationBundle, provider: InMemoryDataProvider) {
15+
static func makeBundleAndInMemoryDataProvider(_ request: ConvertRequest) -> (inputs: DocumentationContext.Inputs, provider: InMemoryDataProvider) {
1616
var files: [URL: Data] = [:]
1717
files.reserveCapacity(
1818
request.symbolGraphs.count
@@ -21,10 +21,10 @@ extension ConvertService {
2121
+ request.miscResourceURLs.count
2222
)
2323
for markupFile in request.markupFiles {
24-
files[makeURL().appendingPathExtension(DocumentationBundleFileTypes.referenceFileExtension)] = markupFile
24+
files[makeURL().appendingPathExtension(DocumentationInputFileTypes.referenceFileExtension)] = markupFile
2525
}
2626
for tutorialFile in request.tutorialFiles {
27-
files[makeURL().appendingPathExtension(DocumentationBundleFileTypes.tutorialFileExtension)] = tutorialFile
27+
files[makeURL().appendingPathExtension(DocumentationInputFileTypes.tutorialFileExtension)] = tutorialFile
2828
}
2929
let markupFileURL = Array(files.keys)
3030

@@ -37,7 +37,7 @@ extension ConvertService {
3737
}
3838

3939
return (
40-
DocumentationBundle(
40+
DocumentationContext.Inputs(
4141
info: request.bundleInfo,
4242
symbolGraphURLs: symbolGraphURLs,
4343
markupURLs: markupFileURL,

Sources/SwiftDocC/DocumentationService/Convert/ConvertService.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public struct ConvertService: DocumentationService {
137137
configuration.externalDocumentationConfiguration.globalSymbolResolver = resolver
138138
}
139139

140-
let bundle: DocumentationBundle
140+
let inputs: DocumentationContext.Inputs
141141
let dataProvider: any DataProvider
142142

143143
let inputProvider = DocumentationContext.InputsProvider()
@@ -149,16 +149,16 @@ public struct ConvertService: DocumentationService {
149149
additionalSymbolGraphFiles: []
150150
)
151151

152-
bundle = try inputProvider.makeInputs(contentOf: catalogURL, options: bundleDiscoveryOptions)
152+
inputs = try inputProvider.makeInputs(contentOf: catalogURL, options: bundleDiscoveryOptions)
153153
dataProvider = FileManager.default
154154
} else {
155-
(bundle, dataProvider) = Self.makeBundleAndInMemoryDataProvider(request)
155+
(inputs, dataProvider) = Self.makeBundleAndInMemoryDataProvider(request)
156156
}
157157

158-
let context = try await DocumentationContext(bundle: bundle, dataProvider: dataProvider, configuration: configuration)
158+
let context = try await DocumentationContext(inputs: inputs, dataProvider: dataProvider, configuration: configuration)
159159

160160
// Precompute the render context
161-
let renderContext = RenderContext(documentationContext: context, bundle: bundle)
161+
let renderContext = RenderContext(documentationContext: context, inputs: inputs)
162162

163163
let symbolIdentifiersMeetingRequirementsForExpandedDocumentation: [String]? = request.symbolIdentifiersWithExpandedDocumentation?.compactMap { identifier, expandedDocsRequirement in
164164
guard let documentationNode = context.documentationCache[identifier] else {
@@ -168,7 +168,7 @@ public struct ConvertService: DocumentationService {
168168
return documentationNode.meetsExpandedDocumentationRequirements(expandedDocsRequirement) ? identifier : nil
169169
}
170170
let converter = DocumentationContextConverter(
171-
bundle: bundle,
171+
inputs: inputs,
172172
context: context,
173173
renderContext: renderContext,
174174
emitSymbolSourceFileURIs: request.emitSymbolSourceFileURIs,
@@ -243,12 +243,12 @@ public struct ConvertService: DocumentationService {
243243
.compactMap { (value, isDocumentationExtensionContent) -> (ResolvedTopicReference, RenderReferenceStore.TopicContent)? in
244244
let (topicReference, article) = value
245245

246-
let bundle = context.bundle
247-
guard bundle.id == topicReference.bundleID else { return nil }
248-
let renderer = DocumentationContentRenderer(documentationContext: context, bundle: bundle)
246+
let inputs = context.inputs
247+
guard inputs.id == topicReference.bundleID else { return nil }
248+
let renderer = DocumentationContentRenderer(documentationContext: context, inputs: inputs)
249249

250250
let documentationNodeKind: DocumentationNode.Kind = isDocumentationExtensionContent ? .unknownSymbol : .article
251-
let overridingDocumentationNode = DocumentationContext.documentationNodeAndTitle(for: article, kind: documentationNodeKind, in: bundle)?.node
251+
let overridingDocumentationNode = DocumentationContext.documentationNodeAndTitle(for: article, kind: documentationNodeKind, in: inputs)?.node
252252
var dependencies = RenderReferenceDependencies()
253253
let renderReference = renderer.renderReference(for: topicReference, with: overridingDocumentationNode, dependencies: &dependencies)
254254

Sources/SwiftDocC/DocumentationService/Convert/Fallback Link Resolution/ConvertServiceFallbackResolver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2024 Apple Inc. and the Swift project authors
4+
Copyright (c) 2024-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -26,7 +26,7 @@ protocol ConvertServiceFallbackResolver {
2626
/// The bundle identifier for the fallback resolver.
2727
///
2828
/// The fallback resolver will only resolve links with this bundle identifier.
29-
var bundleID: DocumentationBundle.Identifier { get }
29+
var bundleID: DocumentationContext.Inputs.Identifier { get }
3030

3131
// MARK: References
3232

Sources/SwiftDocC/DocumentationService/Models/Services/Convert/ConvertRequest.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -17,7 +17,7 @@ public struct ConvertRequest: Codable {
1717
///
1818
/// ## See Also
1919
/// - ``DocumentationBundle/Info``
20-
public var bundleInfo: DocumentationBundle.Info
20+
public var bundleInfo: DocumentationContext.Inputs.Info
2121

2222
/// Feature flags to enable when performing this convert request.
2323
public var featureFlags: FeatureFlags
@@ -116,7 +116,7 @@ public struct ConvertRequest: Codable {
116116
/// - symbolIdentifiersWithExpandedDocumentation: A dictionary of identifiers to requirements for these symbols to have expanded
117117
/// documentation available.
118118
public init(
119-
bundleInfo: DocumentationBundle.Info,
119+
bundleInfo: DocumentationContext.Inputs.Info,
120120
featureFlags: FeatureFlags = FeatureFlags(),
121121
externalIDsToConvert: [String]?,
122122
documentPathsToConvert: [String]? = nil,

Sources/SwiftDocC/Infrastructure/Bundle Assets/DataAssetManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ public struct AssetReference: Hashable, Codable {
348348
public var assetName: String
349349

350350
/// The identifier of the bundle the asset is apart of.
351-
public let bundleID: DocumentationBundle.Identifier
351+
public let bundleID: DocumentationContext.Inputs.Identifier
352352

353353
/// Creates a reference from a given asset name and the bundle it is apart of.
354-
public init(assetName: String, bundleID: DocumentationBundle.Identifier) {
354+
public init(assetName: String, bundleID: DocumentationContext.Inputs.Identifier) {
355355
self.assetName = assetName
356356
self.bundleID = bundleID
357357
}

Sources/SwiftDocC/Infrastructure/Context/DocumentationContext+Configuration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2024 Apple Inc. and the Swift project authors
4+
Copyright (c) 2024-2025 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -76,7 +76,7 @@ extension DocumentationContext {
7676
/// A collection of configuration related to external sources of documentation.
7777
public struct ExternalDocumentationConfiguration {
7878
/// The lookup of external documentation sources by their bundle identifiers.
79-
public var sources: [DocumentationBundle.Identifier: any ExternalDocumentationSource] = [:]
79+
public var sources: [DocumentationContext.Inputs.Identifier: any ExternalDocumentationSource] = [:]
8080
/// A type that resolves all symbols that are referenced in symbol graph files but can't be found in any of the locally available symbol graph files.
8181
public var globalSymbolResolver: (any GlobalExternalSymbolResolver)?
8282
/// A list of URLs to documentation archives that the local documentation depends on.

0 commit comments

Comments
 (0)