@willbooster/web-tree-sitter 26.2.0 → 26.3.0

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/README.md CHANGED
@@ -163,7 +163,7 @@ If everything is fine, file `tree-sitter-javascript.wasm` should be generated in
163
163
 
164
164
  ### Wasm compatibility
165
165
 
166
- `@willbooster/web-tree-sitter` accepts language ABIs `0x5742000d` through `0x57420013`. Generate parsers with the CLI from the same release
166
+ `@willbooster/web-tree-sitter` accepts language ABIs `0x5742000d` through `0x57420014`. Generate parsers with the CLI from the same release
167
167
  as the runtime, then rebuild their `.wasm` files. Parsers generated for other ABI versions are rejected, including
168
168
  those generated by upstream's CLI.
169
169
 
@@ -771,7 +771,7 @@ var require_web_tree_sitter = __commonJS({
771
771
  newDSO("__main__", 0, wasmImports);
772
772
  }
773
773
  };
774
- var ___heap_base = 82e3;
774
+ var ___heap_base = 82096;
775
775
  var alignMemory = /* @__PURE__ */ __name((size, alignment) => {
776
776
  assert(alignment, "alignment argument is required");
777
777
  return Math.ceil(size / alignment) * alignment;
@@ -866,7 +866,7 @@ var require_web_tree_sitter = __commonJS({
866
866
  }, "convertJsFunctionToWasm");
867
867
  var wasmTableMirror = [];
868
868
  var wasmTable = new WebAssembly.Table({
869
- "initial": 64,
869
+ "initial": 65,
870
870
  "element": "anyfunc"
871
871
  });
872
872
  var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
@@ -1402,12 +1402,12 @@ var require_web_tree_sitter = __commonJS({
1402
1402
  "value": "i32",
1403
1403
  "mutable": false
1404
1404
  }, 1024);
1405
- var ___stack_high = 82e3;
1406
- var ___stack_low = 16464;
1405
+ var ___stack_high = 82096;
1406
+ var ___stack_low = 16560;
1407
1407
  var ___stack_pointer = new WebAssembly.Global({
1408
1408
  "value": "i32",
1409
1409
  "mutable": true
1410
- }, 82e3);
1410
+ }, 82096);
1411
1411
  var ___table_base = new WebAssembly.Global({
1412
1412
  "value": "i32",
1413
1413
  "mutable": false
@@ -2076,7 +2076,7 @@ var require_web_tree_sitter = __commonJS({
2076
2076
  }
2077
2077
  __name(callMain, "callMain");
2078
2078
  function stackCheckInit() {
2079
- _emscripten_stack_set_limits(82e3, 16464);
2079
+ _emscripten_stack_set_limits(82096, 16560);
2080
2080
  writeStackCookie();
2081
2081
  }
2082
2082
  __name(stackCheckInit, "stackCheckInit");
@@ -3507,7 +3507,9 @@ var Parser = class {
3507
3507
  *
3508
3508
  * If the language was not successfully assigned, an error will be thrown.
3509
3509
  * This happens if the language was generated with an incompatible
3510
- * version of the Tree-sitter CLI. Check the language's version using
3510
+ * version of the Tree-sitter CLI or has incompatible name-role tables.
3511
+ * Regenerate the grammar with the CLI from the runtime's release and
3512
+ * rebuild its Wasm file. Check the language's version using
3511
3513
  * {@link Language#abiVersion}; this library accepts versions from
3512
3514
  * {@link MIN_COMPATIBLE_VERSION} to {@link LANGUAGE_VERSION}.
3513
3515
  */
@@ -3515,15 +3517,17 @@ var Parser = class {
3515
3517
  let address;
3516
3518
  if (!language) {
3517
3519
  address = 0;
3518
- this.language = null;
3519
3520
  } else if (language.constructor === Language) {
3520
3521
  address = language[0];
3521
3522
  assertSupportedLanguage(language);
3522
- this.language = language;
3523
3523
  } else {
3524
3524
  throw new Error("Argument must be a Language");
3525
3525
  }
3526
- C._wb_ts_parser_set_language(this[0], address);
3526
+ if (!C._wb_ts_parser_set_language(this[0], address)) {
3527
+ this.language = null;
3528
+ throw new Error("Language cannot be used for parsing.");
3529
+ }
3530
+ this.language = address ? language : null;
3527
3531
  return this;
3528
3532
  }
3529
3533
  /**