@willbooster/web-tree-sitter 1.0.3 → 1.0.5

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.
@@ -3609,7 +3609,7 @@ __name(unmarshalLanguageMetadata, "unmarshalLanguageMetadata");
3609
3609
 
3610
3610
  // src/language.ts
3611
3611
  var LANGUAGE_FUNCTION_REGEX = /^tree_sitter_\w+$/;
3612
- var Language = class _Language {
3612
+ var Language = class {
3613
3613
  static {
3614
3614
  __name(this, "Language");
3615
3615
  }
@@ -3828,18 +3828,7 @@ ${body2}`);
3828
3828
  }
3829
3829
  }
3830
3830
  const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
3831
- return _Language.loadFromWasmExports(mod, { sync: false });
3832
- }
3833
- static loadFromWasmExports(mod, { sync }) {
3834
- const symbolNames = Object.keys(mod);
3835
- const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
3836
- if (!functionName) {
3837
- console.log(`Couldn't find language function in Wasm file. Symbols:
3838
- ${JSON.stringify(symbolNames, null, 2)}`);
3839
- throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
3840
- }
3841
- const languageAddress = mod[functionName]();
3842
- return new _Language(INTERNAL, languageAddress);
3831
+ return loadFromWasmExports(mod, { sync: false });
3843
3832
  }
3844
3833
  /**
3845
3834
  * Load a language synchronously from a pre-compiled WebAssembly module.
@@ -3847,9 +3836,21 @@ ${JSON.stringify(symbolNames, null, 2)}`);
3847
3836
  */
3848
3837
  static loadSync(wasmModule) {
3849
3838
  const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
3850
- return _Language.loadFromWasmExports(mod, { sync: true });
3839
+ return loadFromWasmExports(mod, { sync: true });
3851
3840
  }
3852
3841
  };
3842
+ function loadFromWasmExports(mod, { sync }) {
3843
+ const symbolNames = Object.keys(mod);
3844
+ const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
3845
+ if (!functionName) {
3846
+ console.log(`Couldn't find language function in Wasm file. Symbols:
3847
+ ${JSON.stringify(symbolNames, null, 2)}`);
3848
+ throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
3849
+ }
3850
+ const languageAddress = mod[functionName]();
3851
+ return new Language(INTERNAL, languageAddress);
3852
+ }
3853
+ __name(loadFromWasmExports, "loadFromWasmExports");
3853
3854
 
3854
3855
  // src/bindings.ts
3855
3856
  var import_web_tree_sitter = __toESM(require_web_tree_sitter(), 1);