@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.
- package/debug/web-tree-sitter.cjs +15 -14
- package/debug/web-tree-sitter.cjs.map +2 -2
- package/debug/web-tree-sitter.js +15 -14
- package/debug/web-tree-sitter.js.map +2 -2
- package/debug/web-tree-sitter.wasm +0 -0
- package/debug/web-tree-sitter.wasm.map +2 -2
- package/package.json +8 -1
- package/web-tree-sitter.cjs +15 -14
- package/web-tree-sitter.cjs.map +2 -2
- package/web-tree-sitter.d.cts +0 -7
- package/web-tree-sitter.d.cts.map +1 -1
- package/web-tree-sitter.d.ts +0 -7
- package/web-tree-sitter.d.ts.map +1 -1
- package/web-tree-sitter.js +15 -14
- package/web-tree-sitter.js.map +2 -2
- package/web-tree-sitter.wasm +0 -0
- package/web-tree-sitter.wasm.map +2 -2
- package/web-tree-sitter.web.js +15 -14
- package/web-tree-sitter.web.js.map +2 -2
package/debug/web-tree-sitter.js
CHANGED
|
@@ -1332,7 +1332,7 @@ __name(unmarshalLanguageMetadata, "unmarshalLanguageMetadata");
|
|
|
1332
1332
|
|
|
1333
1333
|
// src/language.ts
|
|
1334
1334
|
var LANGUAGE_FUNCTION_REGEX = /^tree_sitter_\w+$/;
|
|
1335
|
-
var Language = class
|
|
1335
|
+
var Language = class {
|
|
1336
1336
|
static {
|
|
1337
1337
|
__name(this, "Language");
|
|
1338
1338
|
}
|
|
@@ -1551,18 +1551,7 @@ ${body2}`);
|
|
|
1551
1551
|
}
|
|
1552
1552
|
}
|
|
1553
1553
|
const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
|
|
1554
|
-
return
|
|
1555
|
-
}
|
|
1556
|
-
static loadFromWasmExports(mod, { sync }) {
|
|
1557
|
-
const symbolNames = Object.keys(mod);
|
|
1558
|
-
const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
|
|
1559
|
-
if (!functionName) {
|
|
1560
|
-
console.log(`Couldn't find language function in Wasm file. Symbols:
|
|
1561
|
-
${JSON.stringify(symbolNames, null, 2)}`);
|
|
1562
|
-
throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
|
|
1563
|
-
}
|
|
1564
|
-
const languageAddress = mod[functionName]();
|
|
1565
|
-
return new _Language(INTERNAL, languageAddress);
|
|
1554
|
+
return loadFromWasmExports(mod, { sync: false });
|
|
1566
1555
|
}
|
|
1567
1556
|
/**
|
|
1568
1557
|
* Load a language synchronously from a pre-compiled WebAssembly module.
|
|
@@ -1570,9 +1559,21 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
1570
1559
|
*/
|
|
1571
1560
|
static loadSync(wasmModule) {
|
|
1572
1561
|
const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
|
|
1573
|
-
return
|
|
1562
|
+
return loadFromWasmExports(mod, { sync: true });
|
|
1574
1563
|
}
|
|
1575
1564
|
};
|
|
1565
|
+
function loadFromWasmExports(mod, { sync }) {
|
|
1566
|
+
const symbolNames = Object.keys(mod);
|
|
1567
|
+
const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
|
|
1568
|
+
if (!functionName) {
|
|
1569
|
+
console.log(`Couldn't find language function in Wasm file. Symbols:
|
|
1570
|
+
${JSON.stringify(symbolNames, null, 2)}`);
|
|
1571
|
+
throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
|
|
1572
|
+
}
|
|
1573
|
+
const languageAddress = mod[functionName]();
|
|
1574
|
+
return new Language(INTERNAL, languageAddress);
|
|
1575
|
+
}
|
|
1576
|
+
__name(loadFromWasmExports, "loadFromWasmExports");
|
|
1576
1577
|
|
|
1577
1578
|
// lib/web-tree-sitter.mjs
|
|
1578
1579
|
async function Module2(moduleArg = {}) {
|