-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from biscuit-auth/0.7
biscuit v3.3 support through biscuit-auth 6.0.0
- Loading branch information
Showing
18 changed files
with
3,250 additions
and
2,793 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# How to update tree-sitter | ||
|
||
Tree-sitter is packaged in a way that makes it difficult to load it up with `wds`, it is packaged as a CommonJS module (modifying a `module.exports` object) and as such does not play well with es modules. | ||
|
||
The simplest solution I have found is to turn the CommonJS module into an ES module by adding the following at the end of the file: | ||
|
||
```js | ||
await TreeSitter.init({ | ||
locateFile(scriptName, scriptDirectory) { | ||
return "/assets/tree-sitter.wasm"; | ||
} | ||
}); | ||
export const Parser = TreeSitter; | ||
``` | ||
|
||
This also calls `init` once, with the proper location of the wasm file. | ||
|
||
So to update `tree-sitter`: | ||
|
||
- run `npm install --no-save web-tree-sitter` (check if that’s the correct version) | ||
- `cp node_modules/web-tree-sitter/tree-sitter.wasm assets/` | ||
- `cp node_modules/web-tree-sitter/tree-sitter-web.d.ts ./tree-sitter.d.ts` | ||
- edit `tree-sitter.d.ts` | ||
- remove the `declare module` scope | ||
- remove the `export = Parser` | ||
- add `export ` in front of `class Parser` | ||
- add `export ` in front of `namespace Parser` | ||
- `cp node_modules/web-tree-sitter/tree-sitter.js ./` | ||
- ```bash | ||
cat << 'EOF' >> tree-sitter.js | ||
await TreeSitter.init({ | ||
locateFile(scriptName, scriptDirectory) { | ||
return "/assets/tree-sitter.wasm"; | ||
} | ||
}); | ||
export const Parser = TreeSitter; | ||
EOF | ||
``` |
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.