Skip to content

Commit fff0769

Browse files
feat: add readme and new package
1 parent ee546b9 commit fff0769

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# rust-tree-sitter-wasm
2+
3+
This package provides binding to make tree-sitter work with Rust in browser.
4+
5+
## Architecture
6+
7+
```mermaid
8+
graph TD;
9+
web_ts_npm("web-tree-sitter(npm)") --> web_ts_sg_npm("web-tree-sitter-sg(npm)")
10+
web_ts_sg_npm -->|wasm-bindgen| web_ts_sg_crate("web-tree-sitter-sg(Rust crate)")
11+
web_ts_sg_crate -->|target:wasm| ts_facade_crate("tree-sitter-facade(Rust crate)")
12+
ts_crate("tree-sitter(Rust crate)") -->|target:native| ts_facade_crate
13+
14+
classDef crate fill:#dea584,stroke:#333;
15+
classDef npm fill:#f1e05a,stroke:#333;
16+
17+
class web_ts_npm npm;
18+
class web_ts_sg_npm npm;
19+
class web_ts_sg_crate crate;
20+
class ts_facade_crate crate;
21+
class ts_crate crate;
22+
```

web-tree-sitter-sg/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @ts-check
2+
"use-strict";
3+
4+
// this is a silly reexport because wasm-pack cannot handle
5+
// `const Parser = require('web-tree-sitter')`
6+
// nor web-tree-sitter behave as a good export citizen
7+
const TreeSitter = require("web-tree-sitter");
8+
module.exports = {
9+
Parser: TreeSitter,
10+
Language: TreeSitter.Language,
11+
init: TreeSitter.init,
12+
};

web-tree-sitter-sg/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "web-tree-sitter-sg",
3+
"description": "Tree-sitter bindings for the web repackaged for compatibility with wasm-bindgen",
4+
"version": "0.20.8",
5+
"license": "Apache-2.0 WITH LLVM-exception",
6+
"author": {
7+
"name": "Herrington Darkholme",
8+
"email": "[email protected]",
9+
"url": "https://github.com/herringtondarkholme"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/ast-grep/tree-sitter-wasm"
14+
},
15+
"main": "index.js",
16+
"scripts": {},
17+
"dependencies": {
18+
"web-tree-sitter": "0.20.8"
19+
}
20+
}

0 commit comments

Comments
 (0)