@willbooster/web-tree-sitter 1.5.1 → 2.0.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.
@@ -138,16 +138,17 @@
138
138
  hasError: boolean;
139
139
  }
140
140
  /**
141
- * The latest ABI version that is supported by the current version of the
142
- * library. The Tree-sitter CLI assigns this ABI version to each generated
143
- * language, unless its `generate --abi` option selects an earlier one.
144
- * The Tree-sitter library is generally backwards-compatible with languages
145
- * generated using older CLI versions, but is not forwards-compatible.
141
+ * The only ABI version that the current version of the library supports. The
142
+ * CLI of this fork assigns it to each generated language. Its upper 16 bits
143
+ * (`0x5742`, "WB") tag the fork and its lower 16 bits count the fork's ABI
144
+ * revisions, so that it never equals an ABI version of upstream Tree-sitter:
145
+ * the library rejects languages generated by upstream's CLI, and upstream's
146
+ * library rejects languages generated by this fork's CLI.
146
147
  */
147
148
  export let LANGUAGE_VERSION: number;
148
149
  /**
149
150
  * The earliest ABI version that is supported by the current version of the
150
- * library.
151
+ * library, which is {@link LANGUAGE_VERSION}.
151
152
  */
152
153
  export let MIN_COMPATIBLE_VERSION: number;
153
154
  /**
@@ -177,8 +178,8 @@
177
178
  * If the language was not successfully assigned, an error will be thrown.
178
179
  * This happens if the language was generated with an incompatible
179
180
  * version of the Tree-sitter CLI. Check the language's version using
180
- * {@link Language#version} and compare it to this library's
181
- * {@link LANGUAGE_VERSION} and {@link MIN_COMPATIBLE_VERSION} constants.
181
+ * {@link Language#abiVersion} and compare it to this library's
182
+ * {@link LANGUAGE_VERSION} constant.
182
183
  */
183
184
  setLanguage(language: Language | null): this;
184
185
  /**
@@ -56,6 +56,6 @@
56
56
  null,
57
57
  null
58
58
  ],
59
- "mappings": ";;;;;;kBASiBA,KAAKA;;;;;;;;;;kBAYLC,KAAKA;;;;;;;;;;;;;aAsCVC,aAAaA;;;;aAKbC,gBAAgBA;;;;;;aAOhBC,WAAWA;;kBChENC,iBAAiBA;;;;;;;cCLrBC,IAAIA;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;;;;;;;;;;;;;;;;;;;;;;;;;;;cCEJC,UAAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBCINC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsEZC,UAAUA;;;;;aAMfC,eAAeA;;;;kBAKVC,cAAcA;;;;;;;;;;kBAYdC,YAAYA;;;;;;;;;;;;;;;kBAqBZC,UAAUA;;;;;;;;;;;;;cA2BfC,iBAAiBA;;;;;;;;aAAjBA,iBAAiBA;;;;;;;;;;;;aAajBC,aAAaA;;;;;;WAORC,oBAAoBA;;;;;;;;;WAOpBC,mBAAmBA;;;;cAyUvBC,KAAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCzfLC,iBAAiBA",
60
60
  "ignoreList": []
61
61
  }
@@ -138,16 +138,17 @@
138
138
  hasError: boolean;
139
139
  }
140
140
  /**
141
- * The latest ABI version that is supported by the current version of the
142
- * library. The Tree-sitter CLI assigns this ABI version to each generated
143
- * language, unless its `generate --abi` option selects an earlier one.
144
- * The Tree-sitter library is generally backwards-compatible with languages
145
- * generated using older CLI versions, but is not forwards-compatible.
141
+ * The only ABI version that the current version of the library supports. The
142
+ * CLI of this fork assigns it to each generated language. Its upper 16 bits
143
+ * (`0x5742`, "WB") tag the fork and its lower 16 bits count the fork's ABI
144
+ * revisions, so that it never equals an ABI version of upstream Tree-sitter:
145
+ * the library rejects languages generated by upstream's CLI, and upstream's
146
+ * library rejects languages generated by this fork's CLI.
146
147
  */
147
148
  export let LANGUAGE_VERSION: number;
148
149
  /**
149
150
  * The earliest ABI version that is supported by the current version of the
150
- * library.
151
+ * library, which is {@link LANGUAGE_VERSION}.
151
152
  */
