refactor(web): rename tree-sitter.js to web-tree-sitter.js#4194
Merged
amaanq merged 3 commits intotree-sitter:masterfrom Feb 12, 2025
Merged
refactor(web): rename tree-sitter.js to web-tree-sitter.js#4194amaanq merged 3 commits intotree-sitter:masterfrom
amaanq merged 3 commits intotree-sitter:masterfrom
Conversation
440b814 to
af294f9
Compare
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
WillLillis
reviewed
Feb 9, 2025
WillLillis
approved these changes
Feb 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The sourcemapping url in the js files points to
tree-sitter.js, but we rename these files in the GH release toweb-tree-sitter.jsandweb-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 inpackage.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.