diff --git a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift b/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift deleted file mode 100644 index e6bb84c1..00000000 --- a/Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift +++ /dev/null @@ -1,58 +0,0 @@ -// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, -// DO NOT EDIT. -// -// To update this file, just rebuild your project or run -// `swift package bridge-js`. - -@_spi(BridgeJS) import JavaScriptKit - -#if arch(wasm32) -@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") -fileprivate func bjs_benchmarkHelperNoop() -> Void -#else -fileprivate func bjs_benchmarkHelperNoop() -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func benchmarkHelperNoop() throws(JSException) -> Void { - bjs_benchmarkHelperNoop() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") -fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void -#else -fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { - let nValue = n.bridgeJSLowerParameter() - bjs_benchmarkHelperNoopWithNumber(nValue) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") -fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void -#else -fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { - let nameValue = name.bridgeJSLowerParameter() - let bodyValue = body.bridgeJSLowerParameter() - bjs_benchmarkRunner(nameValue, bodyValue) - if let error = _swift_js_take_exception() { - throw error - } -} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/BridgeJS.Macros.swift b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift new file mode 100644 index 00000000..c9678949 --- /dev/null +++ b/Benchmarks/Sources/Generated/BridgeJS.Macros.swift @@ -0,0 +1,13 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func benchmarkHelperNoop() throws (JSException) -> Void + +@JSFunction func benchmarkHelperNoopWithNumber(_ n: Double) throws (JSException) -> Void + +@JSFunction func benchmarkRunner(_ name: String, _ body: JSObject) throws (JSException) -> Void diff --git a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift b/Benchmarks/Sources/Generated/BridgeJS.swift similarity index 96% rename from Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift rename to Benchmarks/Sources/Generated/BridgeJS.swift index 2c9d9b6b..44bf94e0 100644 --- a/Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift +++ b/Benchmarks/Sources/Generated/BridgeJS.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -1172,4 +1173,64 @@ fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> fileprivate func _bjs_ClassRoundtrip_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +// bridge-js: skip +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +@_spi(BridgeJS) import JavaScriptKit + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") +fileprivate func bjs_benchmarkHelperNoop() -> Void +#else +fileprivate func bjs_benchmarkHelperNoop() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$benchmarkHelperNoop() throws(JSException) -> Void { + bjs_benchmarkHelperNoop() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") +fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void +#else +fileprivate func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { + let nValue = n.bridgeJSLowerParameter() + bjs_benchmarkHelperNoopWithNumber(nValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") +fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void +#else +fileprivate func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { + let nameValue = name.bridgeJSLowerParameter() + let bodyValue = body.bridgeJSLowerParameter() + bjs_benchmarkRunner(nameValue, bodyValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index e3532d33..00000000 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,1584 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_EnumRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_EnumRoundtrip_take", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "take", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSuccess", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFailure", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeFlag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFlag", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeRate", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeRate", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makePrecise", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makePrecise", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_makeInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_EnumRoundtrip_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "name" : "EnumRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "EnumRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_ComplexResultRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_ComplexResultRoundtrip_take", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "take", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSuccess", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeError", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeError", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeLocation", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeLocation", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeStatus", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeCoordinates", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeCoordinates", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeComprehensive", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComprehensive", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_makeInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_ComplexResultRoundtrip_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "name" : "ComplexResultRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "ComplexResultRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_StringRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_StringRoundtrip_take", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "take", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StringRoundtrip_make", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "make", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "StringRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "StringRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_StructRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_StructRoundtrip_takeSimple", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeSimple", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makeSimple", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSimple", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripSimple", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripSimple", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "SimpleStruct" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_takeAddress", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeAddress", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makeAddress", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAddress", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripAddress", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAddress", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_takePerson", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takePerson", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Person" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makePerson", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makePerson", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Person" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripPerson", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripPerson", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "Person" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Person" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_takeComplex", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeComplex", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_makeComplex", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplex", - "parameters" : [ - - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - }, - { - "abiName" : "bjs_StructRoundtrip_roundtripComplex", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripComplex", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ComplexStruct" - } - } - } - ], - "name" : "StructRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "StructRoundtrip" - }, - { - "constructor" : { - "abiName" : "bjs_SimpleClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "label" : "flag", - "name" : "flag", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "rate", - "name" : "rate", - "type" : { - "float" : { - - } - } - }, - { - "label" : "precise", - "name" : "precise", - "type" : { - "double" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "SimpleClass", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "flag", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "rate", - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "precise", - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "SimpleClass" - }, - { - "constructor" : { - "abiName" : "bjs_AddressClass_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "street", - "name" : "street", - "type" : { - "string" : { - - } - } - }, - { - "label" : "city", - "name" : "city", - "type" : { - "string" : { - - } - } - }, - { - "label" : "zipCode", - "name" : "zipCode", - "type" : { - "int" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "AddressClass", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "street", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "city", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "zipCode", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "AddressClass" - }, - { - "constructor" : { - "abiName" : "bjs_ClassRoundtrip_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_ClassRoundtrip_takeSimpleClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeSimpleClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_makeSimpleClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeSimpleClass", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_roundtripSimpleClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripSimpleClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "SimpleClass" - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_takeAddressClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeAddressClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_makeAddressClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAddressClass", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - }, - { - "abiName" : "bjs_ClassRoundtrip_roundtripAddressClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAddressClass", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "AddressClass" - } - } - } - ], - "name" : "ClassRoundtrip", - "properties" : [ - - ], - "swiftCallName" : "ClassRoundtrip" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - } - ], - "name" : "flag" - }, - { - "associatedValues" : [ - { - "type" : { - "float" : { - - } - } - } - ], - "name" : "rate" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "precise" - }, - { - "associatedValues" : [ - - ], - "name" : "info" - } - ], - "emitStyle" : "const", - "name" : "APIResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIResult", - "tsFullPath" : "APIResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "error" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "location" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "coordinates" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "comprehensive" - }, - { - "associatedValues" : [ - - ], - "name" : "info" - } - ], - "emitStyle" : "const", - "name" : "ComplexResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "ComplexResult", - "tsFullPath" : "ComplexResult" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_run", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "run", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - } - ], - "moduleName" : "Benchmarks", - "protocols" : [ - - ], - "structs" : [ - { - "methods" : [ - - ], - "name" : "SimpleStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "flag", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "rate", - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "precise", - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "SimpleStruct" - }, - { - "methods" : [ - - ], - "name" : "Address", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "street", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "city", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "zipCode", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "Address" - }, - { - "methods" : [ - - ], - "name" : "Person", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "age", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "address", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "email", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "Person" - }, - { - "methods" : [ - - ], - "name" : "ComplexStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "active", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "score", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "tags", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "metadata", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "ComplexStruct" - } - ] -} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json deleted file mode 100644 index 366342bb..00000000 --- a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.ImportTS.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "children" : [ - { - "functions" : [ - { - "name" : "benchmarkHelperNoop", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "benchmarkHelperNoopWithNumber", - "parameters" : [ - { - "name" : "n", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "benchmarkRunner", - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "body", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "types" : [ - - ] - } - ], - "moduleName" : "Benchmarks" -} \ No newline at end of file diff --git a/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json new file mode 100644 index 00000000..3b69ebe9 --- /dev/null +++ b/Benchmarks/Sources/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,1662 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_EnumRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_EnumRoundtrip_take", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "take", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSuccess", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFailure", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeFlag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFlag", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeRate", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeRate", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makePrecise", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makePrecise", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_makeInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_EnumRoundtrip_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "name" : "EnumRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "EnumRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_ComplexResultRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_ComplexResultRoundtrip_take", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "take", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSuccess", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeError", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeError", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeLocation", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeLocation", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStatus", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeCoordinates", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeCoordinates", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeComprehensive", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComprehensive", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_makeInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_ComplexResultRoundtrip_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "name" : "ComplexResultRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "ComplexResultRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_StringRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_StringRoundtrip_take", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "take", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StringRoundtrip_make", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "make", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "StringRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "StringRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_StructRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_StructRoundtrip_takeSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeSimple", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSimple", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripSimple", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripSimple", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SimpleStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takeAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeAddress", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAddress", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripAddress", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAddress", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takePerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takePerson", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makePerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makePerson", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripPerson", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripPerson", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "Person" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Person" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_takeComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeComplex", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_makeComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplex", + "parameters" : [ + + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + }, + { + "abiName" : "bjs_StructRoundtrip_roundtripComplex", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripComplex", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ComplexStruct" + } + } + } + ], + "name" : "StructRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "StructRoundtrip" + }, + { + "constructor" : { + "abiName" : "bjs_SimpleClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "rate", + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "label" : "precise", + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "SimpleClass", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "SimpleClass" + }, + { + "constructor" : { + "abiName" : "bjs_AddressClass_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "street", + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "label" : "city", + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "label" : "zipCode", + "name" : "zipCode", + "type" : { + "int" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "AddressClass", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "zipCode", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "AddressClass" + }, + { + "constructor" : { + "abiName" : "bjs_ClassRoundtrip_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_ClassRoundtrip_takeSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeSimpleClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_makeSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeSimpleClass", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_roundtripSimpleClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripSimpleClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "SimpleClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_takeAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeAddressClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_makeAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAddressClass", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + }, + { + "abiName" : "bjs_ClassRoundtrip_roundtripAddressClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAddressClass", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "AddressClass" + } + } + } + ], + "name" : "ClassRoundtrip", + "properties" : [ + + ], + "swiftCallName" : "ClassRoundtrip" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + } + ], + "name" : "flag" + }, + { + "associatedValues" : [ + { + "type" : { + "float" : { + + } + } + } + ], + "name" : "rate" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "precise" + }, + { + "associatedValues" : [ + + ], + "name" : "info" + } + ], + "emitStyle" : "const", + "name" : "APIResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "error" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "location" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "coordinates" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "comprehensive" + }, + { + "associatedValues" : [ + + ], + "name" : "info" + } + ], + "emitStyle" : "const", + "name" : "ComplexResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "ComplexResult", + "tsFullPath" : "ComplexResult" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_run", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "run", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + } + ], + "moduleName" : "Benchmarks", + "protocols" : [ + + ], + "structs" : [ + { + "methods" : [ + + ], + "name" : "SimpleStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "flag", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "rate", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "precise", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "SimpleStruct" + }, + { + "methods" : [ + + ], + "name" : "Address", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "zipCode", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Person", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "Person" + }, + { + "methods" : [ + + ], + "name" : "ComplexStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "active", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "score", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "tags", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "metadata", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "ComplexStruct" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + + ] + }, + { + "functions" : [ + { + "name" : "benchmarkHelperNoop", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "benchmarkHelperNoopWithNumber", + "parameters" : [ + { + "name" : "n", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "benchmarkRunner", + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "body", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "types" : [ + + ] + } + ], + "moduleName" : "Benchmarks" + }, + "moduleName" : "Benchmarks" +} \ No newline at end of file diff --git a/Benchmarks/Sources/bridge-js.d.ts b/Benchmarks/Sources/bridge-js.d.ts index a9eb5d0b..9f5137e1 100644 --- a/Benchmarks/Sources/bridge-js.d.ts +++ b/Benchmarks/Sources/bridge-js.d.ts @@ -1,3 +1,3 @@ -declare function benchmarkHelperNoop(): void; -declare function benchmarkHelperNoopWithNumber(n: number): void; -declare function benchmarkRunner(name: string, body: (n: number) => void): void; +export function benchmarkHelperNoop(): void; +export function benchmarkHelperNoopWithNumber(n: number): void; +export function benchmarkRunner(name: string, body: (n: number) => void): void; diff --git a/Examples/PlayBridgeJS/Sources/Generated/BridgeJS.swift b/Examples/PlayBridgeJS/Sources/Generated/BridgeJS.swift new file mode 100644 index 00000000..ff717e1a --- /dev/null +++ b/Examples/PlayBridgeJS/Sources/Generated/BridgeJS.swift @@ -0,0 +1,183 @@ +// bridge-js: skip +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +@_spi(BridgeJS) import JavaScriptKit + +@_expose(wasm, "bjs_PlayBridgeJS_init") +@_cdecl("bjs_PlayBridgeJS_init") +public func _bjs_PlayBridgeJS_init() -> UnsafeMutableRawPointer { + #if arch(wasm32) + let ret = PlayBridgeJS() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PlayBridgeJS_update") +@_cdecl("bjs_PlayBridgeJS_update") +public func _bjs_PlayBridgeJS_update(_ _self: UnsafeMutableRawPointer, _ swiftSourceBytes: Int32, _ swiftSourceLength: Int32, _ dtsSourceBytes: Int32, _ dtsSourceLength: Int32) -> UnsafeMutableRawPointer { + #if arch(wasm32) + do { + let ret = try PlayBridgeJS.bridgeJSLiftParameter(_self).update(swiftSource: String.bridgeJSLiftParameter(swiftSourceBytes, swiftSourceLength), dtsSource: String.bridgeJSLiftParameter(dtsSourceBytes, dtsSourceLength)) + return ret.bridgeJSLowerReturn() + } catch let error { + if let error = error.thrownValue.object { + withExtendedLifetime(error) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } else { + let jsError = JSError(message: String(describing: error)) + withExtendedLifetime(jsError.jsObject) { + _swift_js_throw(Int32(bitPattern: $0.id)) + } + } + return UnsafeMutableRawPointer(bitPattern: -1).unsafelyUnwrapped + } + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PlayBridgeJS_deinit") +@_cdecl("bjs_PlayBridgeJS_deinit") +public func _bjs_PlayBridgeJS_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension PlayBridgeJS: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_PlayBridgeJS_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJS_wrap") +fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PlayBridgeJS_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +@_expose(wasm, "bjs_PlayBridgeJSOutput_outputJs") +@_cdecl("bjs_PlayBridgeJSOutput_outputJs") +public func _bjs_PlayBridgeJSOutput_outputJs(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).outputJs() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PlayBridgeJSOutput_outputDts") +@_cdecl("bjs_PlayBridgeJSOutput_outputDts") +public func _bjs_PlayBridgeJSOutput_outputDts(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).outputDts() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PlayBridgeJSOutput_importSwiftGlue") +@_cdecl("bjs_PlayBridgeJSOutput_importSwiftGlue") +public func _bjs_PlayBridgeJSOutput_importSwiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).importSwiftGlue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PlayBridgeJSOutput_exportSwiftGlue") +@_cdecl("bjs_PlayBridgeJSOutput_exportSwiftGlue") +public func _bjs_PlayBridgeJSOutput_exportSwiftGlue(_ _self: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + let ret = PlayBridgeJSOutput.bridgeJSLiftParameter(_self).exportSwiftGlue() + return ret.bridgeJSLowerReturn() + #else + fatalError("Only available on WebAssembly") + #endif +} + +@_expose(wasm, "bjs_PlayBridgeJSOutput_deinit") +@_cdecl("bjs_PlayBridgeJSOutput_deinit") +public func _bjs_PlayBridgeJSOutput_deinit(_ pointer: UnsafeMutableRawPointer) -> Void { + #if arch(wasm32) + Unmanaged.fromOpaque(pointer).release() + #else + fatalError("Only available on WebAssembly") + #endif +} + +extension PlayBridgeJSOutput: ConvertibleToJSValue, _BridgedSwiftHeapObject { + var jsValue: JSValue { + return .object(JSObject(id: UInt32(bitPattern: _bjs_PlayBridgeJSOutput_wrap(Unmanaged.passRetained(self).toOpaque())))) + } +} + +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJSOutput_wrap") +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 +#else +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +// bridge-js: skip +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +@_spi(BridgeJS) import JavaScriptKit + +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Swift") +fileprivate func bjs_createTS2Swift() -> Int32 +#else +fileprivate func bjs_createTS2Swift() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$createTS2Swift() throws(JSException) -> TS2Swift { + let ret = bjs_createTS2Swift() + if let error = _swift_js_take_exception() { + throw error + } + return TS2Swift.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Swift_convert") +fileprivate func bjs_TS2Swift_convert(_ self: Int32, _ ts: Int32) -> Int32 +#else +fileprivate func bjs_TS2Swift_convert(_ self: Int32, _ ts: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$TS2Swift_convert(_ self: JSObject, _ ts: String) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TS2Swift_convert(selfValue, tsValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/Generated/JavaScript/BridgeJS.json new file mode 100644 index 00000000..ad36514c --- /dev/null +++ b/Examples/PlayBridgeJS/Sources/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,219 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PlayBridgeJS_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PlayBridgeJS_update", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "update", + "parameters" : [ + { + "label" : "swiftSource", + "name" : "swiftSource", + "type" : { + "string" : { + + } + } + }, + { + "label" : "dtsSource", + "name" : "dtsSource", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "PlayBridgeJSOutput" + } + } + } + ], + "name" : "PlayBridgeJS", + "properties" : [ + + ], + "swiftCallName" : "PlayBridgeJS" + }, + { + "methods" : [ + { + "abiName" : "bjs_PlayBridgeJSOutput_outputJs", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "outputJs", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_outputDts", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "outputDts", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_importSwiftGlue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "importSwiftGlue", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_exportSwiftGlue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "exportSwiftGlue", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PlayBridgeJSOutput", + "properties" : [ + + ], + "swiftCallName" : "PlayBridgeJSOutput" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "moduleName" : "PlayBridgeJS", + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + { + "name" : "createTS2Swift", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "TS2Swift" + } + } + } + ], + "types" : [ + { + "getters" : [ + + ], + "methods" : [ + { + "name" : "convert", + "parameters" : [ + { + "name" : "ts", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "TS2Swift", + "setters" : [ + + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + + ] + }, + { + "functions" : [ + + ], + "types" : [ + + ] + } + ], + "moduleName" : "PlayBridgeJS" + }, + "moduleName" : "PlayBridgeJS" +} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/JavaScript/app.js b/Examples/PlayBridgeJS/Sources/JavaScript/app.js index 2f5267d3..b8281023 100644 --- a/Examples/PlayBridgeJS/Sources/JavaScript/app.js +++ b/Examples/PlayBridgeJS/Sources/JavaScript/app.js @@ -102,11 +102,11 @@ export class BridgeJSPlayground { // Import the BridgeJS module this.setProgress('Loading BridgeJS…', 50); const { init } = await import("../../Bundle/index.js"); - const virtualHost = await this.createTS2SkeletonFactory(); + const virtualHost = await this.createTS2SwiftFactory(); this.setProgress('Preparing TypeScript host…', 60); const { exports } = await init({ getImports: () => ({ - createTS2Skeleton: () => this.createTS2Skeleton(virtualHost) + createTS2Swift: () => this.createTS2Swift(virtualHost) }) }); this.setProgress('Creating runtime…', 65); @@ -193,7 +193,7 @@ export class BridgeJSPlayground { }); } - async createTS2SkeletonFactory() { + async createTS2SwiftFactory() { const createVirtualHost = async () => { const fsMap = await createDefaultMapFromCDN( { target: ts.ScriptTarget.ES2015 }, @@ -217,7 +217,7 @@ export class BridgeJSPlayground { /** * @param {ReturnType} virtualHost */ - createTS2Skeleton(virtualHost) { + createTS2Swift(virtualHost) { return { /** * @param {string} dtsCode diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift deleted file mode 100644 index cd1ef981..00000000 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift +++ /dev/null @@ -1,52 +0,0 @@ -// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, -// DO NOT EDIT. -// -// To update this file, just rebuild your project or run -// `swift package bridge-js`. - -@_spi(BridgeJS) import JavaScriptKit - -#if arch(wasm32) -@_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Skeleton") -fileprivate func bjs_createTS2Skeleton() -> Int32 -#else -fileprivate func bjs_createTS2Skeleton() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func createTS2Skeleton() throws(JSException) -> TS2Skeleton { - let ret = bjs_createTS2Skeleton() - if let error = _swift_js_take_exception() { - throw error - } - return TS2Skeleton.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Skeleton_convert") -fileprivate func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 -#else -fileprivate func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -struct TS2Skeleton: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - func convert(_ ts: String) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TS2Skeleton_convert(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - -} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift new file mode 100644 index 00000000..feb0a2ea --- /dev/null +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift @@ -0,0 +1,13 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func createTS2Swift() throws (JSException) -> TS2Swift + +@JSClass struct TS2Swift: _JSBridgedClass { + @JSFunction func convert(_ ts: String) throws (JSException) -> String +} diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift similarity index 100% rename from Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift rename to Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.swift diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index a536a23f..00000000 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_PlayBridgeJS_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_PlayBridgeJS_update", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "update", - "parameters" : [ - { - "label" : "swiftSource", - "name" : "swiftSource", - "type" : { - "string" : { - - } - } - }, - { - "label" : "dtsSource", - "name" : "dtsSource", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "PlayBridgeJSOutput" - } - } - } - ], - "name" : "PlayBridgeJS", - "properties" : [ - - ], - "swiftCallName" : "PlayBridgeJS" - }, - { - "methods" : [ - { - "abiName" : "bjs_PlayBridgeJSOutput_outputJs", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "outputJs", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_PlayBridgeJSOutput_outputDts", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "outputDts", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_PlayBridgeJSOutput_importSwiftGlue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "importSwiftGlue", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_PlayBridgeJSOutput_exportSwiftGlue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "exportSwiftGlue", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "PlayBridgeJSOutput", - "properties" : [ - - ], - "swiftCallName" : "PlayBridgeJSOutput" - } - ], - "enums" : [ - - ], - "exposeToGlobal" : false, - "functions" : [ - - ], - "moduleName" : "PlayBridgeJS", - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json deleted file mode 100644 index f1a567cd..00000000 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.ImportTS.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "children" : [ - { - "functions" : [ - { - "name" : "createTS2Skeleton", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "TS2Skeleton" - } - } - } - ], - "types" : [ - { - "methods" : [ - { - "name" : "convert", - "parameters" : [ - { - "name" : "ts", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "TS2Skeleton", - "properties" : [ - - ] - } - ] - } - ], - "moduleName" : "PlayBridgeJS" -} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json new file mode 100644 index 00000000..d1186bd4 --- /dev/null +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,165 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_PlayBridgeJS_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PlayBridgeJS_update", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "update", + "parameters" : [ + { + "label" : "swiftSource", + "name" : "swiftSource", + "type" : { + "string" : { + + } + } + }, + { + "label" : "dtsSource", + "name" : "dtsSource", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "PlayBridgeJSOutput" + } + } + } + ], + "name" : "PlayBridgeJS", + "properties" : [ + + ], + "swiftCallName" : "PlayBridgeJS" + }, + { + "methods" : [ + { + "abiName" : "bjs_PlayBridgeJSOutput_outputJs", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "outputJs", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_outputDts", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "outputDts", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_importSwiftGlue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "importSwiftGlue", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_PlayBridgeJSOutput_exportSwiftGlue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "exportSwiftGlue", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PlayBridgeJSOutput", + "properties" : [ + + ], + "swiftCallName" : "PlayBridgeJSOutput" + } + ], + "enums" : [ + + ], + "exposeToGlobal" : false, + "functions" : [ + + ], + "moduleName" : "PlayBridgeJS", + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + + ] + } + ], + "moduleName" : "PlayBridgeJS" + }, + "moduleName" : "PlayBridgeJS" +} \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts index 44e79a5c..7173fab8 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/bridge-js.d.ts @@ -1,5 +1,5 @@ -export interface TS2Skeleton { +export interface TS2Swift { convert(ts: string): string; } -export function createTS2Skeleton(): TS2Skeleton; \ No newline at end of file +export function createTS2Swift(): TS2Swift; \ No newline at end of file diff --git a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift index 52cb0cc2..b82fc6f4 100644 --- a/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift +++ b/Examples/PlayBridgeJS/Sources/PlayBridgeJS/main.swift @@ -22,8 +22,8 @@ import class Foundation.JSONDecoder try exportSwift.addSourceFile(sourceFile, "Playground.swift") let exportResult = try exportSwift.finalize() var importTS = ImportTS(progress: .silent, moduleName: "Playground") - let ts2skeleton = try createTS2Skeleton() - let skeletonJSONString = try ts2skeleton.convert(dtsSource) + let ts2swift = try createTS2Swift() + let skeletonJSONString = try ts2swift.convert(dtsSource) let decoder = JSONDecoder() let importSkeleton = try decoder.decode( ImportedFileSkeleton.self, diff --git a/Package.swift b/Package.swift index 670b4350..62b10a7d 100644 --- a/Package.swift +++ b/Package.swift @@ -42,7 +42,7 @@ let package = Package( targets: [ .target( name: "JavaScriptKit", - dependencies: ["_CJavaScriptKit"], + dependencies: ["_CJavaScriptKit", "BridgeJSMacros"], exclude: useLegacyResourceBundling ? [] : ["Runtime"], resources: useLegacyResourceBundling ? [.copy("Runtime")] : [], cSettings: shouldBuildForEmbedded @@ -59,6 +59,14 @@ let package = Package( ] : []) ), .target(name: "_CJavaScriptKit"), + .macro( + name: "BridgeJSMacros", + dependencies: [ + .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), + ] + ), + .testTarget( name: "JavaScriptKitTests", dependencies: ["JavaScriptKit"], @@ -165,7 +173,7 @@ let package = Package( .product(name: "SwiftBasicFormat", package: "swift-syntax"), .product(name: "SwiftSyntaxBuilder", package: "swift-syntax"), ], - exclude: ["TS2Skeleton/JavaScript", "README.md"] + exclude: ["TS2Swift/JavaScript", "README.md"] ), .testTarget( name: "BridgeJSRuntimeTests", diff --git a/Plugins/BridgeJS/Package.swift b/Plugins/BridgeJS/Package.swift index 36b92052..63c74c53 100644 --- a/Plugins/BridgeJS/Package.swift +++ b/Plugins/BridgeJS/Package.swift @@ -1,5 +1,6 @@ // swift-tools-version: 6.0 +import CompilerPluginSupport import PackageDescription let package = Package( @@ -14,11 +15,11 @@ let package = Package( name: "BridgeJSTool", dependencies: [ "BridgeJSCore", - "TS2Skeleton", + "TS2Swift", ] ), .target( - name: "TS2Skeleton", + name: "TS2Swift", dependencies: [ "BridgeJSCore", "BridgeJSSkeleton", @@ -52,9 +53,23 @@ let package = Package( dependencies: [ "BridgeJSCore", "BridgeJSLink", - "TS2Skeleton", + "TS2Swift", ], exclude: ["__Snapshots__", "Inputs", "MultifileInputs"] ), + .macro( + name: "BridgeJSMacros", + dependencies: [ + .product(name: "SwiftSyntaxMacros", package: "swift-syntax"), + .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), + ] + ), + .testTarget( + name: "BridgeJSMacrosTests", + dependencies: [ + "BridgeJSMacros", + .product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"), + ] + ), ] ) diff --git a/Plugins/BridgeJS/README.md b/Plugins/BridgeJS/README.md index f762c294..a086d611 100644 --- a/Plugins/BridgeJS/README.md +++ b/Plugins/BridgeJS/README.md @@ -13,34 +13,39 @@ BridgeJS provides easy interoperability between Swift and JavaScript/TypeScript. 1. **Importing TypeScript APIs into Swift**: Use TypeScript/JavaScript APIs directly from Swift code 2. **Exporting Swift APIs to JavaScript**: Make your Swift APIs available to JavaScript code +The workflow is: +1. `ts2swift` converts TypeScript definitions (`.d.ts`) to macro-annotated Swift declarations (`ImportTS.Macros.swift`) +2. `bridge-js generate` processes both: + - Swift source files (for export) → generates `ExportSwift.swift` and `ExportSwift.json` + - Macro-annotated Swift files (for import) → generates `ImportTS.swift` and `ImportTS.json` +3. `bridge-js link` combines all skeletons to produce JavaScript glue code + ## Architecture Diagram ```mermaid graph LR - E1 --> G3[ExportSwift.json] subgraph ModuleA - A.swift --> E1[[bridge-js export]] - B.swift --> E1 - E1 --> G1[ExportSwift.swift] - B1[bridge-js.d.ts]-->I1[[bridge-js import]] - I1 --> G2[ImportTS.swift] + A.swift --> G1[bridge-js generate] + B.swift --> G1 + B1[bridge-js.d.ts] --> T1[[ts2swift]] + T1 --> M1[ImportTS.Macros.swift] + M1 --> G1 + G1 --> G3[BridgeJS.json] + G1 --> G2[BridgeJS.swift] end - I1 --> G4[ImportTS.json] - E2 --> G7[ExportSwift.json] subgraph ModuleB - C.swift --> E2[[bridge-js export]] - D.swift --> E2 - E2 --> G5[ExportSwift.swift] - B2[bridge-js.d.ts]-->I2[[bridge-js import]] - I2 --> G6[ImportTS.swift] + C.swift --> G4[bridge-js generate] + D.swift --> G4 + B2[bridge-js.d.ts] --> T2[[ts2swift]] + T2 --> M2[ImportTS.Macros.swift] + M2 --> G4 + G4 --> G5[BridgeJS.swift] + G4 --> G6[BridgeJS.json] end - I2 --> G8[ImportTS.json] G3 --> L1[[bridge-js link]] - G4 --> L1 - G7 --> L1 - G8 --> L1 + G6 --> L1 L1 --> F1[bridge-js.js] L1 --> F2[bridge-js.d.ts] diff --git a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift index 47487bfc..aec9f3bc 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSBuildPlugin/BridgeJSBuildPlugin.swift @@ -11,95 +11,58 @@ struct BridgeJSBuildPlugin: BuildToolPlugin { guard let swiftSourceModuleTarget = target as? SwiftSourceModuleTarget else { return [] } - var commands: [Command] = [] - commands.append(try createExportSwiftCommand(context: context, target: swiftSourceModuleTarget)) - if let importCommand = try createImportTSCommand(context: context, target: swiftSourceModuleTarget) { - commands.append(importCommand) - } - return commands + return [try createGenerateCommand(context: context, target: swiftSourceModuleTarget)] } private func pathToConfigFile(target: SwiftSourceModuleTarget) -> URL { return target.directoryURL.appending(path: "bridge-js.config.json") } - private func createExportSwiftCommand(context: PluginContext, target: SwiftSourceModuleTarget) throws -> Command { - let outputSwiftPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ExportSwift.swift") - let outputSkeletonPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ExportSwift.json") + private func createGenerateCommand(context: PluginContext, target: SwiftSourceModuleTarget) throws -> Command { + let outputSwiftPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.swift") + let inputSwiftFiles = target.sourceFiles.filter { !$0.url.path.hasPrefix(context.pluginWorkDirectoryURL.path + "/") } .map(\.url) + let configFile = pathToConfigFile(target: target) - let inputFiles: [URL] + var inputFiles: [URL] = inputSwiftFiles if FileManager.default.fileExists(atPath: configFile.path) { - inputFiles = inputSwiftFiles + [configFile] - } else { - inputFiles = inputSwiftFiles + inputFiles.append(configFile) } - return .buildCommand( - displayName: "Export Swift API", - executable: try context.tool(named: "BridgeJSTool").url, - arguments: [ - "export", - "--module-name", - target.name, - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - outputSkeletonPath.path, - "--output-swift", - outputSwiftPath.path, - // Generate the output files even if nothing is exported not to surprise - // the build system. - "--always-write", "true", - ] + inputSwiftFiles.map(\.path), - inputFiles: inputFiles, - outputFiles: [ - outputSwiftPath - ] - ) - } - private func createImportTSCommand(context: PluginContext, target: SwiftSourceModuleTarget) throws -> Command? { - let outputSwiftPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ImportTS.swift") - let outputSkeletonPath = context.pluginWorkDirectoryURL.appending(path: "BridgeJS.ImportTS.json") let inputTSFile = target.directoryURL.appending(path: "bridge-js.d.ts") - guard FileManager.default.fileExists(atPath: inputTSFile.path) else { - return nil - } + let tsconfigPath = context.package.directoryURL.appending(path: "tsconfig.json") - let configFile = pathToConfigFile(target: target) - let inputFiles: [URL] - if FileManager.default.fileExists(atPath: configFile.path) { - inputFiles = [inputTSFile, configFile] - } else { - inputFiles = [inputTSFile] + var arguments: [String] = [ + "generate", + "--module-name", + target.name, + "--target-dir", + target.directoryURL.path, + "--output-dir", + context.pluginWorkDirectoryURL.path, + "--always-write", "true", + ] + + if FileManager.default.fileExists(atPath: inputTSFile.path) { + // Add .d.ts file and tsconfig.json as inputs + inputFiles.append(contentsOf: [inputTSFile, tsconfigPath]) + arguments.append(contentsOf: [ + "--project", + tsconfigPath.path, + ]) } + + arguments.append(contentsOf: inputSwiftFiles.map(\.path)) + return .buildCommand( - displayName: "Import TypeScript API", + displayName: "Generate BridgeJS code", executable: try context.tool(named: "BridgeJSTool").url, - arguments: [ - "import", - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - outputSkeletonPath.path, - "--output-swift", - outputSwiftPath.path, - "--module-name", - target.name, - // Generate the output files even if nothing is imported not to surprise - // the build system. - "--always-write", "true", - "--project", - context.package.directoryURL.appending(path: "tsconfig.json").path, - inputTSFile.path, - ], + arguments: arguments, inputFiles: inputFiles, - outputFiles: [ - outputSwiftPath - ] + outputFiles: [outputSwiftPath] ) } } diff --git a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift index 26a0d0ef..3dce6257 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCommandPlugin/BridgeJSCommandPlugin.swift @@ -97,54 +97,41 @@ extension BridgeJSCommandPlugin.Context { ) throws { printStderr("Generating bridge code for \(target.name)...") - printVerbose("Exporting Swift API for \(target.name)...") - let generatedDirectory = target.directoryURL.appending(path: "Generated") let generatedJavaScriptDirectory = generatedDirectory.appending(path: "JavaScript") - try runBridgeJSTool( - arguments: [ - "export", - "--module-name", - target.name, - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - generatedJavaScriptDirectory.appending(path: "BridgeJS.ExportSwift.json").path, - "--output-swift", - generatedDirectory.appending(path: "BridgeJS.ExportSwift.swift").path, - "--verbose", - options.verbose ? "true" : "false", - ] - + target.sourceFiles.filter { - !$0.url.path.hasPrefix(generatedDirectory.path + "/") - }.map(\.url.path) + remainingArguments - ) - - printVerbose("Importing TypeScript API for \(target.name)...") - let bridgeDtsPath = target.directoryURL.appending(path: "bridge-js.d.ts") - // Execute import only if bridge-js.d.ts exists + let tsconfigPath = context.package.directoryURL.appending(path: "tsconfig.json") + + // Unified generate command + var generateArguments: [String] = [ + "generate", + "--module-name", + target.name, + "--target-dir", + target.directoryURL.path, + "--output-dir", + generatedDirectory.path, + "--verbose", + options.verbose ? "true" : "false", + ] + if FileManager.default.fileExists(atPath: bridgeDtsPath.path) { - try runBridgeJSTool( - arguments: [ - "import", - "--target-dir", - target.directoryURL.path, - "--output-skeleton", - generatedJavaScriptDirectory.appending(path: "BridgeJS.ImportTS.json").path, - "--output-swift", - generatedDirectory.appending(path: "BridgeJS.ImportTS.swift").path, - "--verbose", - options.verbose ? "true" : "false", - "--module-name", - target.name, - "--project", - context.package.directoryURL.appending(path: "tsconfig.json").path, - bridgeDtsPath.path, - ] + remainingArguments - ) + generateArguments.append(contentsOf: [ + "--project", + tsconfigPath.path, + bridgeDtsPath.path, + ]) } + + generateArguments.append( + contentsOf: target.sourceFiles.filter { + !$0.url.path.hasPrefix(generatedDirectory.path + "/") + }.map(\.url.path) + ) + generateArguments.append(contentsOf: remainingArguments) + + try runBridgeJSTool(arguments: generateArguments) } private func runBridgeJSTool(arguments: [String]) throws { diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift index e20bb6ab..51c73ce6 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift @@ -1660,6 +1660,7 @@ public class ExportSwift { } static let prelude: DeclSyntax = """ + // bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift new file mode 100644 index 00000000..c6ae5a98 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportSwiftMacros.swift @@ -0,0 +1,743 @@ +import SwiftSyntax +#if canImport(BridgeJSSkeleton) +import BridgeJSSkeleton +#endif +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities +#endif + +/// Collects macro-annotated Swift declarations and produces ImportedModuleSkeleton. +public final class ImportSwiftMacros { + let progress: ProgressReporting + let moduleName: String + private var sourceFiles: [(sourceFile: SourceFileSyntax, inputFilePath: String)] = [] + + public init(progress: ProgressReporting, moduleName: String) { + self.progress = progress + self.moduleName = moduleName + } + + /// Processes a Swift source file to find declarations marked with @JSFunction/@JSGetter/@JSSetter/@JSClass + /// + /// - Parameters: + /// - sourceFile: The parsed Swift source file to process + /// - inputFilePath: The file path for error reporting + public func addSourceFile(_ sourceFile: SourceFileSyntax, _ inputFilePath: String) { + sourceFiles.append((sourceFile, inputFilePath)) + } + + /// Finalizes the import process and generates the bridge code plus skeleton. + public func finalize() throws -> (outputSwift: String?, outputSkeleton: ImportedModuleSkeleton) { + var perSourceErrors: [(inputFilePath: String, errors: [DiagnosticError])] = [] + var importedFiles: [ImportedFileSkeleton] = [] + + for (sourceFile, inputFilePath) in sourceFiles { + progress.print("Processing \(inputFilePath)") + let collector = APICollector( + inputFilePath: inputFilePath, + knownJSClassNames: Self.collectJSClassNames(from: sourceFile) + ) + collector.walk(sourceFile) + if !collector.errors.isEmpty { + perSourceErrors.append((inputFilePath: inputFilePath, errors: collector.errors)) + } + importedFiles.append( + ImportedFileSkeleton( + functions: collector.importedFunctions, + types: collector.importedTypes + ) + ) + } + + if !perSourceErrors.isEmpty { + var allErrors: [String] = [] + for (inputFilePath, errors) in perSourceErrors { + for error in errors { + allErrors.append(error.formattedDescription(fileName: inputFilePath)) + } + } + throw BridgeJSCoreError(allErrors.joined(separator: "\n")) + } + + let moduleSkeleton = ImportedModuleSkeleton(moduleName: moduleName, children: importedFiles) + + var importer = ImportTS(progress: progress, moduleName: moduleName) + for skeleton in importedFiles { + importer.addSkeleton(skeleton) + } + let outputSwift = try importer.finalize() + return (outputSwift: outputSwift, outputSkeleton: moduleSkeleton) + } + + private static func collectJSClassNames(from sourceFile: SourceFileSyntax) -> Set { + let collector = JSImportTypeNameCollector(viewMode: .sourceAccurate) + collector.walk(sourceFile) + return collector.typeNames + } + + private final class JSImportTypeNameCollector: SyntaxAnyVisitor { + var typeNames: Set = [] + + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + if APICollector.hasJSClassAttributeStatic(node.attributes) { + typeNames.insert(node.name.text) + } + return .visitChildren + } + + override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { + if APICollector.hasJSClassAttributeStatic(node.attributes) { + typeNames.insert(node.name.text) + } + return .visitChildren + } + } + + fileprivate final class APICollector: SyntaxAnyVisitor { + var importedFunctions: [ImportedFunctionSkeleton] = [] + var importedTypes: [ImportedTypeSkeleton] = [] + var errors: [DiagnosticError] = [] + + private let inputFilePath: String + private var jsClassNames: Set + + init(inputFilePath: String, knownJSClassNames: Set) { + self.inputFilePath = inputFilePath + self.jsClassNames = knownJSClassNames + super.init(viewMode: .sourceAccurate) + } + + override func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind { + if hasJSClassAttribute(node.attributes) { + collectJSImportType(from: node, typeName: node.name.text) + return .skipChildren + } + return .visitChildren + } + + override func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind { + if hasJSClassAttribute(node.attributes) { + collectJSImportType(from: node, typeName: node.name.text) + return .skipChildren + } + return .visitChildren + } + + override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind { + let typeName = node.extendedType.trimmedDescription + collectStaticMembers(in: node.memberBlock.members, typeName: typeName) + return .skipChildren + } + + override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind { + if hasJSFunctionAttribute(node.attributes) { + if let function = parseFunction(node, enclosingTypeName: nil, isStaticMember: true) { + importedFunctions.append(function) + } + return .skipChildren + } + if hasJSSetterAttribute(node.attributes) { + if let setter = parseSetter(node, enclosingTypeName: nil, isStaticMember: true) { + importedFunctions.append(setter) + } + return .skipChildren + } + return .visitChildren + } + + override func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind { + guard hasJSGetterAttribute(node.attributes) else { + return .visitChildren + } + collectTopLevelProperty(from: node, enclosingTypeName: nil) + return .skipChildren + } + + private func collectJSImportType( + from node: some DeclGroupSyntax & DeclSyntaxProtocol, + typeName: String + ) { + var constructor: ImportedConstructorSkeleton? + var methods: [ImportedFunctionSkeleton] = [] + var getters: [ImportedGetterSkeleton] = [] + var setters: [ImportedSetterSkeleton] = [] + + // First pass: collect all explicit @JSSetter functions to track which properties have explicit setters + var propertiesWithExplicitSetters = Set() + for member in node.memberBlock.members { + if let function = member.decl.as(FunctionDeclSyntax.self), + hasJSSetterAttribute(function.attributes), + !isStatic(function.modifiers) + { + if let setter = parseSetterSkeleton(function, enclosingTypeName: typeName) { + propertiesWithExplicitSetters.insert(setter.name) + } + } + } + + // Second pass: process all members + for member in node.memberBlock.members { + if let initializer = member.decl.as(InitializerDeclSyntax.self) { + if hasJSFunctionAttribute(initializer.attributes) { + if constructor != nil { + errors.append( + DiagnosticError( + node: initializer, + message: "Only one @JSFunction initializer is supported in @JSClass types." + ) + ) + continue + } + if let parsed = parseConstructor(initializer, typeName: typeName) { + constructor = parsed + } + } + continue + } + + if let function = member.decl.as(FunctionDeclSyntax.self) { + if hasJSFunctionAttribute(function.attributes) { + if isStatic(function.modifiers) { + if let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) { + importedFunctions.append(parsed) + } + } else if let parsed = parseFunction( + function, + enclosingTypeName: typeName, + isStaticMember: false + ) { + methods.append(parsed) + } + continue + } + if hasJSSetterAttribute(function.attributes) { + if isStatic(function.modifiers) { + if let parsed = parseSetter(function, enclosingTypeName: typeName, isStaticMember: true) { + importedFunctions.append(parsed) + } + } else { + // Parse as setter skeleton + if let setter = parseSetterSkeleton(function, enclosingTypeName: typeName) { + setters.append(setter) + } + } + continue + } + continue + } + + if let variable = member.decl.as(VariableDeclSyntax.self) { + guard hasJSGetterAttribute(variable.attributes) else { continue } + if isStatic(variable.modifiers) { + collectTopLevelProperty(from: variable, enclosingTypeName: typeName) + } else { + // Parse as getter skeleton only + // Setters are ONLY generated from explicit @JSSetter functions, never from properties + if let getter = parseGetterSkeleton(variable, enclosingTypeName: typeName) { + getters.append(getter) + } + } + continue + } + } + + importedTypes.append( + ImportedTypeSkeleton( + name: typeName, + constructor: constructor, + methods: methods, + getters: getters, + setters: setters, + documentation: nil + ) + ) + } + + private func collectStaticMembers(in members: MemberBlockItemListSyntax, typeName: String) { + for member in members { + if let function = member.decl.as(FunctionDeclSyntax.self) { + if hasJSFunctionAttribute(function.attributes) { + if let parsed = parseFunction(function, enclosingTypeName: typeName, isStaticMember: true) { + importedFunctions.append(parsed) + } + continue + } + if hasJSSetterAttribute(function.attributes) { + if let parsed = parseSetter(function, enclosingTypeName: typeName, isStaticMember: true) { + importedFunctions.append(parsed) + } + continue + } + continue + } + + if let variable = member.decl.as(VariableDeclSyntax.self) { + guard hasJSGetterAttribute(variable.attributes) else { continue } + collectTopLevelProperty(from: variable, enclosingTypeName: typeName) + continue + } + } + } + + private func parseConstructor( + _ initializer: InitializerDeclSyntax, + typeName: String + ) -> ImportedConstructorSkeleton? { + guard let effects = parseEffects(initializer.signature.effectSpecifiers) else { + errors.append( + DiagnosticError( + node: initializer, + message: "@JSFunction initializers must be throws.", + hint: "Declare the initializer as 'throws (JSException)'." + ) + ) + return nil + } + if effects.isAsync { + errors.append( + DiagnosticError( + node: initializer, + message: "@JSFunction initializers do not support async yet." + ) + ) + return nil + } + let parameters = parseParameters( + from: initializer.signature.parameterClause, + enclosingTypeName: typeName + ) + return ImportedConstructorSkeleton(parameters: parameters) + } + + private func parseFunction( + _ node: FunctionDeclSyntax, + enclosingTypeName: String?, + isStaticMember: Bool + ) -> ImportedFunctionSkeleton? { + guard let effects = parseEffects(node.signature.effectSpecifiers) else { + errors.append( + DiagnosticError( + node: node, + message: "@JSFunction declarations must be throws.", + hint: "Declare the function as 'throws (JSException)'." + ) + ) + return nil + } + if effects.isAsync { + errors.append( + DiagnosticError( + node: node, + message: "@JSFunction declarations do not support async yet." + ) + ) + return nil + } + + let baseName = normalizeIdentifier(node.name.text) + let name: String + if isStaticMember, let enclosingTypeName { + name = "\(enclosingTypeName)_\(baseName)" + } else { + name = baseName + } + + let parameters = parseParameters( + from: node.signature.parameterClause, + enclosingTypeName: enclosingTypeName + ) + let returnType = parseReturnType( + node.signature.returnClause?.type, + enclosingTypeName: enclosingTypeName + ) + return ImportedFunctionSkeleton( + name: name, + parameters: parameters, + returnType: returnType, + documentation: nil + ) + } + + private func parseSetter( + _ node: FunctionDeclSyntax, + enclosingTypeName: String?, + isStaticMember: Bool + ) -> ImportedFunctionSkeleton? { + guard let effects = parseEffects(node.signature.effectSpecifiers) else { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter declarations must be throws.", + hint: "Declare the function as 'throws (JSException)'." + ) + ) + return nil + } + if effects.isAsync { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter declarations do not support async yet." + ) + ) + return nil + } + + let functionName = node.name.text + + // Extract property name from setter function name (e.g., "setFoo" -> "foo") + let propertyName = String(functionName.dropFirst(3)) + // Convert first character to lowercase (e.g., "Foo" -> "foo") + let baseName = propertyName.prefix(1).lowercased() + propertyName.dropFirst() + + // Get the parameter - setters should have one parameter + let parameters = node.signature.parameterClause.parameters + guard let firstParam = parameters.first else { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter function must have at least one parameter." + ) + ) + return nil + } + + let paramType = firstParam.type + if paramType.is(MissingTypeSyntax.self) { + errors.append( + DiagnosticError( + node: firstParam, + message: "All @JSSetter parameters must have explicit types." + ) + ) + return nil + } + + let valueType = parseType(paramType, enclosingTypeName: enclosingTypeName) + let paramName = firstParam.secondName ?? firstParam.firstName + let normalizedParamName = normalizeIdentifier(paramName.text) + + // Generate the setter function name + // For instance methods, don't include type prefix (bridge generator adds it) + // For static methods, include type prefix + // Use propertyName_set pattern to match property getters + let name: String + if isStaticMember, let enclosingTypeName { + name = "\(enclosingTypeName)_\(baseName)_set" + } else if enclosingTypeName != nil { + // Instance setter: use propertyName_set (no type prefix) + // Bridge generator will add TypeName_ prefix + name = "\(baseName)_set" + } else { + name = "\(baseName)_set" + } + + return ImportedFunctionSkeleton( + name: name, + parameters: [Parameter(label: nil, name: normalizedParamName, type: valueType)], + returnType: .void, + documentation: nil + ) + } + + private func parseGetterSkeleton( + _ node: VariableDeclSyntax, + enclosingTypeName: String? + ) -> ImportedGetterSkeleton? { + guard let binding = node.bindings.first else { + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter must declare a single stored property with an explicit type." + ) + ) + return nil + } + guard let identifier = binding.pattern.as(IdentifierPatternSyntax.self) else { + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter must declare a single stored property with an explicit type." + ) + ) + return nil + } + guard let typeAnnotation = binding.typeAnnotation else { + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter requires an explicit type annotation." + ) + ) + return nil + } + + let propertyType = parseType(typeAnnotation.type, enclosingTypeName: enclosingTypeName) + let propertyName = normalizeIdentifier(identifier.identifier.text) + + return ImportedGetterSkeleton( + name: propertyName, + type: propertyType, + documentation: nil, + functionName: nil + ) + } + + private func parseSetterSkeletonFromProperty( + _ node: VariableDeclSyntax, + enclosingTypeName: String? + ) -> ImportedSetterSkeleton? { + guard let binding = node.bindings.first else { return nil } + guard let identifier = binding.pattern.as(IdentifierPatternSyntax.self) else { return nil } + guard let typeAnnotation = binding.typeAnnotation else { return nil } + + let propertyType = parseType(typeAnnotation.type, enclosingTypeName: enclosingTypeName) + let propertyName = normalizeIdentifier(identifier.identifier.text) + + return ImportedSetterSkeleton( + name: propertyName, + type: propertyType, + documentation: nil, + functionName: nil + ) + } + + private func parseSetterSkeleton( + _ node: FunctionDeclSyntax, + enclosingTypeName: String? + ) -> ImportedSetterSkeleton? { + let functionName = node.name.text + + // Extract property name from setter function name (e.g., "setFoo" -> "foo") + // Strip backticks if present (e.g., "set`prefix`" -> "prefix") + let rawFunctionName = + functionName.hasPrefix("`") && functionName.hasSuffix("`") && functionName.count > 2 + ? String(functionName.dropFirst().dropLast()) + : functionName + + guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { + return nil + } + + let propertyName = String(rawFunctionName.dropFirst(3)) + // Convert first character to lowercase (e.g., "Foo" -> "foo") and normalize + let baseName = normalizeIdentifier(propertyName.prefix(1).lowercased() + propertyName.dropFirst()) + + // Get the parameter type + let parameters = node.signature.parameterClause.parameters + guard let firstParam = parameters.first else { + errors.append( + DiagnosticError( + node: node, + message: "@JSSetter function '\(functionName)' must have at least one parameter. \(node)" + ) + ) + return nil + } + + let paramType = firstParam.type + if paramType.is(MissingTypeSyntax.self) { + errors.append( + DiagnosticError( + node: firstParam, + message: "All @JSSetter parameters must have explicit types." + ) + ) + return nil + } + + let valueType = parseType(paramType, enclosingTypeName: enclosingTypeName) + + // Generate the setter function name + let setterFunctionName: String + if let enclosingTypeName { + setterFunctionName = "\(baseName)_set" + } else { + setterFunctionName = "\(baseName)_set" + } + + return ImportedSetterSkeleton( + name: baseName, + type: valueType, + documentation: nil, + functionName: setterFunctionName + ) + } + + private func collectTopLevelProperty( + from node: VariableDeclSyntax, + enclosingTypeName: String? + ) { + guard let binding = node.bindings.first else { + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter must declare a single stored property with an explicit type." + ) + ) + return + } + guard let identifier = binding.pattern.as(IdentifierPatternSyntax.self) else { + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter must declare a single stored property with an explicit type." + ) + ) + return + } + guard let typeAnnotation = binding.typeAnnotation else { + errors.append( + DiagnosticError( + node: node, + message: "@JSGetter requires an explicit type annotation." + ) + ) + return + } + + let propertyType = parseType(typeAnnotation.type, enclosingTypeName: enclosingTypeName) + let propertyName = normalizeIdentifier(identifier.identifier.text) + let isReadonly = node.bindingSpecifier.tokenKind == .keyword(.let) + + let prefix: String + if let enclosingTypeName { + prefix = "\(enclosingTypeName)_\(propertyName)" + } else { + prefix = propertyName + } + + importedFunctions.append( + ImportedFunctionSkeleton( + name: "\(prefix)_get", + parameters: [], + returnType: propertyType, + documentation: nil + ) + ) + + // Only generate default setter if property is not readonly + // Custom setters from @JSSetter will be handled separately + if !isReadonly { + // Note: If there's a @JSSetter function, it will be linked to the property + // and this default setter won't be generated (handled by the property skeleton) + importedFunctions.append( + ImportedFunctionSkeleton( + name: "\(prefix)_set", + parameters: [Parameter(label: nil, name: "newValue", type: propertyType)], + returnType: .void, + documentation: nil + ) + ) + } + } + + private func parseParameters( + from clause: FunctionParameterClauseSyntax, + enclosingTypeName: String? + ) -> [Parameter] { + clause.parameters.compactMap { param in + let type = param.type + if type.is(MissingTypeSyntax.self) { + errors.append( + DiagnosticError( + node: param, + message: "All @JSFunction parameters must have explicit types." + ) + ) + return nil + } + let nameToken = param.secondName ?? param.firstName + let name = normalizeIdentifier(nameToken.text) + let labelToken = param.secondName == nil ? nil : param.firstName + let label = labelToken?.text == "_" ? nil : labelToken?.text + let bridgeType = parseType(type, enclosingTypeName: enclosingTypeName) + return Parameter(label: label, name: name, type: bridgeType) + } + } + + private func parseReturnType(_ type: TypeSyntax?, enclosingTypeName: String?) -> BridgeType { + guard let type else { return .void } + return parseType(type, enclosingTypeName: enclosingTypeName) + } + + private func parseType(_ type: TypeSyntax, enclosingTypeName: String?) -> BridgeType { + if let identifier = type.as(IdentifierTypeSyntax.self) { + let name = normalizeIdentifier(identifier.name.text) + if name == "Self", let enclosingTypeName { + return .jsObject(enclosingTypeName) + } + if let primitive = BridgeType(swiftType: name) { + return primitive + } + if jsClassNames.contains(name) { + return .jsObject(name) + } + return .jsObject(name) + } + + errors.append( + DiagnosticError( + node: type, + message: "Unsupported @JS type '\(type.trimmedDescription)'." + ) + ) + return .void + } + + private func parseEffects(_ effects: FunctionEffectSpecifiersSyntax?) -> Effects? { + let isThrows = effects?.throwsClause != nil + let isAsync = effects?.asyncSpecifier != nil + guard isThrows else { + return nil + } + return Effects(isAsync: isAsync, isThrows: isThrows) + } + + private func hasJSFunctionAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, names: ["JSFunction", "JSFunction"]) + } + + private func hasJSGetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, names: ["JSGetter", "JSGetter"]) + } + + private func hasJSSetterAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, names: ["JSSetter", "JSSetter"]) + } + + private func hasJSClassAttribute(_ attributes: AttributeListSyntax?) -> Bool { + hasAttribute(attributes, names: ["JSClass"]) + } + + private func hasAttribute(_ attributes: AttributeListSyntax?, names: [String]) -> Bool { + guard let attributes else { return false } + return attributes.contains { attribute in + guard let syntax = attribute.as(AttributeSyntax.self) else { return false } + return names.contains(syntax.attributeName.trimmedDescription) + } + } + + static func hasJSClassAttributeStatic(_ attributes: AttributeListSyntax?) -> Bool { + guard let attributes else { return false } + return attributes.contains { attribute in + guard let syntax = attribute.as(AttributeSyntax.self) else { return false } + return ["JSClass"].contains(syntax.attributeName.trimmedDescription) + } + } + + private func isStatic(_ modifiers: DeclModifierListSyntax?) -> Bool { + guard let modifiers else { return false } + return modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + } + + private func normalizeIdentifier(_ name: String) -> String { + guard name.hasPrefix("`"), name.hasSuffix("`"), name.count >= 2 else { + return name + } + return String(name.dropFirst().dropLast()) + } + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift index e4f6c89b..5dfd1b8b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSCore/ImportTS.swift @@ -303,6 +303,7 @@ public struct ImportTS { } static let prelude: DeclSyntax = """ + // bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -312,6 +313,28 @@ public struct ImportTS { @_spi(BridgeJS) import JavaScriptKit """ + private static func thunkName(function: ImportedFunctionSkeleton) -> String { + "_$\(function.name)" + } + + private static func thunkName(type: ImportedTypeSkeleton, method: ImportedFunctionSkeleton) -> String { + "_$\(type.name)_\(method.name)" + } + + private static func thunkName(type: ImportedTypeSkeleton) -> String { + "_$\(type.name)_init" + } + + private static func thunkName( + type: ImportedTypeSkeleton, + propertyName: String, + operation: String + ) + -> String + { + "_$\(type.name)_\(propertyName)_\(operation)" + } + func renderSwiftThunk( _ function: ImportedFunctionSkeleton, topLevelDecls: inout [DeclSyntax] @@ -325,7 +348,7 @@ public struct ImportTS { topLevelDecls.append(builder.renderImportDecl()) return [ builder.renderThunkDecl( - name: function.name, + name: Self.thunkName(function: function), parameters: function.parameters, returnType: function.returnType ) @@ -334,11 +357,12 @@ public struct ImportTS { } func renderSwiftType(_ type: ImportedTypeSkeleton, topLevelDecls: inout [DeclSyntax]) throws -> [DeclSyntax] { - let name = type.name + let selfParameter = Parameter(label: nil, name: "self", type: .jsObject(nil)) + var decls: [DeclSyntax] = [] func renderMethod(method: ImportedFunctionSkeleton) throws -> [DeclSyntax] { let builder = CallJSEmission(moduleName: moduleName, abiName: method.abiName(context: type)) - try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) + try builder.lowerParameter(param: selfParameter) for param in method.parameters { try builder.lowerParameter(param: param) } @@ -347,11 +371,10 @@ public struct ImportTS { topLevelDecls.append(builder.renderImportDecl()) return [ builder.renderThunkDecl( - name: method.name, - parameters: method.parameters, + name: Self.thunkName(type: type, method: method), + parameters: [selfParameter] + method.parameters, returnType: method.returnType ) - .with(\.leadingTrivia, Self.renderDocumentation(documentation: method.documentation)) ] } @@ -360,119 +383,69 @@ public struct ImportTS { for param in constructor.parameters { try builder.lowerParameter(param: param) } - try builder.call(returnType: .jsObject(name)) - builder.assignThis(returnType: .jsObject(name)) + try builder.call(returnType: .jsObject(nil)) + try builder.liftReturnValue(returnType: .jsObject(nil)) topLevelDecls.append(builder.renderImportDecl()) return [ - builder.renderConstructorDecl(parameters: constructor.parameters) + builder.renderThunkDecl( + name: Self.thunkName(type: type), + parameters: constructor.parameters, + returnType: .jsObject(nil) + ) ] } - func renderGetterDecl(property: ImportedPropertySkeleton) throws -> AccessorDeclSyntax { + func renderGetterDecl(getter: ImportedGetterSkeleton) throws -> DeclSyntax { let builder = CallJSEmission( moduleName: moduleName, - abiName: property.getterAbiName(context: type) + abiName: getter.abiName(context: type) ) - try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) - try builder.call(returnType: property.type) - try builder.liftReturnValue(returnType: property.type) + try builder.lowerParameter(param: selfParameter) + try builder.call(returnType: getter.type) + try builder.liftReturnValue(returnType: getter.type) topLevelDecls.append(builder.renderImportDecl()) - return AccessorDeclSyntax( - accessorSpecifier: .keyword(.get), - effectSpecifiers: Self.buildAccessorEffect(throws: true, async: false), - body: CodeBlockSyntax { - builder.body - } + return DeclSyntax( + builder.renderThunkDecl( + name: Self.thunkName(type: type, propertyName: getter.name, operation: "get"), + parameters: [selfParameter], + returnType: getter.type + ) ) } - func renderSetterDecl(property: ImportedPropertySkeleton) throws -> DeclSyntax { + func renderSetterDecl(setter: ImportedSetterSkeleton) throws -> DeclSyntax { let builder = CallJSEmission( moduleName: moduleName, - abiName: property.setterAbiName(context: type) + abiName: setter.abiName(context: type) ) - let newValue = Parameter(label: nil, name: "newValue", type: property.type) - try builder.lowerParameter(param: Parameter(label: nil, name: "self", type: .jsObject(name))) + let newValue = Parameter(label: nil, name: "newValue", type: setter.type) + try builder.lowerParameter(param: selfParameter) try builder.lowerParameter(param: newValue) try builder.call(returnType: .void) topLevelDecls.append(builder.renderImportDecl()) return builder.renderThunkDecl( - name: "set\(property.name.capitalizedFirstLetter)", - parameters: [newValue], + name: Self.thunkName(type: type, propertyName: setter.name, operation: "set"), + parameters: [selfParameter, newValue], returnType: .void ) } - - func renderPropertyDecl(property: ImportedPropertySkeleton) throws -> [DeclSyntax] { - let accessorDecls: [AccessorDeclSyntax] = [try renderGetterDecl(property: property)] - var decls: [DeclSyntax] = [ - DeclSyntax( - VariableDeclSyntax( - leadingTrivia: Self.renderDocumentation(documentation: property.documentation), - bindingSpecifier: .keyword(.var), - bindingsBuilder: { - PatternBindingListSyntax { - PatternBindingSyntax( - pattern: IdentifierPatternSyntax( - identifier: .identifier(property.name.backtickIfNeeded()) - ), - typeAnnotation: TypeAnnotationSyntax( - type: IdentifierTypeSyntax(name: .identifier(property.type.swiftType)) - ), - accessorBlock: AccessorBlockSyntax( - accessors: .accessors( - AccessorDeclListSyntax(accessorDecls) - ) - ) - ) - } - } - ) - ) - ] - if !property.isReadonly { - decls.append(try renderSetterDecl(property: property)) - } - return decls + if let constructor = type.constructor { + decls.append(contentsOf: try renderConstructorDecl(constructor: constructor)) } - let classDecl = try StructDeclSyntax( - leadingTrivia: Self.renderDocumentation(documentation: type.documentation), - name: .identifier(name), - inheritanceClause: InheritanceClauseSyntax( - inheritedTypesBuilder: { - InheritedTypeSyntax(type: TypeSyntax("_JSBridgedClass")) - } - ), - memberBlockBuilder: { - DeclSyntax( - """ - let jsObject: JSObject - """ - ).with(\.trailingTrivia, .newlines(2)) - - DeclSyntax( - """ - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - """ - ).with(\.trailingTrivia, .newlines(2)) - if let constructor = type.constructor { - try renderConstructorDecl(constructor: constructor).map { $0.with(\.trailingTrivia, .newlines(2)) } - } + for getter in type.getters { + decls.append(try renderGetterDecl(getter: getter)) + } - for property in type.properties { - try renderPropertyDecl(property: property).map { $0.with(\.trailingTrivia, .newlines(2)) } - } + for setter in type.setters { + decls.append(try renderSetterDecl(setter: setter)) + } - for method in type.methods { - try renderMethod(method: method).map { $0.with(\.trailingTrivia, .newlines(2)) } - } - } - ) + for method in type.methods { + decls.append(contentsOf: try renderMethod(method: method)) + } - return [DeclSyntax(classDecl)] + return decls } static func renderDocumentation(documentation: String?) -> Trivia { diff --git a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift index 41b32342..2224329b 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift @@ -24,14 +24,28 @@ struct BridgeJSLink { self.sharedMemory = sharedMemory } - mutating func addExportedSkeletonFile(data: Data) throws { - let skeleton = try JSONDecoder().decode(ExportedSkeleton.self, from: data) - exportedSkeletons.append(skeleton) - } - - mutating func addImportedSkeletonFile(data: Data) throws { - let skeletons = try JSONDecoder().decode(ImportedModuleSkeleton.self, from: data) - importedSkeletons.append(skeletons) + mutating func addSkeletonFile(data: Data) throws { + do { + let unified = try JSONDecoder().decode(BridgeJSSkeleton.self, from: data) + if let exported = unified.exported { + exportedSkeletons.append(exported) + } + if let imported = unified.imported { + importedSkeletons.append(imported) + } + } catch { + struct SkeletonDecodingError: Error, CustomStringConvertible { + let description: String + } + throw SkeletonDecodingError( + description: """ + Failed to decode skeleton file: \(error) + + This file appears to be in an old format. Please regenerate skeleton files using: + bridge-js generate --module-name --target-dir --output-skeleton ... + """ + ) + } } let swiftHeapObjectClassDts = """ @@ -1145,14 +1159,21 @@ struct BridgeJSLink { printer.write(methodSignature) } - // Add properties - for property in type.properties { + // Add properties from getters + var propertyNames = Set() + for getter in type.getters { + propertyNames.insert(getter.name) + let hasSetter = type.setters.contains { $0.name == getter.name } let propertySignature = - property.isReadonly - ? "readonly \(property.name): \(resolveTypeScriptType(property.type));" - : "\(property.name): \(resolveTypeScriptType(property.type));" + hasSetter + ? "\(getter.name): \(resolveTypeScriptType(getter.type));" + : "readonly \(getter.name): \(resolveTypeScriptType(getter.type));" printer.write(propertySignature) } + // Add setters that don't have corresponding getters + for setter in type.setters where !propertyNames.contains(setter.name) { + printer.write("\(setter.name): \(resolveTypeScriptType(setter.type));") + } printer.unindent() printer.write("}") @@ -2868,34 +2889,34 @@ extension BridgeJSLink { constructor: constructor ) } - for property in type.properties { - let getterAbiName = property.getterAbiName(context: type) - let (js, dts) = try renderImportedProperty( - property: property, + for getter in type.getters { + let getterAbiName = getter.abiName(context: type) + let (js, dts) = try renderImportedGetter( + getter: getter, abiName: getterAbiName, emitCall: { thunkBuilder in - return try thunkBuilder.callPropertyGetter(name: property.name, returnType: property.type) + return try thunkBuilder.callPropertyGetter(name: getter.name, returnType: getter.type) } ) importObjectBuilder.assignToImportObject(name: getterAbiName, function: js) importObjectBuilder.appendDts(dts) + } - if !property.isReadonly { - let setterAbiName = property.setterAbiName(context: type) - let (js, dts) = try renderImportedProperty( - property: property, - abiName: setterAbiName, - emitCall: { thunkBuilder in - try thunkBuilder.liftParameter( - param: Parameter(label: nil, name: "newValue", type: property.type) - ) - thunkBuilder.callPropertySetter(name: property.name, returnType: property.type) - return nil - } - ) - importObjectBuilder.assignToImportObject(name: setterAbiName, function: js) - importObjectBuilder.appendDts(dts) - } + for setter in type.setters { + let setterAbiName = setter.abiName(context: type) + let (js, dts) = try renderImportedSetter( + setter: setter, + abiName: setterAbiName, + emitCall: { thunkBuilder in + try thunkBuilder.liftParameter( + param: Parameter(label: nil, name: "newValue", type: setter.type) + ) + thunkBuilder.callPropertySetter(name: setter.name, returnType: setter.type) + return nil + } + ) + importObjectBuilder.assignToImportObject(name: setterAbiName, function: js) + importObjectBuilder.appendDts(dts) } for method in type.methods { let (js, dts) = try renderImportedMethod(context: type, method: method) @@ -2935,8 +2956,8 @@ extension BridgeJSLink { importObjectBuilder.appendDts(dtsPrinter.lines) } - func renderImportedProperty( - property: ImportedPropertySkeleton, + func renderImportedGetter( + getter: ImportedGetterSkeleton, abiName: String, emitCall: (ImportedThunkBuilder) throws -> String? ) throws -> (js: [String], dts: [String]) { @@ -2946,7 +2967,23 @@ extension BridgeJSLink { let funcLines = thunkBuilder.renderFunction( name: abiName, returnExpr: returnExpr, - returnType: property.type + returnType: getter.type + ) + return (funcLines, []) + } + + func renderImportedSetter( + setter: ImportedSetterSkeleton, + abiName: String, + emitCall: (ImportedThunkBuilder) throws -> String? + ) throws -> (js: [String], dts: [String]) { + let thunkBuilder = ImportedThunkBuilder() + thunkBuilder.liftSelf() + let returnExpr = try emitCall(thunkBuilder) + let funcLines = thunkBuilder.renderFunction( + name: abiName, + returnExpr: returnExpr, + returnType: .void ) return (funcLines, []) } diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/BridgeJSMacrosPlugin.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/BridgeJSMacrosPlugin.swift new file mode 100644 index 00000000..9a45fa0f --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/BridgeJSMacrosPlugin.swift @@ -0,0 +1,12 @@ +import SwiftCompilerPlugin +import SwiftSyntaxMacros + +@main +struct BridgeJSMacrosPlugin: CompilerPlugin { + var providingMacros: [Macro.Type] = [ + JSFunctionMacro.self, + JSGetterMacro.self, + JSSetterMacro.self, + JSClassMacro.self, + ] +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift new file mode 100644 index 00000000..fc7af6cd --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSClassMacro.swift @@ -0,0 +1,51 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSClassMacro {} + +extension JSClassMacro: MemberMacro { + public static func expansion( + of node: AttributeSyntax, + providingMembersOf declaration: some DeclGroupSyntax, + in context: some MacroExpansionContext + ) throws -> [DeclSyntax] { + var members: [DeclSyntax] = [] + + let existingMembers = declaration.memberBlock.members + let hasJSObjectProperty = existingMembers.contains { member in + guard let variable = member.decl.as(VariableDeclSyntax.self) else { return false } + return variable.bindings.contains { binding in + binding.pattern.as(IdentifierPatternSyntax.self)?.identifier.text == "jsObject" + } + } + + if !hasJSObjectProperty { + members.append(DeclSyntax("let jsObject: JSObject")) + } + + let hasUnsafelyWrappingInit = existingMembers.contains { member in + guard let initializer = member.decl.as(InitializerDeclSyntax.self) else { return false } + let parameters = initializer.signature.parameterClause.parameters + guard let firstParam = parameters.first else { return false } + let externalName = firstParam.firstName.text + let internalName = firstParam.secondName?.text + return externalName == "unsafelyWrapping" && internalName == "jsObject" + } + + if !hasUnsafelyWrappingInit { + members.append( + DeclSyntax( + """ + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + """ + ) + ) + } + + return members + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift new file mode 100644 index 00000000..7dfd635f --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSFunctionMacro.swift @@ -0,0 +1,72 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSFunctionMacro {} + +extension JSFunctionMacro: BodyMacro { + public static func expansion( + of node: AttributeSyntax, + providingBodyFor declaration: some DeclSyntaxProtocol & WithOptionalCodeBlockSyntax, + in context: some MacroExpansionContext + ) throws -> [CodeBlockItemSyntax] { + if let functionDecl = declaration.as(FunctionDeclSyntax.self) { + let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) + let isStatic = JSMacroHelper.isStatic(functionDecl.modifiers) + let isInstanceMember = enclosingTypeName != nil && !isStatic + + // Strip backticks from function name (e.g., "`prefix`" -> "prefix") + // Backticks are only needed for Swift identifiers, not function names + let name = JSMacroHelper.stripBackticks(functionDecl.name.text) + let glueName = JSMacroHelper.glueName(baseName: name, enclosingTypeName: enclosingTypeName) + + var arguments: [String] = [] + if isInstanceMember { + arguments.append("self.jsObject") + } + arguments.append( + contentsOf: JSMacroHelper.parameterNames(functionDecl.signature.parameterClause.parameters) + ) + + let argsJoined = arguments.joined(separator: ", ") + let call = "\(glueName)(\(argsJoined))" + + let effects = functionDecl.signature.effectSpecifiers + let isAsync = effects?.asyncSpecifier != nil + let isThrows = effects?.throwsClause != nil + let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: isThrows) + + let isVoid = JSMacroHelper.isVoidReturn(functionDecl.signature.returnClause?.type) + let line = isVoid ? "\(prefix)\(call)" : "return \(prefix)\(call)" + return [CodeBlockItemSyntax(stringLiteral: line)] + } + + if let initializerDecl = declaration.as(InitializerDeclSyntax.self) { + guard let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) else { + context.diagnose( + Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration) + ) + return [] + } + + let glueName = JSMacroHelper.glueName(baseName: "init", enclosingTypeName: enclosingTypeName) + let parameters = initializerDecl.signature.parameterClause.parameters + let arguments = JSMacroHelper.parameterNames(parameters) + let call = "\(glueName)(\(arguments.joined(separator: ", ")))" + + let effects = initializerDecl.signature.effectSpecifiers + let isAsync = effects?.asyncSpecifier != nil + let isThrows = effects?.throwsClause != nil + let prefix = JSMacroHelper.tryAwaitPrefix(isAsync: isAsync, isThrows: isThrows) + + return [ + CodeBlockItemSyntax(stringLiteral: "let jsObject = \(prefix)\(call)"), + CodeBlockItemSyntax(stringLiteral: "self.init(unsafelyWrapping: jsObject)"), + ] + } + + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedDeclaration)) + return [] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift new file mode 100644 index 00000000..b996facf --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSGetterMacro.swift @@ -0,0 +1,62 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSGetterMacro {} + +extension JSGetterMacro: AccessorMacro { + public static func expansion( + of node: AttributeSyntax, + providingAccessorsOf declaration: some DeclSyntaxProtocol, + in context: some MacroExpansionContext + ) throws -> [AccessorDeclSyntax] { + guard let variableDecl = declaration.as(VariableDeclSyntax.self), + let binding = variableDecl.bindings.first, + let identifier = binding.pattern.as(IdentifierPatternSyntax.self) + else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedVariable)) + return [] + } + + let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) + let isStatic = JSMacroHelper.isStatic(variableDecl.modifiers) + let isInstanceMember = enclosingTypeName != nil && !isStatic + + // Strip backticks from property name (e.g., "`prefix`" -> "prefix") + // Backticks are only needed for Swift identifiers, not function names + let propertyName = JSMacroHelper.stripBackticks(identifier.identifier.text) + let getterName = JSMacroHelper.glueName( + baseName: propertyName, + enclosingTypeName: enclosingTypeName, + operation: "get" + ) + + var getterArgs: [String] = [] + if isInstanceMember { + getterArgs.append("self.jsObject") + } + let getterCall: CodeBlockItemSyntax = + "return try \(raw: getterName)(\(raw: getterArgs.joined(separator: ", ")))" + + let throwsClause = ThrowsClauseSyntax( + throwsSpecifier: .keyword(.throws), + leftParen: .leftParenToken(), + type: IdentifierTypeSyntax(name: .identifier("JSException")), + rightParen: .rightParenToken() + ) + + return [ + AccessorDeclSyntax( + accessorSpecifier: .keyword(.get), + effectSpecifiers: AccessorEffectSpecifiersSyntax( + asyncSpecifier: nil, + throwsClause: throwsClause + ), + body: CodeBlockSyntax { + getterCall + } + ) + ] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift new file mode 100644 index 00000000..b10871f6 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSMacroSupport.swift @@ -0,0 +1,100 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +enum JSMacroMessage: String, DiagnosticMessage { + case unsupportedDeclaration = "@JSFunction can only be applied to functions or initializers." + case unsupportedVariable = "@JSGetter can only be applied to single-variable declarations." + case unsupportedSetterDeclaration = "@JSSetter can only be applied to functions." + case invalidSetterName = + "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo')." + case setterRequiresParameter = "@JSSetter function must have at least one parameter." + + var message: String { rawValue } + var diagnosticID: MessageID { MessageID(domain: "JavaScriptKitMacros", id: rawValue) } + var severity: DiagnosticSeverity { .error } +} + +enum JSMacroHelper { + static func enclosingTypeName(from context: some MacroExpansionContext) -> String? { + for syntax in context.lexicalContext { + if let decl = syntax.as(ClassDeclSyntax.self) { + return decl.name.text + } + if let decl = syntax.as(StructDeclSyntax.self) { + return decl.name.text + } + if let decl = syntax.as(EnumDeclSyntax.self) { + return decl.name.text + } + if let decl = syntax.as(ActorDeclSyntax.self) { + return decl.name.text + } + } + return nil + } + + static func isStatic(_ modifiers: DeclModifierListSyntax?) -> Bool { + guard let modifiers else { return false } + return modifiers.contains { modifier in + modifier.name.tokenKind == .keyword(.static) || modifier.name.tokenKind == .keyword(.class) + } + } + + static func isVoidReturn(_ returnType: TypeSyntax?) -> Bool { + guard let returnType else { return true } + if let identifier = returnType.as(IdentifierTypeSyntax.self), identifier.name.text == "Void" { + return true + } + if let tuple = returnType.as(TupleTypeSyntax.self), tuple.elements.isEmpty { + return true + } + return false + } + + static func glueName(baseName: String, enclosingTypeName: String?) -> String { + if let enclosingTypeName { + return "_$\(enclosingTypeName)_\(baseName)" + } + return "_$\(baseName)" + } + + static func glueName(baseName: String, enclosingTypeName: String?, operation: String) -> String { + if let enclosingTypeName { + return "_$\(enclosingTypeName)_\(baseName)_\(operation)" + } + return "_$\(baseName)_\(operation)" + } + + static func parameterNames(_ parameters: FunctionParameterListSyntax) -> [String] { + parameters.compactMap { param in + let nameToken = param.secondName ?? param.firstName + let nameText = nameToken.text + return nameText == "_" ? nil : nameText + } + } + + static func tryAwaitPrefix(isAsync: Bool, isThrows: Bool) -> String { + switch (isAsync, isThrows) { + case (true, true): + return "try await " + case (true, false): + return "await " + case (false, true): + return "try " + case (false, false): + return "" + } + } + + /// Strips backticks from an identifier name. + /// Swift identifiers with keywords are escaped with backticks (e.g., `` `prefix` ``), + /// but function names should not include backticks. + static func stripBackticks(_ name: String) -> String { + if name.hasPrefix("`") && name.hasSuffix("`") && name.count > 2 { + return String(name.dropFirst().dropLast()) + } + return name + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift new file mode 100644 index 00000000..bb9fd1f2 --- /dev/null +++ b/Plugins/BridgeJS/Sources/BridgeJSMacros/JSSetterMacro.swift @@ -0,0 +1,71 @@ +import SwiftSyntax +import SwiftSyntaxBuilder +import SwiftSyntaxMacros +import SwiftDiagnostics + +public enum JSSetterMacro {} + +extension JSSetterMacro: BodyMacro { + public static func expansion( + of node: AttributeSyntax, + providingBodyFor declaration: some DeclSyntaxProtocol & WithOptionalCodeBlockSyntax, + in context: some MacroExpansionContext + ) throws -> [CodeBlockItemSyntax] { + guard let functionDecl = declaration.as(FunctionDeclSyntax.self) else { + context.diagnose( + Diagnostic(node: Syntax(declaration), message: JSMacroMessage.unsupportedSetterDeclaration) + ) + return [] + } + + let functionName = functionDecl.name.text + + // Extract property name from setter function name (e.g., "setFoo" -> "foo") + // Strip backticks if present (e.g., "set`prefix`" -> "prefix") + let rawFunctionName = JSMacroHelper.stripBackticks(functionName) + guard rawFunctionName.hasPrefix("set"), rawFunctionName.count > 3 else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) + return [] + } + + let propertyName = String(rawFunctionName.dropFirst(3)) + guard !propertyName.isEmpty else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.invalidSetterName)) + return [] + } + + // Convert first character to lowercase (e.g., "Foo" -> "foo") + let baseName = propertyName.prefix(1).lowercased() + propertyName.dropFirst() + + let enclosingTypeName = JSMacroHelper.enclosingTypeName(from: context) + let isStatic = JSMacroHelper.isStatic(functionDecl.modifiers) + let isInstanceMember = enclosingTypeName != nil && !isStatic + + let glueName = JSMacroHelper.glueName( + baseName: baseName, + enclosingTypeName: enclosingTypeName, + operation: "set" + ) + + var arguments: [String] = [] + if isInstanceMember { + arguments.append("self.jsObject") + } + + // Get the parameter name(s) - setters typically have one parameter + let parameters = functionDecl.signature.parameterClause.parameters + guard let firstParam = parameters.first else { + context.diagnose(Diagnostic(node: Syntax(declaration), message: JSMacroMessage.setterRequiresParameter)) + return [] + } + + let paramName = firstParam.secondName ?? firstParam.firstName + arguments.append(paramName.text) + + let argsJoined = arguments.joined(separator: ", ") + let call = "\(glueName)(\(argsJoined))" + + // Setters should throw JSException, so always use try + return [CodeBlockItemSyntax(stringLiteral: "try \(call)")] + } +} diff --git a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift index b2dae86c..bacde239 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift @@ -588,6 +588,13 @@ public struct ImportedFunctionSkeleton: Codable { public let returnType: BridgeType public let documentation: String? + public init(name: String, parameters: [Parameter], returnType: BridgeType, documentation: String? = nil) { + self.name = name + self.parameters = parameters + self.returnType = returnType + self.documentation = documentation + } + public func abiName(context: ImportedTypeSkeleton?) -> String { return ABINameGenerator.generateImportedABIName( baseName: name, @@ -599,6 +606,10 @@ public struct ImportedFunctionSkeleton: Codable { public struct ImportedConstructorSkeleton: Codable { public let parameters: [Parameter] + public init(parameters: [Parameter]) { + self.parameters = parameters + } + public func abiName(context: ImportedTypeSkeleton) -> String { return ABINameGenerator.generateImportedABIName( baseName: "init", @@ -607,21 +618,68 @@ public struct ImportedConstructorSkeleton: Codable { } } -public struct ImportedPropertySkeleton: Codable { +public struct ImportedGetterSkeleton: Codable { public let name: String - public let isReadonly: Bool public let type: BridgeType public let documentation: String? + /// Name of the getter function if it's a separate function (from @JSGetter) + public let functionName: String? + + public init( + name: String, + type: BridgeType, + documentation: String? = nil, + functionName: String? = nil + ) { + self.name = name + self.type = type + self.documentation = documentation + self.functionName = functionName + } - public func getterAbiName(context: ImportedTypeSkeleton) -> String { + public func abiName(context: ImportedTypeSkeleton) -> String { + if let functionName = functionName { + return ABINameGenerator.generateImportedABIName( + baseName: functionName, + context: context, + operation: nil + ) + } return ABINameGenerator.generateImportedABIName( baseName: name, context: context, operation: "get" ) } +} + +public struct ImportedSetterSkeleton: Codable { + public let name: String + public let type: BridgeType + public let documentation: String? + /// Name of the setter function if it's a separate function (from @JSSetter) + public let functionName: String? + + public init( + name: String, + type: BridgeType, + documentation: String? = nil, + functionName: String? = nil + ) { + self.name = name + self.type = type + self.documentation = documentation + self.functionName = functionName + } - public func setterAbiName(context: ImportedTypeSkeleton) -> String { + public func abiName(context: ImportedTypeSkeleton) -> String { + if let functionName = functionName { + return ABINameGenerator.generateImportedABIName( + baseName: functionName, + context: context, + operation: nil + ) + } return ABINameGenerator.generateImportedABIName( baseName: name, context: context, @@ -634,13 +692,35 @@ public struct ImportedTypeSkeleton: Codable { public let name: String public let constructor: ImportedConstructorSkeleton? public let methods: [ImportedFunctionSkeleton] - public let properties: [ImportedPropertySkeleton] + public let getters: [ImportedGetterSkeleton] + public let setters: [ImportedSetterSkeleton] public let documentation: String? + + public init( + name: String, + constructor: ImportedConstructorSkeleton? = nil, + methods: [ImportedFunctionSkeleton], + getters: [ImportedGetterSkeleton] = [], + setters: [ImportedSetterSkeleton] = [], + documentation: String? = nil + ) { + self.name = name + self.constructor = constructor + self.methods = methods + self.getters = getters + self.setters = setters + self.documentation = documentation + } } public struct ImportedFileSkeleton: Codable { public let functions: [ImportedFunctionSkeleton] public let types: [ImportedTypeSkeleton] + + public init(functions: [ImportedFunctionSkeleton], types: [ImportedTypeSkeleton]) { + self.functions = functions + self.types = types + } } public struct ImportedModuleSkeleton: Codable { @@ -653,6 +733,21 @@ public struct ImportedModuleSkeleton: Codable { } } +// MARK: - Unified Skeleton + +/// Unified skeleton containing both exported and imported API definitions +public struct BridgeJSSkeleton: Codable { + public let moduleName: String + public let exported: ExportedSkeleton? + public let imported: ImportedModuleSkeleton? + + public init(moduleName: String, exported: ExportedSkeleton? = nil, imported: ImportedModuleSkeleton? = nil) { + self.moduleName = moduleName + self.exported = exported + self.imported = imported + } +} + // MARK: - BridgeType extension extension BridgeType { diff --git a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift index d5a58aba..4321ae9d 100644 --- a/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift +++ b/Plugins/BridgeJS/Sources/BridgeJSTool/BridgeJSTool.swift @@ -9,6 +9,7 @@ @preconcurrency import class Foundation.JSONDecoder @preconcurrency import class Foundation.ProcessInfo import SwiftParser +import SwiftSyntax #if canImport(BridgeJSCore) import BridgeJSCore @@ -16,8 +17,11 @@ import BridgeJSCore #if canImport(BridgeJSSkeleton) import BridgeJSSkeleton #endif -#if canImport(TS2Skeleton) -import TS2Skeleton +#if canImport(TS2Swift) +import TS2Swift +#endif +#if canImport(BridgeJSUtilities) +import BridgeJSUtilities #endif /// BridgeJS Tool @@ -29,10 +33,7 @@ import TS2Skeleton /// 2. Export: Generate JavaScript bindings for Swift declarations /// /// Usage: -/// For importing TypeScript: -/// $ bridge-js import --module-name --output-swift --output-skeleton --project -/// For exporting Swift: -/// $ bridge-js export --output-swift --output-skeleton +/// $ bridge-js generate --module-name --target-dir --output-swift --output-skeleton [--output-import-swift ] [--output-import-skeleton ] [--project ] ... [...] /// /// This tool is intended to be used through the Swift Package Manager plugin system /// and is not typically called directly by end users. @@ -40,11 +41,10 @@ import TS2Skeleton static func help() -> String { return """ - Usage: \(CommandLine.arguments.first ?? "bridge-js-tool") [options] + Usage: \(CommandLine.arguments.first ?? "bridge-js-tool") generate [options] ... - Subcommands: - import Generate binding code to import TypeScript APIs into Swift - export Generate binding code to export Swift APIs to JavaScript + Generate bridge code for both exporting Swift APIs and importing TypeScript APIs. + Input files can be Swift source files (for export) or macro-annotated Swift files (for import). """ } @@ -69,16 +69,16 @@ import TS2Skeleton ) } switch subcommand { - case "import": + case "generate": let parser = ArgumentParser( singleDashOptions: [:], doubleDashOptions: [ "module-name": OptionRule( - help: "The name of the module to import the TypeScript API into", + help: "The name of the module", required: true ), "always-write": OptionRule( - help: "Always write the output files even if no APIs are imported", + help: "Always write the output files even if no APIs are found", required: false ), "verbose": OptionRule( @@ -89,14 +89,13 @@ import TS2Skeleton help: "The SwiftPM package target directory", required: true ), - "output-swift": OptionRule(help: "The output file path for the Swift source code", required: true), - "output-skeleton": OptionRule( - help: "The output file path for the skeleton of the imported TypeScript APIs", + "output-dir": OptionRule( + help: "The output directory for generated code", required: true ), "project": OptionRule( - help: "The path to the TypeScript project configuration file", - required: true + help: "The path to the TypeScript project configuration file (required for .d.ts files)", + required: false ), ] ) @@ -104,140 +103,100 @@ import TS2Skeleton arguments: Array(arguments.dropFirst()) ) let progress = ProgressReporting(verbose: doubleDashOptions["verbose"] == "true") - var importer = ImportTS(progress: progress, moduleName: doubleDashOptions["module-name"]!) + let moduleName = doubleDashOptions["module-name"]! let targetDirectory = URL(fileURLWithPath: doubleDashOptions["target-dir"]!) + let outputDirectory = URL(fileURLWithPath: doubleDashOptions["output-dir"]!) let config = try BridgeJSConfig.load(targetDirectory: targetDirectory) let nodePath: URL = try config.findTool("node", targetDirectory: targetDirectory) - for inputFile in positionalArguments { - if inputFile.hasSuffix(".json") { - let sourceURL = URL(fileURLWithPath: inputFile) - let skeleton = try JSONDecoder().decode( - ImportedFileSkeleton.self, - from: Data(contentsOf: sourceURL) - ) - importer.addSkeleton(skeleton) - } else if inputFile.hasSuffix(".d.ts") { - let tsconfigPath = URL(fileURLWithPath: doubleDashOptions["project"]!) - try importer.addSourceFile(inputFile, tsconfigPath: tsconfigPath.path, nodePath: nodePath) - } - } - let outputSwift = try importer.finalize() - let shouldWrite = doubleDashOptions["always-write"] == "true" || outputSwift != nil - guard shouldWrite else { - progress.print("No imported TypeScript APIs found") - return + let bridgeJsDtsPath = targetDirectory.appending(path: "bridge-js.d.ts") + if FileManager.default.fileExists(atPath: bridgeJsDtsPath.path) { + guard let tsconfigPath = doubleDashOptions["project"] else { + throw BridgeJSToolError("--project option is required when processing .d.ts files") + } + let bridgeJSMacrosPath = outputDirectory.appending(path: "BridgeJS.Macros.swift") + _ = try invokeTS2Swift( + dtsFile: bridgeJsDtsPath.path, + tsconfigPath: tsconfigPath, + nodePath: nodePath, + progress: progress, + outputPath: bridgeJSMacrosPath.path + ) } - let outputSwiftURL = URL(fileURLWithPath: doubleDashOptions["output-swift"]!) - try FileManager.default.createDirectory( - at: outputSwiftURL.deletingLastPathComponent(), - withIntermediateDirectories: true, - attributes: nil - ) - try (outputSwift ?? "").write(to: outputSwiftURL, atomically: true, encoding: .utf8) - - let outputSkeletonsURL = URL(fileURLWithPath: doubleDashOptions["output-skeleton"]!) - try FileManager.default.createDirectory( - at: outputSkeletonsURL.deletingLastPathComponent(), - withIntermediateDirectories: true, - attributes: nil - ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - try encoder.encode(importer.skeleton).write(to: outputSkeletonsURL) - - progress.print( - """ - Imported TypeScript APIs: - - \(outputSwiftURL.path) - - \(outputSkeletonsURL.path) - """ - ) - case "export": - let parser = ArgumentParser( - singleDashOptions: [:], - doubleDashOptions: [ - "module-name": OptionRule( - help: "The name of the module for external function references", - required: true - ), - "target-dir": OptionRule( - help: "The SwiftPM package target directory", - required: true - ), - "output-skeleton": OptionRule( - help: "The output file path for the skeleton of the exported Swift APIs", - required: true - ), - "output-swift": OptionRule(help: "The output file path for the Swift source code", required: true), - "always-write": OptionRule( - help: "Always write the output files even if no APIs are exported", - required: false - ), - "verbose": OptionRule( - help: "Print verbose output", - required: false - ), - ] - ) - let (positionalArguments, _, doubleDashOptions) = try parser.parse( - arguments: Array(arguments.dropFirst()) - ) - let progress = ProgressReporting(verbose: doubleDashOptions["verbose"] == "true") - let targetDirectory = URL(fileURLWithPath: doubleDashOptions["target-dir"]!) - let config = try BridgeJSConfig.load(targetDirectory: targetDirectory) + let inputFiles = inputSwiftFiles(targetDirectory: targetDirectory, positionalArguments: positionalArguments) let exporter = ExportSwift( progress: progress, - moduleName: doubleDashOptions["module-name"]!, + moduleName: moduleName, exposeToGlobal: config.exposeToGlobal ) - for inputFile in positionalArguments.sorted() { - let sourceURL = URL(fileURLWithPath: inputFile) - guard sourceURL.pathExtension == "swift" else { continue } - let sourceContent = try String(contentsOf: sourceURL, encoding: .utf8) - let sourceFile = Parser.parse(source: sourceContent) - try exporter.addSourceFile(sourceFile, sourceURL.path) - } + let importSwift = ImportSwiftMacros(progress: progress, moduleName: moduleName) + + for inputFile in inputFiles.sorted() { + let content = try String(contentsOf: URL(fileURLWithPath: inputFile), encoding: .utf8) + if hasBridgeJSSkipComment(content) { + continue + } - // Finalize the export - let output = try exporter.finalize() - let outputSwiftURL = URL(fileURLWithPath: doubleDashOptions["output-swift"]!) - let outputSkeletonURL = URL(fileURLWithPath: doubleDashOptions["output-skeleton"]!) + let sourceFile = Parser.parse(source: content) + try exporter.addSourceFile(sourceFile, inputFile) + importSwift.addSourceFile(sourceFile, inputFile) + } - let shouldWrite = doubleDashOptions["always-write"] == "true" || output != nil - guard shouldWrite else { - progress.print("No exported Swift APIs found") - return + let importResult = try importSwift.finalize() + var importer = ImportTS(progress: progress, moduleName: moduleName) + for child in importResult.outputSkeleton.children { + importer.addSkeleton(child) + } + let importSwiftCode = try importer.finalize() + let importSkeleton = importer.skeleton + let exportResult = try exporter.finalize() + + // Combine and write unified Swift output + let outputSwiftURL = outputDirectory.appending(path: "BridgeJS.swift") + var combinedSwift: [String] = [] + if let exportCode = exportResult?.outputSwift { + combinedSwift.append(exportCode) + } + if let importCode = importResult.outputSwift { + combinedSwift.append(importCode) + } + let shouldWrite = doubleDashOptions["always-write"] == "true" || !combinedSwift.isEmpty + if shouldWrite { + try FileManager.default.createDirectory( + at: outputSwiftURL.deletingLastPathComponent(), + withIntermediateDirectories: true, + attributes: nil + ) + try combinedSwift.joined(separator: "\n\n").write(to: outputSwiftURL, atomically: true, encoding: .utf8) } - // Create the output directory if it doesn't exist - try FileManager.default.createDirectory( - at: outputSwiftURL.deletingLastPathComponent(), - withIntermediateDirectories: true, - attributes: nil + // Write unified skeleton + let outputSkeletonURL = outputDirectory.appending(path: "JavaScript/BridgeJS.json") + let unifiedSkeleton = BridgeJSSkeleton( + moduleName: moduleName, + exported: exportResult?.outputSkeleton, + imported: importSkeleton ) try FileManager.default.createDirectory( at: outputSkeletonURL.deletingLastPathComponent(), withIntermediateDirectories: true, attributes: nil ) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let skeletonData = try encoder.encode(unifiedSkeleton) + try skeletonData.write(to: outputSkeletonURL) - // Write the output Swift file - try (output?.outputSwift ?? "").write(to: outputSwiftURL, atomically: true, encoding: .utf8) - - if let outputSkeleton = output?.outputSkeleton { - // Write the output skeleton file - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(outputSkeleton) - try outputSkeletonData.write(to: outputSkeletonURL) + if exportResult != nil || importResult != nil { + progress.print("Generated BridgeJS code") } - progress.print( + case "export", "import": + throw BridgeJSToolError( """ - Exported Swift APIs: - - \(outputSwiftURL.path) - - \(outputSkeletonURL.path) + Error: Subcommands 'export' and 'import' have been unified into 'generate'. + + \(BridgeJSTool.help()) """ ) default: @@ -264,6 +223,44 @@ private func printStderr(_ message: String) { fputs(message + "\n", stderr) } +private func hasBridgeJSSkipComment(_ content: String) -> Bool { + let magicComment = "// bridge-js: skip\n" + return content.starts(with: magicComment) +} + +private func recursivelyCollectSwiftFiles(from directory: URL) -> [URL] { + var swiftFiles: [URL] = [] + let fileManager = FileManager.default + + guard + let enumerator = fileManager.enumerator( + at: directory, + includingPropertiesForKeys: [.isRegularFileKey, .isDirectoryKey], + options: [.skipsHiddenFiles] + ) + else { + return [] + } + + for case let fileURL as URL in enumerator { + if fileURL.pathExtension == "swift" { + let resourceValues = try? fileURL.resourceValues(forKeys: [.isRegularFileKey]) + if resourceValues?.isRegularFile == true { + swiftFiles.append(fileURL) + } + } + } + + return swiftFiles.sorted { $0.path < $1.path } +} + +private func inputSwiftFiles(targetDirectory: URL, positionalArguments: [String]) -> [String] { + if positionalArguments.isEmpty { + return recursivelyCollectSwiftFiles(from: targetDirectory).map(\.path) + } + return positionalArguments +} + // MARK: - Minimal Argument Parsing struct OptionRule { diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/README.md b/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/README.md deleted file mode 100644 index de680635..00000000 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# ts2skeleton - -This script analyzes the TypeScript type definitions and produces a structured JSON output with skeleton information that can be used to generate Swift bindings. diff --git a/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/README.md b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/README.md new file mode 100644 index 00000000..b2dbe6a6 --- /dev/null +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/README.md @@ -0,0 +1,3 @@ +# ts2swift + +This script analyzes the TypeScript type definitions and produces macro-annotated Swift declarations that can be fed into BridgeJS for glue generation. diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/bin/ts2skeleton.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js old mode 100755 new mode 100644 similarity index 53% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/bin/ts2skeleton.js rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js index ba926a88..cc94fce3 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/bin/ts2skeleton.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/bin/ts2swift.js @@ -2,11 +2,10 @@ // @ts-check /** - * Main entry point for the ts2skeleton tool + * Main entry point for the ts2swift tool * - * This script analyzes the TypeScript type definitions and produces a structured - * JSON output with skeleton information that can be used to generate Swift - * bindings. + * This script analyzes the TypeScript type definitions and produces macro-annotated + * Swift declarations that can be used to generate Swift bindings. */ import { main } from "../src/cli.js" diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/package.json b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json similarity index 69% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/package.json rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json index 48fb77cf..d6b34558 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/package.json +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/package.json @@ -4,6 +4,6 @@ "typescript": "5.8.2" }, "bin": { - "ts2skeleton": "./bin/ts2skeleton.js" + "ts2swift": "./bin/ts2swift.js" } } diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/cli.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js similarity index 90% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/cli.js rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js index 41f6e419..28f37e0e 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/cli.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js @@ -73,7 +73,7 @@ class DiagnosticEngine { } function printUsage() { - console.error('Usage: ts2skeleton -p [-o output.json]'); + console.error('Usage: ts2swift -p [-o output.swift]'); } /** @@ -139,13 +139,14 @@ export function main(args) { } const processor = new TypeProcessor(program.getTypeChecker(), diagnosticEngine); - const results = processor.processTypeDeclarations(program, filePath); + const { content: swiftOutput, hasAny } = processor.processTypeDeclarations(program, filePath); - // Write results to file or stdout - const jsonOutput = JSON.stringify(results, null, 2); if (options.values.output) { - fs.writeFileSync(options.values.output, jsonOutput); + if (hasAny) { + fs.mkdirSync(path.dirname(options.values.output), { recursive: true }); + fs.writeFileSync(options.values.output, swiftOutput); + } } else { - process.stdout.write(jsonOutput, "utf-8"); + process.stdout.write(swiftOutput, "utf-8"); } } diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/index.d.ts b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts similarity index 100% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/index.d.ts rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/index.d.ts diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js similarity index 52% rename from Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js rename to Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js index cdcff719..ac43c4ae 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/JavaScript/src/processor.js +++ b/Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js @@ -5,14 +5,10 @@ // @ts-check import ts from 'typescript'; +import path from 'path'; -/** @typedef {import('./index').ImportSkeleton} ImportSkeleton */ -/** @typedef {import('./index').ImportFunctionSkeleton} ImportFunctionSkeleton */ -/** @typedef {import('./index').ImportTypeSkeleton} ImportTypeSkeleton */ -/** @typedef {import('./index').ImportPropertySkeleton} ImportPropertySkeleton */ -/** @typedef {import('./index').ImportConstructorSkeleton} ImportConstructorSkeleton */ -/** @typedef {import('./index').Parameter} Parameter */ -/** @typedef {import('./index').BridgeType} BridgeType */ +/** @typedef {import('./index.d.ts').Parameter} Parameter */ +/** @typedef {import('./index.d.ts').BridgeType} BridgeType */ /** * @typedef {{ @@ -57,21 +53,33 @@ export class TypeProcessor { this.processedTypes = new Map(); /** @type {Map} Seen position by type */ this.seenTypes = new Map(); - /** @type {ImportFunctionSkeleton[]} */ - this.functions = []; - /** @type {ImportTypeSkeleton[]} */ - this.types = []; + /** @type {string[]} Collected Swift code lines */ + this.swiftLines = []; } /** - * Process type declarations from a TypeScript program + * Process type declarations from a TypeScript program and render Swift code * @param {ts.Program} program - TypeScript program * @param {string} inputFilePath - Path to the input file - * @returns {ImportSkeleton} Processed type declarations + * @returns {{ content: string, hasAny: boolean }} Rendered Swift code */ processTypeDeclarations(program, inputFilePath) { - const sourceFiles = program.getSourceFiles().filter( - sf => !sf.isDeclarationFile || sf.fileName === inputFilePath + const normalizedInput = path.resolve(inputFilePath); + const sourceFiles = program.getSourceFiles().filter(sf => { + if (!sf.isDeclarationFile) return true; + return path.resolve(sf.fileName) === normalizedInput; + }); + + // Add prelude + this.swiftLines.push( + "// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit,", + "// DO NOT EDIT.", + "//", + "// To update this file, just rebuild your project or run", + "// `swift package bridge-js`.", + "", + "import JavaScriptKit", + "" ); for (const sourceFile of sourceFiles) { @@ -88,10 +96,7 @@ export class TypeProcessor { const typeString = this.checker.typeToString(type); const members = type.getProperties(); if (members) { - const type = this.visitStructuredType(typeString, members); - this.types.push(type); - } else { - this.types.push(this.createUnknownType(typeString)); + this.visitStructuredType(typeString, members); } } }); @@ -100,23 +105,11 @@ export class TypeProcessor { } } - return { functions: this.functions, types: this.types }; + const content = this.swiftLines.join("\n").trimEnd() + "\n"; + const hasAny = this.swiftLines.length > 9; // More than just the prelude + return { content, hasAny }; } - /** - * Create an unknown type - * @param {string} typeString - Type string - * @returns {ImportTypeSkeleton} Unknown type - */ - createUnknownType(typeString) { - return { - name: typeString, - documentation: undefined, - properties: [], - methods: [], - constructor: undefined, - }; - } /** * Visit a node and process it @@ -124,50 +117,34 @@ export class TypeProcessor { */ visitNode(node) { if (ts.isFunctionDeclaration(node)) { - const func = this.visitFunctionLikeDecl(node); - if (func && node.name) { - this.functions.push({ ...func, name: node.name.getText() }); - } + this.visitFunctionDeclaration(node); } else if (ts.isClassDeclaration(node)) { - const cls = this.visitClassDecl(node); - if (cls) this.types.push(cls); + this.visitClassDecl(node); } } /** - * Process a function declaration into ImportFunctionSkeleton format - * @param {ts.SignatureDeclaration} node - The function node - * @returns {ImportFunctionSkeleton | null} Processed function + * Visit a function declaration and render Swift code + * @param {ts.FunctionDeclaration} node - The function node * @private */ - visitFunctionLikeDecl(node) { - if (!node.name) return null; + visitFunctionDeclaration(node) { + if (!node.name) return; const name = node.name.getText(); if (!isValidSwiftDeclName(name)) { - return null; + return; } const signature = this.checker.getSignatureFromDeclaration(node); - if (!signature) return null; - - /** @type {Parameter[]} */ - const parameters = []; - for (const p of signature.getParameters()) { - const bridgeType = this.visitSignatureParameter(p, node); - parameters.push(bridgeType); - } - - const returnType = signature.getReturnType(); - const bridgeReturnType = this.visitType(returnType, node); - const documentation = this.getFullJSDocText(node); - - return { - name, - parameters, - returnType: bridgeReturnType, - documentation, - effects: { isAsync: false }, - }; + if (!signature) return; + + const params = this.renderParameters(signature.getParameters(), node); + const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); + const effects = this.renderEffects({ isAsync: false }); + const swiftName = this.renderIdentifier(name); + + this.swiftLines.push(`@JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); + this.swiftLines.push(""); } /** @@ -188,25 +165,21 @@ export class TypeProcessor { } /** + * Render constructor parameters * @param {ts.ConstructorDeclaration} node - * @returns {ImportConstructorSkeleton | null} + * @returns {string} Rendered parameters + * @private */ - visitConstructorDecl(node) { + renderConstructorParameters(node) { const signature = this.checker.getSignatureFromDeclaration(node); - if (!signature) return null; - - const parameters = []; - for (const p of signature.getParameters()) { - const bridgeType = this.visitSignatureParameter(p, node); - parameters.push(bridgeType); - } + if (!signature) return ""; - return { parameters }; + return this.renderParameters(signature.getParameters(), node); } /** * @param {ts.PropertyDeclaration | ts.PropertySignature} node - * @returns {ImportPropertySkeleton | null} + * @returns {{ name: string, type: BridgeType, isReadonly: boolean, documentation: string | undefined } | null} */ visitPropertyDecl(node) { if (!node.name) return null; @@ -235,39 +208,29 @@ export class TypeProcessor { } /** + * Visit a class declaration and render Swift code * @param {ts.ClassDeclaration} node - * @returns {ImportTypeSkeleton | null} + * @private */ visitClassDecl(node) { - if (!node.name) return null; + if (!node.name) return; - const name = node.name.text; - const properties = []; - const methods = []; - /** @type {ImportConstructorSkeleton | undefined} */ - let constructor = undefined; + const className = this.renderIdentifier(node.name.text); + this.swiftLines.push(`@JSClass struct ${className}: _JSBridgedClass {`); + // Process members in declaration order for (const member of node.members) { if (ts.isPropertyDeclaration(member)) { - const property = this.visitPropertyDecl(member); - if (property) properties.push(property); + this.renderProperty(member); } else if (ts.isMethodDeclaration(member)) { - const decl = this.visitFunctionLikeDecl(member); - if (decl) methods.push(decl); + this.renderMethod(member); } else if (ts.isConstructorDeclaration(member)) { - const decl = this.visitConstructorDecl(member); - if (decl) constructor = decl; + this.renderConstructor(member); } } - const documentation = this.getFullJSDocText(node); - return { - name, - constructor, - properties, - methods, - documentation, - }; + this.swiftLines.push("}"); + this.swiftLines.push(""); } /** @@ -301,47 +264,51 @@ export class TypeProcessor { } /** + * Visit a structured type (interface) and render Swift code * @param {string} name * @param {ts.Symbol[]} members - * @returns {ImportTypeSkeleton} + * @private */ visitStructuredType(name, members) { - /** @type {ImportPropertySkeleton[]} */ - const properties = []; - /** @type {ImportFunctionSkeleton[]} */ - const methods = []; - /** @type {ImportConstructorSkeleton | undefined} */ - let constructor = undefined; + const typeName = this.renderIdentifier(name); + this.swiftLines.push(`@JSClass struct ${typeName}: _JSBridgedClass {`); + + // Collect all declarations with their positions to preserve order + /** @type {Array<{ decl: ts.Node, symbol: ts.Symbol, position: number }>} */ + const allDecls = []; + for (const symbol of members) { + for (const decl of symbol.getDeclarations() ?? []) { + const sourceFile = decl.getSourceFile(); + const pos = sourceFile ? decl.getStart() : 0; + allDecls.push({ decl, symbol, position: pos }); + } + } + + // Sort by position to preserve declaration order + allDecls.sort((a, b) => a.position - b.position); + + // Process declarations in order + for (const { decl, symbol } of allDecls) { if (symbol.flags & ts.SymbolFlags.Property) { - for (const decl of symbol.getDeclarations() ?? []) { - if (ts.isPropertyDeclaration(decl) || ts.isPropertySignature(decl)) { - const property = this.visitPropertyDecl(decl); - if (property) properties.push(property); - } else if (ts.isMethodSignature(decl)) { - const method = this.visitFunctionLikeDecl(decl); - if (method) methods.push(method); - } + if (ts.isPropertyDeclaration(decl) || ts.isPropertySignature(decl)) { + this.renderProperty(decl); + } else if (ts.isMethodSignature(decl)) { + this.renderMethodSignature(decl); } } else if (symbol.flags & ts.SymbolFlags.Method) { - for (const decl of symbol.getDeclarations() ?? []) { - if (!ts.isMethodSignature(decl)) { - continue; - } - const method = this.visitFunctionLikeDecl(decl); - if (method) methods.push(method); + if (ts.isMethodSignature(decl)) { + this.renderMethodSignature(decl); } } else if (symbol.flags & ts.SymbolFlags.Constructor) { - for (const decl of symbol.getDeclarations() ?? []) { - if (!ts.isConstructorDeclaration(decl)) { - continue; - } - const ctor = this.visitConstructorDecl(decl); - if (ctor) constructor = ctor; + if (ts.isConstructorDeclaration(decl)) { + this.renderConstructor(decl); } } } - return { name, properties, methods, constructor, documentation: undefined }; + + this.swiftLines.push("}"); + this.swiftLines.push(""); } /** @@ -431,6 +398,157 @@ export class TypeProcessor { } return undefined; } + + /** + * Render a property declaration + * @param {ts.PropertyDeclaration | ts.PropertySignature} node + * @private + */ + renderProperty(node) { + const property = this.visitPropertyDecl(node); + if (!property) return; + + const type = this.renderBridgeType(property.type, node); + const name = this.renderIdentifier(property.name); + + // Always render getter + this.swiftLines.push(` @JSGetter var ${name}: ${type}`); + + // Render setter if not readonly + if (!property.isReadonly) { + const setterName = `set${property.name.charAt(0).toUpperCase() + property.name.slice(1)}`; + this.swiftLines.push(` @JSSetter func ${this.renderIdentifier(setterName)}(_ value: ${type}) ${this.renderEffects({ isAsync: false })}`); + } + } + + /** + * Render a method declaration + * @param {ts.MethodDeclaration | ts.MethodSignature} node + * @private + */ + renderMethod(node) { + if (!node.name) return; + const name = node.name.getText(); + if (!isValidSwiftDeclName(name)) return; + + const signature = this.checker.getSignatureFromDeclaration(node); + if (!signature) return; + + const params = this.renderParameters(signature.getParameters(), node); + const returnType = this.renderBridgeType(this.visitType(signature.getReturnType(), node), node); + const effects = this.renderEffects({ isAsync: false }); + const swiftName = this.renderIdentifier(name); + + this.swiftLines.push(` @JSFunction func ${swiftName}(${params}) ${effects} -> ${returnType}`); + } + + /** + * Render a method signature (from interface) + * @param {ts.MethodSignature} node + * @private + */ + renderMethodSignature(node) { + this.renderMethod(node); + } + + /** + * Render a constructor declaration + * @param {ts.ConstructorDeclaration} node + * @private + */ + renderConstructor(node) { + const params = this.renderConstructorParameters(node); + const effects = this.renderEffects({ isAsync: false }); + this.swiftLines.push(` @JSFunction init(${params}) ${effects}`); + } + + /** + * Render function parameters + * @param {ts.Symbol[]} parameters + * @param {ts.Node} node + * @returns {string} + * @private + */ + renderParameters(parameters, node) { + const params = []; + for (const p of parameters) { + const bridgeType = this.visitSignatureParameter(p, node); + const paramName = this.renderIdentifier(p.name); + const type = this.renderBridgeType(bridgeType.type, node); + params.push(`_ ${paramName}: ${type}`); + } + return params.join(", "); + } + + /** + * Render bridge type to Swift type + * @param {BridgeType} bridgeType + * @param {ts.Node} node + * @returns {string} + * @private + */ + renderBridgeType(bridgeType, node) { + if ("int" in bridgeType) return "Int"; + if ("float" in bridgeType) return "Float"; + if ("double" in bridgeType) return "Double"; + if ("string" in bridgeType) return "String"; + if ("bool" in bridgeType) return "Bool"; + if ("void" in bridgeType) return "Void"; + if ("jsObject" in bridgeType) { + const name = "_0" in bridgeType.jsObject ? bridgeType.jsObject._0 : undefined; + return name ? this.renderIdentifier(name) : "JSObject"; + } + return "JSObject"; + } + + /** + * Render effects (async/throws) + * @param {{ isAsync: boolean }} effects + * @returns {string} + * @private + */ + renderEffects(effects) { + const parts = []; + if (effects?.isAsync) { + parts.push("async"); + } + parts.push("throws (JSException)"); + return parts.join(" "); + } + + /** + * Render identifier with backticks if needed + * @param {string} name + * @returns {string} + * @private + */ + renderIdentifier(name) { + if (!name) return name; + if (!isValidSwiftDeclName(name) || isSwiftKeyword(name)) { + return `\`${name}\``; + } + return name; + } +} + + +const SWIFT_KEYWORDS = new Set([ + "associatedtype", "class", "deinit", "enum", "extension", "fileprivate", + "func", "import", "init", "inout", "internal", "let", "open", "operator", + "private", "protocol", "public", "static", "struct", "subscript", "typealias", + "var", "break", "case", "continue", "default", "defer", "do", "else", + "fallthrough", "for", "guard", "if", "in", "repeat", "return", "switch", + "where", "while", "as", "Any", "catch", "false", "is", "nil", "rethrows", + "super", "self", "Self", "throw", "throws", "true", "try", + "prefix", "postfix", "infix" // Contextual keywords for operator declarations +]); + +/** + * @param {string} name + * @returns {boolean} + */ +function isSwiftKeyword(name) { + return SWIFT_KEYWORDS.has(name); } /** diff --git a/Plugins/BridgeJS/Sources/TS2Skeleton/TS2Skeleton.swift b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift similarity index 65% rename from Plugins/BridgeJS/Sources/TS2Skeleton/TS2Skeleton.swift rename to Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift index c7725faf..0a69eb70 100644 --- a/Plugins/BridgeJS/Sources/TS2Skeleton/TS2Skeleton.swift +++ b/Plugins/BridgeJS/Sources/TS2Swift/TS2Swift.swift @@ -1,4 +1,3 @@ -@preconcurrency import class Foundation.JSONDecoder @preconcurrency import class Foundation.Process @preconcurrency import class Foundation.Pipe @preconcurrency import class Foundation.ProcessInfo @@ -11,6 +10,8 @@ @preconcurrency import var Foundation.SIGTERM import protocol Dispatch.DispatchSourceSignal import class Dispatch.DispatchSource +import SwiftParser +import SwiftSyntax #if canImport(BridgeJSCore) import BridgeJSCore @@ -76,48 +77,57 @@ extension BridgeJSConfig { } } -extension ImportTS { - /// Processes a TypeScript definition file and extracts its API information - public mutating func addSourceFile( - _ sourceFile: String, - tsconfigPath: String, - nodePath: URL - ) throws { - let ts2skeletonPath = URL(fileURLWithPath: #filePath) - .deletingLastPathComponent() - .appendingPathComponent("JavaScript") - .appendingPathComponent("bin") - .appendingPathComponent("ts2skeleton.js") - let arguments = [ts2skeletonPath.path, sourceFile, "--project", tsconfigPath] +/// Invokes ts2swift to convert TypeScript definitions to macro-annotated Swift +/// - Parameters: +/// - dtsFile: Path to the TypeScript definition file +/// - tsconfigPath: Path to the TypeScript project configuration file +/// - nodePath: Path to the node executable +/// - progress: Progress reporting instance +/// - outputPath: Optional path to write the output file. If nil, output is collected from stdout (for testing) +/// - Returns: The generated Swift source code (always collected from stdout for return value) +public func invokeTS2Swift( + dtsFile: String, + tsconfigPath: String, + nodePath: URL, + progress: ProgressReporting, + outputPath: String? = nil +) throws -> String { + let ts2swiftPath = URL(fileURLWithPath: #filePath) + .deletingLastPathComponent() + .appendingPathComponent("JavaScript") + .appendingPathComponent("bin") + .appendingPathComponent("ts2swift.js") + var arguments = [ts2swiftPath.path, dtsFile, "--project", tsconfigPath] + if let outputPath = outputPath { + arguments.append(contentsOf: ["--output", outputPath]) + } - progress.print("Running ts2skeleton...") - progress.print(" \(([nodePath.path] + arguments).joined(separator: " "))") + progress.print("Running ts2swift...") + progress.print(" \(([nodePath.path] + arguments).joined(separator: " "))") - let process = Process() - let stdoutPipe = Pipe() - nonisolated(unsafe) var stdoutData = Data() + let process = Process() + let stdoutPipe = Pipe() + nonisolated(unsafe) var stdoutData = Data() - process.executableURL = nodePath - process.arguments = arguments - process.standardOutput = stdoutPipe + process.executableURL = nodePath + process.arguments = arguments + process.standardOutput = stdoutPipe - stdoutPipe.fileHandleForReading.readabilityHandler = { handle in - let data = handle.availableData - if data.count > 0 { - stdoutData.append(data) - } - } - try process.forwardTerminationSignals { - try process.run() - process.waitUntilExit() + stdoutPipe.fileHandleForReading.readabilityHandler = { handle in + let data = handle.availableData + if data.count > 0 { + stdoutData.append(data) } + } + try process.forwardTerminationSignals { + try process.run() + process.waitUntilExit() + } - if process.terminationStatus != 0 { - throw BridgeJSCoreError("ts2skeleton returned \(process.terminationStatus)") - } - let skeleton = try JSONDecoder().decode(ImportedFileSkeleton.self, from: stdoutData) - self.addSkeleton(skeleton) + if process.terminationStatus != 0 { + throw BridgeJSCoreError("ts2swift returned \(process.terminationStatus)") } + return String(decoding: stdoutData, as: UTF8.self) } extension Foundation.Process { diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift new file mode 100644 index 00000000..5997d305 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSClassMacroTests.swift @@ -0,0 +1,289 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSClassMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func emptyStruct() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithExistingJSObject() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + let jsObject: JSObject + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithExistingInit() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithBothExisting() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithMembers() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + var name: String + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + var name: String + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func _class() { + assertMacroExpansion( + """ + @JSClass + class MyClass { + } + """, + expandedSource: """ + class MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func _enum() { + assertMacroExpansion( + """ + @JSClass + enum MyEnum { + } + """, + expandedSource: """ + enum MyEnum { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func _actor() { + assertMacroExpansion( + """ + @JSClass + actor MyActor { + } + """, + expandedSource: """ + actor MyActor { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithDifferentJSObjectName() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + var otherProperty: String + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + var otherProperty: String + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithDifferentInit() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + init(name: String) { + } + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + init(name: String) { + } + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithMultipleMembers() { + assertMacroExpansion( + """ + @JSClass + struct MyClass { + var name: String + var age: Int + } + """, + expandedSource: """ + struct MyClass { + let jsObject: JSObject + + var name: String + var age: Int + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func structWithComment() { + assertMacroExpansion( + """ + /// Documentation comment + @JSClass + struct MyClass { + } + """, + expandedSource: """ + /// Documentation comment + struct MyClass { + let jsObject: JSObject + + init(unsafelyWrapping jsObject: JSObject) { + self.jsObject = jsObject + } + } + """, + macros: ["JSClass": JSClassMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift new file mode 100644 index 00000000..8cfdd66e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSFunctionMacroTests.swift @@ -0,0 +1,377 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSFunctionMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func topLevelFunction() { + assertMacroExpansion( + """ + @JSFunction + func greet(name: String) -> String + """, + expandedSource: """ + func greet(name: String) -> String { + return _$greet(name) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionVoidReturn() { + assertMacroExpansion( + """ + @JSFunction + func log(message: String) + """, + expandedSource: """ + func log(message: String) { + _$log(message) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithExplicitVoidReturn() { + assertMacroExpansion( + """ + @JSFunction + func log(message: String) -> Void + """, + expandedSource: """ + func log(message: String) -> Void { + _$log(message) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithEmptyTupleReturn() { + assertMacroExpansion( + """ + @JSFunction + func log(message: String) -> () + """, + expandedSource: """ + func log(message: String) -> () { + _$log(message) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionThrows() { + assertMacroExpansion( + """ + @JSFunction + func parse(json: String) throws -> [String: Any] + """, + expandedSource: """ + func parse(json: String) throws -> [String: Any] { + return try _$parse(json) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionAsync() { + assertMacroExpansion( + """ + @JSFunction + func fetch(url: String) async -> String + """, + expandedSource: """ + func fetch(url: String) async -> String { + return await _$fetch(url) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionAsyncThrows() { + assertMacroExpansion( + """ + @JSFunction + func fetch(url: String) async throws -> String + """, + expandedSource: """ + func fetch(url: String) async throws -> String { + return try await _$fetch(url) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithUnderscoreParameter() { + assertMacroExpansion( + """ + @JSFunction + func process(_ value: Int) -> Int + """, + expandedSource: """ + func process(_ value: Int) -> Int { + return _$process(value) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelFunctionWithMultipleParameters() { + assertMacroExpansion( + """ + @JSFunction + func add(a: Int, b: Int) -> Int + """, + expandedSource: """ + func add(a: Int, b: Int) -> Int { + return _$add(a, b) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceMethod() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + func getName() -> String + } + """, + expandedSource: """ + struct MyClass { + func getName() -> String { + return _$MyClass_getName(self.jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func staticMethod() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + static func create() -> MyClass + } + """, + expandedSource: """ + struct MyClass { + static func create() -> MyClass { + return _$create() + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func classMethod() { + assertMacroExpansion( + """ + class MyClass { + @JSFunction + class func create() -> MyClass + } + """, + expandedSource: """ + class MyClass { + class func create() -> MyClass { + return _$create() + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializer() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + init(name: String) + } + """, + expandedSource: """ + struct MyClass { + init(name: String) { + let jsObject = _$MyClass_init(name) + self.init(unsafelyWrapping: jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializerThrows() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + init(name: String) throws + } + """, + expandedSource: """ + struct MyClass { + init(name: String) throws { + let jsObject = try _$MyClass_init(name) + self.init(unsafelyWrapping: jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializerAsyncThrows() { + assertMacroExpansion( + """ + struct MyClass { + @JSFunction + init(name: String) async throws + } + """, + expandedSource: """ + struct MyClass { + init(name: String) async throws { + let jsObject = try await _$MyClass_init(name) + self.init(unsafelyWrapping: jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func initializerWithoutEnclosingType() { + assertMacroExpansion( + """ + @JSFunction + init() + """, + expandedSource: """ + init() + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSFunction can only be applied to functions or initializers.", + line: 1, + column: 1 + ) + ], + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func unsupportedDeclaration() { + assertMacroExpansion( + """ + @JSFunction + var property: String + """, + expandedSource: """ + var property: String + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSFunction can only be applied to functions or initializers.", + line: 1, + column: 1 + ) + ], + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func enumInstanceMethod() { + assertMacroExpansion( + """ + enum MyEnum { + @JSFunction + func getValue() -> Int + } + """, + expandedSource: """ + enum MyEnum { + func getValue() -> Int { + return _$MyEnum_getValue(self.jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func actorInstanceMethod() { + assertMacroExpansion( + """ + actor MyActor { + @JSFunction + func getValue() -> Int + } + """, + expandedSource: """ + actor MyActor { + func getValue() -> Int { + return _$MyActor_getValue(self.jsObject) + } + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func functionWithExistingBody() { + assertMacroExpansion( + """ + @JSFunction + func greet(name: String) -> String { + return "Hello, \\(name)" + } + """, + expandedSource: """ + func greet(name: String) -> String { + return _$greet(name) + } + """, + macros: ["JSFunction": JSFunctionMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift new file mode 100644 index 00000000..8c7f3c11 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSGetterMacroTests.swift @@ -0,0 +1,299 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSGetterMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func topLevelVariable() { + assertMacroExpansion( + """ + @JSGetter + var count: Int + """, + expandedSource: """ + var count: Int { + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelLet() { + assertMacroExpansion( + """ + @JSGetter + let constant: String + """, + expandedSource: """ + let constant: String { + get throws(JSException) { + return try _$constant_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceProperty() { + assertMacroExpansion( + """ + struct MyClass { + @JSGetter + var name: String + } + """, + expandedSource: """ + struct MyClass { + var name: String { + get throws(JSException) { + return try _$MyClass_name_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceLetProperty() { + assertMacroExpansion( + """ + struct MyClass { + @JSGetter + let id: Int + } + """, + expandedSource: """ + struct MyClass { + let id: Int { + get throws(JSException) { + return try _$MyClass_id_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func staticProperty() { + assertMacroExpansion( + """ + struct MyClass { + @JSGetter + static var version: String + } + """, + expandedSource: """ + struct MyClass { + static var version: String { + get throws(JSException) { + return try _$version_get() + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func classProperty() { + assertMacroExpansion( + """ + class MyClass { + @JSGetter + class var version: String + } + """, + expandedSource: """ + class MyClass { + class var version: String { + get throws(JSException) { + return try _$version_get() + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func enumProperty() { + assertMacroExpansion( + """ + enum MyEnum { + @JSGetter + var value: Int + } + """, + expandedSource: """ + enum MyEnum { + var value: Int { + get throws(JSException) { + return try _$MyEnum_value_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func actorProperty() { + assertMacroExpansion( + """ + actor MyActor { + @JSGetter + var state: String + } + """, + expandedSource: """ + actor MyActor { + var state: String { + get throws(JSException) { + return try _$MyActor_state_get(self.jsObject) + } + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithExistingAccessor() { + assertMacroExpansion( + """ + @JSGetter + var count: Int { + return 0 + } + """, + expandedSource: """ + var count: Int { + get { + return 0 + } + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithInitializer() { + assertMacroExpansion( + """ + @JSGetter + var count: Int = 0 + """, + expandedSource: """ + var count: Int { + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func multipleBindings() { + assertMacroExpansion( + """ + @JSGetter + var x: Int, y: Int + """, + expandedSource: """ + var x: Int, y: Int + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSGetter can only be applied to single-variable declarations.", + line: 1, + column: 1, + severity: .error + ) + ], + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func unsupportedDeclaration() { + assertMacroExpansion( + """ + @JSGetter + func test() {} + """, + expandedSource: """ + func test() {} + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSGetter can only be applied to single-variable declarations.", + line: 1, + column: 1, + severity: .error + ) + ], + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithTrailingComment() { + assertMacroExpansion( + """ + @JSGetter + var count: Int // comment + """, + expandedSource: """ + var count: Int { // comment + get throws(JSException) { + return try _$count_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func variableWithUnderscoreName() { + assertMacroExpansion( + """ + @JSGetter + var _internal: String + """, + expandedSource: """ + var _internal: String { + get throws(JSException) { + return try _$internal_get() + } + } + """, + macros: ["JSGetter": JSGetterMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift new file mode 100644 index 00000000..83289e09 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSMacrosTests/JSSetterMacroTests.swift @@ -0,0 +1,278 @@ +import SwiftDiagnostics +import SwiftSyntax +import SwiftSyntaxMacros +import SwiftSyntaxMacrosTestSupport +import Testing +import BridgeJSMacros + +@Suite struct JSSetterMacroTests { + private let indentationWidth: Trivia = .spaces(4) + + @Test func topLevelSetter() { + assertMacroExpansion( + """ + @JSSetter + func setFoo(_ value: Foo) throws(JSException) + """, + expandedSource: """ + func setFoo(_ value: Foo) throws(JSException) { + try _$foo_set(value) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func topLevelSetterWithNamedParameter() { + assertMacroExpansion( + """ + @JSSetter + func setCount(count: Int) throws(JSException) + """, + expandedSource: """ + func setCount(count: Int) throws(JSException) { + try _$count_set(count) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func instanceSetter() { + assertMacroExpansion( + """ + struct MyClass { + @JSSetter + func setName(_ name: String) throws(JSException) + } + """, + expandedSource: """ + struct MyClass { + func setName(_ name: String) throws(JSException) { + try _$MyClass_name_set(self.jsObject, name) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func staticSetter() { + assertMacroExpansion( + """ + struct MyClass { + @JSSetter + static func setVersion(_ version: String) throws(JSException) + } + """, + expandedSource: """ + struct MyClass { + static func setVersion(_ version: String) throws(JSException) { + try _$version_set(version) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func classSetter() { + assertMacroExpansion( + """ + class MyClass { + @JSSetter + class func setConfig(_ config: Config) throws(JSException) + } + """, + expandedSource: """ + class MyClass { + class func setConfig(_ config: Config) throws(JSException) { + try _$config_set(config) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func enumSetter() { + assertMacroExpansion( + """ + enum MyEnum { + @JSSetter + func setValue(_ value: Int) throws(JSException) + } + """, + expandedSource: """ + enum MyEnum { + func setValue(_ value: Int) throws(JSException) { + try _$MyEnum_value_set(self.jsObject, value) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func actorSetter() { + assertMacroExpansion( + """ + actor MyActor { + @JSSetter + func setState(_ state: String) throws(JSException) + } + """, + expandedSource: """ + actor MyActor { + func setState(_ state: String) throws(JSException) { + try _$MyActor_state_set(self.jsObject, state) + } + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithExistingBody() { + assertMacroExpansion( + """ + @JSSetter + func setFoo(_ value: Foo) throws(JSException) { + print("Setting foo") + } + """, + expandedSource: """ + func setFoo(_ value: Foo) throws(JSException) { + try _$foo_set(value) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func invalidSetterName() { + assertMacroExpansion( + """ + @JSSetter + func updateFoo(_ value: Foo) throws(JSException) + """, + expandedSource: """ + func updateFoo(_ value: Foo) throws(JSException) + """, + diagnostics: [ + DiagnosticSpec( + message: + "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo').", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterNameTooShort() { + assertMacroExpansion( + """ + @JSSetter + func set(_ value: Foo) throws(JSException) + """, + expandedSource: """ + func set(_ value: Foo) throws(JSException) + """, + diagnostics: [ + DiagnosticSpec( + message: + "@JSSetter function name must start with 'set' followed by a property name (e.g., 'setFoo').", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithoutParameter() { + assertMacroExpansion( + """ + @JSSetter + func setFoo() throws(JSException) + """, + expandedSource: """ + func setFoo() throws(JSException) + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSSetter function must have at least one parameter.", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func unsupportedDeclaration() { + assertMacroExpansion( + """ + @JSSetter + var property: String + """, + expandedSource: """ + var property: String + """, + diagnostics: [ + DiagnosticSpec( + message: "@JSSetter can only be applied to functions.", + line: 1, + column: 1 + ) + ], + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithMultipleWords() { + assertMacroExpansion( + """ + @JSSetter + func setConnectionTimeout(_ timeout: Int) throws(JSException) + """, + expandedSource: """ + func setConnectionTimeout(_ timeout: Int) throws(JSException) { + try _$connectionTimeout_set(timeout) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } + + @Test func setterWithSingleLetterProperty() { + assertMacroExpansion( + """ + @JSSetter + func setX(_ x: Int) throws(JSException) + """, + expandedSource: """ + func setX(_ x: Int) throws(JSException) { + try _$x_set(x) + } + """, + macros: ["JSSetter": JSSetterMacro.self], + indentationWidth: indentationWidth + ) + } +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift index c81a224f..657c24d7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/BridgeJSLinkTests.swift @@ -4,7 +4,8 @@ import SwiftParser import Testing @testable import BridgeJSLink @testable import BridgeJSCore -@testable import TS2Skeleton +@testable import TS2Swift +@testable import BridgeJSSkeleton @Suite struct BridgeJSLinkTests { private func snapshot( @@ -59,19 +60,39 @@ import Testing @Test(arguments: collectInputs(extension: ".d.ts")) func snapshotImport(input: String) throws { let url = Self.inputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().deletingPathExtension().lastPathComponent let tsconfigPath = url.deletingLastPathComponent().appendingPathComponent("tsconfig.json") - var importTS = ImportTS(progress: .silent, moduleName: "TestModule") let nodePath = try #require(which("node")) - try importTS.addSourceFile(url.path, tsconfigPath: tsconfigPath.path, nodePath: nodePath) - let name = url.deletingPathExtension().deletingPathExtension().lastPathComponent + let swiftSource = try invokeTS2Swift( + dtsFile: url.path, + tsconfigPath: tsconfigPath.path, + nodePath: nodePath, + progress: .silent + ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.prettyPrinted, .sortedKeys] - let outputSkeletonData = try encoder.encode(importTS.skeleton) + let sourceFile = Parser.parse(source: swiftSource) + let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "TestModule") + importSwift.addSourceFile(sourceFile, "\(name).Macros.swift") + let importResult = try importSwift.finalize() + + var importTS = ImportTS(progress: .silent, moduleName: "TestModule") + for child in importResult.outputSkeleton.children { + importTS.addSkeleton(child) + } + let importSkeleton = importTS.skeleton var bridgeJSLink = BridgeJSLink(sharedMemory: false) - try bridgeJSLink.addImportedSkeletonFile(data: outputSkeletonData) + // Create unified skeleton for test + let unifiedSkeleton = BridgeJSSkeleton( + moduleName: "TestModule", + exported: nil, + imported: importSkeleton + ) + let encoder = JSONEncoder() + encoder.outputFormatting = [.prettyPrinted, .sortedKeys] + let unifiedData = try encoder.encode(unifiedSkeleton) + try bridgeJSLink.addSkeletonFile(data: unifiedData) try snapshot(bridgeJSLink: bridgeJSLink, name: name + ".Import") } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift index ef642ed3..f56fbfb6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/ImportTSTests.swift @@ -1,7 +1,8 @@ import Testing import Foundation +import SwiftParser @testable import BridgeJSCore -@testable import TS2Skeleton +@testable import TS2Swift @Suite struct ImportTSTests { static let inputsDirectory = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent( @@ -16,13 +17,37 @@ import Foundation @Test(arguments: collectInputs()) func snapshot(input: String) throws { - var api = ImportTS(progress: .silent, moduleName: "Check") let url = Self.inputsDirectory.appendingPathComponent(input) + let name = url.deletingPathExtension().deletingPathExtension().deletingPathExtension().lastPathComponent let nodePath = try #require(which("node")) let tsconfigPath = url.deletingLastPathComponent().appendingPathComponent("tsconfig.json") - try api.addSourceFile(url.path, tsconfigPath: tsconfigPath.path, nodePath: nodePath) + + // Use the new workflow: invokeTS2Swift -> ImportSwiftMacros -> ImportTS + let swiftSource = try invokeTS2Swift( + dtsFile: url.path, + tsconfigPath: tsconfigPath.path, + nodePath: nodePath, + progress: .silent + ) + try assertSnapshot( + name: name + ".Macros", + filePath: #filePath, + function: #function, + input: swiftSource.data(using: .utf8)!, + fileExtension: "swift" + ) + + let sourceFile = Parser.parse(source: swiftSource) + let importSwift = ImportSwiftMacros(progress: .silent, moduleName: "Check") + importSwift.addSourceFile(sourceFile, "\(name).Macros.swift") + let importResult = try importSwift.finalize() + + var api = ImportTS(progress: .silent, moduleName: "Check") + for child in importResult.outputSkeleton.children { + api.addSkeleton(child) + } + let outputSwift = try #require(try api.finalize()) - let name = url.deletingPathExtension().deletingPathExtension().deletingPathExtension().lastPathComponent try assertSnapshot( name: name, filePath: #filePath, diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift index 958d4d64..f82b3dfe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/WhichTests.swift @@ -1,6 +1,6 @@ import Testing import Foundation -@testable import TS2Skeleton +@testable import TS2Swift @testable import BridgeJSCore @Suite struct WhichTests { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts index 2b0474bb..e6cd9d96 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.d.ts @@ -6,13 +6,14 @@ export interface ArrayBufferLike { slice(begin: number, end: number): ArrayBufferLike; - readonly byteLength: number; + byteLength: number; } export interface WeirdNaming { as(): void; normalProperty: string; for: string; Any: string; + any: string; } export type Exports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js index a71c8dd7..3a3f0789 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js @@ -219,6 +219,13 @@ export async function createInstantiator(options, swift) { return 0 } } + TestModule["bjs_ArrayBufferLike_byteLength_set"] = function bjs_ArrayBufferLike_byteLength_set(self, newValue) { + try { + swift.memory.getObject(self).byteLength = newValue; + } catch (error) { + setException(error); + } + } TestModule["bjs_ArrayBufferLike_slice"] = function bjs_ArrayBufferLike_slice(self, begin, end) { try { let ret = swift.memory.getObject(self).slice(begin, end); @@ -237,6 +244,24 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_WeirdNaming_for_get"] = function bjs_WeirdNaming_for_get(self) { + try { + let ret = swift.memory.getObject(self).for; + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } + TestModule["bjs_WeirdNaming_Any_get"] = function bjs_WeirdNaming_Any_get(self) { + try { + let ret = swift.memory.getObject(self).Any; + tmpRetBytes = textEncoder.encode(ret); + return tmpRetBytes.length; + } catch (error) { + setException(error); + } + } TestModule["bjs_WeirdNaming_normalProperty_set"] = function bjs_WeirdNaming_normalProperty_set(self, newValue) { try { const newValueObject = swift.memory.getObject(newValue); @@ -246,11 +271,11 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_WeirdNaming_for_get"] = function bjs_WeirdNaming_for_get(self) { + TestModule["bjs_WeirdNaming_normalProperty_set"] = function bjs_WeirdNaming_normalProperty_set(self, newValue) { try { - let ret = swift.memory.getObject(self).for; - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).normalProperty = newValueObject; } catch (error) { setException(error); } @@ -264,11 +289,11 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_WeirdNaming_Any_get"] = function bjs_WeirdNaming_Any_get(self) { + TestModule["bjs_WeirdNaming_for_set"] = function bjs_WeirdNaming_for_set(self, newValue) { try { - let ret = swift.memory.getObject(self).Any; - tmpRetBytes = textEncoder.encode(ret); - return tmpRetBytes.length; + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).for = newValueObject; } catch (error) { setException(error); } @@ -282,6 +307,15 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_WeirdNaming_any_set"] = function bjs_WeirdNaming_any_set(self, newValue) { + try { + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).any = newValueObject; + } catch (error) { + setException(error); + } + } TestModule["bjs_WeirdNaming_as"] = function bjs_WeirdNaming_as(self) { try { swift.memory.getObject(self).as(); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts index 83fe3c14..c27295c2 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.d.ts @@ -7,18 +7,18 @@ export interface DatabaseConnection { connect(url: string): void; execute(query: string): any; - readonly isConnected: boolean; + isConnected: boolean; connectionTimeout: number; } export interface Logger { log(message: string): void; error(message: string, error: any): void; - readonly level: string; + level: string; } export interface ConfigManager { get(key: string): any; set(key: string, value: any): void; - readonly configPath: string; + configPath: string; } export type Exports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js index 86edf39a..d3d65a17 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/MultipleImportedTypes.Import.js @@ -239,12 +239,25 @@ export async function createInstantiator(options, swift) { return 0 } } + TestModule["bjs_DatabaseConnection_isConnected_set"] = function bjs_DatabaseConnection_isConnected_set(self, newValue) { + try { + swift.memory.getObject(self).isConnected = newValue !== 0; + } catch (error) { + setException(error); + } + } + TestModule["bjs_DatabaseConnection_connectionTimeout_set"] = function bjs_DatabaseConnection_connectionTimeout_set(self, newValue) { + try { + swift.memory.getObject(self).connectionTimeout = newValue; + } catch (error) { + setException(error); + } + } TestModule["bjs_DatabaseConnection_connectionTimeout_set"] = function bjs_DatabaseConnection_connectionTimeout_set(self, newValue) { try { swift.memory.getObject(self).connectionTimeout = newValue; } catch (error) { setException(error); - return 0 } } TestModule["bjs_DatabaseConnection_connect"] = function bjs_DatabaseConnection_connect(self, url) { @@ -276,6 +289,15 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_Logger_level_set"] = function bjs_Logger_level_set(self, newValue) { + try { + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).level = newValueObject; + } catch (error) { + setException(error); + } + } TestModule["bjs_Logger_log"] = function bjs_Logger_log(self, message) { try { const messageObject = swift.memory.getObject(message); @@ -303,6 +325,15 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_ConfigManager_configPath_set"] = function bjs_ConfigManager_configPath_set(self, newValue) { + try { + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).configPath = newValueObject; + } catch (error) { + setException(error); + } + } TestModule["bjs_ConfigManager_get"] = function bjs_ConfigManager_get(self, key) { try { const keyObject = swift.memory.getObject(key); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts index 26d56fb6..a42addfe 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.d.ts @@ -7,11 +7,11 @@ export interface TypeScriptProcessor { convert(ts: string): string; validate(ts: string): boolean; - readonly version: string; + version: string; } export interface CodeGenerator { generate(input: any): string; - readonly outputFormat: string; + outputFormat: string; } export type Exports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js index 2bbae4fe..30b4d25e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TS2SkeletonLike.Import.js @@ -221,6 +221,15 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_TypeScriptProcessor_version_set"] = function bjs_TypeScriptProcessor_version_set(self, newValue) { + try { + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).version = newValueObject; + } catch (error) { + setException(error); + } + } TestModule["bjs_TypeScriptProcessor_convert"] = function bjs_TypeScriptProcessor_convert(self, ts) { try { const tsObject = swift.memory.getObject(ts); @@ -252,6 +261,15 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_CodeGenerator_outputFormat_set"] = function bjs_CodeGenerator_outputFormat_set(self, newValue) { + try { + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).outputFormat = newValueObject; + } catch (error) { + setException(error); + } + } TestModule["bjs_CodeGenerator_generate"] = function bjs_CodeGenerator_generate(self, input) { try { let ret = swift.memory.getObject(self).generate(swift.memory.getObject(input)); diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.d.ts b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.d.ts index 24d3d8fa..d7a7b69a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.d.ts +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.d.ts @@ -8,7 +8,7 @@ export interface Greeter { greet(): string; changeName(name: string): void; name: string; - readonly age: number; + age: number; } export type Exports = { } diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js index 0e204182..23c5ecd4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/TypeScriptClass.Import.js @@ -211,6 +211,15 @@ export async function createInstantiator(options, swift) { setException(error); } } + TestModule["bjs_Greeter_age_get"] = function bjs_Greeter_age_get(self) { + try { + let ret = swift.memory.getObject(self).age; + return ret; + } catch (error) { + setException(error); + return 0 + } + } TestModule["bjs_Greeter_name_set"] = function bjs_Greeter_name_set(self, newValue) { try { const newValueObject = swift.memory.getObject(newValue); @@ -220,13 +229,20 @@ export async function createInstantiator(options, swift) { setException(error); } } - TestModule["bjs_Greeter_age_get"] = function bjs_Greeter_age_get(self) { + TestModule["bjs_Greeter_name_set"] = function bjs_Greeter_name_set(self, newValue) { try { - let ret = swift.memory.getObject(self).age; - return ret; + const newValueObject = swift.memory.getObject(newValue); + swift.memory.release(newValue); + swift.memory.getObject(self).name = newValueObject; + } catch (error) { + setException(error); + } + } + TestModule["bjs_Greeter_age_set"] = function bjs_Greeter_age_set(self, newValue) { + try { + swift.memory.getObject(self).age = newValue; } catch (error) { setException(error); - return 0 } } TestModule["bjs_Greeter_greet"] = function bjs_Greeter_greet(self) { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift index 08e38435..6856c42f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Async.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift index eef86b6d..fac668d4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.ReverseOrder.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift index 72952036..5dd18137 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileFunctionTypes.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift index 7504b289..8af2ec8e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.ReverseOrder.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift index 04130f74..bbf2c768 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/CrossFileTypeResolution.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift index f624dc33..0f7b7716 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/DefaultParameters.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift index 1a1bc9ba..231c5825 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumAssociatedValue.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift index a513a22a..30e19e7f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumCase.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift index 66f8e22a..439bdae4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.Global.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift index 66f8e22a..439bdae4 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumNamespace.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift index 5d88fce4..4a0b0e37 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/EnumRawType.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift index 3e38fee4..41bdb750 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedGlobal.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift index 76a1a6c2..4747e8ec 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/MixedPrivate.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift index 19fe8ea9..09e4da97 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.Global.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift index 19fe8ea9..09e4da97 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Namespaces.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift index f2f19f9a..1f76a77a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Optionals.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift index 4f906704..dcd3d1fd 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveParameters.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift index 63e5f03c..6c91ec7e 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PrimitiveReturn.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift index 96bde51e..07c4334a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/PropertyTypes.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift index 318b908b..e39a9933 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Protocol.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift index 8ea228dc..ee21d2ea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.Global.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift index 8ea228dc..ee21d2ea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticFunctions.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift index 91577ebf..5f77f774 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.Global.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift index 91577ebf..5f77f774 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StaticProperties.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift index 6e32c00d..23c1d963 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringParameter.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift index 0475def5..18b25423 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/StringReturn.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift index 65279210..34479012 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClass.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift index 2e57a8a5..4235b174 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftClosure.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift index f35fc3b0..3033beb1 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/SwiftStruct.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift index 8b865b7d..f8a6ee99 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/Throws.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift index 15e91a0b..a0e40470 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ExportSwiftTests/VoidParameterVoidReturn.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift new file mode 100644 index 00000000..e5b2742a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.Macros.swift @@ -0,0 +1,13 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void + +@JSFunction func checkArrayWithLength(_ a: JSObject, _ b: Double) throws (JSException) -> Void + +@JSFunction func checkArray(_ a: JSObject) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift index 56425b20..07535681 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/ArrayParameter.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_checkArray(_ a: Int32) -> Void { } #endif -func checkArray(_ a: JSObject) throws(JSException) -> Void { +func _$checkArray(_ a: JSObject) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkArray(aValue) if let error = _swift_js_take_exception() { @@ -32,7 +33,7 @@ fileprivate func bjs_checkArrayWithLength(_ a: Int32, _ b: Float64) -> Void { } #endif -func checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { +func _$checkArrayWithLength(_ a: JSObject, _ b: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() let bValue = b.bridgeJSLowerParameter() bjs_checkArrayWithLength(aValue, bValue) @@ -50,7 +51,7 @@ fileprivate func bjs_checkArray(_ a: Int32) -> Void { } #endif -func checkArray(_ a: JSObject) throws(JSException) -> Void { +func _$checkArray(_ a: JSObject) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkArray(aValue) if let error = _swift_js_take_exception() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift new file mode 100644 index 00000000..1f16ba9f --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.Macros.swift @@ -0,0 +1,21 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func asyncReturnVoid() throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripInt(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripString(_ v: String) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripBool(_ v: Bool) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripFloat(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripDouble(_ v: Double) throws (JSException) -> JSPromise + +@JSFunction func asyncRoundTripJSObject(_ v: JSObject) throws (JSException) -> JSPromise diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift index 41a89ad2..1201ea8f 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Async.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_asyncReturnVoid() -> Int32 { } #endif -func asyncReturnVoid() throws(JSException) -> JSPromise { +func _$asyncReturnVoid() throws(JSException) -> JSPromise { let ret = bjs_asyncReturnVoid() if let error = _swift_js_take_exception() { throw error @@ -32,7 +33,7 @@ fileprivate func bjs_asyncRoundTripInt(_ v: Float64) -> Int32 { } #endif -func asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { +func _$asyncRoundTripInt(_ v: Double) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripInt(vValue) if let error = _swift_js_take_exception() { @@ -50,7 +51,7 @@ fileprivate func bjs_asyncRoundTripString(_ v: Int32) -> Int32 { } #endif -func asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { +func _$asyncRoundTripString(_ v: String) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripString(vValue) if let error = _swift_js_take_exception() { @@ -68,7 +69,7 @@ fileprivate func bjs_asyncRoundTripBool(_ v: Int32) -> Int32 { } #endif -func asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { +func _$asyncRoundTripBool(_ v: Bool) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripBool(vValue) if let error = _swift_js_take_exception() { @@ -86,7 +87,7 @@ fileprivate func bjs_asyncRoundTripFloat(_ v: Float64) -> Int32 { } #endif -func asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { +func _$asyncRoundTripFloat(_ v: Double) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripFloat(vValue) if let error = _swift_js_take_exception() { @@ -104,7 +105,7 @@ fileprivate func bjs_asyncRoundTripDouble(_ v: Float64) -> Int32 { } #endif -func asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { +func _$asyncRoundTripDouble(_ v: Double) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripDouble(vValue) if let error = _swift_js_take_exception() { @@ -122,7 +123,7 @@ fileprivate func bjs_asyncRoundTripJSObject(_ v: Int32) -> Int32 { } #endif -func asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise { +func _$asyncRoundTripJSObject(_ v: JSObject) throws(JSException) -> JSPromise { let vValue = v.bridgeJSLowerParameter() let ret = bjs_asyncRoundTripJSObject(vValue) if let error = _swift_js_take_exception() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift new file mode 100644 index 00000000..435d5011 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.Macros.swift @@ -0,0 +1,14 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func returnAnimatable() throws (JSException) -> Animatable + +@JSClass struct Animatable: _JSBridgedClass { + @JSFunction func animate(_ keyframes: JSObject, _ options: JSObject) throws (JSException) -> JSObject + @JSFunction func getAnimations(_ options: JSObject) throws (JSException) -> JSObject +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift index 12277171..2b33434c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/Interface.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_returnAnimatable() -> Int32 { } #endif -func returnAnimatable() throws(JSException) -> Animatable { +func _$returnAnimatable() throws(JSException) -> Animatable { let ret = bjs_returnAnimatable() if let error = _swift_js_take_exception() { throw error @@ -41,32 +42,23 @@ fileprivate func bjs_Animatable_getAnimations(_ self: Int32, _ options: Int32) - } #endif -struct Animatable: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - func animate(_ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let keyframesValue = keyframes.bridgeJSLowerParameter() - let optionsValue = options.bridgeJSLowerParameter() - let ret = bjs_Animatable_animate(selfValue, keyframesValue, optionsValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$Animatable_animate(_ self: JSObject, _ keyframes: JSObject, _ options: JSObject) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let keyframesValue = keyframes.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_animate(selfValue, keyframesValue, optionsValue) + if let error = _swift_js_take_exception() { + throw error } + return JSObject.bridgeJSLiftReturn(ret) +} - func getAnimations(_ options: JSObject) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let optionsValue = options.bridgeJSLowerParameter() - let ret = bjs_Animatable_getAnimations(selfValue, optionsValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$Animatable_getAnimations(_ self: JSObject, _ options: JSObject) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let optionsValue = options.bridgeJSLowerParameter() + let ret = bjs_Animatable_getAnimations(selfValue, optionsValue) + if let error = _swift_js_take_exception() { + throw error } - + return JSObject.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift new file mode 100644 index 00000000..25cef35a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.Macros.swift @@ -0,0 +1,26 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func createArrayBuffer() throws (JSException) -> ArrayBufferLike + +@JSClass struct ArrayBufferLike: _JSBridgedClass { + @JSGetter var byteLength: Double + @JSFunction func slice(_ begin: Double, _ end: Double) throws (JSException) -> ArrayBufferLike +} + +@JSFunction func createWeirdObject() throws (JSException) -> WeirdNaming + +@JSClass struct WeirdNaming: _JSBridgedClass { + @JSGetter var normalProperty: String + @JSSetter func setNormalProperty(_ value: String) throws (JSException) + @JSGetter var `for`: String + @JSSetter func setFor(_ value: String) throws (JSException) + @JSGetter var `Any`: String + @JSSetter func setAny(_ value: String) throws (JSException) + @JSFunction func `as`() throws (JSException) -> Void +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift index c7868299..9947b3c7 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/InvalidPropertyNames.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_createArrayBuffer() -> Int32 { } #endif -func createArrayBuffer() throws(JSException) -> ArrayBufferLike { +func _$createArrayBuffer() throws(JSException) -> ArrayBufferLike { let ret = bjs_createArrayBuffer() if let error = _swift_js_take_exception() { throw error @@ -32,7 +33,7 @@ fileprivate func bjs_createWeirdObject() -> Int32 { } #endif -func createWeirdObject() throws(JSException) -> WeirdNaming { +func _$createWeirdObject() throws(JSException) -> WeirdNaming { let ret = bjs_createWeirdObject() if let error = _swift_js_take_exception() { throw error @@ -49,6 +50,15 @@ fileprivate func bjs_ArrayBufferLike_byteLength_get(_ self: Int32) -> Float64 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_byteLength_set") +fileprivate func bjs_ArrayBufferLike_byteLength_set(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_ArrayBufferLike_byteLength_set(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ArrayBufferLike_slice") fileprivate func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ end: Float64) -> Int32 @@ -58,35 +68,33 @@ fileprivate func bjs_ArrayBufferLike_slice(_ self: Int32, _ begin: Float64, _ en } #endif -struct ArrayBufferLike: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$ArrayBufferLike_byteLength_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_ArrayBufferLike_byteLength_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Double.bridgeJSLiftReturn(ret) +} - var byteLength: Double { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_ArrayBufferLike_byteLength_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) - } +func _$ArrayBufferLike_byteLength_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_ArrayBufferLike_byteLength_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func slice(_ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike { - let selfValue = self.bridgeJSLowerParameter() - let beginValue = begin.bridgeJSLowerParameter() - let endValue = end.bridgeJSLowerParameter() - let ret = bjs_ArrayBufferLike_slice(selfValue, beginValue, endValue) - if let error = _swift_js_take_exception() { - throw error - } - return ArrayBufferLike.bridgeJSLiftReturn(ret) +func _$ArrayBufferLike_slice(_ self: JSObject, _ begin: Double, _ end: Double) throws(JSException) -> ArrayBufferLike { + let selfValue = self.bridgeJSLowerParameter() + let beginValue = begin.bridgeJSLowerParameter() + let endValue = end.bridgeJSLowerParameter() + let ret = bjs_ArrayBufferLike_slice(selfValue, beginValue, endValue) + if let error = _swift_js_take_exception() { + throw error } - + return ArrayBufferLike.bridgeJSLiftReturn(ret) } #if arch(wasm32) @@ -98,6 +106,24 @@ fileprivate func bjs_WeirdNaming_normalProperty_get(_ self: Int32) -> Int32 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") +fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") +fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void @@ -108,10 +134,10 @@ fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: I #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_get") -fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_normalProperty_set") +fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_for_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_normalProperty_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -126,10 +152,10 @@ fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Vo #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_Any_get") -fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_for_set") +fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_WeirdNaming_Any_get(_ self: Int32) -> Int32 { +fileprivate func bjs_WeirdNaming_for_set(_ self: Int32, _ newValue: Int32) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -143,6 +169,15 @@ fileprivate func bjs_WeirdNaming_Any_set(_ self: Int32, _ newValue: Int32) -> Vo } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_WeirdNaming_any_set") +fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_WeirdNaming_any_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_WeirdNaming_as") fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void @@ -152,79 +187,91 @@ fileprivate func bjs_WeirdNaming_as(_ self: Int32) -> Void { } #endif -struct WeirdNaming: _JSBridgedClass { - let jsObject: JSObject +func _$WeirdNaming_normalProperty_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_normalProperty_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$WeirdNaming_for_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_for_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - var normalProperty: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeirdNaming_normalProperty_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$WeirdNaming_Any_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_WeirdNaming_Any_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func setNormalProperty(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeirdNaming_normalProperty_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_normalProperty_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_normalProperty_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - var `for`: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeirdNaming_for_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$WeirdNaming_normalProperty_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_normalProperty_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func setFor(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeirdNaming_for_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_for_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_for_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - var `Any`: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_WeirdNaming_Any_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$WeirdNaming_for_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_for_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func setAny(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_WeirdNaming_Any_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_Any_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_Any_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func `as`() throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - bjs_WeirdNaming_as(selfValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$WeirdNaming_any_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_WeirdNaming_any_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} +func _$WeirdNaming_as(_ self: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + bjs_WeirdNaming_as(selfValue) + if let error = _swift_js_take_exception() { + throw error + } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift new file mode 100644 index 00000000..0d5635c3 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.Macros.swift @@ -0,0 +1,33 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func createDatabaseConnection(_ config: JSObject) throws (JSException) -> DatabaseConnection + +@JSClass struct DatabaseConnection: _JSBridgedClass { + @JSFunction func connect(_ url: String) throws (JSException) -> Void + @JSFunction func execute(_ query: String) throws (JSException) -> JSObject + @JSGetter var isConnected: Bool + @JSGetter var connectionTimeout: Double + @JSSetter func setConnectionTimeout(_ value: Double) throws (JSException) +} + +@JSFunction func createLogger(_ level: String) throws (JSException) -> Logger + +@JSClass struct Logger: _JSBridgedClass { + @JSFunction func log(_ message: String) throws (JSException) -> Void + @JSFunction func error(_ message: String, _ error: JSObject) throws (JSException) -> Void + @JSGetter var level: String +} + +@JSFunction func getConfigManager() throws (JSException) -> ConfigManager + +@JSClass struct ConfigManager: _JSBridgedClass { + @JSFunction func get(_ key: String) throws (JSException) -> JSObject + @JSFunction func set(_ key: String, _ value: JSObject) throws (JSException) -> Void + @JSGetter var configPath: String +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift index 1f8a1480..4a92923b 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/MultipleImportedTypes.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_createDatabaseConnection(_ config: Int32) -> Int32 { } #endif -func createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection { +func _$createDatabaseConnection(_ config: JSObject) throws(JSException) -> DatabaseConnection { let configValue = config.bridgeJSLowerParameter() let ret = bjs_createDatabaseConnection(configValue) if let error = _swift_js_take_exception() { @@ -33,7 +34,7 @@ fileprivate func bjs_createLogger(_ level: Int32) -> Int32 { } #endif -func createLogger(_ level: String) throws(JSException) -> Logger { +func _$createLogger(_ level: String) throws(JSException) -> Logger { let levelValue = level.bridgeJSLowerParameter() let ret = bjs_createLogger(levelValue) if let error = _swift_js_take_exception() { @@ -51,7 +52,7 @@ fileprivate func bjs_getConfigManager() -> Int32 { } #endif -func getConfigManager() throws(JSException) -> ConfigManager { +func _$getConfigManager() throws(JSException) -> ConfigManager { let ret = bjs_getConfigManager() if let error = _swift_js_take_exception() { throw error @@ -77,6 +78,24 @@ fileprivate func bjs_DatabaseConnection_connectionTimeout_get(_ self: Int32) -> } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_isConnected_set") +fileprivate func bjs_DatabaseConnection_isConnected_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_DatabaseConnection_isConnected_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_set") +fileprivate func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_DatabaseConnection_connectionTimeout_set") fileprivate func bjs_DatabaseConnection_connectionTimeout_set(_ self: Int32, _ newValue: Float64) -> Void @@ -104,63 +123,68 @@ fileprivate func bjs_DatabaseConnection_execute(_ self: Int32, _ query: Int32) - } #endif -struct DatabaseConnection: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$DatabaseConnection_isConnected_get(_ self: JSObject) throws(JSException) -> Bool { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_isConnected_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Bool.bridgeJSLiftReturn(ret) +} - var isConnected: Bool { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_isConnected_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) - } +func _$DatabaseConnection_connectionTimeout_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_connectionTimeout_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Double.bridgeJSLiftReturn(ret) +} - var connectionTimeout: Double { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_connectionTimeout_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) - } +func _$DatabaseConnection_isConnected_set(_ self: JSObject, _ newValue: Bool) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_DatabaseConnection_isConnected_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func setConnectionTimeout(_ newValue: Double) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_DatabaseConnection_connectionTimeout_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$DatabaseConnection_connectionTimeout_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_DatabaseConnection_connectionTimeout_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func connect(_ url: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let urlValue = url.bridgeJSLowerParameter() - bjs_DatabaseConnection_connect(selfValue, urlValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$DatabaseConnection_connectionTimeout_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_DatabaseConnection_connectionTimeout_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func execute(_ query: String) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let queryValue = query.bridgeJSLowerParameter() - let ret = bjs_DatabaseConnection_execute(selfValue, queryValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$DatabaseConnection_connect(_ self: JSObject, _ url: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let urlValue = url.bridgeJSLowerParameter() + bjs_DatabaseConnection_connect(selfValue, urlValue) + if let error = _swift_js_take_exception() { + throw error } +} +func _$DatabaseConnection_execute(_ self: JSObject, _ query: String) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let queryValue = query.bridgeJSLowerParameter() + let ret = bjs_DatabaseConnection_execute(selfValue, queryValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) } #if arch(wasm32) @@ -172,6 +196,15 @@ fileprivate func bjs_Logger_level_get(_ self: Int32) -> Int32 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Logger_level_set") +fileprivate func bjs_Logger_level_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_Logger_level_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Logger_log") fileprivate func bjs_Logger_log(_ self: Int32, _ message: Int32) -> Void @@ -190,43 +223,41 @@ fileprivate func bjs_Logger_error(_ self: Int32, _ message: Int32, _ error: Int3 } #endif -struct Logger: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$Logger_level_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Logger_level_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - var level: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Logger_level_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$Logger_level_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Logger_level_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func log(_ message: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let messageValue = message.bridgeJSLowerParameter() - bjs_Logger_log(selfValue, messageValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Logger_log(_ self: JSObject, _ message: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + bjs_Logger_log(selfValue, messageValue) + if let error = _swift_js_take_exception() { + throw error } +} - func error(_ message: String, _ error: JSObject) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let messageValue = message.bridgeJSLowerParameter() - let errorValue = error.bridgeJSLowerParameter() - bjs_Logger_error(selfValue, messageValue, errorValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Logger_error(_ self: JSObject, _ message: String, _ error: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let messageValue = message.bridgeJSLowerParameter() + let errorValue = error.bridgeJSLowerParameter() + bjs_Logger_error(selfValue, messageValue, errorValue) + if let error = _swift_js_take_exception() { + throw error } - } #if arch(wasm32) @@ -238,6 +269,15 @@ fileprivate func bjs_ConfigManager_configPath_get(_ self: Int32) -> Int32 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_ConfigManager_configPath_set") +fileprivate func bjs_ConfigManager_configPath_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_ConfigManager_configPath_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_ConfigManager_get") fileprivate func bjs_ConfigManager_get(_ self: Int32, _ key: Int32) -> Int32 @@ -256,42 +296,40 @@ fileprivate func bjs_ConfigManager_set(_ self: Int32, _ key: Int32, _ value: Int } #endif -struct ConfigManager: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$ConfigManager_configPath_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_ConfigManager_configPath_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - var configPath: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_ConfigManager_configPath_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$ConfigManager_configPath_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_ConfigManager_configPath_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func get(_ key: String) throws(JSException) -> JSObject { - let selfValue = self.bridgeJSLowerParameter() - let keyValue = key.bridgeJSLowerParameter() - let ret = bjs_ConfigManager_get(selfValue, keyValue) - if let error = _swift_js_take_exception() { - throw error - } - return JSObject.bridgeJSLiftReturn(ret) +func _$ConfigManager_get(_ self: JSObject, _ key: String) throws(JSException) -> JSObject { + let selfValue = self.bridgeJSLowerParameter() + let keyValue = key.bridgeJSLowerParameter() + let ret = bjs_ConfigManager_get(selfValue, keyValue) + if let error = _swift_js_take_exception() { + throw error } + return JSObject.bridgeJSLiftReturn(ret) +} - func set(_ key: String, _ value: JSObject) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let keyValue = key.bridgeJSLowerParameter() - let valueValue = value.bridgeJSLowerParameter() - bjs_ConfigManager_set(selfValue, keyValue, valueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$ConfigManager_set(_ self: JSObject, _ key: String, _ value: JSObject) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let keyValue = key.bridgeJSLowerParameter() + let valueValue = value.bridgeJSLowerParameter() + bjs_ConfigManager_set(selfValue, keyValue, valueValue) + if let error = _swift_js_take_exception() { + throw error } - } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift new file mode 100644 index 00000000..6ede7fab --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.Macros.swift @@ -0,0 +1,9 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func check(_ a: Double, _ b: Bool) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift index 90088799..a988cee6 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveParameters.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_check(_ a: Float64, _ b: Int32) -> Void { } #endif -func check(_ a: Double, _ b: Bool) throws(JSException) -> Void { +func _$check(_ a: Double, _ b: Bool) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() let bValue = b.bridgeJSLowerParameter() bjs_check(aValue, bValue) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift new file mode 100644 index 00000000..198c44c9 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.Macros.swift @@ -0,0 +1,11 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func checkNumber() throws (JSException) -> Double + +@JSFunction func checkBoolean() throws (JSException) -> Bool diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift index 6424329b..b5347650 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/PrimitiveReturn.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_checkNumber() -> Float64 { } #endif -func checkNumber() throws(JSException) -> Double { +func _$checkNumber() throws(JSException) -> Double { let ret = bjs_checkNumber() if let error = _swift_js_take_exception() { throw error @@ -32,7 +33,7 @@ fileprivate func bjs_checkBoolean() -> Int32 { } #endif -func checkBoolean() throws(JSException) -> Bool { +func _$checkBoolean() throws(JSException) -> Bool { let ret = bjs_checkBoolean() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift new file mode 100644 index 00000000..46643d1e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.Macros.swift @@ -0,0 +1,11 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func checkString(_ a: String) throws (JSException) -> Void + +@JSFunction func checkStringWithLength(_ a: String, _ b: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift index 35502a7c..c69adebc 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringParameter.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_checkString(_ a: Int32) -> Void { } #endif -func checkString(_ a: String) throws(JSException) -> Void { +func _$checkString(_ a: String) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkString(aValue) if let error = _swift_js_take_exception() { @@ -32,7 +33,7 @@ fileprivate func bjs_checkStringWithLength(_ a: Int32, _ b: Float64) -> Void { } #endif -func checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void { +func _$checkStringWithLength(_ a: String, _ b: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() let bValue = b.bridgeJSLowerParameter() bjs_checkStringWithLength(aValue, bValue) diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift new file mode 100644 index 00000000..0d2b146c --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.Macros.swift @@ -0,0 +1,9 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func checkString() throws (JSException) -> String diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift index 638eedb0..1741864a 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/StringReturn.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_checkString() -> Int32 { } #endif -func checkString() throws(JSException) -> String { +func _$checkString() throws(JSException) -> String { let ret = bjs_checkString() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift new file mode 100644 index 00000000..7149a24a --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.Macros.swift @@ -0,0 +1,22 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func createTS2Skeleton() throws (JSException) -> TypeScriptProcessor + +@JSClass struct TypeScriptProcessor: _JSBridgedClass { + @JSFunction func convert(_ ts: String) throws (JSException) -> String + @JSFunction func validate(_ ts: String) throws (JSException) -> Bool + @JSGetter var version: String +} + +@JSFunction func createCodeGenerator(_ format: String) throws (JSException) -> CodeGenerator + +@JSClass struct CodeGenerator: _JSBridgedClass { + @JSFunction func generate(_ input: JSObject) throws (JSException) -> String + @JSGetter var outputFormat: String +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift index 26d37a90..08901617 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TS2SkeletonLike.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_createTS2Skeleton() -> Int32 { } #endif -func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { +func _$createTS2Skeleton() throws(JSException) -> TypeScriptProcessor { let ret = bjs_createTS2Skeleton() if let error = _swift_js_take_exception() { throw error @@ -32,7 +33,7 @@ fileprivate func bjs_createCodeGenerator(_ format: Int32) -> Int32 { } #endif -func createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator { +func _$createCodeGenerator(_ format: String) throws(JSException) -> CodeGenerator { let formatValue = format.bridgeJSLowerParameter() let ret = bjs_createCodeGenerator(formatValue) if let error = _swift_js_take_exception() { @@ -50,6 +51,15 @@ fileprivate func bjs_TypeScriptProcessor_version_get(_ self: Int32) -> Int32 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_version_set") +fileprivate func bjs_TypeScriptProcessor_version_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_TypeScriptProcessor_version_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_TypeScriptProcessor_convert") fileprivate func bjs_TypeScriptProcessor_convert(_ self: Int32, _ ts: Int32) -> Int32 @@ -68,44 +78,42 @@ fileprivate func bjs_TypeScriptProcessor_validate(_ self: Int32, _ ts: Int32) -> } #endif -struct TypeScriptProcessor: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$TypeScriptProcessor_version_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_version_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - var version: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_version_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$TypeScriptProcessor_version_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_TypeScriptProcessor_version_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func convert(_ ts: String) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_convert(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) +func _$TypeScriptProcessor_convert(_ self: JSObject, _ ts: String) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_convert(selfValue, tsValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - func validate(_ ts: String) throws(JSException) -> Bool { - let selfValue = self.bridgeJSLowerParameter() - let tsValue = ts.bridgeJSLowerParameter() - let ret = bjs_TypeScriptProcessor_validate(selfValue, tsValue) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) +func _$TypeScriptProcessor_validate(_ self: JSObject, _ ts: String) throws(JSException) -> Bool { + let selfValue = self.bridgeJSLowerParameter() + let tsValue = ts.bridgeJSLowerParameter() + let ret = bjs_TypeScriptProcessor_validate(selfValue, tsValue) + if let error = _swift_js_take_exception() { + throw error } - + return Bool.bridgeJSLiftReturn(ret) } #if arch(wasm32) @@ -117,6 +125,15 @@ fileprivate func bjs_CodeGenerator_outputFormat_get(_ self: Int32) -> Int32 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_CodeGenerator_outputFormat_set") +fileprivate func bjs_CodeGenerator_outputFormat_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_CodeGenerator_outputFormat_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_CodeGenerator_generate") fileprivate func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> Int32 @@ -126,32 +143,30 @@ fileprivate func bjs_CodeGenerator_generate(_ self: Int32, _ input: Int32) -> In } #endif -struct CodeGenerator: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$CodeGenerator_outputFormat_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_CodeGenerator_outputFormat_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - var outputFormat: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_CodeGenerator_outputFormat_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$CodeGenerator_outputFormat_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_CodeGenerator_outputFormat_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func generate(_ input: JSObject) throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let inputValue = input.bridgeJSLowerParameter() - let ret = bjs_CodeGenerator_generate(selfValue, inputValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) +func _$CodeGenerator_generate(_ self: JSObject, _ input: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let inputValue = input.bridgeJSLowerParameter() + let ret = bjs_CodeGenerator_generate(selfValue, inputValue) + if let error = _swift_js_take_exception() { + throw error } - + return String.bridgeJSLiftReturn(ret) } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift new file mode 100644 index 00000000..5724d9d4 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.Macros.swift @@ -0,0 +1,9 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func checkSimple(_ a: Double) throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift index afd99723..5b43649c 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeAlias.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_checkSimple(_ a: Float64) -> Void { } #endif -func checkSimple(_ a: Double) throws(JSException) -> Void { +func _$checkSimple(_ a: Double) throws(JSException) -> Void { let aValue = a.bridgeJSLowerParameter() bjs_checkSimple(aValue) if let error = _swift_js_take_exception() { diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift new file mode 100644 index 00000000..9f33c11e --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.Macros.swift @@ -0,0 +1,16 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSClass struct Greeter: _JSBridgedClass { + @JSGetter var name: String + @JSSetter func setName(_ value: String) throws (JSException) + @JSGetter var age: Double + @JSFunction init(_ name: String) throws (JSException) + @JSFunction func greet() throws (JSException) -> String + @JSFunction func changeName(_ name: String) throws (JSException) -> Void +} diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift index 6d1bdca3..13c4b064 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/TypeScriptClass.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -24,6 +25,15 @@ fileprivate func bjs_Greeter_name_get(_ self: Int32) -> Int32 { } #endif +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") +fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 +#else +fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + #if arch(wasm32) @_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void @@ -34,10 +44,19 @@ fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void #endif #if arch(wasm32) -@_extern(wasm, module: "Check", name: "bjs_Greeter_age_get") -fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 +@_extern(wasm, module: "Check", name: "bjs_Greeter_name_set") +fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void #else -fileprivate func bjs_Greeter_age_get(_ self: Int32) -> Float64 { +fileprivate func bjs_Greeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "Check", name: "bjs_Greeter_age_set") +fileprivate func bjs_Greeter_age_set(_ self: Int32, _ newValue: Float64) -> Void +#else +fileprivate func bjs_Greeter_age_set(_ self: Int32, _ newValue: Float64) -> Void { fatalError("Only available on WebAssembly") } #endif @@ -60,69 +79,74 @@ fileprivate func bjs_Greeter_changeName(_ self: Int32, _ name: Int32) -> Void { } #endif -struct Greeter: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject +func _$Greeter_init(_ name: String) throws(JSException) -> JSObject { + let nameValue = name.bridgeJSLowerParameter() + let ret = bjs_Greeter_init(nameValue) + if let error = _swift_js_take_exception() { + throw error } + return JSObject.bridgeJSLiftReturn(ret) +} - init(_ name: String) throws(JSException) { - let nameValue = name.bridgeJSLowerParameter() - let ret = bjs_Greeter_init(nameValue) - if let error = _swift_js_take_exception() { - throw error - } - self.jsObject = JSObject(id: UInt32(bitPattern: ret)) +func _$Greeter_name_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_name_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} - var name: String { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Greeter_name_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } +func _$Greeter_age_get(_ self: JSObject) throws(JSException) -> Double { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_age_get(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return Double.bridgeJSLiftReturn(ret) +} - func setName(_ newValue: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let newValueValue = newValue.bridgeJSLowerParameter() - bjs_Greeter_name_set(selfValue, newValueValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Greeter_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Greeter_name_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - var age: Double { - get throws(JSException) { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Greeter_age_get(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) - } +func _$Greeter_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Greeter_name_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func greet() throws(JSException) -> String { - let selfValue = self.bridgeJSLowerParameter() - let ret = bjs_Greeter_greet(selfValue) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) +func _$Greeter_age_set(_ self: JSObject, _ newValue: Double) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_Greeter_age_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error } +} - func changeName(_ name: String) throws(JSException) -> Void { - let selfValue = self.bridgeJSLowerParameter() - let nameValue = name.bridgeJSLowerParameter() - bjs_Greeter_changeName(selfValue, nameValue) - if let error = _swift_js_take_exception() { - throw error - } +func _$Greeter_greet(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_Greeter_greet(selfValue) + if let error = _swift_js_take_exception() { + throw error } + return String.bridgeJSLiftReturn(ret) +} +func _$Greeter_changeName(_ self: JSObject, _ name: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let nameValue = name.bridgeJSLowerParameter() + bjs_Greeter_changeName(selfValue, nameValue) + if let error = _swift_js_take_exception() { + throw error + } } \ No newline at end of file diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift new file mode 100644 index 00000000..1fe58af3 --- /dev/null +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.Macros.swift @@ -0,0 +1,9 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func check() throws (JSException) -> Void diff --git a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift index 51167847..fcbccaea 100644 --- a/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift +++ b/Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/ImportTSTests/VoidParameterVoidReturn.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -15,7 +16,7 @@ fileprivate func bjs_check() -> Void { } #endif -func check() throws(JSException) -> Void { +func _$check() throws(JSException) -> Void { bjs_check() if let error = _swift_js_take_exception() { throw error diff --git a/Plugins/PackageToJS/Sources/PackageToJS.swift b/Plugins/PackageToJS/Sources/PackageToJS.swift index ec984043..ea99f0b0 100644 --- a/Plugins/PackageToJS/Sources/PackageToJS.swift +++ b/Plugins/PackageToJS/Sources/PackageToJS.swift @@ -602,19 +602,21 @@ struct PackagingPlanner { let bridgeDts = outputDir.appending(path: "bridge-js.d.ts") packageInputs.append( make.addTask(inputFiles: exportedSkeletons + importedSkeletons, output: bridgeJs) { _, scope in - let link = try BridgeJSLink( - exportedSkeletons: exportedSkeletons.map { - let decoder = JSONDecoder() - let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: $0).path)) - return try decoder.decode(ExportedSkeleton.self, from: data) - }, - importedSkeletons: importedSkeletons.map { - let decoder = JSONDecoder() - let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: $0).path)) - return try decoder.decode(ImportedModuleSkeleton.self, from: data) - }, + var link = BridgeJSLink( + exportedSkeletons: [], + importedSkeletons: [], sharedMemory: Self.isSharedMemoryEnabled(triple: triple) ) + + // Decode unified skeleton format + // Unified skeleton files can contain both exported and imported parts + // Deduplicate file paths since we may have the same file in both lists + let allSkeletonPaths = Set(exportedSkeletons + importedSkeletons) + for skeletonPath in allSkeletonPaths { + let data = try Data(contentsOf: URL(fileURLWithPath: scope.resolve(path: skeletonPath).path)) + try link.addSkeletonFile(data: data) + } + let (outputJs, outputDts) = try link.link() try system.writeFile(atPath: scope.resolve(path: bridgeJs).path, content: Data(outputJs.utf8)) try system.writeFile(atPath: scope.resolve(path: bridgeDts).path, content: Data(outputDts.utf8)) diff --git a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift index 709dc8f3..32271f24 100644 --- a/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift +++ b/Plugins/PackageToJS/Sources/PackageToJSPlugin.swift @@ -166,7 +166,7 @@ struct PackageToJSPlugin: CommandPlugin { } } - static let JAVASCRIPTKIT_PRODUCT_ID: Product.ID = "JavaScriptKit" + static let JAVASCRIPTEVENTLOOP_PRODUCT_ID: Product.ID = "JavaScriptEventLoop" func performBuildCommand(context: PluginContext, arguments: [String]) throws { if arguments.contains(where: { ["-h", "--help"].contains($0) }) { @@ -396,7 +396,11 @@ struct PackageToJSPlugin: CommandPlugin { guard let selfPackage = findPackageInDependencies( package: package, - including: Self.JAVASCRIPTKIT_PRODUCT_ID + // NOTE: We use JavaScriptEventLoop product to find the JavaScriptKit package + // instead of JavaScriptKit product because SwiftPM in 6.0 does not returns + // product information for JavaScriptKit product for some reason (very likely + // a bug in SwiftPM). + including: Self.JAVASCRIPTEVENTLOOP_PRODUCT_ID ) else { throw PackageToJSError("Failed to find JavaScriptKit in dependencies!?") @@ -702,10 +706,8 @@ class SkeletonCollector { private var visitedProducts: Set = [] private var visitedTargets: Set = [] - var exportedSkeletons: [URL] = [] - var importedSkeletons: [URL] = [] - let exportedSkeletonFile = "BridgeJS.ExportSwift.json" - let importedSkeletonFile = "BridgeJS.ImportTS.json" + var skeletons: [URL] = [] + let skeletonFile = "BridgeJS.json" let context: PluginContext init(context: PluginContext) { @@ -717,7 +719,9 @@ class SkeletonCollector { return ([], []) } visit(product: product, package: context.package) - return (exportedSkeletons, importedSkeletons) + // Unified skeleton files contain both exported and imported parts + // Return the same list for both since BridgeJSLink.addSkeletonFile handles the unified format + return (skeletons, skeletons) } func collectFromTests() -> (exportedSkeletons: [URL], importedSkeletons: [URL]) { @@ -728,7 +732,9 @@ class SkeletonCollector { for test in tests { visit(target: test, package: context.package) } - return (exportedSkeletons, importedSkeletons) + // Unified skeleton files contain both exported and imported parts + // Return the same list for both since BridgeJSLink.addSkeletonFile handles the unified format + return (skeletons, skeletons) } private func visit(product: Product, package: Package) { @@ -742,6 +748,11 @@ class SkeletonCollector { private func visit(target: Target, package: Package) { if visitedTargets.contains(target.id) { return } visitedTargets.insert(target.id) + if let sourceModuleTarget = target as? SourceModuleTarget { + if sourceModuleTarget.kind == .macro { + return + } + } if let target = target as? SwiftSourceModuleTarget { let directories = [ target.directoryURL.appending(path: "Generated/JavaScript"), @@ -751,13 +762,9 @@ class SkeletonCollector { .appending(path: "outputs/\(package.id)/\(target.name)/destination/BridgeJS"), ] for directory in directories { - let exportedSkeletonURL = directory.appending(path: exportedSkeletonFile) - let importedSkeletonURL = directory.appending(path: importedSkeletonFile) - if FileManager.default.fileExists(atPath: exportedSkeletonURL.path) { - exportedSkeletons.append(exportedSkeletonURL) - } - if FileManager.default.fileExists(atPath: importedSkeletonURL.path) { - importedSkeletons.append(importedSkeletonURL) + let skeletonURL = directory.appending(path: skeletonFile) + if FileManager.default.fileExists(atPath: skeletonURL.path) { + skeletons.append(skeletonURL) } } } diff --git a/Sources/BridgeJSMacros b/Sources/BridgeJSMacros new file mode 120000 index 00000000..2d3d8a4a --- /dev/null +++ b/Sources/BridgeJSMacros @@ -0,0 +1 @@ +../Plugins/BridgeJS/Sources/BridgeJSMacros \ No newline at end of file diff --git a/Sources/BridgeJSTool/TS2Skeleton b/Sources/BridgeJSTool/TS2Skeleton deleted file mode 120000 index c41c1280..00000000 --- a/Sources/BridgeJSTool/TS2Skeleton +++ /dev/null @@ -1 +0,0 @@ -../../Plugins/BridgeJS/Sources/TS2Skeleton \ No newline at end of file diff --git a/Sources/BridgeJSTool/TS2Swift b/Sources/BridgeJSTool/TS2Swift new file mode 120000 index 00000000..6d9b4332 --- /dev/null +++ b/Sources/BridgeJSTool/TS2Swift @@ -0,0 +1 @@ +../../Plugins/BridgeJS/Sources/TS2Swift \ No newline at end of file diff --git a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md index e3f52885..ee6ac304 100644 --- a/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md +++ b/Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Ahead-of-Time-Code-Generation.md @@ -111,9 +111,8 @@ This command will: For example, with a target named "MyApp", it will create: ``` -Sources/MyApp/Generated/ExportSwift.swift # Generated code for Swift exports -Sources/MyApp/Generated/ImportTS.swift # Generated code for TypeScript imports -Sources/MyApp/Generated/JavaScript/ # Generated JSON skeletons +Sources/MyApp/Generated/BridgeJS.swift # Generated code for both exports and imports +Sources/MyApp/Generated/JavaScript/BridgeJS.json # Unified skeleton JSON ``` ### Step 6: Add Generated Files to Version Control diff --git a/Sources/JavaScriptKit/Macros.swift b/Sources/JavaScriptKit/Macros.swift index b8a44a08..9cf5e0c3 100644 --- a/Sources/JavaScriptKit/Macros.swift +++ b/Sources/JavaScriptKit/Macros.swift @@ -107,3 +107,19 @@ public enum JSEnumStyle: String { /// - Important: This feature is still experimental. No API stability is guaranteed, and the API may change in future releases. @attached(peer) public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Builtin.ExternalMacro + +@attached(accessor) +public macro JSGetter(from: String? = nil, jsName: String? = nil) = + #externalMacro(module: "BridgeJSMacros", type: "JSGetterMacro") + +@attached(body) +public macro JSSetter(from: String? = nil, jsName: String? = nil) = + #externalMacro(module: "BridgeJSMacros", type: "JSSetterMacro") + +@attached(body) +public macro JSFunction(from: String? = nil, jsName: String? = nil) = + #externalMacro(module: "BridgeJSMacros", type: "JSFunctionMacro") + +@attached(member, names: arbitrary) +public macro JSClass(from: String? = nil, jsName: String? = nil) = + #externalMacro(module: "BridgeJSMacros", type: "JSClassMacro") diff --git a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift similarity index 99% rename from Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift rename to Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift index 09cd79ec..aaa5f1b8 100644 --- a/Tests/BridgeJSGlobalTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSGlobalTests/Generated/BridgeJS.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index 955b78f6..00000000 --- a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,540 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_TestHTTPServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_TestHTTPServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "GlobalNetworking", - "API" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "GlobalNetworking.API.CallMethod" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "TestHTTPServer", - "namespace" : [ - "GlobalNetworking", - "API" - ], - "properties" : [ - - ], - "swiftCallName" : "GlobalNetworking.API.TestHTTPServer" - }, - { - "constructor" : { - "abiName" : "bjs_TestInternalServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_TestInternalServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "GlobalNetworking", - "APIV2", - "Internal" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Internal.SupportedServerMethod" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "TestInternalServer", - "namespace" : [ - "GlobalNetworking", - "APIV2", - "Internal" - ], - "properties" : [ - - ], - "swiftCallName" : "Internal.TestInternalServer" - }, - { - "constructor" : { - "abiName" : "bjs_PublicConverter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_PublicConverter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "namespace" : [ - "GlobalUtils" - ], - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "PublicConverter", - "namespace" : [ - "GlobalUtils" - ], - "properties" : [ - - ], - "swiftCallName" : "GlobalUtils.PublicConverter" - } - ], - "enums" : [ - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalNetworking", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalNetworking", - "tsFullPath" : "GlobalNetworking" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "API", - "namespace" : [ - "GlobalNetworking" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalNetworking.API", - "tsFullPath" : "GlobalNetworking.API" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - }, - { - "associatedValues" : [ - - ], - "name" : "put" - }, - { - "associatedValues" : [ - - ], - "name" : "delete" - } - ], - "emitStyle" : "const", - "name" : "CallMethod", - "namespace" : [ - "GlobalNetworking", - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalNetworking.API.CallMethod", - "tsFullPath" : "GlobalNetworking.API.CallMethod" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalConfiguration", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalConfiguration", - "tsFullPath" : "GlobalConfiguration" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "debug", - "rawValue" : "debug" - }, - { - "associatedValues" : [ - - ], - "name" : "info", - "rawValue" : "info" - }, - { - "associatedValues" : [ - - ], - "name" : "warning", - "rawValue" : "warning" - }, - { - "associatedValues" : [ - - ], - "name" : "error", - "rawValue" : "error" - } - ], - "emitStyle" : "const", - "name" : "PublicLogLevel", - "namespace" : [ - "GlobalConfiguration" - ], - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalConfiguration.PublicLogLevel", - "tsFullPath" : "GlobalConfiguration.PublicLogLevel" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "http", - "rawValue" : "80" - }, - { - "associatedValues" : [ - - ], - "name" : "https", - "rawValue" : "443" - }, - { - "associatedValues" : [ - - ], - "name" : "development", - "rawValue" : "3000" - } - ], - "emitStyle" : "const", - "name" : "AvailablePort", - "namespace" : [ - "GlobalConfiguration" - ], - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalConfiguration.AvailablePort", - "tsFullPath" : "GlobalConfiguration.AvailablePort" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Internal", - "namespace" : [ - "GlobalNetworking", - "APIV2" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal", - "tsFullPath" : "GlobalNetworking.APIV2.Internal" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - } - ], - "emitStyle" : "const", - "name" : "SupportedServerMethod", - "namespace" : [ - "GlobalNetworking", - "APIV2", - "Internal" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal.SupportedServerMethod", - "tsFullPath" : "GlobalNetworking.APIV2.Internal.SupportedServerMethod" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalStaticPropertyNamespace", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "namespaceProperty", - "namespace" : [ - "GlobalStaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "namespaceConstant", - "namespace" : [ - "GlobalStaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "GlobalStaticPropertyNamespace", - "tsFullPath" : "GlobalStaticPropertyNamespace" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "NestedProperties", - "namespace" : [ - "GlobalStaticPropertyNamespace" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedProperty", - "namespace" : [ - "GlobalStaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "nestedConstant", - "namespace" : [ - "GlobalStaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedDouble", - "namespace" : [ - "GlobalStaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "GlobalStaticPropertyNamespace.NestedProperties", - "tsFullPath" : "GlobalStaticPropertyNamespace.NestedProperties" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "GlobalUtils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "GlobalUtils", - "tsFullPath" : "GlobalUtils" - } - ], - "exposeToGlobal" : true, - "functions" : [ - - ], - "moduleName" : "BridgeJSGlobalTests", - "protocols" : [ - - ], - "structs" : [ - - ] -} \ No newline at end of file diff --git a/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json new file mode 100644 index 00000000..10757d8e --- /dev/null +++ b/Tests/BridgeJSGlobalTests/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,556 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_TestHTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestHTTPServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "GlobalNetworking.API.CallMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestHTTPServer", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API.TestHTTPServer" + }, + { + "constructor" : { + "abiName" : "bjs_TestInternalServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestInternalServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Internal.SupportedServerMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestInternalServer", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "properties" : [ + + ], + "swiftCallName" : "Internal.TestInternalServer" + }, + { + "constructor" : { + "abiName" : "bjs_PublicConverter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_PublicConverter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "GlobalUtils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PublicConverter", + "namespace" : [ + "GlobalUtils" + ], + "properties" : [ + + ], + "swiftCallName" : "GlobalUtils.PublicConverter" + } + ], + "enums" : [ + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalNetworking", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking", + "tsFullPath" : "GlobalNetworking" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "API", + "namespace" : [ + "GlobalNetworking" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API", + "tsFullPath" : "GlobalNetworking.API" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + }, + { + "associatedValues" : [ + + ], + "name" : "put" + }, + { + "associatedValues" : [ + + ], + "name" : "delete" + } + ], + "emitStyle" : "const", + "name" : "CallMethod", + "namespace" : [ + "GlobalNetworking", + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalNetworking.API.CallMethod", + "tsFullPath" : "GlobalNetworking.API.CallMethod" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalConfiguration", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration", + "tsFullPath" : "GlobalConfiguration" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "debug", + "rawValue" : "debug" + }, + { + "associatedValues" : [ + + ], + "name" : "info", + "rawValue" : "info" + }, + { + "associatedValues" : [ + + ], + "name" : "warning", + "rawValue" : "warning" + }, + { + "associatedValues" : [ + + ], + "name" : "error", + "rawValue" : "error" + } + ], + "emitStyle" : "const", + "name" : "PublicLogLevel", + "namespace" : [ + "GlobalConfiguration" + ], + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration.PublicLogLevel", + "tsFullPath" : "GlobalConfiguration.PublicLogLevel" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "http", + "rawValue" : "80" + }, + { + "associatedValues" : [ + + ], + "name" : "https", + "rawValue" : "443" + }, + { + "associatedValues" : [ + + ], + "name" : "development", + "rawValue" : "3000" + } + ], + "emitStyle" : "const", + "name" : "AvailablePort", + "namespace" : [ + "GlobalConfiguration" + ], + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalConfiguration.AvailablePort", + "tsFullPath" : "GlobalConfiguration.AvailablePort" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Internal", + "namespace" : [ + "GlobalNetworking", + "APIV2" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal", + "tsFullPath" : "GlobalNetworking.APIV2.Internal" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + } + ], + "emitStyle" : "const", + "name" : "SupportedServerMethod", + "namespace" : [ + "GlobalNetworking", + "APIV2", + "Internal" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal.SupportedServerMethod", + "tsFullPath" : "GlobalNetworking.APIV2.Internal.SupportedServerMethod" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalStaticPropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "GlobalStaticPropertyNamespace", + "tsFullPath" : "GlobalStaticPropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "NestedProperties", + "namespace" : [ + "GlobalStaticPropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "GlobalStaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "GlobalStaticPropertyNamespace.NestedProperties", + "tsFullPath" : "GlobalStaticPropertyNamespace.NestedProperties" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "GlobalUtils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "GlobalUtils", + "tsFullPath" : "GlobalUtils" + } + ], + "exposeToGlobal" : true, + "functions" : [ + + ], + "moduleName" : "BridgeJSGlobalTests", + "protocols" : [ + + ], + "structs" : [ + + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + + ] + } + ], + "moduleName" : "BridgeJSGlobalTests" + }, + "moduleName" : "BridgeJSGlobalTests" +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift deleted file mode 100644 index e75febb8..00000000 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ImportTS.swift +++ /dev/null @@ -1,271 +0,0 @@ -// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, -// DO NOT EDIT. -// -// To update this file, just rebuild your project or run -// `swift package bridge-js`. - -@_spi(BridgeJS) import JavaScriptKit - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") -fileprivate func bjs_jsRoundTripVoid() -> Void -#else -fileprivate func bjs_jsRoundTripVoid() -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func jsRoundTripVoid() throws(JSException) -> Void { - bjs_jsRoundTripVoid() - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") -fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 -#else -fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { - let ret = bjs_jsRoundTripNumber(v.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") -fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 -#else -fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { - let ret = bjs_jsRoundTripBool(v.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") -fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 -#else -fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsRoundTripString(_ v: String) throws(JSException) -> String { - let ret = bjs_jsRoundTripString(v.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") -fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void -#else -fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { - bjs_jsThrowOrVoid(shouldThrow.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") -fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 -#else -fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { - let ret = bjs_jsThrowOrNumber(shouldThrow.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return Double.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") -fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 -#else -fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { - let ret = bjs_jsThrowOrBool(shouldThrow.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return Bool.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") -fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 -#else -fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { - let ret = bjs_jsThrowOrString(shouldThrow.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") -fileprivate func bjs_runAsyncWorks() -> Int32 -#else -fileprivate func bjs_runAsyncWorks() -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -func runAsyncWorks() throws(JSException) -> JSPromise { - let ret = bjs_runAsyncWorks() - if let error = _swift_js_take_exception() { - throw error - } - return JSPromise.bridgeJSLiftReturn(ret) -} - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") -fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") -fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") -fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void -#else -fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") -fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 -#else -fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { - fatalError("Only available on WebAssembly") -} -#endif - -#if arch(wasm32) -@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") -fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void -#else -fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { - fatalError("Only available on WebAssembly") -} -#endif - -struct JsGreeter: _JSBridgedClass { - let jsObject: JSObject - - init(unsafelyWrapping jsObject: JSObject) { - self.jsObject = jsObject - } - - init(_ name: String, _ prefix: String) throws(JSException) { - let ret = bjs_JsGreeter_init(name.bridgeJSLowerParameter(), prefix.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - self.jsObject = JSObject(id: UInt32(bitPattern: ret)) - } - - var name: String { - get throws(JSException) { - let ret = bjs_JsGreeter_name_get(self.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - } - - func setName(_ newValue: String) throws(JSException) -> Void { - bjs_JsGreeter_name_set(self.bridgeJSLowerParameter(), newValue.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - } - - var prefix: String { - get throws(JSException) { - let ret = bjs_JsGreeter_prefix_get(self.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - } - - func greet() throws(JSException) -> String { - let ret = bjs_JsGreeter_greet(self.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - return String.bridgeJSLiftReturn(ret) - } - - func changeName(_ name: String) throws(JSException) -> Void { - bjs_JsGreeter_changeName(self.bridgeJSLowerParameter(), name.bridgeJSLowerParameter()) - if let error = _swift_js_take_exception() { - throw error - } - } - -} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift new file mode 100644 index 00000000..1f06bd2a --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift @@ -0,0 +1,34 @@ +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +import JavaScriptKit + +@JSFunction func jsRoundTripVoid() throws (JSException) -> Void + +@JSFunction func jsRoundTripNumber(_ v: Double) throws (JSException) -> Double + +@JSFunction func jsRoundTripBool(_ v: Bool) throws (JSException) -> Bool + +@JSFunction func jsRoundTripString(_ v: String) throws (JSException) -> String + +@JSFunction func jsThrowOrVoid(_ shouldThrow: Bool) throws (JSException) -> Void + +@JSFunction func jsThrowOrNumber(_ shouldThrow: Bool) throws (JSException) -> Double + +@JSFunction func jsThrowOrBool(_ shouldThrow: Bool) throws (JSException) -> Bool + +@JSFunction func jsThrowOrString(_ shouldThrow: Bool) throws (JSException) -> String + +@JSClass struct JsGreeter: _JSBridgedClass { + @JSGetter var name: String + @JSSetter func setName(_ value: String) throws (JSException) + @JSGetter var `prefix`: String + @JSFunction init(_ name: String, _ `prefix`: String) throws (JSException) + @JSFunction func greet() throws (JSException) -> String + @JSFunction func changeName(_ name: String) throws (JSException) -> Void +} + +@JSFunction func runAsyncWorks() throws (JSException) -> JSPromise diff --git a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift similarity index 96% rename from Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift rename to Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift index 0a95e88f..8e7b8ea2 100644 --- a/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.ExportSwift.swift +++ b/Tests/BridgeJSRuntimeTests/Generated/BridgeJS.swift @@ -1,3 +1,4 @@ +// bridge-js: skip // NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, // DO NOT EDIT. // @@ -6163,4 +6164,280 @@ fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int3 fileprivate func _bjs_Container_wrap(_ pointer: UnsafeMutableRawPointer) -> Int32 { fatalError("Only available on WebAssembly") } -#endif \ No newline at end of file +#endif + +// bridge-js: skip +// NOTICE: This is auto-generated code by BridgeJS from JavaScriptKit, +// DO NOT EDIT. +// +// To update this file, just rebuild your project or run +// `swift package bridge-js`. + +@_spi(BridgeJS) import JavaScriptKit + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripVoid") +fileprivate func bjs_jsRoundTripVoid() -> Void +#else +fileprivate func bjs_jsRoundTripVoid() -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripVoid() throws(JSException) -> Void { + bjs_jsRoundTripVoid() + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripNumber") +fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 +#else +fileprivate func bjs_jsRoundTripNumber(_ v: Float64) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripNumber(_ v: Double) throws(JSException) -> Double { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripNumber(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripBool") +fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripBool(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripBool(_ v: Bool) throws(JSException) -> Bool { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripBool(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsRoundTripString") +fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 +#else +fileprivate func bjs_jsRoundTripString(_ v: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsRoundTripString(_ v: String) throws(JSException) -> String { + let vValue = v.bridgeJSLowerParameter() + let ret = bjs_jsRoundTripString(vValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrVoid") +fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void +#else +fileprivate func bjs_jsThrowOrVoid(_ shouldThrow: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsThrowOrVoid(_ shouldThrow: Bool) throws(JSException) -> Void { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + bjs_jsThrowOrVoid(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrNumber") +fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 +#else +fileprivate func bjs_jsThrowOrNumber(_ shouldThrow: Int32) -> Float64 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsThrowOrNumber(_ shouldThrow: Bool) throws(JSException) -> Double { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + let ret = bjs_jsThrowOrNumber(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } + return Double.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrBool") +fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 +#else +fileprivate func bjs_jsThrowOrBool(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsThrowOrBool(_ shouldThrow: Bool) throws(JSException) -> Bool { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + let ret = bjs_jsThrowOrBool(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } + return Bool.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_jsThrowOrString") +fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 +#else +fileprivate func bjs_jsThrowOrString(_ shouldThrow: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$jsThrowOrString(_ shouldThrow: Bool) throws(JSException) -> String { + let shouldThrowValue = shouldThrow.bridgeJSLowerParameter() + let ret = bjs_jsThrowOrString(shouldThrowValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_runAsyncWorks") +fileprivate func bjs_runAsyncWorks() -> Int32 +#else +fileprivate func bjs_runAsyncWorks() -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +func _$runAsyncWorks() throws(JSException) -> JSPromise { + let ret = bjs_runAsyncWorks() + if let error = _swift_js_take_exception() { + throw error + } + return JSPromise.bridgeJSLiftReturn(ret) +} + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_init") +fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_init(_ name: Int32, _ prefix: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_get") +fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_name_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_prefix_get") +fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_prefix_get(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_name_set") +fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void +#else +fileprivate func bjs_JsGreeter_name_set(_ self: Int32, _ newValue: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_greet") +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 +#else +fileprivate func bjs_JsGreeter_greet(_ self: Int32) -> Int32 { + fatalError("Only available on WebAssembly") +} +#endif + +#if arch(wasm32) +@_extern(wasm, module: "BridgeJSRuntimeTests", name: "bjs_JsGreeter_changeName") +fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void +#else +fileprivate func bjs_JsGreeter_changeName(_ self: Int32, _ name: Int32) -> Void { + fatalError("Only available on WebAssembly") +} +#endif + +func _$JsGreeter_init(_ name: String, _ prefix: String) throws(JSException) -> JSObject { + let nameValue = name.bridgeJSLowerParameter() + let prefixValue = prefix.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_init(nameValue, prefixValue) + if let error = _swift_js_take_exception() { + throw error + } + return JSObject.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_name_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_name_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_prefix_get(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_prefix_get(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_name_set(_ self: JSObject, _ newValue: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let newValueValue = newValue.bridgeJSLowerParameter() + bjs_JsGreeter_name_set(selfValue, newValueValue) + if let error = _swift_js_take_exception() { + throw error + } +} + +func _$JsGreeter_greet(_ self: JSObject) throws(JSException) -> String { + let selfValue = self.bridgeJSLowerParameter() + let ret = bjs_JsGreeter_greet(selfValue) + if let error = _swift_js_take_exception() { + throw error + } + return String.bridgeJSLiftReturn(ret) +} + +func _$JsGreeter_changeName(_ self: JSObject, _ name: String) throws(JSException) -> Void { + let selfValue = self.bridgeJSLowerParameter() + let nameValue = name.bridgeJSLowerParameter() + bjs_JsGreeter_changeName(selfValue, nameValue) + if let error = _swift_js_take_exception() { + throw error + } +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json deleted file mode 100644 index 872af025..00000000 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ExportSwift.json +++ /dev/null @@ -1,8923 +0,0 @@ -{ - "classes" : [ - { - "constructor" : { - "abiName" : "bjs_Greeter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ] - }, - "explicitAccessControl" : "public", - "methods" : [ - { - "abiName" : "bjs_Greeter_greet", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_Greeter_changeName", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "changeName", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_Greeter_greetWith", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "greetWith", - "parameters" : [ - { - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "label" : "customGreeting", - "name" : "customGreeting", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_Greeter_makeFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFormatter", - "parameters" : [ - { - "label" : "suffix", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_Greeter_static_makeCreator", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "makeCreator", - "parameters" : [ - { - "label" : "defaultName", - "name" : "defaultName", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_7GreeterC", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - "staticContext" : { - "className" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_Greeter_makeCustomGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeCustomGreeter", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "name" : "Greeter", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "Greeter" - }, - { - "methods" : [ - { - "abiName" : "bjs_Calculator_square", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "square", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_Calculator_add", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - } - ], - "name" : "Calculator", - "properties" : [ - - ], - "swiftCallName" : "Calculator" - }, - { - "explicitAccessControl" : "internal", - "methods" : [ - - ], - "name" : "InternalGreeter", - "properties" : [ - - ], - "swiftCallName" : "InternalGreeter" - }, - { - "explicitAccessControl" : "public", - "methods" : [ - - ], - "name" : "PublicGreeter", - "properties" : [ - - ], - "swiftCallName" : "PublicGreeter" - }, - { - "explicitAccessControl" : "package", - "methods" : [ - - ], - "name" : "PackageGreeter", - "properties" : [ - - ], - "swiftCallName" : "PackageGreeter" - }, - { - "constructor" : { - "abiName" : "bjs_Converter_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_Converter_toString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "toString", - "namespace" : [ - "Utils" - ], - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "Converter", - "namespace" : [ - "Utils" - ], - "properties" : [ - - ], - "swiftCallName" : "Utils.Converter" - }, - { - "constructor" : { - "abiName" : "bjs_HTTPServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_HTTPServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "Networking", - "API" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "HTTPServer", - "namespace" : [ - "Networking", - "API" - ], - "properties" : [ - - ], - "swiftCallName" : "Networking.API.HTTPServer" - }, - { - "constructor" : { - "abiName" : "bjs_TestServer_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_TestServer_call", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "call", - "namespace" : [ - "Networking", - "APIV2", - "Internal" - ], - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "TestServer", - "namespace" : [ - "Networking", - "APIV2", - "Internal" - ], - "properties" : [ - - ], - "swiftCallName" : "Internal.TestServer" - }, - { - "constructor" : { - "abiName" : "bjs_OptionalPropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "optionalName", - "name" : "optionalName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "OptionalPropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalName", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalAge", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalGreeter", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "swiftCallName" : "OptionalPropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_SimplePropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "SimplePropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "SimplePropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_PropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "label" : "floatValue", - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "label" : "doubleValue", - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "label" : "boolValue", - "name" : "boolValue", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "stringValue", - "name" : "stringValue", - "type" : { - "string" : { - - } - } - }, - { - "label" : "jsObject", - "name" : "jsObject", - "type" : { - "jsObject" : { - - } - } - }, - { - "label" : "sibling", - "name" : "sibling", - "type" : { - "swiftHeapObject" : { - "_0" : "SimplePropertyHolder" - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_PropertyHolder_getAllValues", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAllValues", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "PropertyHolder", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "boolValue", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "stringValue", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyInt", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyFloat", - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyDouble", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyBool", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "readonlyString", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "jsObject", - "type" : { - "jsObject" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "sibling", - "type" : { - "swiftHeapObject" : { - "_0" : "SimplePropertyHolder" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "lazyValue", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "computedReadonly", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "computedReadWrite", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "observedProperty", - "type" : { - "int" : { - - } - } - } - ], - "swiftCallName" : "PropertyHolder" - }, - { - "methods" : [ - { - "abiName" : "bjs_MathUtils_static_add", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - }, - { - "abiName" : "bjs_MathUtils_static_substract", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "substract", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "int" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "className" : { - "_0" : "MathUtils" - } - } - } - ], - "name" : "MathUtils", - "properties" : [ - - ], - "swiftCallName" : "MathUtils" - }, - { - "constructor" : { - "abiName" : "bjs_ConstructorDefaults_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Default" - } - }, - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - }, - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "tag", - "name" : "tag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_ConstructorDefaults_describe", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "describe", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - } - ], - "name" : "ConstructorDefaults", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "enabled", - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "tag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "swiftCallName" : "ConstructorDefaults" - }, - { - "constructor" : { - "abiName" : "bjs_StaticPropertyHolder_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - - ], - "name" : "StaticPropertyHolder", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : true, - "name" : "staticConstant", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticVariable", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticString", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticBool", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticFloat", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "float" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "staticDouble", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedProperty", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "readOnlyComputed", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalString", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "optionalInt", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "jsObjectProperty", - "staticContext" : { - "className" : { - "_0" : "StaticPropertyHolder" - } - }, - "type" : { - "jsObject" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyHolder" - }, - { - "constructor" : { - "abiName" : "bjs_DataProcessorManager_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "processor", - "name" : "processor", - "type" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_DataProcessorManager_incrementByAmount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "incrementByAmount", - "parameters" : [ - { - "label" : "_", - "name" : "amount", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorLabel", - "parameters" : [ - { - "label" : "_", - "name" : "prefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "suffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_isProcessorEven", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "isProcessorEven", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorLabel", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getCurrentValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getCurrentValue", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_incrementBoth", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "incrementBoth", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getBackupValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getBackupValue", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_hasBackup", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "hasBackup", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorOptionalTag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorOptionalTag", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorOptionalTag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorOptionalTag", - "parameters" : [ - { - "label" : "_", - "name" : "tag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorOptionalCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorOptionalCount", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorOptionalCount", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorOptionalCount", - "parameters" : [ - { - "label" : "_", - "name" : "count", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorDirection", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorTheme", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorHttpStatus", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_getProcessorAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getProcessorAPIResult", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessorManager_setProcessorAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setProcessorAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "apiResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "DataProcessorManager", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "processor", - "type" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "backupProcessor", - "type" : { - "optional" : { - "_0" : { - "swiftProtocol" : { - "_0" : "DataProcessor" - } - } - } - } - } - ], - "swiftCallName" : "DataProcessorManager" - }, - { - "constructor" : { - "abiName" : "bjs_SwiftDataProcessor_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - - ] - }, - "methods" : [ - { - "abiName" : "bjs_SwiftDataProcessor_increment", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "increment", - "parameters" : [ - { - "label" : "by", - "name" : "amount", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getValue", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_setLabelElements", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setLabelElements", - "parameters" : [ - { - "label" : "_", - "name" : "labelPrefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "labelSuffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getLabel", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_isEven", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "isEven", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_processGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_createGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createGreeter", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_processOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_createOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createOptionalGreeter", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_handleAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_SwiftDataProcessor_getAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAPIResult", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "name" : "SwiftDataProcessor", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalTag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalCount", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalTheme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "httpStatus", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "apiResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "optionalHelper", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "swiftCallName" : "SwiftDataProcessor" - }, - { - "constructor" : { - "abiName" : "bjs_TextProcessor_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "transform", - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_TextProcessor_process", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "process", - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processWithCustom", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processWithCustom", - "parameters" : [ - { - "label" : "_", - "name" : "text", - "type" : { - "string" : { - - } - } - }, - { - "label" : "customTransform", - "name" : "customTransform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSiSSSd_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - }, - { - "string" : { - - } - }, - { - "double" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_getTransform", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTransform", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalString", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalInt", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSqSi_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeOptionalStringFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeOptionalStringFormatter", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeOptionalGreeterCreator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeOptionalGreeterCreator", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsy_Sq7GreeterC", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_processDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9DirectionO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "caseEnum" : { - "_0" : "Direction" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests5ThemeO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeDirectionChecker", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeDirectionChecker", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9DirectionO_Sb", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "caseEnum" : { - "_0" : "Direction" - } - } - ], - "returnType" : { - "bool" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeThemeValidator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeThemeValidator", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests5ThemeO_Sb", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - ], - "returnType" : { - "bool" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeStatusCodeExtractor", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeStatusCodeExtractor", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeAPIResultHandler", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultHandler", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalDirection", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalTheme", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq5ThemeO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_processOptionalAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "callback", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq9APIResultO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_TextProcessor_makeOptionalDirectionFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeOptionalDirectionFormatter", - "parameters" : [ - - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "name" : "TextProcessor", - "properties" : [ - - ], - "swiftCallName" : "TextProcessor" - }, - { - "constructor" : { - "abiName" : "bjs_Container_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "location", - "name" : "location", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "label" : "config", - "name" : "config", - "type" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "Container", - "properties" : [ - { - "isReadonly" : false, - "isStatic" : false, - "name" : "location", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "isReadonly" : false, - "isStatic" : false, - "name" : "config", - "type" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - } - } - ], - "swiftCallName" : "Container" - } - ], - "enums" : [ - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "north" - }, - { - "associatedValues" : [ - - ], - "name" : "south" - }, - { - "associatedValues" : [ - - ], - "name" : "east" - }, - { - "associatedValues" : [ - - ], - "name" : "west" - } - ], - "emitStyle" : "const", - "name" : "Direction", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Direction", - "tsFullPath" : "Direction" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "loading" - }, - { - "associatedValues" : [ - - ], - "name" : "success" - }, - { - "associatedValues" : [ - - ], - "name" : "error" - } - ], - "emitStyle" : "const", - "name" : "Status", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Status", - "tsFullPath" : "Status" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "light", - "rawValue" : "light" - }, - { - "associatedValues" : [ - - ], - "name" : "dark", - "rawValue" : "dark" - }, - { - "associatedValues" : [ - - ], - "name" : "auto", - "rawValue" : "auto" - } - ], - "emitStyle" : "const", - "name" : "Theme", - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Theme", - "tsFullPath" : "Theme" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "ok", - "rawValue" : "200" - }, - { - "associatedValues" : [ - - ], - "name" : "notFound", - "rawValue" : "404" - }, - { - "associatedValues" : [ - - ], - "name" : "serverError", - "rawValue" : "500" - }, - { - "associatedValues" : [ - - ], - "name" : "unknown", - "rawValue" : "-1" - } - ], - "emitStyle" : "const", - "name" : "HttpStatus", - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "HttpStatus", - "tsFullPath" : "HttpStatus" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "north" - }, - { - "associatedValues" : [ - - ], - "name" : "south" - }, - { - "associatedValues" : [ - - ], - "name" : "east" - }, - { - "associatedValues" : [ - - ], - "name" : "west" - } - ], - "emitStyle" : "tsEnum", - "name" : "TSDirection", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TSDirection", - "tsFullPath" : "TSDirection" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "light", - "rawValue" : "light" - }, - { - "associatedValues" : [ - - ], - "name" : "dark", - "rawValue" : "dark" - }, - { - "associatedValues" : [ - - ], - "name" : "auto", - "rawValue" : "auto" - } - ], - "emitStyle" : "tsEnum", - "name" : "TSTheme", - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "TSTheme", - "tsFullPath" : "TSTheme" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utils", - "tsFullPath" : "Utils" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Networking", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Networking", - "tsFullPath" : "Networking" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "API", - "namespace" : [ - "Networking" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Networking.API", - "tsFullPath" : "Networking.API" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - }, - { - "associatedValues" : [ - - ], - "name" : "put" - }, - { - "associatedValues" : [ - - ], - "name" : "delete" - } - ], - "emitStyle" : "const", - "name" : "Method", - "namespace" : [ - "Networking", - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Networking.API.Method", - "tsFullPath" : "Networking.API.Method" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Configuration", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Configuration", - "tsFullPath" : "Configuration" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "debug", - "rawValue" : "debug" - }, - { - "associatedValues" : [ - - ], - "name" : "info", - "rawValue" : "info" - }, - { - "associatedValues" : [ - - ], - "name" : "warning", - "rawValue" : "warning" - }, - { - "associatedValues" : [ - - ], - "name" : "error", - "rawValue" : "error" - } - ], - "emitStyle" : "const", - "name" : "LogLevel", - "namespace" : [ - "Configuration" - ], - "rawType" : "String", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Configuration.LogLevel", - "tsFullPath" : "Configuration.LogLevel" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "http", - "rawValue" : "80" - }, - { - "associatedValues" : [ - - ], - "name" : "https", - "rawValue" : "443" - }, - { - "associatedValues" : [ - - ], - "name" : "development", - "rawValue" : "3000" - } - ], - "emitStyle" : "const", - "name" : "Port", - "namespace" : [ - "Configuration" - ], - "rawType" : "Int", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Configuration.Port", - "tsFullPath" : "Configuration.Port" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Internal", - "namespace" : [ - "Networking", - "APIV2" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal", - "tsFullPath" : "Networking.APIV2.Internal" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "get" - }, - { - "associatedValues" : [ - - ], - "name" : "post" - } - ], - "emitStyle" : "const", - "name" : "SupportedMethod", - "namespace" : [ - "Networking", - "APIV2", - "Internal" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Internal.SupportedMethod", - "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - } - ], - "name" : "flag" - }, - { - "associatedValues" : [ - { - "type" : { - "float" : { - - } - } - } - ], - "name" : "rate" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "precise" - }, - { - "associatedValues" : [ - - ], - "name" : "info" - } - ], - "emitStyle" : "const", - "name" : "APIResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIResult", - "tsFullPath" : "APIResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "error" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "location" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - }, - { - "associatedValues" : [ - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - } - ], - "name" : "coordinates" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "double" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "comprehensive" - }, - { - "associatedValues" : [ - - ], - "name" : "info" - } - ], - "emitStyle" : "const", - "name" : "ComplexResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "ComplexResult", - "tsFullPath" : "ComplexResult" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Utilities", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utilities", - "tsFullPath" : "Utilities" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "bool" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - }, - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "Result", - "namespace" : [ - "Utilities" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "Utilities.Result", - "tsFullPath" : "Utilities.Result" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "API", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "API", - "tsFullPath" : "API" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "string" : { - - } - } - }, - { - "type" : { - "int" : { - - } - } - } - ], - "name" : "failure" - } - ], - "emitStyle" : "const", - "name" : "NetworkingResult", - "namespace" : [ - "API" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "API.NetworkingResult", - "tsFullPath" : "API.NetworkingResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "name" : "success" - }, - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "name" : "failure" - }, - { - "associatedValues" : [ - { - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "name" : "status" - } - ], - "emitStyle" : "const", - "name" : "APIOptionalResult", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "APIOptionalResult", - "tsFullPath" : "APIOptionalResult" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "scientific" - }, - { - "associatedValues" : [ - - ], - "name" : "basic" - } - ], - "emitStyle" : "const", - "name" : "StaticCalculator", - "staticMethods" : [ - { - "abiName" : "bjs_StaticCalculator_static_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundtrip", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - }, - "staticContext" : { - "enumName" : { - "_0" : "StaticCalculator" - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "StaticCalculator", - "tsFullPath" : "StaticCalculator" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "StaticUtils", - "staticMethods" : [ - - ], - "staticProperties" : [ - - ], - "swiftCallName" : "StaticUtils", - "tsFullPath" : "StaticUtils" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "Nested", - "namespace" : [ - "StaticUtils" - ], - "staticMethods" : [ - { - "abiName" : "bjs_StaticUtils_Nested_static_roundtrip", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "roundtrip", - "namespace" : [ - "StaticUtils", - "Nested" - ], - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - }, - "staticContext" : { - "namespaceEnum" : { - - } - } - } - ], - "staticProperties" : [ - - ], - "swiftCallName" : "StaticUtils.Nested", - "tsFullPath" : "StaticUtils.Nested" - }, - { - "cases" : [ - { - "associatedValues" : [ - - ], - "name" : "option1" - }, - { - "associatedValues" : [ - - ], - "name" : "option2" - } - ], - "emitStyle" : "const", - "name" : "StaticPropertyEnum", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumProperty", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "enumConstant", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumBool", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "bool" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "enumVariable", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "computedReadonly", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "computedReadWrite", - "staticContext" : { - "enumName" : { - "_0" : "StaticPropertyEnum" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyEnum", - "tsFullPath" : "StaticPropertyEnum" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "StaticPropertyNamespace", - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "namespaceProperty", - "namespace" : [ - "StaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "namespaceConstant", - "namespace" : [ - "StaticPropertyNamespace" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyNamespace", - "tsFullPath" : "StaticPropertyNamespace" - }, - { - "cases" : [ - - ], - "emitStyle" : "const", - "name" : "NestedProperties", - "namespace" : [ - "StaticPropertyNamespace" - ], - "staticMethods" : [ - - ], - "staticProperties" : [ - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedProperty", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "nestedConstant", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "nestedDouble", - "namespace" : [ - "StaticPropertyNamespace", - "NestedProperties" - ], - "staticContext" : { - "namespaceEnum" : { - - } - }, - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "StaticPropertyNamespace.NestedProperties", - "tsFullPath" : "StaticPropertyNamespace.NestedProperties" - } - ], - "exposeToGlobal" : false, - "functions" : [ - { - "abiName" : "bjs_roundTripVoid", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_roundTripInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripInt", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_roundTripFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripFloat", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDouble", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_roundTripBool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripBool", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_roundTripString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripString", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_roundTripSwiftHeapObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripSwiftHeapObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_roundTripJSObject", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripJSObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_throwsSwiftError", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsSwiftError", - "parameters" : [ - { - "label" : "shouldThrow", - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithIntResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithIntResult", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithStringResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithStringResult", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithBoolResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithBoolResult", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithFloatResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithFloatResult", - "parameters" : [ - - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithDoubleResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithDoubleResult", - "parameters" : [ - - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_throwsWithSwiftHeapObjectResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithSwiftHeapObjectResult", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_throwsWithJSObjectResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : true - }, - "name" : "throwsWithJSObjectResult", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripVoid", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripInt", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripInt", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripFloat", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripFloat", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "float" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripDouble", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripDouble", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripBool", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripBool", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripString", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripString", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_asyncRoundTripSwiftHeapObject", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripSwiftHeapObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_asyncRoundTripJSObject", - "effects" : { - "isAsync" : true, - "isStatic" : false, - "isThrows" : false - }, - "name" : "asyncRoundTripJSObject", - "parameters" : [ - { - "label" : "v", - "name" : "v", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_takeGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "takeGreeter", - "parameters" : [ - { - "label" : "g", - "name" : "g", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "label" : "name", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_createCalculator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createCalculator", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Calculator" - } - } - }, - { - "abiName" : "bjs_useCalculator", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "useCalculator", - "parameters" : [ - { - "label" : "calc", - "name" : "calc", - "type" : { - "swiftHeapObject" : { - "_0" : "Calculator" - } - } - }, - { - "label" : "x", - "name" : "x", - "type" : { - "int" : { - - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_testGreeterToJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testGreeterToJSValue", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_testCalculatorToJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testCalculatorToJSValue", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_testSwiftClassAsJSValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testSwiftClassAsJSValue", - "parameters" : [ - { - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "jsObject" : { - - } - } - }, - { - "abiName" : "bjs_setDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "abiName" : "bjs_getDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getDirection", - "parameters" : [ - - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "abiName" : "bjs_processDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processDirection", - "parameters" : [ - { - "label" : "_", - "name" : "input", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "abiName" : "bjs_setTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_getTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTheme", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_setHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setHttpStatus", - "parameters" : [ - { - "label" : "_", - "name" : "status", - "type" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_getHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getHttpStatus", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_processTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_setTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTSDirection", - "parameters" : [ - { - "label" : "_", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - }, - { - "abiName" : "bjs_getTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTSDirection", - "parameters" : [ - - ], - "returnType" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - }, - { - "abiName" : "bjs_setTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setTSTheme", - "parameters" : [ - { - "label" : "_", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_getTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getTSTheme", - "parameters" : [ - - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_roundtripNetworkingAPIMethod", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripNetworkingAPIMethod", - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - }, - { - "abiName" : "bjs_roundtripConfigurationLogLevel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripConfigurationLogLevel", - "parameters" : [ - { - "label" : "_", - "name" : "level", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_roundtripConfigurationPort", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripConfigurationPort", - "parameters" : [ - { - "label" : "_", - "name" : "port", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_processConfigurationLogLevel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processConfigurationLogLevel", - "parameters" : [ - { - "label" : "_", - "name" : "level", - "type" : { - "rawValueEnum" : { - "_0" : "Configuration.LogLevel", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Configuration.Port", - "_1" : "Int" - } - } - }, - { - "abiName" : "bjs_roundtripInternalSupportedMethod", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripInternalSupportedMethod", - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Internal.SupportedMethod" - } - } - }, - { - "abiName" : "bjs_roundtripAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAPIResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultFailure", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultFlag", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultFlag", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultRate", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultRate", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "float" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_makeAPIResultPrecise", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPIResultPrecise", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "abiName" : "bjs_roundtripComplexResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripComplexResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "value", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultError", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultError", - "parameters" : [ - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultLocation", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultLocation", - "parameters" : [ - { - "label" : "_", - "name" : "lat", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "lng", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultStatus", - "parameters" : [ - { - "label" : "_", - "name" : "active", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "int" : { - - } - } - }, - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultCoordinates", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultCoordinates", - "parameters" : [ - { - "label" : "_", - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "y", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "z", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultComprehensive", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultComprehensive", - "parameters" : [ - { - "label" : "_", - "name" : "flag1", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "flag2", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "count1", - "type" : { - "int" : { - - } - } - }, - { - "label" : "_", - "name" : "count2", - "type" : { - "int" : { - - } - } - }, - { - "label" : "_", - "name" : "value1", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "value2", - "type" : { - "double" : { - - } - } - }, - { - "label" : "_", - "name" : "text1", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "text2", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "text3", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeComplexResultInfo", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeComplexResultInfo", - "parameters" : [ - - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - }, - { - "abiName" : "bjs_makeUtilitiesResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeUtilitiesResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_makeUtilitiesResultFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeUtilitiesResultFailure", - "parameters" : [ - { - "label" : "_", - "name" : "error", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_makeUtilitiesResultStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeUtilitiesResultStatus", - "parameters" : [ - { - "label" : "_", - "name" : "active", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "int" : { - - } - } - }, - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_makeAPINetworkingResultSuccess", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPINetworkingResultSuccess", - "parameters" : [ - { - "label" : "_", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - }, - { - "abiName" : "bjs_makeAPINetworkingResultFailure", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAPINetworkingResultFailure", - "parameters" : [ - { - "label" : "_", - "name" : "error", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "code", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - }, - { - "abiName" : "bjs_roundtripUtilitiesResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripUtilitiesResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "Utilities.Result" - } - } - }, - { - "abiName" : "bjs_roundtripAPINetworkingResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundtripAPINetworkingResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - } - ], - "returnType" : { - "associatedValueEnum" : { - "_0" : "API.NetworkingResult" - } - } - }, - { - "abiName" : "bjs_roundTripOptionalString", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalString", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalInt", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalInt", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalBool", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalBool", - "parameters" : [ - { - "label" : "flag", - "name" : "flag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalFloat", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalFloat", - "parameters" : [ - { - "label" : "number", - "name" : "number", - "type" : { - "optional" : { - "_0" : { - "float" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "float" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalDouble", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalDouble", - "parameters" : [ - { - "label" : "precision", - "name" : "precision", - "type" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalMixSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalMixSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalSwiftSyntax", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalSwiftSyntax", - "parameters" : [ - { - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalWithSpaces", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalWithSpaces", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "double" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTypeAlias", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTypeAlias", - "parameters" : [ - { - "label" : "age", - "name" : "age", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalStatus", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTheme", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalHttpStatus", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalHttpStatus", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSDirection", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSDirection", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "TSDirection" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalTSTheme", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalTSTheme", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "TSTheme", - "_1" : "String" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalNetworkingAPIMethod", - "parameters" : [ - { - "label" : "_", - "name" : "method", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Networking.API.Method" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIResult", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "abiName" : "bjs_compareAPIResults", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "compareAPIResults", - "parameters" : [ - { - "label" : "_", - "name" : "r1", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "label" : "_", - "name" : "r2", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_roundTripOptionalComplexResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalComplexResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "ComplexResult" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalClass", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalClass", - "parameters" : [ - { - "label" : "value", - "name" : "value", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - { - "abiName" : "bjs_roundTripOptionalAPIOptionalResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripOptionalAPIOptionalResult", - "parameters" : [ - { - "label" : "result", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIOptionalResult" - } - } - } - } - }, - { - "abiName" : "bjs_createPropertyHolder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createPropertyHolder", - "parameters" : [ - { - "label" : "intValue", - "name" : "intValue", - "type" : { - "int" : { - - } - } - }, - { - "label" : "floatValue", - "name" : "floatValue", - "type" : { - "float" : { - - } - } - }, - { - "label" : "doubleValue", - "name" : "doubleValue", - "type" : { - "double" : { - - } - } - }, - { - "label" : "boolValue", - "name" : "boolValue", - "type" : { - "bool" : { - - } - } - }, - { - "label" : "stringValue", - "name" : "stringValue", - "type" : { - "string" : { - - } - } - }, - { - "label" : "jsObject", - "name" : "jsObject", - "type" : { - "jsObject" : { - - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" - } - } - }, - { - "abiName" : "bjs_testPropertyHolder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testPropertyHolder", - "parameters" : [ - { - "label" : "holder", - "name" : "holder", - "type" : { - "swiftHeapObject" : { - "_0" : "PropertyHolder" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_resetObserverCounts", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "resetObserverCounts", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_getObserverStats", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getObserverStats", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testStringDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testStringDefault", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Hello World" - } - }, - "label" : "message", - "name" : "message", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testIntDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testIntDefault", - "parameters" : [ - { - "defaultValue" : { - "int" : { - "_0" : 42 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_testBoolDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testBoolDefault", - "parameters" : [ - { - "defaultValue" : { - "bool" : { - "_0" : true - } - }, - "label" : "flag", - "name" : "flag", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_testOptionalDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testOptionalDefault", - "parameters" : [ - { - "defaultValue" : { - "null" : { - - } - }, - "label" : "name", - "name" : "name", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - } - ], - "returnType" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "abiName" : "bjs_testMultipleDefaults", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testMultipleDefaults", - "parameters" : [ - { - "defaultValue" : { - "string" : { - "_0" : "Default Title" - } - }, - "label" : "title", - "name" : "title", - "type" : { - "string" : { - - } - } - }, - { - "defaultValue" : { - "int" : { - "_0" : -10 - } - }, - "label" : "count", - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "defaultValue" : { - "bool" : { - "_0" : false - } - }, - "label" : "enabled", - "name" : "enabled", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testSimpleEnumDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testSimpleEnumDefault", - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Status", - "_1" : "success" - } - }, - "label" : "status", - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Status" - } - } - }, - { - "abiName" : "bjs_testDirectionDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testDirectionDefault", - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Direction", - "_1" : "north" - } - }, - "label" : "direction", - "name" : "direction", - "type" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - ], - "returnType" : { - "caseEnum" : { - "_0" : "Direction" - } - } - }, - { - "abiName" : "bjs_testRawStringEnumDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testRawStringEnumDefault", - "parameters" : [ - { - "defaultValue" : { - "enumCase" : { - "_0" : "Theme", - "_1" : "light" - } - }, - "label" : "theme", - "name" : "theme", - "type" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - ], - "returnType" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - }, - { - "abiName" : "bjs_testComplexInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testComplexInit", - "parameters" : [ - { - "defaultValue" : { - "objectWithArguments" : { - "_0" : "Greeter", - "_1" : [ - { - "string" : { - "_0" : "DefaultGreeter" - } - } - ] - } - }, - "label" : "greeter", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_testEmptyInit", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testEmptyInit", - "parameters" : [ - { - "defaultValue" : { - "object" : { - "_0" : "StaticPropertyHolder" - } - }, - "label" : "_", - "name" : "object", - "type" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "StaticPropertyHolder" - } - } - }, - { - "abiName" : "bjs_formatName", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "formatName", - "parameters" : [ - { - "label" : "_", - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "label" : "transform", - "name" : "transform", - "type" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_makeFormatter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeFormatter", - "parameters" : [ - { - "label" : "prefix", - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSS_SS", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "string" : { - - } - } - ], - "returnType" : { - "string" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_makeAdder", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "makeAdder", - "parameters" : [ - { - "label" : "base", - "name" : "base", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "closure" : { - "_0" : { - "isAsync" : false, - "isThrows" : false, - "mangleName" : "20BridgeJSRuntimeTestsSi_Si", - "moduleName" : "BridgeJSRuntimeTests", - "parameters" : [ - { - "int" : { - - } - } - ], - "returnType" : { - "int" : { - - } - } - } - } - } - }, - { - "abiName" : "bjs_testStructDefault", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testStructDefault", - "parameters" : [ - { - "defaultValue" : { - "structLiteral" : { - "_0" : "DataPoint", - "_1" : [ - { - "name" : "x", - "value" : { - "float" : { - "_0" : 1 - } - } - }, - { - "name" : "y", - "value" : { - "float" : { - "_0" : 2 - } - } - }, - { - "name" : "label", - "value" : { - "string" : { - "_0" : "default" - } - } - }, - { - "name" : "optCount", - "value" : { - "null" : { - - } - } - }, - { - "name" : "optFlag", - "value" : { - "null" : { - - } - } - } - ] - } - }, - "label" : "point", - "name" : "point", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_roundTripDataPoint", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripDataPoint", - "parameters" : [ - { - "label" : "_", - "name" : "data", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - }, - { - "abiName" : "bjs_roundTripContact", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripContact", - "parameters" : [ - { - "label" : "_", - "name" : "contact", - "type" : { - "swiftStruct" : { - "_0" : "Contact" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Contact" - } - } - }, - { - "abiName" : "bjs_roundTripConfig", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripConfig", - "parameters" : [ - { - "label" : "_", - "name" : "config", - "type" : { - "swiftStruct" : { - "_0" : "Config" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "Config" - } - } - }, - { - "abiName" : "bjs_roundTripSessionData", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripSessionData", - "parameters" : [ - { - "label" : "_", - "name" : "session", - "type" : { - "swiftStruct" : { - "_0" : "SessionData" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "SessionData" - } - } - }, - { - "abiName" : "bjs_roundTripValidationReport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "roundTripValidationReport", - "parameters" : [ - { - "label" : "_", - "name" : "report", - "type" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - }, - { - "abiName" : "bjs_updateValidationReport", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "updateValidationReport", - "parameters" : [ - { - "label" : "_", - "name" : "newResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "label" : "_", - "name" : "report", - "type" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - } - ], - "returnType" : { - "swiftStruct" : { - "_0" : "ValidationReport" - } - } - }, - { - "abiName" : "bjs_testContainerWithStruct", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "testContainerWithStruct", - "parameters" : [ - { - "label" : "_", - "name" : "point", - "type" : { - "swiftStruct" : { - "_0" : "DataPoint" - } - } - } - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Container" - } - } - } - ], - "moduleName" : "BridgeJSRuntimeTests", - "protocols" : [ - { - "methods" : [ - { - "abiName" : "bjs_DataProcessor_increment", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "increment", - "parameters" : [ - { - "label" : "by", - "name" : "amount", - "type" : { - "int" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getValue", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getValue", - "parameters" : [ - - ], - "returnType" : { - "int" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_setLabelElements", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "setLabelElements", - "parameters" : [ - { - "label" : "_", - "name" : "labelPrefix", - "type" : { - "string" : { - - } - } - }, - { - "label" : "_", - "name" : "labelSuffix", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getLabel", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getLabel", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_isEven", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "isEven", - "parameters" : [ - - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_processGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_createGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createGreeter", - "parameters" : [ - - ], - "returnType" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "abiName" : "bjs_DataProcessor_processOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "processOptionalGreeter", - "parameters" : [ - { - "label" : "_", - "name" : "greeter", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_createOptionalGreeter", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "createOptionalGreeter", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - }, - { - "abiName" : "bjs_DataProcessor_handleAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "handleAPIResult", - "parameters" : [ - { - "label" : "_", - "name" : "result", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "abiName" : "bjs_DataProcessor_getAPIResult", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "getAPIResult", - "parameters" : [ - - ], - "returnType" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "name" : "DataProcessor", - "properties" : [ - { - "isReadonly" : false, - "name" : "count", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : false, - "name" : "optionalTag", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "optionalCount", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "optionalTheme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "httpStatus", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "HttpStatus", - "_1" : "Int" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "apiResult", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - }, - { - "isReadonly" : false, - "name" : "helper", - "type" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - }, - { - "isReadonly" : false, - "name" : "optionalHelper", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ] - } - ], - "structs" : [ - { - "constructor" : { - "abiName" : "bjs_DataPoint_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "label" : "x", - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "label" : "y", - "name" : "y", - "type" : { - "double" : { - - } - } - }, - { - "label" : "label", - "name" : "label", - "type" : { - "string" : { - - } - } - }, - { - "label" : "optCount", - "name" : "optCount", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "label" : "optFlag", - "name" : "optFlag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ] - }, - "methods" : [ - - ], - "name" : "DataPoint", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "x", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "y", - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "label", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optCount", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "optFlag", - "type" : { - "optional" : { - "_0" : { - "bool" : { - - } - } - } - } - } - ], - "swiftCallName" : "DataPoint" - }, - { - "methods" : [ - - ], - "name" : "Address", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "street", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "city", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "zipCode", - "type" : { - "optional" : { - "_0" : { - "int" : { - - } - } - } - } - } - ], - "swiftCallName" : "Address" - }, - { - "methods" : [ - - ], - "name" : "Contact", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "age", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "address", - "type" : { - "swiftStruct" : { - "_0" : "Address" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "email", - "type" : { - "optional" : { - "_0" : { - "string" : { - - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "secondaryAddress", - "type" : { - "optional" : { - "_0" : { - "swiftStruct" : { - "_0" : "Address" - } - } - } - } - } - ], - "swiftCallName" : "Contact" - }, - { - "methods" : [ - - ], - "name" : "Config", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "theme", - "type" : { - "optional" : { - "_0" : { - "rawValueEnum" : { - "_0" : "Theme", - "_1" : "String" - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "direction", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Direction" - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "status", - "type" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - ], - "swiftCallName" : "Config" - }, - { - "methods" : [ - - ], - "name" : "SessionData", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "owner", - "type" : { - "optional" : { - "_0" : { - "swiftHeapObject" : { - "_0" : "Greeter" - } - } - } - } - } - ], - "swiftCallName" : "SessionData" - }, - { - "methods" : [ - - ], - "name" : "ValidationReport", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "id", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "result", - "type" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "status", - "type" : { - "optional" : { - "_0" : { - "caseEnum" : { - "_0" : "Status" - } - } - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "outcome", - "type" : { - "optional" : { - "_0" : { - "associatedValueEnum" : { - "_0" : "APIResult" - } - } - } - } - } - ], - "swiftCallName" : "ValidationReport" - }, - { - "constructor" : { - "abiName" : "bjs_MathOperations_init", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "parameters" : [ - { - "defaultValue" : { - "double" : { - "_0" : 0 - } - }, - "label" : "baseValue", - "name" : "baseValue", - "type" : { - "double" : { - - } - } - } - ] - }, - "methods" : [ - { - "abiName" : "bjs_MathOperations_add", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "add", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "double" : { - - } - } - }, - { - "defaultValue" : { - "double" : { - "_0" : 10 - } - }, - "label" : "b", - "name" : "b", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_MathOperations_multiply", - "effects" : { - "isAsync" : false, - "isStatic" : false, - "isThrows" : false - }, - "name" : "multiply", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "double" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "abiName" : "bjs_MathOperations_static_subtract", - "effects" : { - "isAsync" : false, - "isStatic" : true, - "isThrows" : false - }, - "name" : "subtract", - "parameters" : [ - { - "label" : "a", - "name" : "a", - "type" : { - "double" : { - - } - } - }, - { - "label" : "b", - "name" : "b", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - }, - "staticContext" : { - "structName" : { - "_0" : "MathOperations" - } - } - } - ], - "name" : "MathOperations", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "baseValue", - "type" : { - "double" : { - - } - } - } - ], - "swiftCallName" : "MathOperations" - }, - { - "methods" : [ - - ], - "name" : "ConfigStruct", - "properties" : [ - { - "isReadonly" : true, - "isStatic" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : false, - "name" : "value", - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "defaultConfig", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "maxRetries", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "int" : { - - } - } - }, - { - "isReadonly" : false, - "isStatic" : true, - "name" : "timeout", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "double" : { - - } - } - }, - { - "isReadonly" : true, - "isStatic" : true, - "name" : "computedSetting", - "staticContext" : { - "structName" : { - "_0" : "ConfigStruct" - } - }, - "type" : { - "string" : { - - } - } - } - ], - "swiftCallName" : "ConfigStruct" - } - ] -} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json deleted file mode 100644 index 82515fec..00000000 --- a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.ImportTS.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "children" : [ - { - "functions" : [ - { - "name" : "jsRoundTripVoid", - "parameters" : [ - - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "jsRoundTripNumber", - "parameters" : [ - { - "name" : "v", - "type" : { - "double" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "name" : "jsRoundTripBool", - "parameters" : [ - { - "name" : "v", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "name" : "jsRoundTripString", - "parameters" : [ - { - "name" : "v", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "name" : "jsThrowOrVoid", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - }, - { - "name" : "jsThrowOrNumber", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "double" : { - - } - } - }, - { - "name" : "jsThrowOrBool", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "bool" : { - - } - } - }, - { - "name" : "jsThrowOrString", - "parameters" : [ - { - "name" : "shouldThrow", - "type" : { - "bool" : { - - } - } - } - ], - "returnType" : { - "string" : { - - } - } - }, - { - "name" : "runAsyncWorks", - "parameters" : [ - - ], - "returnType" : { - "jsObject" : { - "_0" : "JSPromise" - } - } - } - ], - "types" : [ - { - "constructor" : { - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ] - }, - "methods" : [ - { - "name" : "greet", - "parameters" : [ - - ], - "returnType" : { - "string" : { - - } - } - }, - { - "name" : "changeName", - "parameters" : [ - { - "name" : "name", - "type" : { - "string" : { - - } - } - } - ], - "returnType" : { - "void" : { - - } - } - } - ], - "name" : "JsGreeter", - "properties" : [ - { - "isReadonly" : false, - "name" : "name", - "type" : { - "string" : { - - } - } - }, - { - "isReadonly" : true, - "name" : "prefix", - "type" : { - "string" : { - - } - } - } - ] - } - ] - } - ], - "moduleName" : "BridgeJSRuntimeTests" -} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json new file mode 100644 index 00000000..64046099 --- /dev/null +++ b/Tests/BridgeJSRuntimeTests/Generated/JavaScript/BridgeJS.json @@ -0,0 +1,9184 @@ +{ + "exported" : { + "classes" : [ + { + "constructor" : { + "abiName" : "bjs_Greeter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + }, + "explicitAccessControl" : "public", + "methods" : [ + { + "abiName" : "bjs_Greeter_greet", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Greeter_changeName", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "changeName", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_Greeter_greetWith", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "greetWith", + "parameters" : [ + { + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "label" : "customGreeting", + "name" : "customGreeting", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_Greeter_makeFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFormatter", + "parameters" : [ + { + "label" : "suffix", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_Greeter_static_makeCreator", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "makeCreator", + "parameters" : [ + { + "label" : "defaultName", + "name" : "defaultName", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + "staticContext" : { + "className" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_Greeter_makeCustomGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeCustomGreeter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "name" : "Greeter", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "Greeter" + }, + { + "methods" : [ + { + "abiName" : "bjs_Calculator_square", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "square", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_Calculator_add", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + } + ], + "name" : "Calculator", + "properties" : [ + + ], + "swiftCallName" : "Calculator" + }, + { + "explicitAccessControl" : "internal", + "methods" : [ + + ], + "name" : "InternalGreeter", + "properties" : [ + + ], + "swiftCallName" : "InternalGreeter" + }, + { + "explicitAccessControl" : "public", + "methods" : [ + + ], + "name" : "PublicGreeter", + "properties" : [ + + ], + "swiftCallName" : "PublicGreeter" + }, + { + "explicitAccessControl" : "package", + "methods" : [ + + ], + "name" : "PackageGreeter", + "properties" : [ + + ], + "swiftCallName" : "PackageGreeter" + }, + { + "constructor" : { + "abiName" : "bjs_Converter_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_Converter_toString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "toString", + "namespace" : [ + "Utils" + ], + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "Converter", + "namespace" : [ + "Utils" + ], + "properties" : [ + + ], + "swiftCallName" : "Utils.Converter" + }, + { + "constructor" : { + "abiName" : "bjs_HTTPServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_HTTPServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "Networking", + "API" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "HTTPServer", + "namespace" : [ + "Networking", + "API" + ], + "properties" : [ + + ], + "swiftCallName" : "Networking.API.HTTPServer" + }, + { + "constructor" : { + "abiName" : "bjs_TestServer_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_TestServer_call", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "call", + "namespace" : [ + "Networking", + "APIV2", + "Internal" + ], + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Internal.SupportedMethod" + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "TestServer", + "namespace" : [ + "Networking", + "APIV2", + "Internal" + ], + "properties" : [ + + ], + "swiftCallName" : "Internal.TestServer" + }, + { + "constructor" : { + "abiName" : "bjs_OptionalPropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "optionalName", + "name" : "optionalName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "OptionalPropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalName", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalAge", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalGreeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "OptionalPropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_SimplePropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "SimplePropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "SimplePropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_PropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "label" : "floatValue", + "name" : "floatValue", + "type" : { + "float" : { + + } + } + }, + { + "label" : "doubleValue", + "name" : "doubleValue", + "type" : { + "double" : { + + } + } + }, + { + "label" : "boolValue", + "name" : "boolValue", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "stringValue", + "name" : "stringValue", + "type" : { + "string" : { + + } + } + }, + { + "label" : "jsObject", + "name" : "jsObject", + "type" : { + "jsObject" : { + + } + } + }, + { + "label" : "sibling", + "name" : "sibling", + "type" : { + "swiftHeapObject" : { + "_0" : "SimplePropertyHolder" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_PropertyHolder_getAllValues", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAllValues", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "PropertyHolder", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "floatValue", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "doubleValue", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "boolValue", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "stringValue", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyInt", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyFloat", + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyDouble", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyBool", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "readonlyString", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "jsObject", + "type" : { + "jsObject" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "sibling", + "type" : { + "swiftHeapObject" : { + "_0" : "SimplePropertyHolder" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "lazyValue", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "computedReadonly", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "computedReadWrite", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "observedProperty", + "type" : { + "int" : { + + } + } + } + ], + "swiftCallName" : "PropertyHolder" + }, + { + "methods" : [ + { + "abiName" : "bjs_MathUtils_static_add", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + }, + { + "abiName" : "bjs_MathUtils_static_substract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "substract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "int" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "className" : { + "_0" : "MathUtils" + } + } + } + ], + "name" : "MathUtils", + "properties" : [ + + ], + "swiftCallName" : "MathUtils" + }, + { + "constructor" : { + "abiName" : "bjs_ConstructorDefaults_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Default" + } + }, + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + }, + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "tag", + "name" : "tag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_ConstructorDefaults_describe", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "describe", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + } + ], + "name" : "ConstructorDefaults", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "enabled", + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "tag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "swiftCallName" : "ConstructorDefaults" + }, + { + "constructor" : { + "abiName" : "bjs_StaticPropertyHolder_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + + ], + "name" : "StaticPropertyHolder", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : true, + "name" : "staticConstant", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticVariable", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticString", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticBool", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticFloat", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "float" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "staticDouble", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedProperty", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "readOnlyComputed", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalString", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "optionalInt", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "jsObjectProperty", + "staticContext" : { + "className" : { + "_0" : "StaticPropertyHolder" + } + }, + "type" : { + "jsObject" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyHolder" + }, + { + "constructor" : { + "abiName" : "bjs_DataProcessorManager_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "processor", + "name" : "processor", + "type" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_DataProcessorManager_incrementByAmount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "incrementByAmount", + "parameters" : [ + { + "label" : "_", + "name" : "amount", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorLabel", + "parameters" : [ + { + "label" : "_", + "name" : "prefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "suffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_isProcessorEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isProcessorEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getCurrentValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getCurrentValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_incrementBoth", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "incrementBoth", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getBackupValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getBackupValue", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_hasBackup", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "hasBackup", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorOptionalTag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorOptionalTag", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalTag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalTag", + "parameters" : [ + { + "label" : "_", + "name" : "tag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorOptionalCount", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorOptionalCount", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorOptionalCount", + "parameters" : [ + { + "label" : "_", + "name" : "count", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorDirection", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorTheme", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_getProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getProcessorAPIResult", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessorManager_setProcessorAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setProcessorAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "DataProcessorManager", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "processor", + "type" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "backupProcessor", + "type" : { + "optional" : { + "_0" : { + "swiftProtocol" : { + "_0" : "DataProcessor" + } + } + } + } + } + ], + "swiftCallName" : "DataProcessorManager" + }, + { + "constructor" : { + "abiName" : "bjs_SwiftDataProcessor_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + + ] + }, + "methods" : [ + { + "abiName" : "bjs_SwiftDataProcessor_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + { + "label" : "by", + "name" : "amount", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_setLabelElements", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setLabelElements", + "parameters" : [ + { + "label" : "_", + "name" : "labelPrefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "labelSuffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_isEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_processGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_createGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createGreeter", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_SwiftDataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "name" : "SwiftDataProcessor", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalTheme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "httpStatus", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "optionalHelper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "SwiftDataProcessor" + }, + { + "constructor" : { + "abiName" : "bjs_TextProcessor_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_TextProcessor_process", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "process", + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processWithCustom", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processWithCustom", + "parameters" : [ + { + "label" : "_", + "name" : "text", + "type" : { + "string" : { + + } + } + }, + { + "label" : "customTransform", + "name" : "customTransform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSiSSSd_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + }, + { + "string" : { + + } + }, + { + "double" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_getTransform", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTransform", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalString", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalInt", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSqSi_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq7GreeterC_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalStringFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalStringFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSqSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalGreeterCreator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalGreeterCreator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsy_Sq7GreeterC", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_processDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests5ThemeO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeDirectionChecker", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeDirectionChecker", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9DirectionO_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "caseEnum" : { + "_0" : "Direction" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeThemeValidator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeThemeValidator", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests5ThemeO_Sb", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + ], + "returnType" : { + "bool" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeStatusCodeExtractor", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeStatusCodeExtractor", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests10HttpStatusO_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeAPIResultHandler", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultHandler", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTests9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalDirection", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalTheme", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq5ThemeO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_processOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "callback", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq9APIResultO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_TextProcessor_makeOptionalDirectionFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeOptionalDirectionFormatter", + "parameters" : [ + + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSq9DirectionO_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "name" : "TextProcessor", + "properties" : [ + + ], + "swiftCallName" : "TextProcessor" + }, + { + "constructor" : { + "abiName" : "bjs_Container_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "location", + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "label" : "config", + "name" : "config", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "Container", + "properties" : [ + { + "isReadonly" : false, + "isStatic" : false, + "name" : "location", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "isReadonly" : false, + "isStatic" : false, + "name" : "config", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + } + } + ], + "swiftCallName" : "Container" + } + ], + "enums" : [ + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "const", + "name" : "Direction", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Direction", + "tsFullPath" : "Direction" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "loading" + }, + { + "associatedValues" : [ + + ], + "name" : "success" + }, + { + "associatedValues" : [ + + ], + "name" : "error" + } + ], + "emitStyle" : "const", + "name" : "Status", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Status", + "tsFullPath" : "Status" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "light", + "rawValue" : "light" + }, + { + "associatedValues" : [ + + ], + "name" : "dark", + "rawValue" : "dark" + }, + { + "associatedValues" : [ + + ], + "name" : "auto", + "rawValue" : "auto" + } + ], + "emitStyle" : "const", + "name" : "Theme", + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Theme", + "tsFullPath" : "Theme" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "ok", + "rawValue" : "200" + }, + { + "associatedValues" : [ + + ], + "name" : "notFound", + "rawValue" : "404" + }, + { + "associatedValues" : [ + + ], + "name" : "serverError", + "rawValue" : "500" + }, + { + "associatedValues" : [ + + ], + "name" : "unknown", + "rawValue" : "-1" + } + ], + "emitStyle" : "const", + "name" : "HttpStatus", + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "HttpStatus", + "tsFullPath" : "HttpStatus" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "north" + }, + { + "associatedValues" : [ + + ], + "name" : "south" + }, + { + "associatedValues" : [ + + ], + "name" : "east" + }, + { + "associatedValues" : [ + + ], + "name" : "west" + } + ], + "emitStyle" : "tsEnum", + "name" : "TSDirection", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TSDirection", + "tsFullPath" : "TSDirection" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "light", + "rawValue" : "light" + }, + { + "associatedValues" : [ + + ], + "name" : "dark", + "rawValue" : "dark" + }, + { + "associatedValues" : [ + + ], + "name" : "auto", + "rawValue" : "auto" + } + ], + "emitStyle" : "tsEnum", + "name" : "TSTheme", + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "TSTheme", + "tsFullPath" : "TSTheme" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utils", + "tsFullPath" : "Utils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Networking", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Networking", + "tsFullPath" : "Networking" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "API", + "namespace" : [ + "Networking" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Networking.API", + "tsFullPath" : "Networking.API" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + }, + { + "associatedValues" : [ + + ], + "name" : "put" + }, + { + "associatedValues" : [ + + ], + "name" : "delete" + } + ], + "emitStyle" : "const", + "name" : "Method", + "namespace" : [ + "Networking", + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Networking.API.Method", + "tsFullPath" : "Networking.API.Method" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Configuration", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Configuration", + "tsFullPath" : "Configuration" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "debug", + "rawValue" : "debug" + }, + { + "associatedValues" : [ + + ], + "name" : "info", + "rawValue" : "info" + }, + { + "associatedValues" : [ + + ], + "name" : "warning", + "rawValue" : "warning" + }, + { + "associatedValues" : [ + + ], + "name" : "error", + "rawValue" : "error" + } + ], + "emitStyle" : "const", + "name" : "LogLevel", + "namespace" : [ + "Configuration" + ], + "rawType" : "String", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Configuration.LogLevel", + "tsFullPath" : "Configuration.LogLevel" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "http", + "rawValue" : "80" + }, + { + "associatedValues" : [ + + ], + "name" : "https", + "rawValue" : "443" + }, + { + "associatedValues" : [ + + ], + "name" : "development", + "rawValue" : "3000" + } + ], + "emitStyle" : "const", + "name" : "Port", + "namespace" : [ + "Configuration" + ], + "rawType" : "Int", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Configuration.Port", + "tsFullPath" : "Configuration.Port" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Internal", + "namespace" : [ + "Networking", + "APIV2" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal", + "tsFullPath" : "Networking.APIV2.Internal" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "get" + }, + { + "associatedValues" : [ + + ], + "name" : "post" + } + ], + "emitStyle" : "const", + "name" : "SupportedMethod", + "namespace" : [ + "Networking", + "APIV2", + "Internal" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Internal.SupportedMethod", + "tsFullPath" : "Networking.APIV2.Internal.SupportedMethod" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + } + ], + "name" : "flag" + }, + { + "associatedValues" : [ + { + "type" : { + "float" : { + + } + } + } + ], + "name" : "rate" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "precise" + }, + { + "associatedValues" : [ + + ], + "name" : "info" + } + ], + "emitStyle" : "const", + "name" : "APIResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIResult", + "tsFullPath" : "APIResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "error" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "location" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + }, + { + "associatedValues" : [ + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + } + ], + "name" : "coordinates" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "double" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "comprehensive" + }, + { + "associatedValues" : [ + + ], + "name" : "info" + } + ], + "emitStyle" : "const", + "name" : "ComplexResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "ComplexResult", + "tsFullPath" : "ComplexResult" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Utilities", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utilities", + "tsFullPath" : "Utilities" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "bool" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + }, + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "Result", + "namespace" : [ + "Utilities" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "Utilities.Result", + "tsFullPath" : "Utilities.Result" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "API", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "API", + "tsFullPath" : "API" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "string" : { + + } + } + }, + { + "type" : { + "int" : { + + } + } + } + ], + "name" : "failure" + } + ], + "emitStyle" : "const", + "name" : "NetworkingResult", + "namespace" : [ + "API" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "API.NetworkingResult", + "tsFullPath" : "API.NetworkingResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "name" : "success" + }, + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "name" : "failure" + }, + { + "associatedValues" : [ + { + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "name" : "status" + } + ], + "emitStyle" : "const", + "name" : "APIOptionalResult", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "APIOptionalResult", + "tsFullPath" : "APIOptionalResult" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "scientific" + }, + { + "associatedValues" : [ + + ], + "name" : "basic" + } + ], + "emitStyle" : "const", + "name" : "StaticCalculator", + "staticMethods" : [ + { + "abiName" : "bjs_StaticCalculator_static_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundtrip", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + }, + "staticContext" : { + "enumName" : { + "_0" : "StaticCalculator" + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "StaticCalculator", + "tsFullPath" : "StaticCalculator" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "StaticUtils", + "staticMethods" : [ + + ], + "staticProperties" : [ + + ], + "swiftCallName" : "StaticUtils", + "tsFullPath" : "StaticUtils" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "Nested", + "namespace" : [ + "StaticUtils" + ], + "staticMethods" : [ + { + "abiName" : "bjs_StaticUtils_Nested_static_roundtrip", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "roundtrip", + "namespace" : [ + "StaticUtils", + "Nested" + ], + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + }, + "staticContext" : { + "namespaceEnum" : { + + } + } + } + ], + "staticProperties" : [ + + ], + "swiftCallName" : "StaticUtils.Nested", + "tsFullPath" : "StaticUtils.Nested" + }, + { + "cases" : [ + { + "associatedValues" : [ + + ], + "name" : "option1" + }, + { + "associatedValues" : [ + + ], + "name" : "option2" + } + ], + "emitStyle" : "const", + "name" : "StaticPropertyEnum", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumProperty", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "enumConstant", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumBool", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "bool" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "enumVariable", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "computedReadonly", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "computedReadWrite", + "staticContext" : { + "enumName" : { + "_0" : "StaticPropertyEnum" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyEnum", + "tsFullPath" : "StaticPropertyEnum" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "StaticPropertyNamespace", + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "namespaceProperty", + "namespace" : [ + "StaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "namespaceConstant", + "namespace" : [ + "StaticPropertyNamespace" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyNamespace", + "tsFullPath" : "StaticPropertyNamespace" + }, + { + "cases" : [ + + ], + "emitStyle" : "const", + "name" : "NestedProperties", + "namespace" : [ + "StaticPropertyNamespace" + ], + "staticMethods" : [ + + ], + "staticProperties" : [ + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedProperty", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "nestedConstant", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "nestedDouble", + "namespace" : [ + "StaticPropertyNamespace", + "NestedProperties" + ], + "staticContext" : { + "namespaceEnum" : { + + } + }, + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "StaticPropertyNamespace.NestedProperties", + "tsFullPath" : "StaticPropertyNamespace.NestedProperties" + } + ], + "exposeToGlobal" : false, + "functions" : [ + { + "abiName" : "bjs_roundTripVoid", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_roundTripInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripInt", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_roundTripFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripFloat", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_roundTripDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDouble", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_roundTripBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripBool", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_roundTripString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripString", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_roundTripSwiftHeapObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripSwiftHeapObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_roundTripJSObject", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripJSObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_throwsSwiftError", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsSwiftError", + "parameters" : [ + { + "label" : "shouldThrow", + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithIntResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithIntResult", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithStringResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithStringResult", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithBoolResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithBoolResult", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithFloatResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithFloatResult", + "parameters" : [ + + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithDoubleResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithDoubleResult", + "parameters" : [ + + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_throwsWithSwiftHeapObjectResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithSwiftHeapObjectResult", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_throwsWithJSObjectResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : true + }, + "name" : "throwsWithJSObjectResult", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripVoid", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripInt", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripInt", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripFloat", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripFloat", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "float" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripDouble", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripDouble", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripBool", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripBool", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripString", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripString", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_asyncRoundTripSwiftHeapObject", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripSwiftHeapObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_asyncRoundTripJSObject", + "effects" : { + "isAsync" : true, + "isStatic" : false, + "isThrows" : false + }, + "name" : "asyncRoundTripJSObject", + "parameters" : [ + { + "label" : "v", + "name" : "v", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_takeGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "takeGreeter", + "parameters" : [ + { + "label" : "g", + "name" : "g", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "label" : "name", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_createCalculator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createCalculator", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Calculator" + } + } + }, + { + "abiName" : "bjs_useCalculator", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "useCalculator", + "parameters" : [ + { + "label" : "calc", + "name" : "calc", + "type" : { + "swiftHeapObject" : { + "_0" : "Calculator" + } + } + }, + { + "label" : "x", + "name" : "x", + "type" : { + "int" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_testGreeterToJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testGreeterToJSValue", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_testCalculatorToJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testCalculatorToJSValue", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_testSwiftClassAsJSValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testSwiftClassAsJSValue", + "parameters" : [ + { + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "jsObject" : { + + } + } + }, + { + "abiName" : "bjs_setDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_getDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getDirection", + "parameters" : [ + + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_processDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processDirection", + "parameters" : [ + { + "label" : "_", + "name" : "input", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "abiName" : "bjs_setTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_getTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTheme", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_setHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setHttpStatus", + "parameters" : [ + { + "label" : "_", + "name" : "status", + "type" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_getHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getHttpStatus", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_processTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_setTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSDirection", + "parameters" : [ + { + "label" : "_", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + }, + { + "abiName" : "bjs_getTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTSDirection", + "parameters" : [ + + ], + "returnType" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + }, + { + "abiName" : "bjs_setTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setTSTheme", + "parameters" : [ + { + "label" : "_", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_getTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getTSTheme", + "parameters" : [ + + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_roundtripNetworkingAPIMethod", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripNetworkingAPIMethod", + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + }, + { + "abiName" : "bjs_roundtripConfigurationLogLevel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripConfigurationLogLevel", + "parameters" : [ + { + "label" : "_", + "name" : "level", + "type" : { + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_roundtripConfigurationPort", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripConfigurationPort", + "parameters" : [ + { + "label" : "_", + "name" : "port", + "type" : { + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_processConfigurationLogLevel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processConfigurationLogLevel", + "parameters" : [ + { + "label" : "_", + "name" : "level", + "type" : { + "rawValueEnum" : { + "_0" : "Configuration.LogLevel", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Configuration.Port", + "_1" : "Int" + } + } + }, + { + "abiName" : "bjs_roundtripInternalSupportedMethod", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripInternalSupportedMethod", + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "caseEnum" : { + "_0" : "Internal.SupportedMethod" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Internal.SupportedMethod" + } + } + }, + { + "abiName" : "bjs_roundtripAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAPIResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultFailure", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultFlag", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultFlag", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultRate", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultRate", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "float" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_makeAPIResultPrecise", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPIResultPrecise", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "abiName" : "bjs_roundtripComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripComplexResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "value", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultError", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultError", + "parameters" : [ + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultLocation", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultLocation", + "parameters" : [ + { + "label" : "_", + "name" : "lat", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "lng", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultStatus", + "parameters" : [ + { + "label" : "_", + "name" : "active", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultCoordinates", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultCoordinates", + "parameters" : [ + { + "label" : "_", + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "y", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "z", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultComprehensive", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultComprehensive", + "parameters" : [ + { + "label" : "_", + "name" : "flag1", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "flag2", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "count1", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "count2", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "value1", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "value2", + "type" : { + "double" : { + + } + } + }, + { + "label" : "_", + "name" : "text1", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "text2", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "text3", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeComplexResultInfo", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeComplexResultInfo", + "parameters" : [ + + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + }, + { + "abiName" : "bjs_makeUtilitiesResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeUtilitiesResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_makeUtilitiesResultFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeUtilitiesResultFailure", + "parameters" : [ + { + "label" : "_", + "name" : "error", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_makeUtilitiesResultStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeUtilitiesResultStatus", + "parameters" : [ + { + "label" : "_", + "name" : "active", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + + } + } + }, + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_makeAPINetworkingResultSuccess", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPINetworkingResultSuccess", + "parameters" : [ + { + "label" : "_", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + }, + { + "abiName" : "bjs_makeAPINetworkingResultFailure", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAPINetworkingResultFailure", + "parameters" : [ + { + "label" : "_", + "name" : "error", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "code", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + }, + { + "abiName" : "bjs_roundtripUtilitiesResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripUtilitiesResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "Utilities.Result" + } + } + }, + { + "abiName" : "bjs_roundtripAPINetworkingResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundtripAPINetworkingResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + } + ], + "returnType" : { + "associatedValueEnum" : { + "_0" : "API.NetworkingResult" + } + } + }, + { + "abiName" : "bjs_roundTripOptionalString", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalString", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalInt", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalInt", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalBool", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalBool", + "parameters" : [ + { + "label" : "flag", + "name" : "flag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalFloat", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalFloat", + "parameters" : [ + { + "label" : "number", + "name" : "number", + "type" : { + "optional" : { + "_0" : { + "float" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "float" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalDouble", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalDouble", + "parameters" : [ + { + "label" : "precision", + "name" : "precision", + "type" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalMixSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalMixSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalSwiftSyntax", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalSwiftSyntax", + "parameters" : [ + { + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalWithSpaces", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalWithSpaces", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "double" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTypeAlias", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTypeAlias", + "parameters" : [ + { + "label" : "age", + "name" : "age", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalStatus", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTheme", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalHttpStatus", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalHttpStatus", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTSDirection", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTSDirection", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "TSDirection" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalTSTheme", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalTSTheme", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "TSTheme", + "_1" : "String" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalNetworkingAPIMethod", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalNetworkingAPIMethod", + "parameters" : [ + { + "label" : "_", + "name" : "method", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Networking.API.Method" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIResult", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "abiName" : "bjs_compareAPIResults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "compareAPIResults", + "parameters" : [ + { + "label" : "_", + "name" : "r1", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "label" : "_", + "name" : "r2", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_roundTripOptionalComplexResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalComplexResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "ComplexResult" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalClass", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalClass", + "parameters" : [ + { + "label" : "value", + "name" : "value", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_roundTripOptionalAPIOptionalResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripOptionalAPIOptionalResult", + "parameters" : [ + { + "label" : "result", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIOptionalResult" + } + } + } + } + }, + { + "abiName" : "bjs_createPropertyHolder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createPropertyHolder", + "parameters" : [ + { + "label" : "intValue", + "name" : "intValue", + "type" : { + "int" : { + + } + } + }, + { + "label" : "floatValue", + "name" : "floatValue", + "type" : { + "float" : { + + } + } + }, + { + "label" : "doubleValue", + "name" : "doubleValue", + "type" : { + "double" : { + + } + } + }, + { + "label" : "boolValue", + "name" : "boolValue", + "type" : { + "bool" : { + + } + } + }, + { + "label" : "stringValue", + "name" : "stringValue", + "type" : { + "string" : { + + } + } + }, + { + "label" : "jsObject", + "name" : "jsObject", + "type" : { + "jsObject" : { + + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "PropertyHolder" + } + } + }, + { + "abiName" : "bjs_testPropertyHolder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testPropertyHolder", + "parameters" : [ + { + "label" : "holder", + "name" : "holder", + "type" : { + "swiftHeapObject" : { + "_0" : "PropertyHolder" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_resetObserverCounts", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "resetObserverCounts", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_getObserverStats", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getObserverStats", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testStringDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testStringDefault", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Hello World" + } + }, + "label" : "message", + "name" : "message", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testIntDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testIntDefault", + "parameters" : [ + { + "defaultValue" : { + "int" : { + "_0" : 42 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_testBoolDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testBoolDefault", + "parameters" : [ + { + "defaultValue" : { + "bool" : { + "_0" : true + } + }, + "label" : "flag", + "name" : "flag", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_testOptionalDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testOptionalDefault", + "parameters" : [ + { + "defaultValue" : { + "null" : { + + } + }, + "label" : "name", + "name" : "name", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + } + ], + "returnType" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "abiName" : "bjs_testMultipleDefaults", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testMultipleDefaults", + "parameters" : [ + { + "defaultValue" : { + "string" : { + "_0" : "Default Title" + } + }, + "label" : "title", + "name" : "title", + "type" : { + "string" : { + + } + } + }, + { + "defaultValue" : { + "int" : { + "_0" : -10 + } + }, + "label" : "count", + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "defaultValue" : { + "bool" : { + "_0" : false + } + }, + "label" : "enabled", + "name" : "enabled", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testSimpleEnumDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testSimpleEnumDefault", + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Status", + "_1" : "success" + } + }, + "label" : "status", + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Status" + } + } + }, + { + "abiName" : "bjs_testDirectionDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testDirectionDefault", + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Direction", + "_1" : "north" + } + }, + "label" : "direction", + "name" : "direction", + "type" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + ], + "returnType" : { + "caseEnum" : { + "_0" : "Direction" + } + } + }, + { + "abiName" : "bjs_testRawStringEnumDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testRawStringEnumDefault", + "parameters" : [ + { + "defaultValue" : { + "enumCase" : { + "_0" : "Theme", + "_1" : "light" + } + }, + "label" : "theme", + "name" : "theme", + "type" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + ], + "returnType" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + }, + { + "abiName" : "bjs_testComplexInit", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testComplexInit", + "parameters" : [ + { + "defaultValue" : { + "objectWithArguments" : { + "_0" : "Greeter", + "_1" : [ + { + "string" : { + "_0" : "DefaultGreeter" + } + } + ] + } + }, + "label" : "greeter", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_testEmptyInit", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testEmptyInit", + "parameters" : [ + { + "defaultValue" : { + "object" : { + "_0" : "StaticPropertyHolder" + } + }, + "label" : "_", + "name" : "object", + "type" : { + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "StaticPropertyHolder" + } + } + }, + { + "abiName" : "bjs_formatName", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "formatName", + "parameters" : [ + { + "label" : "_", + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "label" : "transform", + "name" : "transform", + "type" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_makeFormatter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeFormatter", + "parameters" : [ + { + "label" : "prefix", + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSS_SS", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "string" : { + + } + } + ], + "returnType" : { + "string" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_makeAdder", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "makeAdder", + "parameters" : [ + { + "label" : "base", + "name" : "base", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "closure" : { + "_0" : { + "isAsync" : false, + "isThrows" : false, + "mangleName" : "20BridgeJSRuntimeTestsSi_Si", + "moduleName" : "BridgeJSRuntimeTests", + "parameters" : [ + { + "int" : { + + } + } + ], + "returnType" : { + "int" : { + + } + } + } + } + } + }, + { + "abiName" : "bjs_testStructDefault", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testStructDefault", + "parameters" : [ + { + "defaultValue" : { + "structLiteral" : { + "_0" : "DataPoint", + "_1" : [ + { + "name" : "x", + "value" : { + "float" : { + "_0" : 1 + } + } + }, + { + "name" : "y", + "value" : { + "float" : { + "_0" : 2 + } + } + }, + { + "name" : "label", + "value" : { + "string" : { + "_0" : "default" + } + } + }, + { + "name" : "optCount", + "value" : { + "null" : { + + } + } + }, + { + "name" : "optFlag", + "value" : { + "null" : { + + } + } + } + ] + } + }, + "label" : "point", + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_roundTripDataPoint", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripDataPoint", + "parameters" : [ + { + "label" : "_", + "name" : "data", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + }, + { + "abiName" : "bjs_roundTripContact", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripContact", + "parameters" : [ + { + "label" : "_", + "name" : "contact", + "type" : { + "swiftStruct" : { + "_0" : "Contact" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Contact" + } + } + }, + { + "abiName" : "bjs_roundTripConfig", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripConfig", + "parameters" : [ + { + "label" : "_", + "name" : "config", + "type" : { + "swiftStruct" : { + "_0" : "Config" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "Config" + } + } + }, + { + "abiName" : "bjs_roundTripSessionData", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripSessionData", + "parameters" : [ + { + "label" : "_", + "name" : "session", + "type" : { + "swiftStruct" : { + "_0" : "SessionData" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "SessionData" + } + } + }, + { + "abiName" : "bjs_roundTripValidationReport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "roundTripValidationReport", + "parameters" : [ + { + "label" : "_", + "name" : "report", + "type" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + }, + { + "abiName" : "bjs_updateValidationReport", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "updateValidationReport", + "parameters" : [ + { + "label" : "_", + "name" : "newResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "label" : "_", + "name" : "report", + "type" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + } + ], + "returnType" : { + "swiftStruct" : { + "_0" : "ValidationReport" + } + } + }, + { + "abiName" : "bjs_testContainerWithStruct", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "testContainerWithStruct", + "parameters" : [ + { + "label" : "_", + "name" : "point", + "type" : { + "swiftStruct" : { + "_0" : "DataPoint" + } + } + } + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Container" + } + } + } + ], + "moduleName" : "BridgeJSRuntimeTests", + "protocols" : [ + { + "methods" : [ + { + "abiName" : "bjs_DataProcessor_increment", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "increment", + "parameters" : [ + { + "label" : "by", + "name" : "amount", + "type" : { + "int" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getValue", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getValue", + "parameters" : [ + + ], + "returnType" : { + "int" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_setLabelElements", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "setLabelElements", + "parameters" : [ + { + "label" : "_", + "name" : "labelPrefix", + "type" : { + "string" : { + + } + } + }, + { + "label" : "_", + "name" : "labelSuffix", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getLabel", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getLabel", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_isEven", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "isEven", + "parameters" : [ + + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_processGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_createGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createGreeter", + "parameters" : [ + + ], + "returnType" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "abiName" : "bjs_DataProcessor_processOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "processOptionalGreeter", + "parameters" : [ + { + "label" : "_", + "name" : "greeter", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_createOptionalGreeter", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "createOptionalGreeter", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + }, + { + "abiName" : "bjs_DataProcessor_handleAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "handleAPIResult", + "parameters" : [ + { + "label" : "_", + "name" : "result", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "abiName" : "bjs_DataProcessor_getAPIResult", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "getAPIResult", + "parameters" : [ + + ], + "returnType" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "name" : "DataProcessor", + "properties" : [ + { + "isReadonly" : false, + "name" : "count", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : false, + "name" : "optionalTag", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "optionalCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "optionalTheme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "httpStatus", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "HttpStatus", + "_1" : "Int" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "apiResult", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + }, + { + "isReadonly" : false, + "name" : "helper", + "type" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + }, + { + "isReadonly" : false, + "name" : "optionalHelper", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ] + } + ], + "structs" : [ + { + "constructor" : { + "abiName" : "bjs_DataPoint_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "label" : "x", + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "label" : "y", + "name" : "y", + "type" : { + "double" : { + + } + } + }, + { + "label" : "label", + "name" : "label", + "type" : { + "string" : { + + } + } + }, + { + "label" : "optCount", + "name" : "optCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "label" : "optFlag", + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ] + }, + "methods" : [ + + ], + "name" : "DataPoint", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "x", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "y", + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "label", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optCount", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "optFlag", + "type" : { + "optional" : { + "_0" : { + "bool" : { + + } + } + } + } + } + ], + "swiftCallName" : "DataPoint" + }, + { + "methods" : [ + + ], + "name" : "Address", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "street", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "city", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "zipCode", + "type" : { + "optional" : { + "_0" : { + "int" : { + + } + } + } + } + } + ], + "swiftCallName" : "Address" + }, + { + "methods" : [ + + ], + "name" : "Contact", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "age", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "address", + "type" : { + "swiftStruct" : { + "_0" : "Address" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "email", + "type" : { + "optional" : { + "_0" : { + "string" : { + + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "secondaryAddress", + "type" : { + "optional" : { + "_0" : { + "swiftStruct" : { + "_0" : "Address" + } + } + } + } + } + ], + "swiftCallName" : "Contact" + }, + { + "methods" : [ + + ], + "name" : "Config", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "theme", + "type" : { + "optional" : { + "_0" : { + "rawValueEnum" : { + "_0" : "Theme", + "_1" : "String" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "direction", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Direction" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + ], + "swiftCallName" : "Config" + }, + { + "methods" : [ + + ], + "name" : "SessionData", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "owner", + "type" : { + "optional" : { + "_0" : { + "swiftHeapObject" : { + "_0" : "Greeter" + } + } + } + } + } + ], + "swiftCallName" : "SessionData" + }, + { + "methods" : [ + + ], + "name" : "ValidationReport", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "id", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "result", + "type" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "status", + "type" : { + "optional" : { + "_0" : { + "caseEnum" : { + "_0" : "Status" + } + } + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "outcome", + "type" : { + "optional" : { + "_0" : { + "associatedValueEnum" : { + "_0" : "APIResult" + } + } + } + } + } + ], + "swiftCallName" : "ValidationReport" + }, + { + "constructor" : { + "abiName" : "bjs_MathOperations_init", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "parameters" : [ + { + "defaultValue" : { + "double" : { + "_0" : 0 + } + }, + "label" : "baseValue", + "name" : "baseValue", + "type" : { + "double" : { + + } + } + } + ] + }, + "methods" : [ + { + "abiName" : "bjs_MathOperations_add", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "add", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "defaultValue" : { + "double" : { + "_0" : 10 + } + }, + "label" : "b", + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_MathOperations_multiply", + "effects" : { + "isAsync" : false, + "isStatic" : false, + "isThrows" : false + }, + "name" : "multiply", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "abiName" : "bjs_MathOperations_static_subtract", + "effects" : { + "isAsync" : false, + "isStatic" : true, + "isThrows" : false + }, + "name" : "subtract", + "parameters" : [ + { + "label" : "a", + "name" : "a", + "type" : { + "double" : { + + } + } + }, + { + "label" : "b", + "name" : "b", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + }, + "staticContext" : { + "structName" : { + "_0" : "MathOperations" + } + } + } + ], + "name" : "MathOperations", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "baseValue", + "type" : { + "double" : { + + } + } + } + ], + "swiftCallName" : "MathOperations" + }, + { + "methods" : [ + + ], + "name" : "ConfigStruct", + "properties" : [ + { + "isReadonly" : true, + "isStatic" : false, + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : false, + "name" : "value", + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "defaultConfig", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "maxRetries", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "int" : { + + } + } + }, + { + "isReadonly" : false, + "isStatic" : true, + "name" : "timeout", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "double" : { + + } + } + }, + { + "isReadonly" : true, + "isStatic" : true, + "name" : "computedSetting", + "staticContext" : { + "structName" : { + "_0" : "ConfigStruct" + } + }, + "type" : { + "string" : { + + } + } + } + ], + "swiftCallName" : "ConfigStruct" + } + ] + }, + "imported" : { + "children" : [ + { + "functions" : [ + + ], + "types" : [ + + ] + }, + { + "functions" : [ + { + "name" : "jsRoundTripVoid", + "parameters" : [ + + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsRoundTripNumber", + "parameters" : [ + { + "name" : "v", + "type" : { + "double" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "jsRoundTripBool", + "parameters" : [ + { + "name" : "v", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "name" : "jsRoundTripString", + "parameters" : [ + { + "name" : "v", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "jsThrowOrVoid", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + }, + { + "name" : "jsThrowOrNumber", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "double" : { + + } + } + }, + { + "name" : "jsThrowOrBool", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "bool" : { + + } + } + }, + { + "name" : "jsThrowOrString", + "parameters" : [ + { + "name" : "shouldThrow", + "type" : { + "bool" : { + + } + } + } + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "runAsyncWorks", + "parameters" : [ + + ], + "returnType" : { + "jsObject" : { + "_0" : "JSPromise" + } + } + } + ], + "types" : [ + { + "constructor" : { + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ] + }, + "getters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + }, + { + "name" : "prefix", + "type" : { + "string" : { + + } + } + } + ], + "methods" : [ + { + "name" : "greet", + "parameters" : [ + + ], + "returnType" : { + "string" : { + + } + } + }, + { + "name" : "changeName", + "parameters" : [ + { + "name" : "name", + "type" : { + "string" : { + + } + } + } + ], + "returnType" : { + "void" : { + + } + } + } + ], + "name" : "JsGreeter", + "setters" : [ + { + "functionName" : "name_set", + "name" : "name", + "type" : { + "string" : { + + } + } + } + ] + } + ] + }, + { + "functions" : [ + + ], + "types" : [ + + ] + } + ], + "moduleName" : "BridgeJSRuntimeTests" + }, + "moduleName" : "BridgeJSRuntimeTests" +} \ No newline at end of file diff --git a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts index e69de29b..86a72ca0 100644 --- a/Tests/BridgeJSRuntimeTests/bridge-js.d.ts +++ b/Tests/BridgeJSRuntimeTests/bridge-js.d.ts @@ -0,0 +1,18 @@ +export function jsRoundTripVoid(): void +export function jsRoundTripNumber(v: number): number +export function jsRoundTripBool(v: boolean): boolean +export function jsRoundTripString(v: string): string +export function jsThrowOrVoid(shouldThrow: boolean): void +export function jsThrowOrNumber(shouldThrow: boolean): number +export function jsThrowOrBool(shouldThrow: boolean): boolean +export function jsThrowOrString(shouldThrow: boolean): string + +export class JsGreeter { + name: string; + readonly prefix: string; + constructor(name: string, prefix: string); + greet(): string; + changeName(name: string): void; +} + +export function runAsyncWorks(): Promise; \ No newline at end of file diff --git a/Utilities/bridge-js-generate.sh b/Utilities/bridge-js-generate.sh index b79befa2..26fde33e 100755 --- a/Utilities/bridge-js-generate.sh +++ b/Utilities/bridge-js-generate.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package plugin --allow-writing-to-package-directory bridge-js -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --package-path ./Benchmarks plugin --allow-writing-to-package-directory bridge-js -env JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1 swift package --package-path ./Examples/PlayBridgeJS plugin --allow-writing-to-package-directory bridge-js +set -euxo pipefail +swift build --package-path ./Plugins/BridgeJS --product BridgeJSTool + +./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name BridgeJSRuntimeTests --target-dir ./Tests/BridgeJSRuntimeTests --output-dir ./Tests/BridgeJSRuntimeTests/Generated +./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name BridgeJSGlobalTests --target-dir ./Tests/BridgeJSGlobalTests --output-dir ./Tests/BridgeJSGlobalTests/Generated +./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name Benchmarks --target-dir ./Benchmarks/Sources --output-dir ./Benchmarks/Sources/Generated +./Plugins/BridgeJS/.build/debug/BridgeJSTool generate --project ./tsconfig.json --module-name PlayBridgeJS --target-dir ./Examples/PlayBridgeJS/Sources --output-dir ./Examples/PlayBridgeJS/Sources/Generated