https://github.com/eclipse-biscuit/biscuit-web-components
web components for Biscuit based Datalog editors and policy execution
https://github.com/eclipse-biscuit/biscuit-web-components
Last synced: 8 months ago
JSON representation
web components for Biscuit based Datalog editors and policy execution
- Host: GitHub
- URL: https://github.com/eclipse-biscuit/biscuit-web-components
- Owner: eclipse-biscuit
- License: apache-2.0
- Created: 2021-11-06T12:20:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T13:50:35.000Z (about 1 year ago)
- Last Synced: 2025-05-03T16:36:11.727Z (about 1 year ago)
- Language: JavaScript
- Size: 789 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `biscuit-web-components`
This repo is part of the [eclipse biscuit](https://github.com/biscuit-auth/biscuit) project.
Biscuit web components are tools used to provide in-browser biscuit tooling.
See [documentation](https://doc.biscuitsec.org/usage/web-components.html)
## 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
```