@willbooster/web-tree-sitter 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/web-tree-sitter",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Tree-sitter bindings for the web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -58,6 +58,13 @@
58
58
  "module": false
59
59
  },
60
60
  "types": "web-tree-sitter.d.ts",
61
+ "typesVersions": {
62
+ "*": {
63
+ "debug": [
64
+ "web-tree-sitter.d.ts"
65
+ ]
66
+ }
67
+ },
61
68
  "keywords": [
62
69
  "incremental",
63
70
  "parsing",
@@ -3009,7 +3009,7 @@ __name(unmarshalLanguageMetadata, "unmarshalLanguageMetadata");
3009
3009
 
3010
3010
  // src/language.ts
3011
3011
  var LANGUAGE_FUNCTION_REGEX = /^tree_sitter_\w+$/;
3012
- var Language = class _Language {
3012
+ var Language = class {
3013
3013
  static {
3014
3014
  __name(this, "Language");
3015
3015
  }
@@ -3228,18 +3228,7 @@ ${body2}`);
3228
3228
  }
3229
3229
  }
3230
3230
  const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
3231
- return _Language.loadFromWasmExports(mod, { sync: false });
3232
- }
3233
- static loadFromWasmExports(mod, { sync }) {
3234
- const symbolNames = Object.keys(mod);
3235
- const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
3236
- if (!functionName) {
3237
- console.log(`Couldn't find language function in Wasm file. Symbols:
3238
- ${JSON.stringify(symbolNames, null, 2)}`);
3239
- throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
3240
- }
3241
- const languageAddress = mod[functionName]();
3242
- return new _Language(INTERNAL, languageAddress);
3231
+ return loadFromWasmExports(mod, { sync: false });
3243
3232
  }
3244
3233
  /**
3245
3234
  * Load a language synchronously from a pre-compiled WebAssembly module.
@@ -3247,9 +3236,21 @@ ${JSON.stringify(symbolNames, null, 2)}`);
3247
3236
  */
3248
3237
  static loadSync(wasmModule) {
3249
3238
  const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
3250
- return _Language.loadFromWasmExports(mod, { sync: true });
3239
+ return loadFromWasmExports(mod, { sync: true });
3251
3240
  }
3252
3241
  };
3242
+ function loadFromWasmExports(mod, { sync }) {
3243
+ const symbolNames = Object.keys(mod);
3244
+ const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
3245
+ if (!functionName) {
3246
+ console.log(`Couldn't find language function in Wasm file. Symbols:
3247
+ ${JSON.stringify(symbolNames, null, 2)}`);
3248
+ throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
3249
+ }
3250
+ const languageAddress = mod[functionName]();
3251
+ return new Language(INTERNAL, languageAddress);
3252
+ }
3253
+ __name(loadFromWasmExports, "loadFromWasmExports");
3253
3254
 
3254
3255
  // src/bindings.ts
3255
3256
  var import_web_tree_sitter = __toESM(require_web_tree_sitter(), 1);