Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add initSync() to initialize WASM synchronously #100

Merged
merged 1 commit into from
Aug 25, 2024

Conversation

joyeecheung
Copy link
Member

This uses the synchronous WebAssembly APIs to compile the WASM part synchronously, which allows users to initialize the library and parse synchronously with WASM without having to resort to the JS version. This would be useful for Node.js core to use the WASM version in paths that require synchronous initialization (it currently always uses the JS version for that).

@@ -1439,4 +1439,5 @@ function isExpressionTerminator (curPos) {
const initPromise = Promise.resolve();

module.exports.init = () => initPromise;
module.exports.initSync = () => {};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why dist/lexer.js was never documented in the README, despite being what Node.js core has been using. But anyway this is added to lexer.js for parity.

This uses the synchronous WebAssembly APIs to compile the WASM
part synchronously, which allows users to initialize the library
and parse synchronously with WASM without having to resort
to the JS version. This would be useful for Node.js core to
use the WASM version in paths that require synchronous
initialization (it currently always uses the JS version for that).
@guybedford guybedford merged commit 5bb8cc3 into nodejs:main Aug 25, 2024
1 check failed
@guybedford
Copy link
Collaborator

I'm not sure why CI has suddenly stopped triggering for this repo, but I tested locally and released this in 1.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants