@willbooster/web-tree-sitter 19.1.1 → 20.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.
package/README.md CHANGED
@@ -110,26 +110,6 @@ console.log(callExpression.type, callExpression.startPosition, callExpression.en
110
110
  // call_expression { row: 0, column: 11 } { row: 0, column: 25 }
111
111
  ```
112
112
 
113
- ### Editing
114
-
115
- If your source code _changes_, you can update the syntax tree. This will take less time than the first parse.
116
-
117
- ```javascript
118
- // Replace 'let' with 'const'
119
- const newSourceCode = 'const x = 1; console.log(x);';
120
-
121
- tree.edit({
122
- startIndex: 0,
123
- oldEndIndex: 3,
124
- newEndIndex: 5,
125
- startPosition: { row: 0, column: 0 },
126
- oldEndPosition: { row: 0, column: 3 },
127
- newEndPosition: { row: 0, column: 5 },
128
- });
129
-
130
- const newTree = parser.parse(newSourceCode, tree);
131
- ```
132
-
133
113
  ### Parsing Text From a Custom Data Structure
134
114
 
135
115
  If your text is stored in a data structure other than a single string, you can parse it by supplying a callback to `parse`
@@ -771,7 +771,7 @@ var require_web_tree_sitter = __commonJS({
771
771
  newDSO("__main__", 0, wasmImports);
772
772
  }
773
773
  };
774
- var ___heap_base = 82464;
774
+ var ___heap_base = 81952;
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": 59,
869
+ "initial": 58,
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 = 82464;
1406
- var ___stack_low = 16928;
1405
+ var ___stack_high = 81952;
1406
+ var ___stack_low = 16416;
1407
1407
  var ___stack_pointer = new WebAssembly.Global({
1408
1408
  "value": "i32",
1409
1409
  "mutable": true
1410
- }, 82464);
1410
+ }, 81952);
1411
1411
  var ___table_base = new WebAssembly.Global({
1412
1412
  "value": "i32",
1413
1413
  "mutable": false
@@ -1743,9 +1743,7 @@ var require_web_tree_sitter = __commonJS({
1743
1743
  var _ts_language_subtypes_wasm = Module["_ts_language_subtypes_wasm"] = makeInvalidEarlyAccess("_ts_language_subtypes_wasm");
1744
1744
  var _ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_root_node_wasm");
1745
1745
  var _ts_tree_root_node_with_offset_wasm = Module["_ts_tree_root_node_with_offset_wasm"] = makeInvalidEarlyAccess("_ts_tree_root_node_with_offset_wasm");
1746
- var _ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = makeInvalidEarlyAccess("_ts_tree_edit_wasm");
1747
1746
  var _ts_tree_included_ranges_wasm = Module["_ts_tree_included_ranges_wasm"] = makeInvalidEarlyAccess("_ts_tree_included_ranges_wasm");
1748
- var _ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = makeInvalidEarlyAccess("_ts_tree_get_changed_ranges_wasm");
1749
1747
  var _ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_new_wasm");
1750
1748
  var _ts_tree_cursor_copy_wasm = Module["_ts_tree_cursor_copy_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_copy_wasm");
1751
1749
  var _ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_delete_wasm");
@@ -1763,8 +1761,6 @@ var require_web_tree_sitter = __commonJS({
1763
1761
  var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_id_wasm");
1764
1762
  var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_position_wasm");
1765
1763
  var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_position_wasm");
1766
- var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_index_wasm");
1767
- var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_index_wasm");
1768
1764
  var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_wasm");
1769
1765
  var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = makeInvalidEarlyAccess("_ts_node_symbol_wasm");
1770
1766
  var _ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = makeInvalidEarlyAccess("_ts_node_field_name_for_child_wasm");
@@ -1796,7 +1792,6 @@ var require_web_tree_sitter = __commonJS({
1796
1792
  var _ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = makeInvalidEarlyAccess("_ts_node_named_children_wasm");
1797
1793
  var _ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = makeInvalidEarlyAccess("_ts_node_descendants_of_type_wasm");
1798
1794
  var _ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = makeInvalidEarlyAccess("_ts_node_is_named_wasm");
1799
- var _ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = makeInvalidEarlyAccess("_ts_node_has_changes_wasm");
1800
1795
  var _ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = makeInvalidEarlyAccess("_ts_node_has_error_wasm");
1801
1796
  var _ts_node_is_error_wasm = Module["_ts_node_is_error_wasm"] = makeInvalidEarlyAccess("_ts_node_is_error_wasm");
1802
1797
  var _ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = makeInvalidEarlyAccess("_ts_node_is_missing_wasm");
@@ -1871,7 +1866,7 @@ var require_web_tree_sitter = __commonJS({
1871
1866
  Module["_ts_scanner_realloc_wasm"] = _ts_scanner_realloc_wasm = createExportWrapper("ts_scanner_realloc_wasm", 2);
1872
1867
  Module["_ts_parser_new_wasm"] = _ts_parser_new_wasm = createExportWrapper("ts_parser_new_wasm", 0);
1873
1868
  Module["_ts_parser_enable_logger_wasm"] = _ts_parser_enable_logger_wasm = createExportWrapper("ts_parser_enable_logger_wasm", 2);
1874
- Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm", 3);
1869
+ Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm", 2);
1875
1870
  Module["_ts_parser_parse_limited_wasm"] = _ts_parser_parse_limited_wasm = createExportWrapper("ts_parser_parse_limited_wasm", 2);
1876
1871
  Module["_ts_parser_last_parse_operations_wasm"] = _ts_parser_last_parse_operations_wasm = createExportWrapper("ts_parser_last_parse_operations_wasm", 1);
1877
1872
  Module["_ts_parser_abort_limited_wasm"] = _ts_parser_abort_limited_wasm = createExportWrapper("ts_parser_abort_limited_wasm", 0);
@@ -1883,9 +1878,7 @@ var require_web_tree_sitter = __commonJS({
1883
1878
  Module["_ts_language_subtypes_wasm"] = _ts_language_subtypes_wasm = createExportWrapper("ts_language_subtypes_wasm", 2);
1884
1879
  Module["_ts_tree_root_node_wasm"] = _ts_tree_root_node_wasm = createExportWrapper("ts_tree_root_node_wasm", 1);
1885
1880
  Module["_ts_tree_root_node_with_offset_wasm"] = _ts_tree_root_node_with_offset_wasm = createExportWrapper("ts_tree_root_node_with_offset_wasm", 1);
1886
- Module["_ts_tree_edit_wasm"] = _ts_tree_edit_wasm = createExportWrapper("ts_tree_edit_wasm", 1);
1887
1881
  Module["_ts_tree_included_ranges_wasm"] = _ts_tree_included_ranges_wasm = createExportWrapper("ts_tree_included_ranges_wasm", 1);
1888
- Module["_ts_tree_get_changed_ranges_wasm"] = _ts_tree_get_changed_ranges_wasm = createExportWrapper("ts_tree_get_changed_ranges_wasm", 2);
1889
1882
  Module["_ts_tree_cursor_new_wasm"] = _ts_tree_cursor_new_wasm = createExportWrapper("ts_tree_cursor_new_wasm", 1);
1890
1883
  Module["_ts_tree_cursor_copy_wasm"] = _ts_tree_cursor_copy_wasm = createExportWrapper("ts_tree_cursor_copy_wasm", 1);
1891
1884
  Module["_ts_tree_cursor_delete_wasm"] = _ts_tree_cursor_delete_wasm = createExportWrapper("ts_tree_cursor_delete_wasm", 1);
@@ -1903,8 +1896,6 @@ var require_web_tree_sitter = __commonJS({
1903
1896
  Module["_ts_tree_cursor_current_node_id_wasm"] = _ts_tree_cursor_current_node_id_wasm = createExportWrapper("ts_tree_cursor_current_node_id_wasm", 1);
1904
1897
  Module["_ts_tree_cursor_start_position_wasm"] = _ts_tree_cursor_start_position_wasm = createExportWrapper("ts_tree_cursor_start_position_wasm", 1);
1905
1898
  Module["_ts_tree_cursor_end_position_wasm"] = _ts_tree_cursor_end_position_wasm = createExportWrapper("ts_tree_cursor_end_position_wasm", 1);
1906
- Module["_ts_tree_cursor_start_index_wasm"] = _ts_tree_cursor_start_index_wasm = createExportWrapper("ts_tree_cursor_start_index_wasm", 1);
1907
- Module["_ts_tree_cursor_end_index_wasm"] = _ts_tree_cursor_end_index_wasm = createExportWrapper("ts_tree_cursor_end_index_wasm", 1);
1908
1899
  Module["_ts_tree_cursor_current_node_wasm"] = _ts_tree_cursor_current_node_wasm = createExportWrapper("ts_tree_cursor_current_node_wasm", 1);
1909
1900
  Module["_ts_node_symbol_wasm"] = _ts_node_symbol_wasm = createExportWrapper("ts_node_symbol_wasm", 1);
1910
1901
  Module["_ts_node_field_name_for_child_wasm"] = _ts_node_field_name_for_child_wasm = createExportWrapper("ts_node_field_name_for_child_wasm", 2);
@@ -1936,7 +1927,6 @@ var require_web_tree_sitter = __commonJS({
1936
1927
  Module["_ts_node_named_children_wasm"] = _ts_node_named_children_wasm = createExportWrapper("ts_node_named_children_wasm", 1);
1937
1928
  Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = createExportWrapper("ts_node_descendants_of_type_wasm", 3);
1938
1929
  Module["_ts_node_is_named_wasm"] = _ts_node_is_named_wasm = createExportWrapper("ts_node_is_named_wasm", 1);
1939
- Module["_ts_node_has_changes_wasm"] = _ts_node_has_changes_wasm = createExportWrapper("ts_node_has_changes_wasm", 1);
1940
1930
  Module["_ts_node_has_error_wasm"] = _ts_node_has_error_wasm = createExportWrapper("ts_node_has_error_wasm", 1);
1941
1931
  Module["_ts_node_is_error_wasm"] = _ts_node_is_error_wasm = createExportWrapper("ts_node_is_error_wasm", 1);
1942
1932
  Module["_ts_node_is_missing_wasm"] = _ts_node_is_missing_wasm = createExportWrapper("ts_node_is_missing_wasm", 1);
@@ -2010,8 +2000,6 @@ var require_web_tree_sitter = __commonJS({
2010
2000
  /** @export */
2011
2001
  invoke_iiii,
2012
2002
  /** @export */
2013
- invoke_iiiii,
2014
- /** @export */
2015
2003
  invoke_ji,
2016
2004
  /** @export */
2017
2005
  invoke_vi,
@@ -2084,17 +2072,6 @@ var require_web_tree_sitter = __commonJS({
2084
2072
  }
2085
2073
  }
2086
2074
  __name(invoke_iiii, "invoke_iiii");
2087
- function invoke_iiiii(index, a1, a2, a3, a4) {
2088
- var sp = stackSave();
2089
- try {
2090
- return getWasmTableEntry(index)(a1, a2, a3, a4);
2091
- } catch (e) {
2092
- stackRestore(sp);
2093
- if (e !== e + 0) throw e;
2094
- _setThrew(1, 0);
2095
- }
2096
- }
2097
- __name(invoke_iiiii, "invoke_iiiii");
2098
2075
  function invoke_iii(index, a1, a2) {
2099
2076
  var sp = stackSave();
2100
2077
  try {
@@ -2135,7 +2112,7 @@ var require_web_tree_sitter = __commonJS({
2135
2112
  }
2136
2113
  __name(callMain, "callMain");
2137
2114
  function stackCheckInit() {
2138
- _emscripten_stack_set_limits(82464, 16928);
2115
+ _emscripten_stack_set_limits(81952, 16416);
2139
2116
  writeStackCookie();
2140
2117
  }
2141
2118
  __name(stackCheckInit, "stackCheckInit");
@@ -2231,7 +2208,6 @@ var require_web_tree_sitter = __commonJS({
2231
2208
  // src/index.ts
2232
2209
  var index_exports = {};
2233
2210
  __export(index_exports, {
2234
- Edit: () => Edit,
2235
2211
  LANGUAGE_VERSION: () => LANGUAGE_VERSION,
2236
2212
  Language: () => Language,
2237
2213
  LookaheadIterator: () => LookaheadIterator,
@@ -2243,108 +2219,6 @@ __export(index_exports, {
2243
2219
  });
2244
2220
  module.exports = __toCommonJS(index_exports);
2245
2221
 
2246
- // src/edit.ts
2247
- var Edit = class {
2248
- static {
2249
- __name(this, "Edit");
2250
- }
2251
- /** The start position of the change. */
2252
- startPosition;
2253
- /** The end position of the change before the edit. */
2254
- oldEndPosition;
2255
- /** The end position of the change after the edit. */
2256
- newEndPosition;
2257
- /** The start index of the change. */
2258
- startIndex;
2259
- /** The end index of the change before the edit. */
2260
- oldEndIndex;
2261
- /** The end index of the change after the edit. */
2262
- newEndIndex;
2263
- constructor({
2264
- startIndex,
2265
- oldEndIndex,
2266
- newEndIndex,
2267
- startPosition,
2268
- oldEndPosition,
2269
- newEndPosition
2270
- }) {
2271
- this.startIndex = startIndex >>> 0;
2272
- this.oldEndIndex = oldEndIndex >>> 0;
2273
- this.newEndIndex = newEndIndex >>> 0;
2274
- this.startPosition = startPosition;
2275
- this.oldEndPosition = oldEndPosition;
2276
- this.newEndPosition = newEndPosition;
2277
- }
2278
- /**
2279
- * Edit a point and index to keep it in-sync with source code that has been edited.
2280
- *
2281
- * This function updates a single point's byte offset and row/column position
2282
- * based on an edit operation. This is useful for editing points without
2283
- * requiring a tree or node instance.
2284
- */
2285
- editPoint(point, index) {
2286
- let newIndex = index;
2287
- const newPoint = { ...point };
2288
- if (index >= this.oldEndIndex) {
2289
- newIndex = this.newEndIndex + (index - this.oldEndIndex);
2290
- const originalRow = point.row;
2291
- newPoint.row = this.newEndPosition.row + (point.row - this.oldEndPosition.row);
2292
- newPoint.column = originalRow === this.oldEndPosition.row ? this.newEndPosition.column + (point.column - this.oldEndPosition.column) : point.column;
2293
- } else if (index > this.startIndex) {
2294
- newIndex = this.newEndIndex;
2295
- newPoint.row = this.newEndPosition.row;
2296
- newPoint.column = this.newEndPosition.column;
2297
- }
2298
- return { point: newPoint, index: newIndex };
2299
- }
2300
- /**
2301
- * Edit a range to keep it in-sync with source code that has been edited.
2302
- *
2303
- * This function updates a range's start and end positions based on an edit
2304
- * operation. This is useful for editing ranges without requiring a tree
2305
- * or node instance.
2306
- */
2307
- editRange(range) {
2308
- const newRange = {
2309
- startIndex: range.startIndex,
2310
- startPosition: { ...range.startPosition },
2311
- endIndex: range.endIndex,
2312
- endPosition: { ...range.endPosition }
2313
- };
2314
- if (range.endIndex >= this.oldEndIndex) {
2315
- if (range.endIndex !== Number.MAX_SAFE_INTEGER) {
2316
- newRange.endIndex = this.newEndIndex + (range.endIndex - this.oldEndIndex);
2317
- newRange.endPosition = {
2318
- row: this.newEndPosition.row + (range.endPosition.row - this.oldEndPosition.row),
2319
- column: range.endPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.endPosition.column - this.oldEndPosition.column) : range.endPosition.column
2320
- };
2321
- if (newRange.endIndex < this.newEndIndex) {
2322
- newRange.endIndex = Number.MAX_SAFE_INTEGER;
2323
- newRange.endPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
2324
- }
2325
- }
2326
- } else if (range.endIndex > this.startIndex) {
2327
- newRange.endIndex = this.startIndex;
2328
- newRange.endPosition = { ...this.startPosition };
2329
- }
2330
- if (range.startIndex >= this.oldEndIndex) {
2331
- newRange.startIndex = this.newEndIndex + (range.startIndex - this.oldEndIndex);
2332
- newRange.startPosition = {
2333
- row: this.newEndPosition.row + (range.startPosition.row - this.oldEndPosition.row),
2334
- column: range.startPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.startPosition.column - this.oldEndPosition.column) : range.startPosition.column
2335
- };
2336
- if (newRange.startIndex < this.newEndIndex) {
2337
- newRange.startIndex = Number.MAX_SAFE_INTEGER;
2338
- newRange.startPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
2339
- }
2340
- } else if (range.startIndex > this.startIndex) {
2341
- newRange.startIndex = this.startIndex;
2342
- newRange.startPosition = { ...this.startPosition };
2343
- }
2344
- return newRange;
2345
- }
2346
- };
2347
-
2348
2222
  // src/constants.ts
2349
2223
  var SIZE_OF_INT = 4;
2350
2224
  var SIZE_OF_NODE = 5 * SIZE_OF_INT;
@@ -2483,8 +2357,6 @@ var TreeCursor = class _TreeCursor {
2483
2357
  /** @internal */
2484
2358
  tree;
2485
2359
  /** @internal */
2486
- editVersion = -1;
2487
- /** @internal */
2488
2360
  _nodeTypeId = 0;
2489
2361
  /** @internal */
2490
2362
  _fieldId = 0;
@@ -2580,7 +2452,6 @@ var TreeCursor = class _TreeCursor {
2580
2452
  }
2581
2453
  /** Get the string content of the cursor's current node. */
2582
2454
  get nodeText() {
2583
- this.syncIndices();
2584
2455
  const { textSource } = this.tree;
2585
2456
  return typeof textSource === "string" ? textSource.slice(this._startIndex, this._endIndex) : getCallbackText(textSource, this._startIndex, this._endIndex, this.startPosition);
2586
2457
  }
@@ -2596,12 +2467,10 @@ var TreeCursor = class _TreeCursor {
2596
2467
  }
2597
2468
  /** Get the start index of the cursor's current node. */
2598
2469
  get startIndex() {
2599
- this.syncIndices();
2600
2470
  return this._startIndex;
2601
2471
  }
2602
2472
  /** Get the end index of the cursor's current node. */
2603
2473
  get endIndex() {
2604
- this.syncIndices();
2605
2474
  return this._endIndex;
2606
2475
  }
2607
2476
  /**
@@ -2747,15 +2616,6 @@ var TreeCursor = class _TreeCursor {
2747
2616
  this._startIndex = heap[base + 2];
2748
2617
  this._endIndex = heap[base + 3];
2749
2618
  this._flags = heap[base + 4];
2750
- this.editVersion = this.tree.editVersion;
2751
- }
2752
- /** @internal */
2753
- syncIndices() {
2754
- if (this.editVersion !== this.tree.editVersion) {
2755
- this._startIndex = C._ts_tree_cursor_start_index_wasm(this[0]) >>> 0;
2756
- this._endIndex = C._ts_tree_cursor_end_index_wasm(this[0]) >>> 0;
2757
- this.editVersion = this.tree.editVersion;
2758
- }
2759
2619
  }
2760
2620
  };
2761
2621
 
@@ -2793,8 +2653,6 @@ var Tree2 = class _Tree {
2793
2653
  // Internal handle for Wasm
2794
2654
  /** @internal */
2795
2655
  textSource;
2796
- /** @internal */
2797
- editVersion = 0;
2798
2656
  /** The language that was used to parse the syntax tree. */
2799
2657
  language;
2800
2658
  /** @internal */
@@ -2832,42 +2690,12 @@ var Tree2 = class _Tree {
2832
2690
  C._ts_tree_root_node_with_offset_wasm(this[0]);
2833
2691
  return unmarshalNode(this);
2834
2692
  }
2835
- /**
2836
- * Edit the syntax tree to keep it in sync with source code that has been
2837
- * edited.
2838
- *
2839
- * You must describe the edit both in terms of byte offsets and in terms of
2840
- * row/column coordinates.
2841
- */
2842
- edit(edit) {
2843
- marshalEdit(edit);
2844
- C._ts_tree_edit_wasm(this[0]);
2845
- this.editVersion++;
2846
- }
2847
2693
  /** Create a new {@link TreeCursor} starting from the root of the tree. */
2848
2694
  walk() {
2849
2695
  C._ts_tree_root_node_wasm(this[0]);
2850
2696
  const address = C._ts_tree_cursor_new_wasm(this[0]);
2851
2697
  return new TreeCursor(INTERNAL, this, address);
2852
2698
  }
2853
- /**
2854
- * Compare this old edited syntax tree to a new syntax tree representing
2855
- * the same document, returning a sequence of ranges whose syntactic
2856
- * structure has changed.
2857
- *
2858
- * For this to work correctly, this syntax tree must have been edited such
2859
- * that its ranges match up to the new tree. Generally, you'll want to
2860
- * call this method right after calling one of the [`Parser::parse`]
2861
- * functions. Call it on the old tree that was passed to parse, and
2862
- * pass the new tree that was returned from `parse`.
2863
- */
2864
- getChangedRanges(other) {
2865
- if (!(other instanceof _Tree)) {
2866
- throw new TypeError("Argument must be a Tree");
2867
- }
2868
- C._ts_tree_get_changed_ranges_wasm(this[0], other[0]);
2869
- return unmarshalRanges();
2870
- }
2871
2699
  /** Get the included ranges that were used to parse the syntax tree. */
2872
2700
  getIncludedRanges() {
2873
2701
  C._ts_tree_included_ranges_wasm(this[0]);
@@ -2906,14 +2734,7 @@ var Node = class {
2906
2734
  /**
2907
2735
  * The numeric id for this node that is unique.
2908
2736
  *
2909
- * Within a given syntax tree, no two nodes have the same id. However:
2910
- *
2911
- * * If a new tree is created based on an older tree, and a node from the old tree is reused in
2912
- * the process, then that node will have the same id in both trees.
2913
- *
2914
- * * A node not marked as having changes does not guarantee it was reused.
2915
- *
2916
- * * If a node is marked as having changed in the old tree, it will not be reused.
2737
+ * Within a given syntax tree, no two nodes have the same id.
2917
2738
  */
2918
2739
  id;
2919
2740
  /** The byte index where this node starts. */
@@ -2986,11 +2807,6 @@ var Node = class {
2986
2807
  marshalNode(this);
2987
2808
  return C._ts_node_is_missing_wasm(this.tree[0]) === 1;
2988
2809
  }
2989
- /** Check if this node has been edited. */
2990
- get hasChanges() {
2991
- marshalNode(this);
2992
- return C._ts_node_has_changes_wasm(this.tree[0]) === 1;
2993
- }
2994
2810
  /**
2995
2811
  * Check if this node represents a syntax error or contains any syntax
2996
2812
  * errors anywhere within it.
@@ -3348,20 +3164,6 @@ var Node = class {
3348
3164
  const address = C._ts_tree_cursor_new_wasm(this.tree[0]);
3349
3165
  return new TreeCursor(INTERNAL, this.tree, address);
3350
3166
  }
3351
- /**
3352
- * Edit this node to keep it in-sync with source code that has been edited.
3353
- *
3354
- * This function is only rarely needed. When you edit a syntax tree with
3355
- * the {@link Tree#edit} method, all of the nodes that you retrieve from
3356
- * the tree afterward will already reflect the edit. You only need to
3357
- * use {@link Node#edit} when you have a specific {@link Node} instance that
3358
- * you want to keep and continue to use after an edit.
3359
- */
3360
- edit(edit) {
3361
- const { point, index } = edit.editPoint(this.startPosition, this.startIndex);
3362
- this.startPosition = point;
3363
- this.startIndex = index;
3364
- }
3365
3167
  /** Get the S-expression representation of this node. */
3366
3168
  toString() {
3367
3169
  marshalNode(this);
@@ -3436,20 +3238,6 @@ function unmarshalRange(address) {
3436
3238
  };
3437
3239
  }
3438
3240
  __name(unmarshalRange, "unmarshalRange");
3439
- function marshalEdit(edit, address = TRANSFER_BUFFER) {
3440
- const base = address >>> 2;
3441
- const heap = C.HEAP32;
3442
- heap[base] = edit.startPosition.row;
3443
- heap[base + 1] = edit.startPosition.column;
3444
- heap[base + 2] = edit.oldEndPosition.row;
3445
- heap[base + 3] = edit.oldEndPosition.column;
3446
- heap[base + 4] = edit.newEndPosition.row;
3447
- heap[base + 5] = edit.newEndPosition.column;
3448
- heap[base + 6] = edit.startIndex;
3449
- heap[base + 7] = edit.oldEndIndex;
3450
- heap[base + 8] = edit.newEndIndex;
3451
- }
3452
- __name(marshalEdit, "marshalEdit");
3453
3241
  function unmarshalLanguageMetadata(address) {
3454
3242
  const base = address >>> 2;
3455
3243
  const heap = C.HEAP32;
@@ -3852,10 +3640,6 @@ var Parser = class {
3852
3640
  *
3853
3641
  * @param {string | ParseCallback} callback - The UTF8-encoded text to parse or a callback function.
3854
3642
  *
3855
- * @param {Tree | null} [oldTree] - A previous syntax tree parsed from the same document. If the text of the
3856
- * document has changed since `oldTree` was created, then you must edit `oldTree` to match
3857
- * the new text using {@link Tree#edit}.
3858
- *
3859
3643
  * @param {ParseOptions} [options] - Options for parsing the text.
3860
3644
  * This can be used to set the included ranges, or a progress callback.
3861
3645
  *
@@ -3864,7 +3648,7 @@ var Parser = class {
3864
3648
  * - The progress callback returned true.
3865
3649
  * - The memory limit was reached or the operation limit was exceeded.
3866
3650
  */
3867
- parse(callback, oldTree, options) {
3651
+ parse(callback, options) {
3868
3652
  const maxMemoryBytes = validateMemoryLimit(options?.maxMemoryBytes);
3869
3653
  const maxOperations = validateOperationLimit(options?.maxOperations);
3870
3654
  if (typeof callback !== "string" && typeof callback !== "function") {
@@ -3876,7 +3660,7 @@ var Parser = class {
3876
3660
  this.syncLogger();
3877
3661
  this.lastParseOperations = 0;
3878
3662
  try {
3879
- const treeAddress = this.runParse(oldTree, options, maxMemoryBytes, maxOperations);
3663
+ const treeAddress = this.runParse(options, maxMemoryBytes, maxOperations);
3880
3664
  if (!treeAddress) return null;
3881
3665
  if (!this.language) throw new Error("Parser must have a language to parse");
3882
3666
  return new Tree2(INTERNAL, treeAddress, this.language, callback);
@@ -3901,7 +3685,7 @@ var Parser = class {
3901
3685
  }
3902
3686
  }
3903
3687
  /** @internal */
3904
- runParse(oldTree, options, maxMemoryBytes, maxOperations) {
3688
+ runParse(options, maxMemoryBytes, maxOperations) {
3905
3689
  if (maxMemoryBytes !== void 0 && !C.treeSitterSetMemoryLimit(maxMemoryBytes)) {
3906
3690
  return 0;
3907
3691
  }
@@ -3910,7 +3694,7 @@ var Parser = class {
3910
3694
  if (rangeCount && !rangeAddress) return 0;
3911
3695
  marshalParseInputs(maxOperations, rangeAddress, rangeCount, options?.progressCallback ? 1 : 0);
3912
3696
  try {
3913
- return maxMemoryBytes === void 0 ? this.executeOrdinaryParse(oldTree ? oldTree[0] : 0) : this.executeLimitedParse();
3697
+ return maxMemoryBytes === void 0 ? this.executeOrdinaryParse() : this.executeLimitedParse();
3914
3698
  } finally {
3915
3699
  this.lastParseOperations = unmarshalOperationCount();
3916
3700
  }
@@ -3919,9 +3703,9 @@ var Parser = class {
3919
3703
  }
3920
3704
  }
3921
3705
  /** @internal */
3922
- executeOrdinaryParse(oldTreeAddress) {
3706
+ executeOrdinaryParse() {
3923
3707
  try {
3924
- return C._ts_parser_parse_wasm(this[0], this[1], oldTreeAddress);
3708
+ return C._ts_parser_parse_wasm(this[0], this[1]);
3925
3709
  } catch (error) {
3926
3710
  C._ts_parser_last_parse_operations_wasm(this[0]);
3927
3711
  throw error;
@@ -4024,7 +3808,6 @@ function clearCallbacks() {
4024
3808
  __name(clearCallbacks, "clearCallbacks");
4025
3809
  // Annotate the CommonJS export names for ESM import in node:
4026
3810
  0 && (module.exports = {
4027
- Edit,
4028
3811
  LANGUAGE_VERSION,
4029
3812
  Language,
4030
3813
  LookaheadIterator,