1
1
import SwiftBasicFormat
2
2
import SwiftSyntax
3
3
import SwiftSyntaxBuilder
4
+ #if canImport(BridgeJSSkeleton)
5
+ import BridgeJSSkeleton
6
+ #endif
4
7
5
8
/// Exports Swift functions and classes to JavaScript
6
9
///
@@ -11,14 +14,14 @@ import SwiftSyntaxBuilder
11
14
///
12
15
/// The generated skeletons will be used by ``BridgeJSLink`` to generate
13
16
/// JavaScript glue code and TypeScript definitions.
14
- class ExportSwift {
17
+ public class ExportSwift {
15
18
let progress : ProgressReporting
16
19
17
20
private var exportedFunctions : [ ExportedFunction ] = [ ]
18
21
private var exportedClasses : [ ExportedClass ] = [ ]
19
22
private var typeDeclResolver : TypeDeclResolver = TypeDeclResolver ( )
20
23
21
- init ( progress: ProgressReporting ) {
24
+ public init ( progress: ProgressReporting ) {
22
25
self . progress = progress
23
26
}
24
27
@@ -27,7 +30,7 @@ class ExportSwift {
27
30
/// - Parameters:
28
31
/// - sourceFile: The parsed Swift source file to process
29
32
/// - inputFilePath: The file path for error reporting
30
- func addSourceFile( _ sourceFile: SourceFileSyntax , _ inputFilePath: String ) throws {
33
+ public func addSourceFile( _ sourceFile: SourceFileSyntax , _ inputFilePath: String ) throws {
31
34
progress. print ( " Processing \( inputFilePath) " )
32
35
typeDeclResolver. addSourceFile ( sourceFile)
33
36
@@ -44,7 +47,7 @@ class ExportSwift {
44
47
///
45
48
/// - Returns: A tuple containing the generated Swift code and a skeleton
46
49
/// describing the exported APIs
47
- func finalize( ) throws -> ( outputSwift: String , outputSkeleton: ExportedSkeleton ) ? {
50
+ public func finalize( ) throws -> ( outputSwift: String , outputSkeleton: ExportedSkeleton ) ? {
48
51
guard let outputSwift = renderSwiftGlue ( ) else {
49
52
return nil
50
53
}
0 commit comments