GeezerVison is showing github.com — BridgeJS: Utilities/bridge-js-generate.sh · rarestype/JavaScriptKit@eddc81f
File treeExpand file treeCollapse file tree Open diff view settings Benchmarks/Sources/Generated Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated Tests/BridgeJSRuntimeTests/Generated
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Benchmarks/Sources/Generated/BridgeJS.ExportSwift.swift +28-25Lines changed: 28 additions & 25 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -362,18 +362,19 @@ public func _bjs_EnumRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { | 362 | 362 |
| 363 | 363 | extension EnumRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { | 364 | 364 | var jsValue: JSValue { | 365 | | - #if arch(wasm32) | 366 | | - @_extern(wasm, module: "Benchmarks", name: "bjs_EnumRoundtrip_wrap") | 367 | | - func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 | 368 | | - #else | 369 | | - func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { | 370 | | - fatalError("Only available on WebAssembly") | 371 | | - } | 372 | | - #endif | 373 | 365 | return .object(JSObject(id: UInt32(bitPattern: _bjs_EnumRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) | 374 | 366 | } | 375 | 367 | } | 376 | 368 |
| | 369 | +#if arch(wasm32) | | 370 | +@_extern(wasm, module: "Benchmarks", name: "bjs_EnumRoundtrip_wrap") | | 371 | +fileprivate func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 | | 372 | +#else | | 373 | +fileprivate func _bjs_EnumRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { | | 374 | + fatalError("Only available on WebAssembly") | | 375 | +} | | 376 | +#endif | | 377 | + | 377 | 378 | @_expose(wasm, "bjs_ComplexResultRoundtrip_init") | 378 | 379 | @_cdecl("bjs_ComplexResultRoundtrip_init") | 379 | 380 | public func _bjs_ComplexResultRoundtrip_init() -> UnsafeMutableRawPointer { | @@ -491,18 +492,19 @@ public func _bjs_ComplexResultRoundtrip_deinit(pointer: UnsafeMutableRawPointer) | 491 | 492 |
| 492 | 493 | extension ComplexResultRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { | 493 | 494 | var jsValue: JSValue { | 494 | | - #if arch(wasm32) | 495 | | - @_extern(wasm, module: "Benchmarks", name: "bjs_ComplexResultRoundtrip_wrap") | 496 | | - func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 | 497 | | - #else | 498 | | - func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { | 499 | | - fatalError("Only available on WebAssembly") | 500 | | - } | 501 | | - #endif | 502 | 495 | return .object(JSObject(id: UInt32(bitPattern: _bjs_ComplexResultRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) | 503 | 496 | } | 504 | 497 | } | 505 | 498 |
| | 499 | +#if arch(wasm32) | | 500 | +@_extern(wasm, module: "Benchmarks", name: "bjs_ComplexResultRoundtrip_wrap") | | 501 | +fileprivate func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 | | 502 | +#else | | 503 | +fileprivate func _bjs_ComplexResultRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { | | 504 | + fatalError("Only available on WebAssembly") | | 505 | +} | | 506 | +#endif | | 507 | + | 506 | 508 | @_expose(wasm, "bjs_StringRoundtrip_init") | 507 | 509 | @_cdecl("bjs_StringRoundtrip_init") | 508 | 510 | public func _bjs_StringRoundtrip_init() -> UnsafeMutableRawPointer { | @@ -543,14 +545,15 @@ public func _bjs_StringRoundtrip_deinit(pointer: UnsafeMutableRawPointer) { | 543 | 545 |
| 544 | 546 | extension StringRoundtrip: ConvertibleToJSValue, _BridgedSwiftHeapObject { | 545 | 547 | var jsValue: JSValue { | 546 | | - #if arch(wasm32) | 547 | | - @_extern(wasm, module: "Benchmarks", name: "bjs_StringRoundtrip_wrap") | 548 | | - func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 | 549 | | - #else | 550 | | - func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { | 551 | | - fatalError("Only available on WebAssembly") | 552 | | - } | 553 | | - #endif | 554 | 548 | return .object(JSObject(id: UInt32(bitPattern: _bjs_StringRoundtrip_wrap(Unmanaged.passRetained(self).toOpaque())))) | 555 | 549 | } | 556 | | -} | | 550 | +} | | 551 | + | | 552 | +#if arch(wasm32) | | 553 | +@_extern(wasm, module: "Benchmarks", name: "bjs_StringRoundtrip_wrap") | | 554 | +fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 | | 555 | +#else | | 556 | +fileprivate func _bjs_StringRoundtrip_wrap(_: UnsafeMutableRawPointer) -> Int32 { | | 557 | + fatalError("Only available on WebAssembly") | | 558 | +} | | 559 | +#endif |
Collapse file Copy file name to clipboardExpand all lines: Benchmarks/Sources/Generated/BridgeJS.ImportTS.swift +27-24Lines changed: 27 additions & 24 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 |
| 7 | 7 | @_spi(BridgeJS) import JavaScriptKit | 8 | 8 |
| | 9 | +#if arch(wasm32) | | 10 | +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") | | 11 | +func bjs_benchmarkHelperNoop() -> Void | | 12 | +#else | | 13 | +func bjs_benchmarkHelperNoop() -> Void { | | 14 | + fatalError("Only available on WebAssembly") | | 15 | +} | | 16 | +#endif | | 17 | + | 9 | 18 | func benchmarkHelperNoop() throws(JSException) -> Void { | 10 | | - #if arch(wasm32) | 11 | | - @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoop") | 12 | | - func bjs_benchmarkHelperNoop() -> Void | 13 | | - #else | 14 | | - func bjs_benchmarkHelperNoop() -> Void { | 15 | | - fatalError("Only available on WebAssembly") | 16 | | - } | 17 | | - #endif | 18 | 19 | bjs_benchmarkHelperNoop() | 19 | 20 | if let error = _swift_js_take_exception() { | 20 | 21 | throw error | 21 | 22 | } | 22 | 23 | } | 23 | 24 |
| | 25 | +#if arch(wasm32) | | 26 | +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") | | 27 | +func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void | | 28 | +#else | | 29 | +func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { | | 30 | + fatalError("Only available on WebAssembly") | | 31 | +} | | 32 | +#endif | | 33 | + | 24 | 34 | func benchmarkHelperNoopWithNumber(_ n: Double) throws(JSException) -> Void { | 25 | | - #if arch(wasm32) | 26 | | - @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkHelperNoopWithNumber") | 27 | | - func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void | 28 | | - #else | 29 | | - func bjs_benchmarkHelperNoopWithNumber(_ n: Float64) -> Void { | 30 | | - fatalError("Only available on WebAssembly") | 31 | | - } | 32 | | - #endif | 33 | 35 | bjs_benchmarkHelperNoopWithNumber(n.bridgeJSLowerParameter()) | 34 | 36 | if let error = _swift_js_take_exception() { | 35 | 37 | throw error | 36 | 38 | } | 37 | 39 | } | 38 | 40 |
| | 41 | +#if arch(wasm32) | | 42 | +@_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") | | 43 | +func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void | | 44 | +#else | | 45 | +func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { | | 46 | + fatalError("Only available on WebAssembly") | | 47 | +} | | 48 | +#endif | | 49 | + | 39 | 50 | func benchmarkRunner(_ name: String, _ body: JSObject) throws(JSException) -> Void { | 40 | | - #if arch(wasm32) | 41 | | - @_extern(wasm, module: "Benchmarks", name: "bjs_benchmarkRunner") | 42 | | - func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void | 43 | | - #else | 44 | | - func bjs_benchmarkRunner(_ name: Int32, _ body: Int32) -> Void { | 45 | | - fatalError("Only available on WebAssembly") | 46 | | - } | 47 | | - #endif | 48 | 51 | bjs_benchmarkRunner(name.bridgeJSLowerParameter(), body.bridgeJSLowerParameter()) | 49 | 52 | if let error = _swift_js_take_exception() { | 50 | 53 | throw error | |
Collapse file Copy file name to clipboardExpand all lines: Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ExportSwift.swift +19-17Lines changed: 19 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,18 +50,19 @@ public func _bjs_PlayBridgeJS_deinit(pointer: UnsafeMutableRawPointer) { | 50 | 50 |
| 51 | 51 | extension PlayBridgeJS: ConvertibleToJSValue, _BridgedSwiftHeapObject { | 52 | 52 | var jsValue: JSValue { | 53 | | - #if arch(wasm32) | 54 | | - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJS_wrap") | 55 | | - func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 | 56 | | - #else | 57 | | - func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 { | 58 | | - fatalError("Only available on WebAssembly") | 59 | | - } | 60 | | - #endif | 61 | 53 | return .object(JSObject(id: UInt32(bitPattern: _bjs_PlayBridgeJS_wrap(Unmanaged.passRetained(self).toOpaque())))) | 62 | 54 | } | 63 | 55 | } | 64 | 56 |
| | 57 | +#if arch(wasm32) | | 58 | +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJS_wrap") | | 59 | +fileprivate func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 | | 60 | +#else | | 61 | +fileprivate func _bjs_PlayBridgeJS_wrap(_: UnsafeMutableRawPointer) -> Int32 { | | 62 | + fatalError("Only available on WebAssembly") | | 63 | +} | | 64 | +#endif | | 65 | + | 65 | 66 | @_expose(wasm, "bjs_PlayBridgeJSOutput_outputJs") | 66 | 67 | @_cdecl("bjs_PlayBridgeJSOutput_outputJs") | 67 | 68 | public func _bjs_PlayBridgeJSOutput_outputJs(_self: UnsafeMutableRawPointer) -> Void { | @@ -114,14 +115,15 @@ public func _bjs_PlayBridgeJSOutput_deinit(pointer: UnsafeMutableRawPointer) { | 114 | 115 |
| 115 | 116 | extension PlayBridgeJSOutput: ConvertibleToJSValue, _BridgedSwiftHeapObject { | 116 | 117 | var jsValue: JSValue { | 117 | | - #if arch(wasm32) | 118 | | - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJSOutput_wrap") | 119 | | - func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 | 120 | | - #else | 121 | | - func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 { | 122 | | - fatalError("Only available on WebAssembly") | 123 | | - } | 124 | | - #endif | 125 | 118 | return .object(JSObject(id: UInt32(bitPattern: _bjs_PlayBridgeJSOutput_wrap(Unmanaged.passRetained(self).toOpaque())))) | 126 | 119 | } | 127 | | -} | | 120 | +} | | 121 | + | | 122 | +#if arch(wasm32) | | 123 | +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_PlayBridgeJSOutput_wrap") | | 124 | +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 | | 125 | +#else | | 126 | +fileprivate func _bjs_PlayBridgeJSOutput_wrap(_: UnsafeMutableRawPointer) -> Int32 { | | 127 | + fatalError("Only available on WebAssembly") | | 128 | +} | | 129 | +#endif |
Collapse file Copy file name to clipboardExpand all lines: Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.ImportTS.swift +18-16Lines changed: 18 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 |
| 7 | 7 | @_spi(BridgeJS) import JavaScriptKit | 8 | 8 |
| | 9 | +#if arch(wasm32) | | 10 | +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Skeleton") | | 11 | +func bjs_createTS2Skeleton() -> Int32 | | 12 | +#else | | 13 | +func bjs_createTS2Skeleton() -> Int32 { | | 14 | + fatalError("Only available on WebAssembly") | | 15 | +} | | 16 | +#endif | | 17 | + | 9 | 18 | func createTS2Skeleton() throws(JSException) -> TS2Skeleton { | 10 | | - #if arch(wasm32) | 11 | | - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_createTS2Skeleton") | 12 | | - func bjs_createTS2Skeleton() -> Int32 | 13 | | - #else | 14 | | - func bjs_createTS2Skeleton() -> Int32 { | 15 | | - fatalError("Only available on WebAssembly") | 16 | | - } | 17 | | - #endif | 18 | 19 | let ret = bjs_createTS2Skeleton() | 19 | 20 | if let error = _swift_js_take_exception() { | 20 | 21 | throw error | 21 | 22 | } | 22 | 23 | return TS2Skeleton.bridgeJSLiftReturn(ret) | 23 | 24 | } | 24 | 25 |
| | 26 | +#if arch(wasm32) | | 27 | +@_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Skeleton_convert") | | 28 | +func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 | | 29 | +#else | | 30 | +func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { | | 31 | + fatalError("Only available on WebAssembly") | | 32 | +} | | 33 | +#endif | | 34 | + | 25 | 35 | struct TS2Skeleton: _JSBridgedClass { | 26 | 36 | let jsObject: JSObject | 27 | 37 |
| @@ -30,14 +40,6 @@ struct TS2Skeleton: _JSBridgedClass { | 30 | 40 | } | 31 | 41 |
| 32 | 42 | func convert(_ ts: String) throws(JSException) -> String { | 33 | | - #if arch(wasm32) | 34 | | - @_extern(wasm, module: "PlayBridgeJS", name: "bjs_TS2Skeleton_convert") | 35 | | - func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 | 36 | | - #else | 37 | | - func bjs_TS2Skeleton_convert(_ self: Int32, _ ts: Int32) -> Int32 { | 38 | | - fatalError("Only available on WebAssembly") | 39 | | - } | 40 | | - #endif | 41 | 43 | let ret = bjs_TS2Skeleton_convert(self.bridgeJSLowerParameter(), ts.bridgeJSLowerParameter()) | 42 | 44 | if let error = _swift_js_take_exception() { | 43 | 45 | throw error | |
|