Skip to content

Commit eb1f0e3

Browse files
committed
BridgeJS: Update PackageToJS template and add short instruction
1 parent e7e1b79 commit eb1f0e3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,9 @@ Run this script when you've made changes to:
112112
113113
These changes require updating the pre-generated Swift bindings committed to the repository.
114114
115+
**Adding new BridgeJS intrinsics:**
116+
117+
If you add new `@_extern(wasm, module: "bjs")` functions to [`BridgeJSInstrincics.swift`](Sources/JavaScriptKit/BridgeJSInstrincics.swift), also add corresponding stub entries to [`Plugins/PackageToJS/Templates/instantiate.js`](Plugins/PackageToJS/Templates/instantiate.js) in the `importObject["bjs"]` object. This allows packages without BridgeJS-generated code to instantiate successfully.
118+
115119
## Support
116120
If you have any questions or need assistance, feel free to reach out via [GitHub Issues](https://github.com/swiftwasm/JavaScriptKit/issues) or [Discord](https://discord.gg/ashJW8T8yp).

Plugins/PackageToJS/Templates/instantiate.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ async function createInstantiator(options, swift) {
5454
swift_js_return_optional_float: unexpectedBjsCall,
5555
swift_js_return_optional_heap_object: unexpectedBjsCall,
5656
swift_js_return_optional_object: unexpectedBjsCall,
57+
swift_js_get_optional_int_presence: unexpectedBjsCall,
58+
swift_js_get_optional_int_value: unexpectedBjsCall,
59+
swift_js_get_optional_string: unexpectedBjsCall,
60+
swift_js_get_optional_float_presence: unexpectedBjsCall,
61+
swift_js_get_optional_float_value: unexpectedBjsCall,
62+
swift_js_get_optional_double_presence: unexpectedBjsCall,
63+
swift_js_get_optional_double_value: unexpectedBjsCall,
5764
}
5865
},
5966
/** @param {WebAssembly.Instance} instance */

0 commit comments

Comments
 (0)