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

Update wasm-bindgen and wasm-pack #908

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ threadpool = "1.8.1"
toml = "0.8.1"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2.81", optional = true }
wasm-bindgen = { version = "0.2.95", optional = true }

[dev-dependencies]
criterion = "0.4.0"
Expand Down
5 changes: 1 addition & 4 deletions wasm/build-wasm.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# TODO: Ensure that version is up to date
cp README.md wasm/
cp LICENSE.md wasm/
npx [email protected] build --target web --out-dir wasm/stylua.web -- --features lua52,lua53,lua54,luau

# workaround for bundler usage
echo "export { getImports as __getImports, finalizeInit as __finalizeInit }" >> wasm/stylua.web/stylua_lib.js
Copy link
Owner

Choose a reason for hiding this comment

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

How come we are removing this line?

Copy link
Author

Choose a reason for hiding this comment

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

Good question, now that you mention this I've realized that other files in the parent directory seem to depend on these exports. The issue is the file which is generated by the latest version of wasm-pack doesn't contain getImports or finalizeInit. I'm not exactly clear on what these were actually for though...

So I've converted this to a draft for now. I'm kinda busy right now so it might be a little bit before I can dig into this and figure out what those were for.

npx [email protected] build --target web --out-dir wasm/stylua.web -- --features lua52,lua53,lua54,luau

# bundle for node CommonJS
npx [email protected] wasm/src/stylua_lib_node.cjs --file wasm/stylua_lib.cjs --format cjs
Loading