152
153
  export let MIN_COMPATIBLE_VERSION: number;
153
154
  /**
@@ -177,8 +178,8 @@
177
178
  * If the language was not successfully assigned, an error will be thrown.
178
179
  * This happens if the language was generated with an incompatible
179
180
  * version of the Tree-sitter CLI. Check the language's version using
180
- * {@link Language#version} and compare it to this library's
181
- * {@link LANGUAGE_VERSION} and {@link MIN_COMPATIBLE_VERSION} constants.
181
+ * {@link Language#abiVersion} and compare it to this library's
182
+ * {@link LANGUAGE_VERSION} constant.
182
183
  */
183
184
  setLanguage(language: Language | null): this;
184
185
  /**
@@ -56,6 +56,6 @@
56
56
  null,
57
57
  null
58
58
  ],
59
- "mappings": ";;;;;;kBASiBA,KAAKA;;;;;;;;;;kBAYLC,KAAKA;;;;;;;;;;;;;aAsCVC,aAAaA;;;;aAKbC,gBAAgBA;;;;;;aAOhBC,WAAWA;;kBChENC,iBAAiBA;;;;;;;cCLrBC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBCgBAC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmCZC,UAAUA;;;;;;;;;;;;;YAsBhBC,gBAAgBA;;;;;YAMhBC,sBAAsBA;;;;;cAWpBC,MAAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WCrFFC,gBAAgBA;;;;;;;;;cAYpBC,QAAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCiBRC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC1BJC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCzfLC,iBAAiBA",
60
60
  "ignoreList": []
61
61
  }
@@ -3219,6 +3219,15 @@ __name(checkModule, "checkModule");
3219
3219
  // src/parser.ts
3220
3220
  var TRANSFER_BUFFER;
3221
3221
  var LANGUAGE_VERSION;
3222
+ function assertSupportedLanguage(language) {
3223
+ const version = C._ts_language_abi_version(language[0]);
3224
+ if (version !== LANGUAGE_VERSION) {
3225
+ throw new Error(
3226
+ `Incompatible language version 0x${(version >>> 0).toString(16)}. Expected 0x${LANGUAGE_VERSION.toString(16)}.`
3227
+ );
3228
+ }
3229
+ }
3230
+ __name(assertSupportedLanguage, "assertSupportedLanguage");
3222
3231
  var MIN_COMPATIBLE_VERSION;
3223
3232
  var finalizer4 = newFinalizer((addresses) => {
3224
3233
  C._ts_parser_delete(addresses[0]);
@@ -3281,8 +3290,8 @@ var Parser = class {
3281
3290
  * If the language was not successfully assigned, an error will be thrown.
3282
3291
  * This happens if the language was generated with an incompatible
3283
3292
  * version of the Tree-sitter CLI. Check the language's version using
3284
- * {@link Language#version} and compare it to this library's
3285
- * {@link LANGUAGE_VERSION} and {@link MIN_COMPATIBLE_VERSION} constants.
3293
+ * {@link Language#abiVersion} and compare it to this library's
3294
+ * {@link LANGUAGE_VERSION} constant.
3286
3295
  */
3287
3296
  setLanguage(language) {
3288
3297
  let address;
@@ -3291,12 +3300,7 @@ var Parser = class {
3291
3300
  this.language = null;
3292
3301
  } else if (language.constructor === Language) {
3293
3302
  address = language[0];
3294
- const version = C._ts_language_abi_version(address);
3295
- if (version < MIN_COMPATIBLE_VERSION || LANGUAGE_VERSION < version) {
3296
- throw new Error(
3297
- `Incompatible language version ${version}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${LANGUAGE_VERSION}.`
3298
- );
3299
- }
3303
+ assertSupportedLanguage(language);
3300
3304
  this.language = language;
3301
3305
  } else {
3302
3306
  throw new Error("Argument must be a Language");
@@ -3694,6 +3698,7 @@ var Query = class {
3694
3698
  * @link {@see https://tree-sitter.github.io/tree-sitter/using-parsers/queries}
3695
3699
  */
3696
3700
  constructor(language, source) {
3701
+ assertSupportedLanguage(language);
3697
3702
  const sourceLength = C.lengthBytesUTF8(source);
3698
3703
  const sourceAddress = C._malloc(sourceLength + 1);
3699
3704
  C.stringToUTF8(source, sourceAddress, sourceLength + 1);