diff --git a/cli/build.rs b/cli/build.rs index 04406487..f0eacefd 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -53,8 +53,8 @@ fn main() { fn web_playground_files_present() -> bool { let paths = [ "../docs/src/assets/js/playground.js", - "../lib/binding_web/tree-sitter.js", - "../lib/binding_web/tree-sitter.wasm", + "../lib/binding_web/web-tree-sitter.js", + "../lib/binding_web/web-tree-sitter.wasm", ]; paths.iter().all(|p| Path::new(p).exists()) diff --git a/cli/src/playground.html b/cli/src/playground.html index 018c4ced..e4d02ed5 100644 --- a/cli/src/playground.html +++ b/cli/src/playground.html @@ -92,7 +92,7 @@ diff --git a/cli/src/playground.rs b/cli/src/playground.rs index 1fdaa057..bce1a18c 100644 --- a/cli/src/playground.rs +++ b/cli/src/playground.rs @@ -34,8 +34,8 @@ macro_rules! optional_resource { } optional_resource!(get_playground_js, "docs/src/assets/js/playground.js"); -optional_resource!(get_lib_js, "lib/binding_web/tree-sitter.js"); -optional_resource!(get_lib_wasm, "lib/binding_web/tree-sitter.wasm"); +optional_resource!(get_lib_js, "lib/binding_web/web-tree-sitter.js"); +optional_resource!(get_lib_wasm, "lib/binding_web/web-tree-sitter.wasm"); fn get_main_html(tree_sitter_dir: Option<&Path>) -> Cow<'static, [u8]> { tree_sitter_dir.map_or( @@ -79,16 +79,16 @@ pub fn serve(grammar_path: &Path, open_in_browser: bool) -> Result<()> { response(&playground_js, &js_header) } } - "/tree-sitter.js" => { + "/web-tree-sitter.js" => { if lib_js.is_empty() { - redirect("https://tree-sitter.github.io/tree-sitter.js") + redirect("https://tree-sitter.github.io/web-tree-sitter.js") } else { response(&lib_js, &js_header) } } - "/tree-sitter.wasm" => { + "/web-tree-sitter.wasm" => { if lib_wasm.is_empty() { - redirect("https://tree-sitter.github.io/tree-sitter.wasm") + redirect("https://tree-sitter.github.io/web-tree-sitter.wasm") } else { response(&lib_wasm, &wasm_header) } diff --git a/docs/src/6-contributing.md b/docs/src/6-contributing.md index 4584be4c..e53b85a1 100644 --- a/docs/src/6-contributing.md +++ b/docs/src/6-contributing.md @@ -197,7 +197,7 @@ and the tree-sitter module is fetched from [here][js url]. This, along with the [go package]: https://pkg.go.dev/github.com/tree-sitter/go-tree-sitter [go ts]: https://github.com/tree-sitter/go-tree-sitter [highlight crate]: https://crates.io/crates/tree-sitter-highlight -[js url]: https://tree-sitter.github.io/tree-sitter.js +[js url]: https://tree-sitter.github.io/web-tree-sitter.js [lib crate]: https://crates.io/crates/tree-sitter [mdBook]: https://rust-lang.github.io/mdBook [mdbook cli]: https://rust-lang.github.io/mdBook/guide/installation.html diff --git a/docs/src/7-playground.md b/docs/src/7-playground.md index 90f97685..92e219a8 100644 --- a/docs/src/7-playground.md +++ b/docs/src/7-playground.md @@ -102,7 +102,7 @@ you must use at least one capture, like (node_name) @capture-nameLANGUAGE_BASE_URL = "https://tree-sitter.github.io"; diff --git a/lib/binding_web/.gitignore b/lib/binding_web/.gitignore index d7edb1e8..02a02f64 100644 --- a/lib/binding_web/.gitignore +++ b/lib/binding_web/.gitignore @@ -1,6 +1,8 @@ debug/ dist/ -tree-sitter* +web-tree-sitter* +!web-tree-sitter.d.ts +!web-tree-sitter.d.ts.map lib/tree-sitter* lib/*.c lib/*.h diff --git a/lib/binding_web/CONTRIBUTING.md b/lib/binding_web/CONTRIBUTING.md index 7072abe0..b37989f2 100644 --- a/lib/binding_web/CONTRIBUTING.md +++ b/lib/binding_web/CONTRIBUTING.md @@ -120,7 +120,7 @@ npm test ### Debugging You might have noticed that when you ran `npm build`, the build process generated a couple of [sourcemaps][sourcemap]: -`tree-sitter.js.map` and `tree-sitter.wasm.map`. These sourcemaps can be used to debug the library in the browser, and are +`web-tree-sitter.js.map` and `web-tree-sitter.wasm.map`. These sourcemaps can be used to debug the library in the browser, and are shipped with the library on both NPM and the GitHub releases. #### Tweaking the Emscripten build diff --git a/lib/binding_web/README.md b/lib/binding_web/README.md index 3713df5e..7438aa04 100644 --- a/lib/binding_web/README.md +++ b/lib/binding_web/README.md @@ -9,11 +9,11 @@ WebAssembly bindings to the [Tree-sitter](https://github.com/tree-sitter/tree-si ## Setup -You can download the `tree-sitter.js` and `tree-sitter.wasm` files from [the latest GitHub release][gh release] and load +You can download the `web-tree-sitter.js` and `web-tree-sitter.wasm` files from [the latest GitHub release][gh release] and load them using a standalone script: ```html - +