Skip to content

refactor(web): rename tree-sitter.js to web-tree-sitter.js#4194

Merged
amaanq merged 3 commits intotree-sitter:masterfrom
amaanq:web-files
Feb 12, 2025
Merged

refactor(web): rename tree-sitter.js to web-tree-sitter.js#4194
amaanq merged 3 commits intotree-sitter:masterfrom
amaanq:web-files

Conversation

@amaanq
Copy link
Member

@amaanq amaanq commented Feb 8, 2025

Problem

The sourcemapping url in the js files points to tree-sitter.js, but we rename these files in the GH release to web-tree-sitter.js and web-tree-sitter-debug.js. This breaks the sourcemap, which is unhelpful to users trying to debug the library.

Solution

Instead, we rename the output file in emscripten & esbuild to web-tree-sitter.(js|wasm), so the sourcemapping url will always be correct, and this doesn't require us to move the file. This is not breaking for consumers of the web bindings since we update the exports in package.json, nor the playground as both filenames will be kept in the .github.io repo.

In the release job, we don't rename the files and instead throw the web files into their own tarball, including the lib files (for debugging the wasm module with its sourcemap).

For verification, a sample release with the web-tree-sitter tarball can be found here, and each sourcemap's source files has the correct relative file path.

@amaanq amaanq force-pushed the web-files branch 2 times, most recently from 440b814 to af294f9 Compare February 8, 2025 20:08
This is not breaking for consumers of the web bindings, nor the
playground as both filenames will be kept in the .github.io repo
We don't actually use this data, it runs without a purpose
@amaanq amaanq merged commit 8e79929 into tree-sitter:master Feb 12, 2025
20 checks passed
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.

Incorrect sourceMappingURLs in web-tree-sitter

2 participants