0.7.0-beta.1 • Published 10 months ago

@biscuit-auth/web-components v0.7.0-beta.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

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:

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 ./
  • cat << 'EOF' >> tree-sitter.js
    await TreeSitter.init({
      locateFile(scriptName, scriptDirectory) {
        return "/assets/tree-sitter.wasm";
      }
    });
    export const Parser = TreeSitter;
    EOF
0.7.0-beta.1

10 months ago

0.7.0-alpha.1

10 months ago

0.7.0-alpha.2

10 months ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.1

2 years ago

0.5.0-alpha2

3 years ago

0.5.0-alpha1

3 years ago

0.5.0

3 years ago

0.4.1-beta1

3 years ago

0.4.0

3 years ago

0.4.0-alpha1

3 years ago

0.4.0-alpha2

3 years ago

0.4.0-alpha3

3 years ago

0.4.0-alpha4

3 years ago

0.3.15

4 years ago

0.3.14

4 years ago

0.3.13

4 years ago

0.3.12

4 years ago

0.3.11

4 years ago

0.3.10

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.0.1-beta4

4 years ago

0.0.1-beta3

4 years ago

0.0.1-beta2

4 years ago

0.0.1-beta

4 years ago