jsonc-morph 0.1.3 → 0.2.1

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.
@@ -192,6 +192,10 @@ function takeFromExternrefTable0(idx) {
192
192
  return value;
193
193
  }
194
194
  /**
195
+ * Parses a JSONC (JSON with Comments) string into a concrete syntax tree.
196
+ * @param text - The JSONC text to parse
197
+ * @param options - Optional parsing options
198
+ * @returns The root node of the parsed CST
195
199
  * @param {string} text
196
200
  * @param {{ allowComments?: boolean; allowTrailingCommas?: boolean; allowLooseObjectPropertyNames?: boolean; } | null} [options]
197
201
  * @returns {RootNode}
@@ -205,6 +209,25 @@ export function parse(text, options) {
205
209
  }
206
210
  return RootNode.__wrap(ret[0]);
207
211
  }
212
+ /**
213
+ * Parses a JSONC (JSON with Comments) string directly to a JavaScript object.
214
+ * @param text - The JSONC text to parse
215
+ * @param options - Optional parsing options
216
+ * @returns The plain JavaScript value (object, array, string, number, boolean, or null)
217
+ * @throws If the text cannot be parsed or converted
218
+ * @param {string} text
219
+ * @param {{ allowComments?: boolean; allowTrailingCommas?: boolean; allowLooseObjectPropertyNames?: boolean; } | null} [options]
220
+ * @returns {any}
221
+ */
222
+ export function parseToValue(text, options) {
223
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
224
+ const len0 = WASM_VECTOR_LEN;
225
+ const ret = wasm.parseToValue(ptr0, len0, isLikeNone(options) ? 0 : addToExternrefTable0(options));
226
+ if (ret[2]) {
227
+ throw takeFromExternrefTable0(ret[1]);
228
+ }
229
+ return takeFromExternrefTable0(ret[0]);
230
+ }
208
231
  function getArrayJsValueFromWasm0(ptr, len) {
209
232
  ptr = ptr >>> 0;
210
233
  const mem = getDataViewMemory0();
@@ -215,9 +238,179 @@ function getArrayJsValueFromWasm0(ptr, len) {
215
238
  wasm.__externref_drop_slice(ptr, len);
216
239
  return result;
217
240
  }
241
+ const BooleanLitFinalization = (typeof FinalizationRegistry === "undefined")
242
+ ? { register: () => { }, unregister: () => { } }
243
+ : new FinalizationRegistry((ptr) => wasm.__wbg_booleanlit_free(ptr >>> 0, 1));
244
+ /**
245
+ * Represents a boolean literal node in the CST.
246
+ * Provides methods for manipulating boolean values.
247
+ */
248
+ export class BooleanLit {
249
+ static __wrap(ptr) {
250
+ ptr = ptr >>> 0;
251
+ const obj = Object.create(BooleanLit.prototype);
252
+ obj.__wbg_ptr = ptr;
253
+ BooleanLitFinalization.register(obj, obj.__wbg_ptr, obj);
254
+ return obj;
255
+ }
256
+ __destroy_into_raw() {
257
+ const ptr = this.__wbg_ptr;
258
+ this.__wbg_ptr = 0;
259
+ BooleanLitFinalization.unregister(this);
260
+ return ptr;
261
+ }
262
+ free() {
263
+ const ptr = this.__destroy_into_raw();
264
+ wasm.__wbg_booleanlit_free(ptr, 0);
265
+ }
266
+ /**
267
+ * Returns the boolean value (true or false).
268
+ * @returns The boolean value
269
+ * @returns {boolean}
270
+ */
271
+ value() {
272
+ const ret = wasm.booleanlit_value(this.__wbg_ptr);
273
+ return ret !== 0;
274
+ }
275
+ /**
276
+ * Sets the boolean value.
277
+ * @param value - The new boolean value (true or false)
278
+ * @param {boolean} value
279
+ */
280
+ setValue(value) {
281
+ wasm.booleanlit_setValue(this.__wbg_ptr, value);
282
+ }
283
+ /**
284
+ * Replaces this boolean literal with a new value.
285
+ * @param replacement - The new value to replace this boolean with
286
+ * @returns The new node that replaced this one, or undefined if this was the root value
287
+ * @param {any} replacement
288
+ * @returns {Node | undefined}
289
+ */
290
+ replaceWith(replacement) {
291
+ const ret = wasm.booleanlit_replaceWith(this.__wbg_ptr, replacement);
292
+ if (ret[2]) {
293
+ throw takeFromExternrefTable0(ret[1]);
294
+ }
295
+ return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
296
+ }
297
+ /**
298
+ * Removes this node from its parent.
299
+ * After calling this method, the node is detached from the CST and can no longer be used.
300
+ */
301
+ remove() {
302
+ const ptr = this.__destroy_into_raw();
303
+ wasm.booleanlit_remove(ptr);
304
+ }
305
+ /**
306
+ * Returns the parent node in the CST.
307
+ * @returns The parent node, or undefined if this is the root
308
+ * @returns {Node | undefined}
309
+ */
310
+ parent() {
311
+ const ret = wasm.booleanlit_parent(this.__wbg_ptr);
312
+ return ret === 0 ? undefined : Node.__wrap(ret);
313
+ }
314
+ /**
315
+ * Returns all ancestor nodes from parent to root.
316
+ * @returns Array of ancestor nodes
317
+ * @returns {Node[]}
318
+ */
319
+ ancestors() {
320
+ const ret = wasm.booleanlit_ancestors(this.__wbg_ptr);
321
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
322
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
323
+ return v1;
324
+ }
325
+ /**
326
+ * Returns the index of this node within its parent's children.
327
+ * @returns The child index
328
+ * @returns {number}
329
+ */
330
+ childIndex() {
331
+ const ret = wasm.booleanlit_childIndex(this.__wbg_ptr);
332
+ return ret >>> 0;
333
+ }
334
+ /**
335
+ * Returns the previous sibling node.
336
+ * @returns The previous sibling, or undefined if this is the first child
337
+ * @returns {Node | undefined}
338
+ */
339
+ previousSibling() {
340
+ const ret = wasm.booleanlit_previousSibling(this.__wbg_ptr);
341
+ return ret === 0 ? undefined : Node.__wrap(ret);
342
+ }
343
+ /**
344
+ * Returns all previous sibling nodes.
345
+ * @returns Array of previous siblings
346
+ * @returns {Node[]}
347
+ */
348
+ previousSiblings() {
349
+ const ret = wasm.booleanlit_previousSiblings(this.__wbg_ptr);
350
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
351
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
352
+ return v1;
353
+ }
354
+ /**
355
+ * Returns the next sibling node.
356
+ * @returns The next sibling, or undefined if this is the last child
357
+ * @returns {Node | undefined}
358
+ */
359
+ nextSibling() {
360
+ const ret = wasm.booleanlit_nextSibling(this.__wbg_ptr);
361
+ return ret === 0 ? undefined : Node.__wrap(ret);
362
+ }
363
+ /**
364
+ * Returns all next sibling nodes.
365
+ * @returns Array of next siblings
366
+ * @returns {Node[]}
367
+ */
368
+ nextSiblings() {
369
+ const ret = wasm.booleanlit_nextSiblings(this.__wbg_ptr);
370
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
371
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
372
+ return v1;
373
+ }
374
+ /**
375
+ * Returns the root node of the document.
376
+ * @returns The root node, or undefined if detached
377
+ * @returns {RootNode | undefined}
378
+ */
379
+ rootNode() {
380
+ const ret = wasm.booleanlit_rootNode(this.__wbg_ptr);
381
+ return ret === 0 ? undefined : RootNode.__wrap(ret);
382
+ }
383
+ /**
384
+ * Returns the indentation string used at this node's depth.
385
+ * @returns The indentation string, or undefined if not applicable
386
+ * @returns {string | undefined}
387
+ */
388
+ indentText() {
389
+ const ret = wasm.booleanlit_indentText(this.__wbg_ptr);
390
+ let v1;
391
+ if (ret[0] !== 0) {
392
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
393
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
394
+ }
395
+ return v1;
396
+ }
397
+ /**
398
+ * Returns whether this node's container uses trailing commas.
399
+ * @returns true if trailing commas are used
400
+ * @returns {boolean}
401
+ */
402
+ usesTrailingCommas() {
403
+ const ret = wasm.booleanlit_usesTrailingCommas(this.__wbg_ptr);
404
+ return ret !== 0;
405
+ }
406
+ }
218
407
  const JsonArrayFinalization = (typeof FinalizationRegistry === "undefined")
219
408
  ? { register: () => { }, unregister: () => { } }
220
409
  : new FinalizationRegistry((ptr) => wasm.__wbg_jsonarray_free(ptr >>> 0, 1));
410
+ /**
411
+ * Represents a JSON array node in the CST.
412
+ * Provides methods for manipulating array elements.
413
+ */
221
414
  export class JsonArray {
222
415
  static __wrap(ptr) {
223
416
  ptr = ptr >>> 0;
@@ -237,6 +430,8 @@ export class JsonArray {
237
430
  wasm.__wbg_jsonarray_free(ptr, 0);
238
431
  }
239
432
  /**
433
+ * Returns all element nodes in the array.
434
+ * @returns Array of element nodes
240
435
  * @returns {Node[]}
241
436
  */
242
437
  elements() {
@@ -245,14 +440,23 @@ export class JsonArray {
245
440
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
246
441
  return v1;
247
442
  }
443
+ /**
444
+ * Removes this array from its parent.
445
+ * After calling this method, the array is detached from the CST and can no longer be used.
446
+ */
248
447
  remove() {
249
448
  const ptr = this.__destroy_into_raw();
250
449
  wasm.jsonarray_remove(ptr);
251
450
  }
451
+ /**
452
+ * Ensures the array is formatted with each element on its own line.
453
+ */
252
454
  ensureMultiline() {
253
455
  wasm.jsonarray_ensureMultiline(this.__wbg_ptr);
254
456
  }
255
457
  /**
458
+ * Returns all child nodes including whitespace and punctuation.
459
+ * @returns Array of all child nodes
256
460
  * @returns {Node[]}
257
461
  */
258
462
  children() {
@@ -262,6 +466,9 @@ export class JsonArray {
262
466
  return v1;
263
467
  }
264
468
  /**
469
+ * Appends a new element to the end of the array.
470
+ * @param value - The value to append
471
+ * @returns The newly created element node
265
472
  * @param {any} value
266
473
  * @returns {Node}
267
474
  */
@@ -273,6 +480,10 @@ export class JsonArray {
273
480
  return Node.__wrap(ret[0]);
274
481
  }
275
482
  /**
483
+ * Inserts a new element at the specified index.
484
+ * @param index - The position to insert at
485
+ * @param value - The value to insert
486
+ * @returns The newly created element node
276
487
  * @param {number} index
277
488
  * @param {any} value
278
489
  * @returns {Node}
@@ -285,12 +496,18 @@ export class JsonArray {
285
496
  return Node.__wrap(ret[0]);
286
497
  }
287
498
  /**
499
+ * Configures whether trailing commas should be used in this array.
500
+ * When enabled, trailing commas are added for multiline formatting.
501
+ * @param enabled - Whether to enable trailing commas
288
502
  * @param {boolean} enabled
289
503
  */
290
504
  setTrailingCommas(enabled) {
291
505
  wasm.jsonarray_setTrailingCommas(this.__wbg_ptr, enabled);
292
506
  }
293
507
  /**
508
+ * Replaces this array with a new value.
509
+ * @param value - The new value to replace this array with
510
+ * @returns The new node that replaced this one, or undefined if this was the root value
294
511
  * @param {any} value
295
512
  * @returns {Node | undefined}
296
513
  */
@@ -302,6 +519,8 @@ export class JsonArray {
302
519
  return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
303
520
  }
304
521
  /**
522
+ * Returns the parent node in the CST.
523
+ * @returns The parent node, or undefined if this is the root
305
524
  * @returns {Node | undefined}
306
525
  */
307
526
  parent() {
@@ -309,6 +528,8 @@ export class JsonArray {
309
528
  return ret === 0 ? undefined : Node.__wrap(ret);
310
529
  }
311
530
  /**
531
+ * Returns the index of this node within its parent's children.
532
+ * @returns The child index
312
533
  * @returns {number}
313
534
  */
314
535
  childIndex() {
@@ -316,6 +537,8 @@ export class JsonArray {
316
537
  return ret >>> 0;
317
538
  }
318
539
  /**
540
+ * Returns all ancestor nodes from parent to root.
541
+ * @returns Array of ancestor nodes
319
542
  * @returns {Node[]}
320
543
  */
321
544
  ancestors() {
@@ -325,6 +548,8 @@ export class JsonArray {
325
548
  return v1;
326
549
  }
327
550
  /**
551
+ * Returns the previous sibling node.
552
+ * @returns The previous sibling, or undefined if this is the first child
328
553
  * @returns {Node | undefined}
329
554
  */
330
555
  previousSibling() {
@@ -332,6 +557,8 @@ export class JsonArray {
332
557
  return ret === 0 ? undefined : Node.__wrap(ret);
333
558
  }
334
559
  /**
560
+ * Returns all previous sibling nodes.
561
+ * @returns Array of previous siblings
335
562
  * @returns {Node[]}
336
563
  */
337
564
  previousSiblings() {
@@ -341,6 +568,8 @@ export class JsonArray {
341
568
  return v1;
342
569
  }
343
570
  /**
571
+ * Returns the next sibling node.
572
+ * @returns The next sibling, or undefined if this is the last child
344
573
  * @returns {Node | undefined}
345
574
  */
346
575
  nextSibling() {
@@ -348,6 +577,8 @@ export class JsonArray {
348
577
  return ret === 0 ? undefined : Node.__wrap(ret);
349
578
  }
350
579
  /**
580
+ * Returns all next sibling nodes.
581
+ * @returns Array of next siblings
351
582
  * @returns {Node[]}
352
583
  */
353
584
  nextSiblings() {
@@ -357,6 +588,8 @@ export class JsonArray {
357
588
  return v1;
358
589
  }
359
590
  /**
591
+ * Returns the root node of the document.
592
+ * @returns The root node, or undefined if detached
360
593
  * @returns {RootNode | undefined}
361
594
  */
362
595
  rootNode() {
@@ -364,6 +597,8 @@ export class JsonArray {
364
597
  return ret === 0 ? undefined : RootNode.__wrap(ret);
365
598
  }
366
599
  /**
600
+ * Returns the indentation string used at this node's depth.
601
+ * @returns The indentation string, or undefined if not applicable
367
602
  * @returns {string | undefined}
368
603
  */
369
604
  indentText() {
@@ -376,6 +611,8 @@ export class JsonArray {
376
611
  return v1;
377
612
  }
378
613
  /**
614
+ * Returns whether this node's container uses trailing commas.
615
+ * @returns true if trailing commas are used
379
616
  * @returns {boolean}
380
617
  */
381
618
  usesTrailingCommas() {
@@ -383,6 +620,8 @@ export class JsonArray {
383
620
  return ret !== 0;
384
621
  }
385
622
  /**
623
+ * Returns child nodes excluding whitespace, comments, and punctuation.
624
+ * @returns Array of significant child nodes
386
625
  * @returns {Node[]}
387
626
  */
388
627
  childrenExcludeTriviaAndTokens() {
@@ -392,6 +631,9 @@ export class JsonArray {
392
631
  return v1;
393
632
  }
394
633
  /**
634
+ * Returns the child node at the specified index.
635
+ * @param index - The child index
636
+ * @returns The child node, or undefined if index is out of bounds
395
637
  * @param {number} index
396
638
  * @returns {Node | undefined}
397
639
  */
@@ -403,6 +645,10 @@ export class JsonArray {
403
645
  const JsonObjectFinalization = (typeof FinalizationRegistry === "undefined")
404
646
  ? { register: () => { }, unregister: () => { } }
405
647
  : new FinalizationRegistry((ptr) => wasm.__wbg_jsonobject_free(ptr >>> 0, 1));
648
+ /**
649
+ * Represents a JSON object node in the CST.
650
+ * Provides methods for manipulating object properties.
651
+ */
406
652
  export class JsonObject {
407
653
  static __wrap(ptr) {
408
654
  ptr = ptr >>> 0;
@@ -422,6 +668,8 @@ export class JsonObject {
422
668
  wasm.__wbg_jsonobject_free(ptr, 0);
423
669
  }
424
670
  /**
671
+ * Returns all properties in the object.
672
+ * @returns Array of object properties
425
673
  * @returns {ObjectProp[]}
426
674
  */
427
675
  properties() {
@@ -431,6 +679,9 @@ export class JsonObject {
431
679
  return v1;
432
680
  }
433
681
  /**
682
+ * Gets a property by name.
683
+ * @param key - The property name to look up
684
+ * @returns The property, or undefined if not found
434
685
  * @param {string} key
435
686
  * @returns {ObjectProp | undefined}
436
687
  */
@@ -441,6 +692,10 @@ export class JsonObject {
441
692
  return ret === 0 ? undefined : ObjectProp.__wrap(ret);
442
693
  }
443
694
  /**
695
+ * Gets a property by name, throwing if not found.
696
+ * @param key - The property name to look up
697
+ * @returns The property
698
+ * @throws If the property is not found
444
699
  * @param {string} key
445
700
  * @returns {ObjectProp}
446
701
  */
@@ -454,6 +709,9 @@ export class JsonObject {
454
709
  return ObjectProp.__wrap(ret[0]);
455
710
  }
456
711
  /**
712
+ * Gets a property value if it's an object.
713
+ * @param name - The property name to look up
714
+ * @returns The object value, or undefined if property doesn't exist or is not an object
457
715
  * @param {string} name
458
716
  * @returns {JsonObject | undefined}
459
717
  */
@@ -464,6 +722,10 @@ export class JsonObject {
464
722
  return ret === 0 ? undefined : JsonObject.__wrap(ret);
465
723
  }
466
724
  /**
725
+ * Gets a property value as an object, throwing if not found or wrong type.
726
+ * @param name - The property name to look up
727
+ * @returns The object value
728
+ * @throws If the property doesn't exist or is not an object
467
729
  * @param {string} name
468
730
  * @returns {JsonObject}
469
731
  */
@@ -477,6 +739,10 @@ export class JsonObject {
477
739
  return JsonObject.__wrap(ret[0]);
478
740
  }
479
741
  /**
742
+ * Gets a property value as an object, creating an empty object if the property doesn't exist.
743
+ * Returns undefined if the property exists but has a non-object value.
744
+ * @param name - The property name to get
745
+ * @returns The object value, or undefined if property has a non-object value
480
746
  * @param {string} name
481
747
  * @returns {JsonObject | undefined}
482
748
  */
@@ -487,6 +753,10 @@ export class JsonObject {
487
753
  return ret === 0 ? undefined : JsonObject.__wrap(ret);
488
754
  }
489
755
  /**
756
+ * Gets a property value as an object, creating or replacing the value with an empty object if needed.
757
+ * Unlike getIfObjectOrCreate, this always returns an object by replacing non-object values.
758
+ * @param name - The property name to get
759
+ * @returns The object value (always succeeds)
490
760
  * @param {string} name
491
761
  * @returns {JsonObject}
492
762
  */
@@ -497,6 +767,9 @@ export class JsonObject {
497
767
  return JsonObject.__wrap(ret);
498
768
  }
499
769
  /**
770
+ * Gets a property value if it's an array.
771
+ * @param name - The property name to look up
772
+ * @returns The array value, or undefined if property doesn't exist or is not an array
500
773
  * @param {string} name
501
774
  * @returns {JsonArray | undefined}
502
775
  */
@@ -507,6 +780,10 @@ export class JsonObject {
507
780
  return ret === 0 ? undefined : JsonArray.__wrap(ret);
508
781
  }
509
782
  /**
783
+ * Gets a property value as an array, throwing if not found or wrong type.
784
+ * @param name - The property name to look up
785
+ * @returns The array value
786
+ * @throws If the property doesn't exist or is not an array
510
787
  * @param {string} name
511
788
  * @returns {JsonArray}
512
789
  */
@@ -520,6 +797,10 @@ export class JsonObject {
520
797
  return JsonArray.__wrap(ret[0]);
521
798
  }
522
799
  /**
800
+ * Gets a property value as an array, creating an empty array if the property doesn't exist.
801
+ * Returns undefined if the property exists but has a non-array value.
802
+ * @param name - The property name to get
803
+ * @returns The array value, or undefined if property has a non-array value
523
804
  * @param {string} name
524
805
  * @returns {JsonArray | undefined}
525
806
  */
@@ -530,6 +811,10 @@ export class JsonObject {
530
811
  return ret === 0 ? undefined : JsonArray.__wrap(ret);
531
812
  }
532
813
  /**
814
+ * Gets a property value as an array, creating or replacing the value with an empty array if needed.
815
+ * Unlike getIfArrayOrCreate, this always returns an array by replacing non-array values.
816
+ * @param name - The property name to get
817
+ * @returns The array value (always succeeds)
533
818
  * @param {string} name
534
819
  * @returns {JsonArray}
535
820
  */
@@ -539,11 +824,17 @@ export class JsonObject {
539
824
  const ret = wasm.jsonobject_getIfArrayOrForce(this.__wbg_ptr, ptr0, len0);
540
825
  return JsonArray.__wrap(ret);
541
826
  }
827
+ /**
828
+ * Removes this object from its parent.
829
+ * After calling this method, the object is detached from the CST and can no longer be used.
830
+ */
542
831
  remove() {
543
832
  const ptr = this.__destroy_into_raw();
544
833
  wasm.jsonobject_remove(ptr);
545
834
  }
546
835
  /**
836
+ * Returns all child nodes including whitespace and punctuation.
837
+ * @returns Array of all child nodes
547
838
  * @returns {Node[]}
548
839
  */
549
840
  children() {
@@ -553,12 +844,16 @@ export class JsonObject {
553
844
  return v1;
554
845
  }
555
846
  /**
556
- * @param {string} prop_name
847
+ * Appends a new property to the object.
848
+ * @param key - The name of the property to add
849
+ * @param value - The value to set for the property
850
+ * @returns The newly created property
851
+ * @param {string} key
557
852
  * @param {any} value
558
853
  * @returns {ObjectProp}
559
854
  */
560
- append(prop_name, value) {
561
- const ptr0 = passStringToWasm0(prop_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
855
+ append(key, value) {
856
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
562
857
  const len0 = WASM_VECTOR_LEN;
563
858
  const ret = wasm.jsonobject_append(this.__wbg_ptr, ptr0, len0, value);
564
859
  if (ret[2]) {
@@ -567,13 +862,18 @@ export class JsonObject {
567
862
  return ObjectProp.__wrap(ret[0]);
568
863
  }
569
864
  /**
865
+ * Inserts a new property at the specified index.
866
+ * @param index - The position to insert the property at
867
+ * @param key - The name of the property to add
868
+ * @param value - The value to set for the property
869
+ * @returns The newly created property
570
870
  * @param {number} index
571
- * @param {string} prop_name
871
+ * @param {string} key
572
872
  * @param {any} value
573
873
  * @returns {ObjectProp}
574
874
  */
575
- insert(index, prop_name, value) {
576
- const ptr0 = passStringToWasm0(prop_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
875
+ insert(index, key, value) {
876
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
577
877
  const len0 = WASM_VECTOR_LEN;
578
878
  const ret = wasm.jsonobject_insert(this.__wbg_ptr, index, ptr0, len0, value);
579
879
  if (ret[2]) {
@@ -582,25 +882,37 @@ export class JsonObject {
582
882
  return ObjectProp.__wrap(ret[0]);
583
883
  }
584
884
  /**
885
+ * Configures whether trailing commas should be used in this object.
886
+ * When enabled, trailing commas are added for multiline formatting.
887
+ * @param enabled - Whether to enable trailing commas
585
888
  * @param {boolean} enabled
586
889
  */
587
890
  setTrailingCommas(enabled) {
588
891
  wasm.jsonobject_setTrailingCommas(this.__wbg_ptr, enabled);
589
892
  }
893
+ /**
894
+ * Ensures the object is formatted with each property on its own line.
895
+ */
590
896
  ensureMultiline() {
591
897
  wasm.jsonobject_ensureMultiline(this.__wbg_ptr);
592
898
  }
593
899
  /**
594
- * @param {string} replacement
900
+ * Replaces this object with a new value.
901
+ * @param replacement - The new value to replace this object with
902
+ * @returns The new node that replaced this one, or undefined if this was the root value
903
+ * @param {any} replacement
595
904
  * @returns {Node | undefined}
596
905
  */
597
906
  replaceWith(replacement) {
598
- const ptr0 = passStringToWasm0(replacement, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
599
- const len0 = WASM_VECTOR_LEN;
600
- const ret = wasm.jsonobject_replaceWith(this.__wbg_ptr, ptr0, len0);
601
- return ret === 0 ? undefined : Node.__wrap(ret);
907
+ const ret = wasm.jsonobject_replaceWith(this.__wbg_ptr, replacement);
908
+ if (ret[2]) {
909
+ throw takeFromExternrefTable0(ret[1]);
910
+ }
911
+ return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
602
912
  }
603
913
  /**
914
+ * Returns the parent node in the CST.
915
+ * @returns The parent node, or undefined if this is the root
604
916
  * @returns {Node | undefined}
605
917
  */
606
918
  parent() {
@@ -608,6 +920,8 @@ export class JsonObject {
608
920
  return ret === 0 ? undefined : Node.__wrap(ret);
609
921
  }
610
922
  /**
923
+ * Returns all ancestor nodes from parent to root.
924
+ * @returns Array of ancestor nodes
611
925
  * @returns {Node[]}
612
926
  */
613
927
  ancestors() {
@@ -617,6 +931,8 @@ export class JsonObject {
617
931
  return v1;
618
932
  }
619
933
  /**
934
+ * Returns the index of this node within its parent's children.
935
+ * @returns The child index
620
936
  * @returns {number}
621
937
  */
622
938
  childIndex() {
@@ -624,6 +940,8 @@ export class JsonObject {
624
940
  return ret >>> 0;
625
941
  }
626
942
  /**
943
+ * Returns the previous sibling node.
944
+ * @returns The previous sibling, or undefined if this is the first child
627
945
  * @returns {Node | undefined}
628
946
  */
629
947
  previousSibling() {
@@ -631,6 +949,8 @@ export class JsonObject {
631
949
  return ret === 0 ? undefined : Node.__wrap(ret);
632
950
  }
633
951
  /**
952
+ * Returns all previous sibling nodes.
953
+ * @returns Array of previous siblings
634
954
  * @returns {Node[]}
635
955
  */
636
956
  previousSiblings() {
@@ -640,6 +960,8 @@ export class JsonObject {
640
960
  return v1;
641
961
  }
642
962
  /**
963
+ * Returns the next sibling node.
964
+ * @returns The next sibling, or undefined if this is the last child
643
965
  * @returns {Node | undefined}
644
966
  */
645
967
  nextSibling() {
@@ -647,6 +969,8 @@ export class JsonObject {
647
969
  return ret === 0 ? undefined : Node.__wrap(ret);
648
970
  }
649
971
  /**
972
+ * Returns all next sibling nodes.
973
+ * @returns Array of next siblings
650
974
  * @returns {Node[]}
651
975
  */
652
976
  nextSiblings() {
@@ -656,6 +980,8 @@ export class JsonObject {
656
980
  return v1;
657
981
  }
658
982
  /**
983
+ * Returns the root node of the document.
984
+ * @returns The root node, or undefined if detached
659
985
  * @returns {RootNode | undefined}
660
986
  */
661
987
  rootNode() {
@@ -663,6 +989,8 @@ export class JsonObject {
663
989
  return ret === 0 ? undefined : RootNode.__wrap(ret);
664
990
  }
665
991
  /**
992
+ * Returns the indentation string used at this node's depth.
993
+ * @returns The indentation string, or undefined if not applicable
666
994
  * @returns {string | undefined}
667
995
  */
668
996
  indentText() {
@@ -675,6 +1003,8 @@ export class JsonObject {
675
1003
  return v1;
676
1004
  }
677
1005
  /**
1006
+ * Returns whether this node's container uses trailing commas.
1007
+ * @returns true if trailing commas are used
678
1008
  * @returns {boolean}
679
1009
  */
680
1010
  usesTrailingCommas() {
@@ -682,6 +1012,8 @@ export class JsonObject {
682
1012
  return ret !== 0;
683
1013
  }
684
1014
  /**
1015
+ * Returns child nodes excluding whitespace, comments, and punctuation.
1016
+ * @returns Array of significant child nodes
685
1017
  * @returns {Node[]}
686
1018
  */
687
1019
  childrenExcludeTriviaAndTokens() {
@@ -691,6 +1023,9 @@ export class JsonObject {
691
1023
  return v1;
692
1024
  }
693
1025
  /**
1026
+ * Returns the child node at the specified index.
1027
+ * @param index - The child index
1028
+ * @returns The child node, or undefined if index is out of bounds
694
1029
  * @param {number} index
695
1030
  * @returns {Node | undefined}
696
1031
  */
@@ -702,6 +1037,10 @@ export class JsonObject {
702
1037
  const NodeFinalization = (typeof FinalizationRegistry === "undefined")
703
1038
  ? { register: () => { }, unregister: () => { } }
704
1039
  : new FinalizationRegistry((ptr) => wasm.__wbg_node_free(ptr >>> 0, 1));
1040
+ /**
1041
+ * Represents a generic node in the CST.
1042
+ * Can be a container node (object, array, property) or a leaf node (string, number, boolean, null).
1043
+ */
705
1044
  export class Node {
706
1045
  static __wrap(ptr) {
707
1046
  ptr = ptr >>> 0;
@@ -721,6 +1060,8 @@ export class Node {
721
1060
  wasm.__wbg_node_free(ptr, 0);
722
1061
  }
723
1062
  /**
1063
+ * Returns true if this node is a container (object, array, or property).
1064
+ * @returns true if this is a container node
724
1065
  * @returns {boolean}
725
1066
  */
726
1067
  isContainer() {
@@ -728,6 +1069,8 @@ export class Node {
728
1069
  return ret !== 0;
729
1070
  }
730
1071
  /**
1072
+ * Returns true if this node is a leaf value (string, number, boolean, null).
1073
+ * @returns true if this is a leaf node
731
1074
  * @returns {boolean}
732
1075
  */
733
1076
  isLeaf() {
@@ -735,6 +1078,8 @@ export class Node {
735
1078
  return ret !== 0;
736
1079
  }
737
1080
  /**
1081
+ * Converts this node to an object if it is one.
1082
+ * @returns The object, or undefined if this node is not an object
738
1083
  * @returns {JsonObject | undefined}
739
1084
  */
740
1085
  asObject() {
@@ -742,6 +1087,9 @@ export class Node {
742
1087
  return ret === 0 ? undefined : JsonObject.__wrap(ret);
743
1088
  }
744
1089
  /**
1090
+ * Converts this node to an object, throwing if it's not an object.
1091
+ * @returns The object
1092
+ * @throws If this node is not an object
745
1093
  * @returns {JsonObject}
746
1094
  */
747
1095
  asObjectOrThrow() {
@@ -752,6 +1100,8 @@ export class Node {
752
1100
  return JsonObject.__wrap(ret[0]);
753
1101
  }
754
1102
  /**
1103
+ * Converts this node to an array if it is one.
1104
+ * @returns The array, or undefined if this node is not an array
755
1105
  * @returns {JsonArray | undefined}
756
1106
  */
757
1107
  asArray() {
@@ -759,6 +1109,9 @@ export class Node {
759
1109
  return ret === 0 ? undefined : JsonArray.__wrap(ret);
760
1110
  }
761
1111
  /**
1112
+ * Converts this node to an array, throwing if it's not an array.
1113
+ * @returns The array
1114
+ * @throws If this node is not an array
762
1115
  * @returns {JsonArray}
763
1116
  */
764
1117
  asArrayOrThrow() {
@@ -769,6 +1122,8 @@ export class Node {
769
1122
  return JsonArray.__wrap(ret[0]);
770
1123
  }
771
1124
  /**
1125
+ * Converts this node to the root node if it is one.
1126
+ * @returns The root node, or undefined if this is not a root node
772
1127
  * @returns {RootNode | undefined}
773
1128
  */
774
1129
  asRootNode() {
@@ -776,6 +1131,9 @@ export class Node {
776
1131
  return ret === 0 ? undefined : RootNode.__wrap(ret);
777
1132
  }
778
1133
  /**
1134
+ * Converts this node to the root node, throwing if it's not a root node.
1135
+ * @returns The root node
1136
+ * @throws If this node is not a root node
779
1137
  * @returns {RootNode}
780
1138
  */
781
1139
  asRootNodeOrThrow() {
@@ -786,6 +1144,8 @@ export class Node {
786
1144
  return RootNode.__wrap(ret[0]);
787
1145
  }
788
1146
  /**
1147
+ * Returns the decoded string value if this node is a string literal.
1148
+ * @returns The string value, or undefined if this node is not a string
789
1149
  * @returns {string | undefined}
790
1150
  */
791
1151
  asString() {
@@ -798,6 +1158,9 @@ export class Node {
798
1158
  return v1;
799
1159
  }
800
1160
  /**
1161
+ * Returns the decoded string value, throwing if not a string.
1162
+ * @returns The string value
1163
+ * @throws If this node is not a string
801
1164
  * @returns {string}
802
1165
  */
803
1166
  asStringOrThrow() {
@@ -821,6 +1184,9 @@ export class Node {
821
1184
  }
822
1185
  }
823
1186
  /**
1187
+ * Returns the raw string representation of a number literal.
1188
+ * Returns a string to preserve the exact formatting (e.g., "1.0" vs "1", "1e10" vs "10000000000").
1189
+ * @returns The number as a string, or undefined if this node is not a number
824
1190
  * @returns {string | undefined}
825
1191
  */
826
1192
  numberValue() {
@@ -833,6 +1199,10 @@ export class Node {
833
1199
  return v1;
834
1200
  }
835
1201
  /**
1202
+ * Returns the raw string representation of a number literal, throwing if not a number.
1203
+ * Returns a string to preserve the exact formatting (e.g., "1.0" vs "1", "1e10" vs "10000000000").
1204
+ * @returns The number as a string
1205
+ * @throws If this node is not a number
836
1206
  * @returns {string}
837
1207
  */
838
1208
  numberValueOrThrow() {
@@ -856,6 +1226,8 @@ export class Node {
856
1226
  }
857
1227
  }
858
1228
  /**
1229
+ * Returns the boolean value if this node is a boolean literal.
1230
+ * @returns The boolean value, or undefined if this node is not a boolean
859
1231
  * @returns {boolean | undefined}
860
1232
  */
861
1233
  asBoolean() {
@@ -863,6 +1235,9 @@ export class Node {
863
1235
  return ret === 0xFFFFFF ? undefined : ret !== 0;
864
1236
  }
865
1237
  /**
1238
+ * Returns the boolean value, throwing if not a boolean.
1239
+ * @returns The boolean value
1240
+ * @throws If this node is not a boolean
866
1241
  * @returns {boolean}
867
1242
  */
868
1243
  asBooleanOrThrow() {
@@ -873,6 +1248,8 @@ export class Node {
873
1248
  return ret[0] !== 0;
874
1249
  }
875
1250
  /**
1251
+ * Returns true if this node is a null keyword.
1252
+ * @returns true if this node represents null
876
1253
  * @returns {boolean}
877
1254
  */
878
1255
  isNull() {
@@ -880,6 +1257,8 @@ export class Node {
880
1257
  return ret !== 0;
881
1258
  }
882
1259
  /**
1260
+ * Returns true if this node is a string literal.
1261
+ * @returns true if this node is a string
883
1262
  * @returns {boolean}
884
1263
  */
885
1264
  isString() {
@@ -887,6 +1266,8 @@ export class Node {
887
1266
  return ret !== 0;
888
1267
  }
889
1268
  /**
1269
+ * Returns true if this node is a number literal.
1270
+ * @returns true if this node is a number
890
1271
  * @returns {boolean}
891
1272
  */
892
1273
  isNumber() {
@@ -894,6 +1275,8 @@ export class Node {
894
1275
  return ret !== 0;
895
1276
  }
896
1277
  /**
1278
+ * Returns true if this node is a boolean literal.
1279
+ * @returns true if this node is a boolean
897
1280
  * @returns {boolean}
898
1281
  */
899
1282
  isBoolean() {
@@ -901,6 +1284,118 @@ export class Node {
901
1284
  return ret !== 0;
902
1285
  }
903
1286
  /**
1287
+ * Returns this node as a StringLit if it is one.
1288
+ * @returns The StringLit, or undefined if this node is not a string literal
1289
+ * @returns {StringLit | undefined}
1290
+ */
1291
+ asStringLit() {
1292
+ const ret = wasm.node_asStringLit(this.__wbg_ptr);
1293
+ return ret === 0 ? undefined : StringLit.__wrap(ret);
1294
+ }
1295
+ /**
1296
+ * Returns this node as a StringLit, throwing if it's not a string literal.
1297
+ * @returns The StringLit
1298
+ * @throws If this node is not a string literal
1299
+ * @returns {StringLit}
1300
+ */
1301
+ asStringLitOrThrow() {
1302
+ const ret = wasm.node_asStringLitOrThrow(this.__wbg_ptr);
1303
+ if (ret[2]) {
1304
+ throw takeFromExternrefTable0(ret[1]);
1305
+ }
1306
+ return StringLit.__wrap(ret[0]);
1307
+ }
1308
+ /**
1309
+ * Returns this node as a NumberLit if it is one.
1310
+ * @returns The NumberLit, or undefined if this node is not a number literal
1311
+ * @returns {NumberLit | undefined}
1312
+ */
1313
+ asNumberLit() {
1314
+ const ret = wasm.node_asNumberLit(this.__wbg_ptr);
1315
+ return ret === 0 ? undefined : NumberLit.__wrap(ret);
1316
+ }
1317
+ /**
1318
+ * Returns this node as a NumberLit, throwing if it's not a number literal.
1319
+ * @returns The NumberLit
1320
+ * @throws If this node is not a number literal
1321
+ * @returns {NumberLit}
1322
+ */
1323
+ asNumberLitOrThrow() {
1324
+ const ret = wasm.node_asNumberLitOrThrow(this.__wbg_ptr);
1325
+ if (ret[2]) {
1326
+ throw takeFromExternrefTable0(ret[1]);
1327
+ }
1328
+ return NumberLit.__wrap(ret[0]);
1329
+ }
1330
+ /**
1331
+ * Returns this node as a BooleanLit if it is one.
1332
+ * @returns The BooleanLit, or undefined if this node is not a boolean literal
1333
+ * @returns {BooleanLit | undefined}
1334
+ */
1335
+ asBooleanLit() {
1336
+ const ret = wasm.node_asBooleanLit(this.__wbg_ptr);
1337
+ return ret === 0 ? undefined : BooleanLit.__wrap(ret);
1338
+ }
1339
+ /**
1340
+ * Returns this node as a BooleanLit, throwing if it's not a boolean literal.
1341
+ * @returns The BooleanLit
1342
+ * @throws If this node is not a boolean literal
1343
+ * @returns {BooleanLit}
1344
+ */
1345
+ asBooleanLitOrThrow() {
1346
+ const ret = wasm.node_asBooleanLitOrThrow(this.__wbg_ptr);
1347
+ if (ret[2]) {
1348
+ throw takeFromExternrefTable0(ret[1]);
1349
+ }
1350
+ return BooleanLit.__wrap(ret[0]);
1351
+ }
1352
+ /**
1353
+ * Returns this node as a NullKeyword if it is one.
1354
+ * @returns The NullKeyword, or undefined if this node is not a null keyword
1355
+ * @returns {NullKeyword | undefined}
1356
+ */
1357
+ asNullKeyword() {
1358
+ const ret = wasm.node_asNullKeyword(this.__wbg_ptr);
1359
+ return ret === 0 ? undefined : NullKeyword.__wrap(ret);
1360
+ }
1361
+ /**
1362
+ * Returns this node as a NullKeyword, throwing if it's not a null keyword.
1363
+ * @returns The NullKeyword
1364
+ * @throws If this node is not a null keyword
1365
+ * @returns {NullKeyword}
1366
+ */
1367
+ asNullKeywordOrThrow() {
1368
+ const ret = wasm.node_asNullKeywordOrThrow(this.__wbg_ptr);
1369
+ if (ret[2]) {
1370
+ throw takeFromExternrefTable0(ret[1]);
1371
+ }
1372
+ return NullKeyword.__wrap(ret[0]);
1373
+ }
1374
+ /**
1375
+ * Returns this node as a WordLit if it is one.
1376
+ * @returns The WordLit, or undefined if this node is not a word literal
1377
+ * @returns {WordLit | undefined}
1378
+ */
1379
+ asWordLit() {
1380
+ const ret = wasm.node_asWordLit(this.__wbg_ptr);
1381
+ return ret === 0 ? undefined : WordLit.__wrap(ret);
1382
+ }
1383
+ /**
1384
+ * Returns this node as a WordLit, throwing if it's not a word literal.
1385
+ * @returns The WordLit
1386
+ * @throws If this node is not a word literal
1387
+ * @returns {WordLit}
1388
+ */
1389
+ asWordLitOrThrow() {
1390
+ const ret = wasm.node_asWordLitOrThrow(this.__wbg_ptr);
1391
+ if (ret[2]) {
1392
+ throw takeFromExternrefTable0(ret[1]);
1393
+ }
1394
+ return WordLit.__wrap(ret[0]);
1395
+ }
1396
+ /**
1397
+ * Returns the parent node in the CST.
1398
+ * @returns The parent node, or undefined if this is the root
904
1399
  * @returns {Node | undefined}
905
1400
  */
906
1401
  parent() {
@@ -908,6 +1403,9 @@ export class Node {
908
1403
  return ret === 0 ? undefined : Node.__wrap(ret);
909
1404
  }
910
1405
  /**
1406
+ * Returns the parent node, throwing if this is the root.
1407
+ * @returns The parent node
1408
+ * @throws If this node has no parent
911
1409
  * @returns {Node}
912
1410
  */
913
1411
  parentOrThrow() {
@@ -918,6 +1416,8 @@ export class Node {
918
1416
  return Node.__wrap(ret[0]);
919
1417
  }
920
1418
  /**
1419
+ * Returns the index of this node within its parent's children.
1420
+ * @returns The child index
921
1421
  * @returns {number}
922
1422
  */
923
1423
  childIndex() {
@@ -925,6 +1425,8 @@ export class Node {
925
1425
  return ret >>> 0;
926
1426
  }
927
1427
  /**
1428
+ * Returns all ancestor nodes from parent to root.
1429
+ * @returns Array of ancestor nodes
928
1430
  * @returns {Node[]}
929
1431
  */
930
1432
  ancestors() {
@@ -934,6 +1436,8 @@ export class Node {
934
1436
  return v1;
935
1437
  }
936
1438
  /**
1439
+ * Returns the previous sibling node.
1440
+ * @returns The previous sibling, or undefined if this is the first child
937
1441
  * @returns {Node | undefined}
938
1442
  */
939
1443
  previousSibling() {
@@ -941,6 +1445,8 @@ export class Node {
941
1445
  return ret === 0 ? undefined : Node.__wrap(ret);
942
1446
  }
943
1447
  /**
1448
+ * Returns all previous sibling nodes.
1449
+ * @returns Array of previous siblings
944
1450
  * @returns {Node[]}
945
1451
  */
946
1452
  previousSiblings() {
@@ -950,6 +1456,8 @@ export class Node {
950
1456
  return v1;
951
1457
  }
952
1458
  /**
1459
+ * Returns the next sibling node.
1460
+ * @returns The next sibling, or undefined if this is the last child
953
1461
  * @returns {Node | undefined}
954
1462
  */
955
1463
  nextSibling() {
@@ -957,6 +1465,8 @@ export class Node {
957
1465
  return ret === 0 ? undefined : Node.__wrap(ret);
958
1466
  }
959
1467
  /**
1468
+ * Returns all next sibling nodes.
1469
+ * @returns Array of next siblings
960
1470
  * @returns {Node[]}
961
1471
  */
962
1472
  nextSiblings() {
@@ -966,6 +1476,8 @@ export class Node {
966
1476
  return v1;
967
1477
  }
968
1478
  /**
1479
+ * Returns the root node of the document.
1480
+ * @returns The root node, or undefined if detached
969
1481
  * @returns {RootNode | undefined}
970
1482
  */
971
1483
  rootNode() {
@@ -973,6 +1485,9 @@ export class Node {
973
1485
  return ret === 0 ? undefined : RootNode.__wrap(ret);
974
1486
  }
975
1487
  /**
1488
+ * Returns the root node, throwing if detached.
1489
+ * @returns The root node
1490
+ * @throws If this node is detached from the CST
976
1491
  * @returns {RootNode}
977
1492
  */
978
1493
  rootNodeOrThrow() {
@@ -983,6 +1498,8 @@ export class Node {
983
1498
  return RootNode.__wrap(ret[0]);
984
1499
  }
985
1500
  /**
1501
+ * Returns the indentation string used at this node's depth.
1502
+ * @returns The indentation string, or undefined if not applicable
986
1503
  * @returns {string | undefined}
987
1504
  */
988
1505
  indentText() {
@@ -995,6 +1512,8 @@ export class Node {
995
1512
  return v1;
996
1513
  }
997
1514
  /**
1515
+ * Returns whether this node's container uses trailing commas.
1516
+ * @returns true if trailing commas are used
998
1517
  * @returns {boolean}
999
1518
  */
1000
1519
  usesTrailingCommas() {
@@ -1002,6 +1521,8 @@ export class Node {
1002
1521
  return ret !== 0;
1003
1522
  }
1004
1523
  /**
1524
+ * Returns true if this node is trivia (whitespace or comments).
1525
+ * @returns true if this node is trivia
1005
1526
  * @returns {boolean}
1006
1527
  */
1007
1528
  isTrivia() {
@@ -1009,6 +1530,8 @@ export class Node {
1009
1530
  return ret !== 0;
1010
1531
  }
1011
1532
  /**
1533
+ * Returns true if this node is a newline character.
1534
+ * @returns true if this node is a newline
1012
1535
  * @returns {boolean}
1013
1536
  */
1014
1537
  isNewline() {
@@ -1016,6 +1539,8 @@ export class Node {
1016
1539
  return ret !== 0;
1017
1540
  }
1018
1541
  /**
1542
+ * Returns true if this node is a comma token.
1543
+ * @returns true if this node is a comma
1019
1544
  * @returns {boolean}
1020
1545
  */
1021
1546
  isComma() {
@@ -1023,6 +1548,8 @@ export class Node {
1023
1548
  return ret !== 0;
1024
1549
  }
1025
1550
  /**
1551
+ * Returns true if this node is a comment.
1552
+ * @returns true if this node is a comment
1026
1553
  * @returns {boolean}
1027
1554
  */
1028
1555
  isComment() {
@@ -1030,6 +1557,8 @@ export class Node {
1030
1557
  return ret !== 0;
1031
1558
  }
1032
1559
  /**
1560
+ * Returns true if this node is a punctuation token (bracket, brace, colon, comma).
1561
+ * @returns true if this node is a token
1033
1562
  * @returns {boolean}
1034
1563
  */
1035
1564
  isToken() {
@@ -1037,6 +1566,8 @@ export class Node {
1037
1566
  return ret !== 0;
1038
1567
  }
1039
1568
  /**
1569
+ * Returns true if this node is whitespace.
1570
+ * @returns true if this node is whitespace
1040
1571
  * @returns {boolean}
1041
1572
  */
1042
1573
  isWhitespace() {
@@ -1044,6 +1575,8 @@ export class Node {
1044
1575
  return ret !== 0;
1045
1576
  }
1046
1577
  /**
1578
+ * Returns the character if this node is a single-character token.
1579
+ * @returns The token character, or undefined if not a token
1047
1580
  * @returns {string | undefined}
1048
1581
  */
1049
1582
  tokenChar() {
@@ -1056,6 +1589,8 @@ export class Node {
1056
1589
  return v1;
1057
1590
  }
1058
1591
  /**
1592
+ * Returns the element index if this node is an array element.
1593
+ * @returns The element index, or undefined if not an array element
1059
1594
  * @returns {number | undefined}
1060
1595
  */
1061
1596
  elementIndex() {
@@ -1063,6 +1598,8 @@ export class Node {
1063
1598
  return ret === 0x100000001 ? undefined : ret;
1064
1599
  }
1065
1600
  /**
1601
+ * Returns all child nodes including whitespace and punctuation.
1602
+ * @returns Array of all child nodes
1066
1603
  * @returns {Node[]}
1067
1604
  */
1068
1605
  children() {
@@ -1072,6 +1609,8 @@ export class Node {
1072
1609
  return v1;
1073
1610
  }
1074
1611
  /**
1612
+ * Returns child nodes excluding whitespace, comments, and punctuation.
1613
+ * @returns Array of significant child nodes
1075
1614
  * @returns {Node[]}
1076
1615
  */
1077
1616
  childrenExcludeTriviaAndTokens() {
@@ -1081,6 +1620,9 @@ export class Node {
1081
1620
  return v1;
1082
1621
  }
1083
1622
  /**
1623
+ * Returns the child node at the specified index.
1624
+ * @param index - The child index
1625
+ * @returns The child node, or undefined if index is out of bounds
1084
1626
  * @param {number} index
1085
1627
  * @returns {Node | undefined}
1086
1628
  */
@@ -1088,88 +1630,428 @@ export class Node {
1088
1630
  const ret = wasm.node_childAtIndex(this.__wbg_ptr, index);
1089
1631
  return ret === 0 ? undefined : Node.__wrap(ret);
1090
1632
  }
1633
+ /**
1634
+ * Converts this CST node to a plain JavaScript value.
1635
+ * This recursively converts objects, arrays, and primitives to their JavaScript equivalents.
1636
+ * Comments and formatting information are discarded.
1637
+ * @returns The plain JavaScript value (object, array, string, number, boolean, or null)
1638
+ * @throws If the node contains invalid values that cannot be converted
1639
+ * @returns {any}
1640
+ */
1641
+ toValue() {
1642
+ const ret = wasm.node_toValue(this.__wbg_ptr);
1643
+ return ret;
1644
+ }
1091
1645
  }
1092
- const ObjectPropFinalization = (typeof FinalizationRegistry === "undefined")
1646
+ const NullKeywordFinalization = (typeof FinalizationRegistry === "undefined")
1093
1647
  ? { register: () => { }, unregister: () => { } }
1094
- : new FinalizationRegistry((ptr) => wasm.__wbg_objectprop_free(ptr >>> 0, 1));
1095
- export class ObjectProp {
1648
+ : new FinalizationRegistry((ptr) => wasm.__wbg_nullkeyword_free(ptr >>> 0, 1));
1649
+ /**
1650
+ * Represents a null keyword node in the CST.
1651
+ */
1652
+ export class NullKeyword {
1096
1653
  static __wrap(ptr) {
1097
1654
  ptr = ptr >>> 0;
1098
- const obj = Object.create(ObjectProp.prototype);
1655
+ const obj = Object.create(NullKeyword.prototype);
1099
1656
  obj.__wbg_ptr = ptr;
1100
- ObjectPropFinalization.register(obj, obj.__wbg_ptr, obj);
1657
+ NullKeywordFinalization.register(obj, obj.__wbg_ptr, obj);
1101
1658
  return obj;
1102
1659
  }
1103
1660
  __destroy_into_raw() {
1104
1661
  const ptr = this.__wbg_ptr;
1105
1662
  this.__wbg_ptr = 0;
1106
- ObjectPropFinalization.unregister(this);
1663
+ NullKeywordFinalization.unregister(this);
1107
1664
  return ptr;
1108
1665
  }
1109
1666
  free() {
1110
1667
  const ptr = this.__destroy_into_raw();
1111
- wasm.__wbg_objectprop_free(ptr, 0);
1668
+ wasm.__wbg_nullkeyword_free(ptr, 0);
1112
1669
  }
1113
1670
  /**
1114
- * @returns {string | undefined}
1671
+ * Replaces this null keyword with a new value.
1672
+ * @param replacement - The new value to replace this null with
1673
+ * @returns The new node that replaced this one, or undefined if this was the root value
1674
+ * @param {any} replacement
1675
+ * @returns {Node | undefined}
1115
1676
  */
1116
- name() {
1117
- const ret = wasm.objectprop_name(this.__wbg_ptr);
1118
- let v1;
1119
- if (ret[0] !== 0) {
1120
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1121
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1677
+ replaceWith(replacement) {
1678
+ const ret = wasm.nullkeyword_replaceWith(this.__wbg_ptr, replacement);
1679
+ if (ret[2]) {
1680
+ throw takeFromExternrefTable0(ret[1]);
1122
1681
  }
1123
- return v1;
1682
+ return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
1124
1683
  }
1125
1684
  /**
1126
- * @returns {string}
1685
+ * Removes this node from its parent.
1686
+ * After calling this method, the node is detached from the CST and can no longer be used.
1127
1687
  */
1128
- nameOrThrow() {
1129
- let deferred2_0;
1130
- let deferred2_1;
1131
- try {
1132
- const ret = wasm.objectprop_nameOrThrow(this.__wbg_ptr);
1133
- var ptr1 = ret[0];
1134
- var len1 = ret[1];
1135
- if (ret[3]) {
1136
- ptr1 = 0;
1137
- len1 = 0;
1138
- throw takeFromExternrefTable0(ret[2]);
1139
- }
1140
- deferred2_0 = ptr1;
1141
- deferred2_1 = len1;
1142
- return getStringFromWasm0(ptr1, len1);
1143
- }
1144
- finally {
1145
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1146
- }
1688
+ remove() {
1689
+ const ptr = this.__destroy_into_raw();
1690
+ wasm.nullkeyword_remove(ptr);
1147
1691
  }
1148
1692
  /**
1693
+ * Returns the parent node in the CST.
1694
+ * @returns The parent node, or undefined if this is the root
1149
1695
  * @returns {Node | undefined}
1150
1696
  */
1151
- value() {
1152
- const ret = wasm.objectprop_value(this.__wbg_ptr);
1697
+ parent() {
1698
+ const ret = wasm.nullkeyword_parent(this.__wbg_ptr);
1153
1699
  return ret === 0 ? undefined : Node.__wrap(ret);
1154
1700
  }
1155
1701
  /**
1156
- * @returns {Node}
1702
+ * Returns all ancestor nodes from parent to root.
1703
+ * @returns Array of ancestor nodes
1704
+ * @returns {Node[]}
1157
1705
  */
1158
- valueOrThrow() {
1159
- const ret = wasm.objectprop_valueOrThrow(this.__wbg_ptr);
1160
- if (ret[2]) {
1161
- throw takeFromExternrefTable0(ret[1]);
1162
- }
1163
- return Node.__wrap(ret[0]);
1706
+ ancestors() {
1707
+ const ret = wasm.nullkeyword_ancestors(this.__wbg_ptr);
1708
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1709
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1710
+ return v1;
1164
1711
  }
1165
1712
  /**
1166
- * @returns {JsonObject | undefined}
1713
+ * Returns the index of this node within its parent's children.
1714
+ * @returns The child index
1715
+ * @returns {number}
1167
1716
  */
1168
- valueIfObject() {
1717
+ childIndex() {
1718
+ const ret = wasm.nullkeyword_childIndex(this.__wbg_ptr);
1719
+ return ret >>> 0;
1720
+ }
1721
+ /**
1722
+ * Returns the previous sibling node.
1723
+ * @returns The previous sibling, or undefined if this is the first child
1724
+ * @returns {Node | undefined}
1725
+ */
1726
+ previousSibling() {
1727
+ const ret = wasm.nullkeyword_previousSibling(this.__wbg_ptr);
1728
+ return ret === 0 ? undefined : Node.__wrap(ret);
1729
+ }
1730
+ /**
1731
+ * Returns all previous sibling nodes.
1732
+ * @returns Array of previous siblings
1733
+ * @returns {Node[]}
1734
+ */
1735
+ previousSiblings() {
1736
+ const ret = wasm.nullkeyword_previousSiblings(this.__wbg_ptr);
1737
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1738
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1739
+ return v1;
1740
+ }
1741
+ /**
1742
+ * Returns the next sibling node.
1743
+ * @returns The next sibling, or undefined if this is the last child
1744
+ * @returns {Node | undefined}
1745
+ */
1746
+ nextSibling() {
1747
+ const ret = wasm.nullkeyword_nextSibling(this.__wbg_ptr);
1748
+ return ret === 0 ? undefined : Node.__wrap(ret);
1749
+ }
1750
+ /**
1751
+ * Returns all next sibling nodes.
1752
+ * @returns Array of next siblings
1753
+ * @returns {Node[]}
1754
+ */
1755
+ nextSiblings() {
1756
+ const ret = wasm.nullkeyword_nextSiblings(this.__wbg_ptr);
1757
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1758
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1759
+ return v1;
1760
+ }
1761
+ /**
1762
+ * Returns the root node of the document.
1763
+ * @returns The root node, or undefined if detached
1764
+ * @returns {RootNode | undefined}
1765
+ */
1766
+ rootNode() {
1767
+ const ret = wasm.nullkeyword_rootNode(this.__wbg_ptr);
1768
+ return ret === 0 ? undefined : RootNode.__wrap(ret);
1769
+ }
1770
+ /**
1771
+ * Returns the indentation string used at this node's depth.
1772
+ * @returns The indentation string, or undefined if not applicable
1773
+ * @returns {string | undefined}
1774
+ */
1775
+ indentText() {
1776
+ const ret = wasm.nullkeyword_indentText(this.__wbg_ptr);
1777
+ let v1;
1778
+ if (ret[0] !== 0) {
1779
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1780
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1781
+ }
1782
+ return v1;
1783
+ }
1784
+ /**
1785
+ * Returns whether this node's container uses trailing commas.
1786
+ * @returns true if trailing commas are used
1787
+ * @returns {boolean}
1788
+ */
1789
+ usesTrailingCommas() {
1790
+ const ret = wasm.nullkeyword_usesTrailingCommas(this.__wbg_ptr);
1791
+ return ret !== 0;
1792
+ }
1793
+ }
1794
+ const NumberLitFinalization = (typeof FinalizationRegistry === "undefined")
1795
+ ? { register: () => { }, unregister: () => { } }
1796
+ : new FinalizationRegistry((ptr) => wasm.__wbg_numberlit_free(ptr >>> 0, 1));
1797
+ /**
1798
+ * Represents a number literal node in the CST.
1799
+ * Provides methods for manipulating number values.
1800
+ */
1801
+ export class NumberLit {
1802
+ static __wrap(ptr) {
1803
+ ptr = ptr >>> 0;
1804
+ const obj = Object.create(NumberLit.prototype);
1805
+ obj.__wbg_ptr = ptr;
1806
+ NumberLitFinalization.register(obj, obj.__wbg_ptr, obj);
1807
+ return obj;
1808
+ }
1809
+ __destroy_into_raw() {
1810
+ const ptr = this.__wbg_ptr;
1811
+ this.__wbg_ptr = 0;
1812
+ NumberLitFinalization.unregister(this);
1813
+ return ptr;
1814
+ }
1815
+ free() {
1816
+ const ptr = this.__destroy_into_raw();
1817
+ wasm.__wbg_numberlit_free(ptr, 0);
1818
+ }
1819
+ /**
1820
+ * Returns the raw string representation of the number.
1821
+ * Returns a string to preserve the exact formatting (e.g., "1.0" vs "1", "1e10" vs "10000000000").
1822
+ * @returns The number as a string
1823
+ * @returns {string}
1824
+ */
1825
+ value() {
1826
+ let deferred1_0;
1827
+ let deferred1_1;
1828
+ try {
1829
+ const ret = wasm.numberlit_value(this.__wbg_ptr);
1830
+ deferred1_0 = ret[0];
1831
+ deferred1_1 = ret[1];
1832
+ return getStringFromWasm0(ret[0], ret[1]);
1833
+ }
1834
+ finally {
1835
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1836
+ }
1837
+ }
1838
+ /**
1839
+ * Sets the raw number value.
1840
+ * The value should be a valid JSON number string (e.g., "42", "3.14", "1e10").
1841
+ * @param value - The raw number string to set
1842
+ * @param {string} value
1843
+ */
1844
+ setRawValue(value) {
1845
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1846
+ const len0 = WASM_VECTOR_LEN;
1847
+ wasm.numberlit_setRawValue(this.__wbg_ptr, ptr0, len0);
1848
+ }
1849
+ /**
1850
+ * Replaces this number literal with a new value.
1851
+ * @param replacement - The new value to replace this number with
1852
+ * @returns The new node that replaced this one, or undefined if this was the root value
1853
+ * @param {any} replacement
1854
+ * @returns {Node | undefined}
1855
+ */
1856
+ replaceWith(replacement) {
1857
+ const ret = wasm.numberlit_replaceWith(this.__wbg_ptr, replacement);
1858
+ if (ret[2]) {
1859
+ throw takeFromExternrefTable0(ret[1]);
1860
+ }
1861
+ return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
1862
+ }
1863
+ /**
1864
+ * Removes this node from its parent.
1865
+ * After calling this method, the node is detached from the CST and can no longer be used.
1866
+ */
1867
+ remove() {
1868
+ const ptr = this.__destroy_into_raw();
1869
+ wasm.numberlit_remove(ptr);
1870
+ }
1871
+ /**
1872
+ * Returns the parent node in the CST.
1873
+ * @returns The parent node, or undefined if this is the root
1874
+ * @returns {Node | undefined}
1875
+ */
1876
+ parent() {
1877
+ const ret = wasm.numberlit_parent(this.__wbg_ptr);
1878
+ return ret === 0 ? undefined : Node.__wrap(ret);
1879
+ }
1880
+ /**
1881
+ * Returns all ancestor nodes from parent to root.
1882
+ * @returns Array of ancestor nodes
1883
+ * @returns {Node[]}
1884
+ */
1885
+ ancestors() {
1886
+ const ret = wasm.numberlit_ancestors(this.__wbg_ptr);
1887
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1888
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1889
+ return v1;
1890
+ }
1891
+ /**
1892
+ * Returns the index of this node within its parent's children.
1893
+ * @returns The child index
1894
+ * @returns {number}
1895
+ */
1896
+ childIndex() {
1897
+ const ret = wasm.numberlit_childIndex(this.__wbg_ptr);
1898
+ return ret >>> 0;
1899
+ }
1900
+ /**
1901
+ * Returns the previous sibling node.
1902
+ * @returns The previous sibling, or undefined if this is the first child
1903
+ * @returns {Node | undefined}
1904
+ */
1905
+ previousSibling() {
1906
+ const ret = wasm.numberlit_previousSibling(this.__wbg_ptr);
1907
+ return ret === 0 ? undefined : Node.__wrap(ret);
1908
+ }
1909
+ /**
1910
+ * Returns all previous sibling nodes.
1911
+ * @returns Array of previous siblings
1912
+ * @returns {Node[]}
1913
+ */
1914
+ previousSiblings() {
1915
+ const ret = wasm.numberlit_previousSiblings(this.__wbg_ptr);
1916
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1917
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1918
+ return v1;
1919
+ }
1920
+ /**
1921
+ * Returns the next sibling node.
1922
+ * @returns The next sibling, or undefined if this is the last child
1923
+ * @returns {Node | undefined}
1924
+ */
1925
+ nextSibling() {
1926
+ const ret = wasm.numberlit_nextSibling(this.__wbg_ptr);
1927
+ return ret === 0 ? undefined : Node.__wrap(ret);
1928
+ }
1929
+ /**
1930
+ * Returns all next sibling nodes.
1931
+ * @returns Array of next siblings
1932
+ * @returns {Node[]}
1933
+ */
1934
+ nextSiblings() {
1935
+ const ret = wasm.numberlit_nextSiblings(this.__wbg_ptr);
1936
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1937
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1938
+ return v1;
1939
+ }
1940
+ /**
1941
+ * Returns the root node of the document.
1942
+ * @returns The root node, or undefined if detached
1943
+ * @returns {RootNode | undefined}
1944
+ */
1945
+ rootNode() {
1946
+ const ret = wasm.numberlit_rootNode(this.__wbg_ptr);
1947
+ return ret === 0 ? undefined : RootNode.__wrap(ret);
1948
+ }
1949
+ /**
1950
+ * Returns the indentation string used at this node's depth.
1951
+ * @returns The indentation string, or undefined if not applicable
1952
+ * @returns {string | undefined}
1953
+ */
1954
+ indentText() {
1955
+ const ret = wasm.numberlit_indentText(this.__wbg_ptr);
1956
+ let v1;
1957
+ if (ret[0] !== 0) {
1958
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1959
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1960
+ }
1961
+ return v1;
1962
+ }
1963
+ /**
1964
+ * Returns whether this node's container uses trailing commas.
1965
+ * @returns true if trailing commas are used
1966
+ * @returns {boolean}
1967
+ */
1968
+ usesTrailingCommas() {
1969
+ const ret = wasm.numberlit_usesTrailingCommas(this.__wbg_ptr);
1970
+ return ret !== 0;
1971
+ }
1972
+ }
1973
+ const ObjectPropFinalization = (typeof FinalizationRegistry === "undefined")
1974
+ ? { register: () => { }, unregister: () => { } }
1975
+ : new FinalizationRegistry((ptr) => wasm.__wbg_objectprop_free(ptr >>> 0, 1));
1976
+ /**
1977
+ * Represents an object property (key-value pair) in the CST.
1978
+ * Provides methods for accessing and manipulating both the property name and its value.
1979
+ */
1980
+ export class ObjectProp {
1981
+ static __wrap(ptr) {
1982
+ ptr = ptr >>> 0;
1983
+ const obj = Object.create(ObjectProp.prototype);
1984
+ obj.__wbg_ptr = ptr;
1985
+ ObjectPropFinalization.register(obj, obj.__wbg_ptr, obj);
1986
+ return obj;
1987
+ }
1988
+ __destroy_into_raw() {
1989
+ const ptr = this.__wbg_ptr;
1990
+ this.__wbg_ptr = 0;
1991
+ ObjectPropFinalization.unregister(this);
1992
+ return ptr;
1993
+ }
1994
+ free() {
1995
+ const ptr = this.__destroy_into_raw();
1996
+ wasm.__wbg_objectprop_free(ptr, 0);
1997
+ }
1998
+ /**
1999
+ * Returns the property name.
2000
+ * @returns The property name, or undefined if malformed
2001
+ * @returns {ObjectPropName | undefined}
2002
+ */
2003
+ name() {
2004
+ const ret = wasm.objectprop_name(this.__wbg_ptr);
2005
+ return ret === 0 ? undefined : ObjectPropName.__wrap(ret);
2006
+ }
2007
+ /**
2008
+ * Returns the property name, throwing if malformed.
2009
+ * @returns The property name
2010
+ * @throws If the property name is malformed
2011
+ * @returns {ObjectPropName}
2012
+ */
2013
+ nameOrThrow() {
2014
+ const ret = wasm.objectprop_nameOrThrow(this.__wbg_ptr);
2015
+ if (ret[2]) {
2016
+ throw takeFromExternrefTable0(ret[1]);
2017
+ }
2018
+ return ObjectPropName.__wrap(ret[0]);
2019
+ }
2020
+ /**
2021
+ * Returns the property value.
2022
+ * @returns The property value, or undefined if malformed
2023
+ * @returns {Node | undefined}
2024
+ */
2025
+ value() {
2026
+ const ret = wasm.objectprop_value(this.__wbg_ptr);
2027
+ return ret === 0 ? undefined : Node.__wrap(ret);
2028
+ }
2029
+ /**
2030
+ * Returns the property value, throwing if malformed.
2031
+ * @returns The property value
2032
+ * @throws If the property value is malformed
2033
+ * @returns {Node}
2034
+ */
2035
+ valueOrThrow() {
2036
+ const ret = wasm.objectprop_valueOrThrow(this.__wbg_ptr);
2037
+ if (ret[2]) {
2038
+ throw takeFromExternrefTable0(ret[1]);
2039
+ }
2040
+ return Node.__wrap(ret[0]);
2041
+ }
2042
+ /**
2043
+ * Returns the property value if it's an object.
2044
+ * @returns The object value, or undefined if not an object
2045
+ * @returns {JsonObject | undefined}
2046
+ */
2047
+ valueIfObject() {
1169
2048
  const ret = wasm.objectprop_valueIfObject(this.__wbg_ptr);
1170
2049
  return ret === 0 ? undefined : JsonObject.__wrap(ret);
1171
2050
  }
1172
2051
  /**
2052
+ * Returns the property value as an object, throwing if not an object.
2053
+ * @returns The object value
2054
+ * @throws If the property value is not an object
1173
2055
  * @returns {JsonObject}
1174
2056
  */
1175
2057
  valueIfObjectOrThrow() {
@@ -1180,6 +2062,9 @@ export class ObjectProp {
1180
2062
  return JsonObject.__wrap(ret[0]);
1181
2063
  }
1182
2064
  /**
2065
+ * Gets the property value as an object, replacing the value with an empty object if needed.
2066
+ * Always returns an object by replacing non-object values.
2067
+ * @returns The object value (always succeeds)
1183
2068
  * @returns {JsonObject}
1184
2069
  */
1185
2070
  valueIfObjectOrForce() {
@@ -1187,6 +2072,8 @@ export class ObjectProp {
1187
2072
  return JsonObject.__wrap(ret);
1188
2073
  }
1189
2074
  /**
2075
+ * Returns the property value if it's an array.
2076
+ * @returns The array value, or undefined if not an array
1190
2077
  * @returns {JsonArray | undefined}
1191
2078
  */
1192
2079
  valueIfArray() {
@@ -1194,6 +2081,9 @@ export class ObjectProp {
1194
2081
  return ret === 0 ? undefined : JsonArray.__wrap(ret);
1195
2082
  }
1196
2083
  /**
2084
+ * Returns the property value as an array, throwing if not an array.
2085
+ * @returns The array value
2086
+ * @throws If the property value is not an array
1197
2087
  * @returns {JsonArray}
1198
2088
  */
1199
2089
  valueIfArrayOrThrow() {
@@ -1204,17 +2094,26 @@ export class ObjectProp {
1204
2094
  return JsonArray.__wrap(ret[0]);
1205
2095
  }
1206
2096
  /**
2097
+ * Gets the property value as an array, replacing the value with an empty array if needed.
2098
+ * Always returns an array by replacing non-array values.
2099
+ * @returns The array value (always succeeds)
1207
2100
  * @returns {JsonArray}
1208
2101
  */
1209
2102
  valueIfArrayOrForce() {
1210
2103
  const ret = wasm.objectprop_valueIfArrayOrForce(this.__wbg_ptr);
1211
2104
  return JsonArray.__wrap(ret);
1212
2105
  }
2106
+ /**
2107
+ * Removes this property from its parent object.
2108
+ * After calling this method, the property is detached from the CST and can no longer be used.
2109
+ */
1213
2110
  remove() {
1214
2111
  const ptr = this.__destroy_into_raw();
1215
2112
  wasm.objectprop_remove(ptr);
1216
2113
  }
1217
2114
  /**
2115
+ * Returns the index of this property within its parent object.
2116
+ * @returns The property index
1218
2117
  * @returns {number}
1219
2118
  */
1220
2119
  propertyIndex() {
@@ -1222,6 +2121,8 @@ export class ObjectProp {
1222
2121
  return ret >>> 0;
1223
2122
  }
1224
2123
  /**
2124
+ * Sets the value of this property.
2125
+ * @param value - The new value to set
1225
2126
  * @param {any} value
1226
2127
  */
1227
2128
  setValue(value) {
@@ -1231,99 +2132,829 @@ export class ObjectProp {
1231
2132
  }
1232
2133
  }
1233
2134
  /**
1234
- * @param {string} key
1235
- * @param {string} replacement
1236
- * @returns {Node | undefined}
2135
+ * Replaces this property with a new property.
2136
+ * This allows changing both the property name and its value.
2137
+ * @param key - The new property name
2138
+ * @param replacement - The new value for the property
2139
+ * @returns The new node that replaced this property, or undefined if this was the root value
2140
+ * @param {string} key
2141
+ * @param {any} replacement
2142
+ * @returns {Node | undefined}
2143
+ */
2144
+ replaceWith(key, replacement) {
2145
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2146
+ const len0 = WASM_VECTOR_LEN;
2147
+ const ret = wasm.objectprop_replaceWith(this.__wbg_ptr, ptr0, len0, replacement);
2148
+ if (ret[2]) {
2149
+ throw takeFromExternrefTable0(ret[1]);
2150
+ }
2151
+ return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
2152
+ }
2153
+ /**
2154
+ * Returns the parent node in the CST.
2155
+ * @returns The parent node, or undefined if this is the root
2156
+ * @returns {Node | undefined}
2157
+ */
2158
+ parent() {
2159
+ const ret = wasm.objectprop_parent(this.__wbg_ptr);
2160
+ return ret === 0 ? undefined : Node.__wrap(ret);
2161
+ }
2162
+ /**
2163
+ * Returns all ancestor nodes from parent to root.
2164
+ * @returns Array of ancestor nodes
2165
+ * @returns {Node[]}
2166
+ */
2167
+ ancestors() {
2168
+ const ret = wasm.objectprop_ancestors(this.__wbg_ptr);
2169
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2170
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2171
+ return v1;
2172
+ }
2173
+ /**
2174
+ * Returns the index of this node within its parent's children.
2175
+ * @returns The child index
2176
+ * @returns {number}
2177
+ */
2178
+ childIndex() {
2179
+ const ret = wasm.objectprop_childIndex(this.__wbg_ptr);
2180
+ return ret >>> 0;
2181
+ }
2182
+ /**
2183
+ * Returns the previous sibling node.
2184
+ * @returns The previous sibling, or undefined if this is the first child
2185
+ * @returns {Node | undefined}
2186
+ */
2187
+ previousSibling() {
2188
+ const ret = wasm.objectprop_previousSibling(this.__wbg_ptr);
2189
+ return ret === 0 ? undefined : Node.__wrap(ret);
2190
+ }
2191
+ /**
2192
+ * Returns all previous sibling nodes.
2193
+ * @returns Array of previous siblings
2194
+ * @returns {Node[]}
2195
+ */
2196
+ previousSiblings() {
2197
+ const ret = wasm.objectprop_previousSiblings(this.__wbg_ptr);
2198
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2199
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2200
+ return v1;
2201
+ }
2202
+ /**
2203
+ * Returns the next sibling node.
2204
+ * @returns The next sibling, or undefined if this is the last child
2205
+ * @returns {Node | undefined}
2206
+ */
2207
+ nextSibling() {
2208
+ const ret = wasm.objectprop_nextSibling(this.__wbg_ptr);
2209
+ return ret === 0 ? undefined : Node.__wrap(ret);
2210
+ }
2211
+ /**
2212
+ * Returns all next sibling nodes.
2213
+ * @returns Array of next siblings
2214
+ * @returns {Node[]}
2215
+ */
2216
+ nextSiblings() {
2217
+ const ret = wasm.objectprop_nextSiblings(this.__wbg_ptr);
2218
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2219
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2220
+ return v1;
2221
+ }
2222
+ /**
2223
+ * Returns the previous property in the same object.
2224
+ * @returns The previous property, or undefined if this is the first property
2225
+ * @returns {ObjectProp | undefined}
2226
+ */
2227
+ previousProperty() {
2228
+ const ret = wasm.objectprop_previousProperty(this.__wbg_ptr);
2229
+ return ret === 0 ? undefined : ObjectProp.__wrap(ret);
2230
+ }
2231
+ /**
2232
+ * Returns the next property in the same object.
2233
+ * @returns The next property, or undefined if this is the last property
2234
+ * @returns {ObjectProp | undefined}
2235
+ */
2236
+ nextProperty() {
2237
+ const ret = wasm.objectprop_nextProperty(this.__wbg_ptr);
2238
+ return ret === 0 ? undefined : ObjectProp.__wrap(ret);
2239
+ }
2240
+ /**
2241
+ * Returns the root node of the document.
2242
+ * @returns The root node, or undefined if detached
2243
+ * @returns {RootNode | undefined}
2244
+ */
2245
+ rootNode() {
2246
+ const ret = wasm.objectprop_rootNode(this.__wbg_ptr);
2247
+ return ret === 0 ? undefined : RootNode.__wrap(ret);
2248
+ }
2249
+ /**
2250
+ * Returns the indentation string used at this node's depth.
2251
+ * @returns The indentation string, or undefined if not applicable
2252
+ * @returns {string | undefined}
2253
+ */
2254
+ indentText() {
2255
+ const ret = wasm.objectprop_indentText(this.__wbg_ptr);
2256
+ let v1;
2257
+ if (ret[0] !== 0) {
2258
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2259
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2260
+ }
2261
+ return v1;
2262
+ }
2263
+ /**
2264
+ * Returns whether this node's container uses trailing commas.
2265
+ * @returns true if trailing commas are used
2266
+ * @returns {boolean}
2267
+ */
2268
+ usesTrailingCommas() {
2269
+ const ret = wasm.objectprop_usesTrailingCommas(this.__wbg_ptr);
2270
+ return ret !== 0;
2271
+ }
2272
+ /**
2273
+ * Returns all child nodes including whitespace and punctuation.
2274
+ * @returns Array of all child nodes
2275
+ * @returns {Node[]}
2276
+ */
2277
+ children() {
2278
+ const ret = wasm.objectprop_children(this.__wbg_ptr);
2279
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2280
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2281
+ return v1;
2282
+ }
2283
+ /**
2284
+ * Returns child nodes excluding whitespace, comments, and punctuation.
2285
+ * @returns Array of significant child nodes
2286
+ * @returns {Node[]}
2287
+ */
2288
+ childrenExcludeTriviaAndTokens() {
2289
+ const ret = wasm.objectprop_childrenExcludeTriviaAndTokens(this.__wbg_ptr);
2290
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2291
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2292
+ return v1;
2293
+ }
2294
+ /**
2295
+ * Returns the child node at the specified index.
2296
+ * @param index - The child index
2297
+ * @returns The child node, or undefined if index is out of bounds
2298
+ * @param {number} index
2299
+ * @returns {Node | undefined}
2300
+ */
2301
+ childAtIndex(index) {
2302
+ const ret = wasm.objectprop_childAtIndex(this.__wbg_ptr, index);
2303
+ return ret === 0 ? undefined : Node.__wrap(ret);
2304
+ }
2305
+ }
2306
+ const ObjectPropNameFinalization = (typeof FinalizationRegistry === "undefined")
2307
+ ? { register: () => { }, unregister: () => { } }
2308
+ : new FinalizationRegistry((ptr) => wasm.__wbg_objectpropname_free(ptr >>> 0, 1));
2309
+ /**
2310
+ * Represents the name part of an object property in the CST.
2311
+ * Can be either a quoted string or an unquoted word literal (when allowLooseObjectPropertyNames is enabled).
2312
+ */
2313
+ export class ObjectPropName {
2314
+ static __wrap(ptr) {
2315
+ ptr = ptr >>> 0;
2316
+ const obj = Object.create(ObjectPropName.prototype);
2317
+ obj.__wbg_ptr = ptr;
2318
+ ObjectPropNameFinalization.register(obj, obj.__wbg_ptr, obj);
2319
+ return obj;
2320
+ }
2321
+ __destroy_into_raw() {
2322
+ const ptr = this.__wbg_ptr;
2323
+ this.__wbg_ptr = 0;
2324
+ ObjectPropNameFinalization.unregister(this);
2325
+ return ptr;
2326
+ }
2327
+ free() {
2328
+ const ptr = this.__destroy_into_raw();
2329
+ wasm.__wbg_objectpropname_free(ptr, 0);
2330
+ }
2331
+ /**
2332
+ * Returns the decoded property name (unquoted and unescaped).
2333
+ * @returns The decoded property name
2334
+ * @returns {string}
2335
+ */
2336
+ decodedValue() {
2337
+ let deferred2_0;
2338
+ let deferred2_1;
2339
+ try {
2340
+ const ret = wasm.objectpropname_decodedValue(this.__wbg_ptr);
2341
+ var ptr1 = ret[0];
2342
+ var len1 = ret[1];
2343
+ if (ret[3]) {
2344
+ ptr1 = 0;
2345
+ len1 = 0;
2346
+ throw takeFromExternrefTable0(ret[2]);
2347
+ }
2348
+ deferred2_0 = ptr1;
2349
+ deferred2_1 = len1;
2350
+ return getStringFromWasm0(ptr1, len1);
2351
+ }
2352
+ finally {
2353
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2354
+ }
2355
+ }
2356
+ /**
2357
+ * Returns the parent node in the CST.
2358
+ * @returns The parent node, or undefined if this is the root
2359
+ * @returns {Node | undefined}
2360
+ */
2361
+ parent() {
2362
+ const ret = wasm.objectpropname_parent(this.__wbg_ptr);
2363
+ return ret === 0 ? undefined : Node.__wrap(ret);
2364
+ }
2365
+ /**
2366
+ * Returns the root node of the document.
2367
+ * @returns The root node, or undefined if detached
2368
+ * @returns {RootNode | undefined}
2369
+ */
2370
+ rootNode() {
2371
+ const ret = wasm.objectpropname_rootNode(this.__wbg_ptr);
2372
+ return ret === 0 ? undefined : RootNode.__wrap(ret);
2373
+ }
2374
+ /**
2375
+ * Returns the index of this node within its parent's children.
2376
+ * @returns The child index
2377
+ * @returns {number}
2378
+ */
2379
+ childIndex() {
2380
+ const ret = wasm.objectpropname_childIndex(this.__wbg_ptr);
2381
+ return ret >>> 0;
2382
+ }
2383
+ /**
2384
+ * Returns all ancestor nodes from parent to root.
2385
+ * @returns Array of ancestor nodes
2386
+ * @returns {Node[]}
2387
+ */
2388
+ ancestors() {
2389
+ const ret = wasm.objectpropname_ancestors(this.__wbg_ptr);
2390
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2391
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2392
+ return v1;
2393
+ }
2394
+ /**
2395
+ * Returns the previous sibling node.
2396
+ * @returns The previous sibling, or undefined if this is the first child
2397
+ * @returns {Node | undefined}
2398
+ */
2399
+ previousSibling() {
2400
+ const ret = wasm.objectpropname_previousSibling(this.__wbg_ptr);
2401
+ return ret === 0 ? undefined : Node.__wrap(ret);
2402
+ }
2403
+ /**
2404
+ * Returns the next sibling node.
2405
+ * @returns The next sibling, or undefined if this is the last child
2406
+ * @returns {Node | undefined}
2407
+ */
2408
+ nextSibling() {
2409
+ const ret = wasm.objectpropname_nextSibling(this.__wbg_ptr);
2410
+ return ret === 0 ? undefined : Node.__wrap(ret);
2411
+ }
2412
+ /**
2413
+ * Returns the indentation string used at this node's depth.
2414
+ * @returns The indentation string, or undefined if not applicable
2415
+ * @returns {string | undefined}
2416
+ */
2417
+ indentText() {
2418
+ const ret = wasm.objectpropname_indentText(this.__wbg_ptr);
2419
+ let v1;
2420
+ if (ret[0] !== 0) {
2421
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2422
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2423
+ }
2424
+ return v1;
2425
+ }
2426
+ /**
2427
+ * Returns whether this node's container uses trailing commas.
2428
+ * @returns true if trailing commas are used
2429
+ * @returns {boolean}
2430
+ */
2431
+ usesTrailingCommas() {
2432
+ const ret = wasm.objectpropname_usesTrailingCommas(this.__wbg_ptr);
2433
+ return ret !== 0;
2434
+ }
2435
+ }
2436
+ const RootNodeFinalization = (typeof FinalizationRegistry === "undefined")
2437
+ ? { register: () => { }, unregister: () => { } }
2438
+ : new FinalizationRegistry((ptr) => wasm.__wbg_rootnode_free(ptr >>> 0, 1));
2439
+ /**
2440
+ * Represents the root node of a JSONC document.
2441
+ * This is the entry point for manipulating the concrete syntax tree.
2442
+ */
2443
+ export class RootNode {
2444
+ static __wrap(ptr) {
2445
+ ptr = ptr >>> 0;
2446
+ const obj = Object.create(RootNode.prototype);
2447
+ obj.__wbg_ptr = ptr;
2448
+ RootNodeFinalization.register(obj, obj.__wbg_ptr, obj);
2449
+ return obj;
2450
+ }
2451
+ __destroy_into_raw() {
2452
+ const ptr = this.__wbg_ptr;
2453
+ this.__wbg_ptr = 0;
2454
+ RootNodeFinalization.unregister(this);
2455
+ return ptr;
2456
+ }
2457
+ free() {
2458
+ const ptr = this.__destroy_into_raw();
2459
+ wasm.__wbg_rootnode_free(ptr, 0);
2460
+ }
2461
+ /**
2462
+ * Returns the root value node.
2463
+ * @returns The root value, or undefined if the document is empty
2464
+ * @returns {Node | undefined}
2465
+ */
2466
+ value() {
2467
+ const ret = wasm.rootnode_value(this.__wbg_ptr);
2468
+ return ret === 0 ? undefined : Node.__wrap(ret);
2469
+ }
2470
+ /**
2471
+ * Returns the root value node, throwing if empty.
2472
+ * @returns The root value
2473
+ * @throws If the document is empty
2474
+ * @returns {Node}
2475
+ */
2476
+ valueOrThrow() {
2477
+ const ret = wasm.rootnode_valueOrThrow(this.__wbg_ptr);
2478
+ if (ret[2]) {
2479
+ throw takeFromExternrefTable0(ret[1]);
2480
+ }
2481
+ return Node.__wrap(ret[0]);
2482
+ }
2483
+ /**
2484
+ * Returns the root value as an object if it is one.
2485
+ * @returns The object, or undefined if root is not an object
2486
+ * @returns {JsonObject | undefined}
2487
+ */
2488
+ asObject() {
2489
+ const ret = wasm.rootnode_asObject(this.__wbg_ptr);
2490
+ return ret === 0 ? undefined : JsonObject.__wrap(ret);
2491
+ }
2492
+ /**
2493
+ * Returns the root value as an object, throwing if it's not an object.
2494
+ * @returns The object
2495
+ * @throws If the root is not an object
2496
+ * @returns {JsonObject}
2497
+ */
2498
+ asObjectOrThrow() {
2499
+ const ret = wasm.rootnode_asObjectOrThrow(this.__wbg_ptr);
2500
+ if (ret[2]) {
2501
+ throw takeFromExternrefTable0(ret[1]);
2502
+ }
2503
+ return JsonObject.__wrap(ret[0]);
2504
+ }
2505
+ /**
2506
+ * Returns the root value as an object, creating an empty object if the root is empty.
2507
+ * Returns undefined if the root contains a value of a different type.
2508
+ * @returns The object, or undefined if a non-object value exists
2509
+ * @returns {JsonObject | undefined}
2510
+ */
2511
+ asObjectOrCreate() {
2512
+ const ret = wasm.rootnode_asObjectOrCreate(this.__wbg_ptr);
2513
+ return ret === 0 ? undefined : JsonObject.__wrap(ret);
2514
+ }
2515
+ /**
2516
+ * Returns the root value as an object, replacing any existing value with an empty object if needed.
2517
+ * Unlike asObjectOrCreate, this always returns an object by replacing non-object values.
2518
+ * @returns The object (always succeeds)
2519
+ * @returns {JsonObject}
2520
+ */
2521
+ asObjectOrForce() {
2522
+ const ret = wasm.rootnode_asObjectOrForce(this.__wbg_ptr);
2523
+ return JsonObject.__wrap(ret);
2524
+ }
2525
+ /**
2526
+ * Returns the root value as an array if it is one.
2527
+ * @returns The array, or undefined if root is not an array
2528
+ * @returns {JsonArray | undefined}
2529
+ */
2530
+ asArray() {
2531
+ const ret = wasm.rootnode_asArray(this.__wbg_ptr);
2532
+ return ret === 0 ? undefined : JsonArray.__wrap(ret);
2533
+ }
2534
+ /**
2535
+ * Returns the root value as an array, throwing if it's not an array.
2536
+ * @returns The array
2537
+ * @throws If the root is not an array
2538
+ * @returns {JsonArray}
2539
+ */
2540
+ asArrayOrThrow() {
2541
+ const ret = wasm.rootnode_asArrayOrThrow(this.__wbg_ptr);
2542
+ if (ret[2]) {
2543
+ throw takeFromExternrefTable0(ret[1]);
2544
+ }
2545
+ return JsonArray.__wrap(ret[0]);
2546
+ }
2547
+ /**
2548
+ * Returns the root value as an array, creating an empty array if the root is empty.
2549
+ * Returns undefined if the root contains a value of a different type.
2550
+ * @returns The array, or undefined if a non-array value exists
2551
+ * @returns {JsonArray | undefined}
2552
+ */
2553
+ asArrayOrCreate() {
2554
+ const ret = wasm.rootnode_asArrayOrCreate(this.__wbg_ptr);
2555
+ return ret === 0 ? undefined : JsonArray.__wrap(ret);
2556
+ }
2557
+ /**
2558
+ * Returns the root value as an array, replacing any existing value with an empty array if needed.
2559
+ * Unlike asArrayOrCreate, this always returns an array by replacing non-array values.
2560
+ * @returns The array (always succeeds)
2561
+ * @returns {JsonArray}
2562
+ */
2563
+ asArrayOrForce() {
2564
+ const ret = wasm.rootnode_asArrayOrForce(this.__wbg_ptr);
2565
+ return JsonArray.__wrap(ret);
2566
+ }
2567
+ /**
2568
+ * Converts the CST back to a string representation.
2569
+ * @returns The JSONC string
2570
+ * @returns {string}
2571
+ */
2572
+ toString() {
2573
+ let deferred1_0;
2574
+ let deferred1_1;
2575
+ try {
2576
+ const ret = wasm.rootnode_toString(this.__wbg_ptr);
2577
+ deferred1_0 = ret[0];
2578
+ deferred1_1 = ret[1];
2579
+ return getStringFromWasm0(ret[0], ret[1]);
2580
+ }
2581
+ finally {
2582
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2583
+ }
2584
+ }
2585
+ /**
2586
+ * Returns all child nodes including whitespace and punctuation.
2587
+ * @returns Array of all child nodes
2588
+ * @returns {Node[]}
2589
+ */
2590
+ children() {
2591
+ const ret = wasm.rootnode_children(this.__wbg_ptr);
2592
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2593
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2594
+ return v1;
2595
+ }
2596
+ /**
2597
+ * Sets the root value of the document.
2598
+ * Accepts any JSON value: string, number, boolean, null, array, or object.
2599
+ * @param value - The new value to set
2600
+ * @param {any} value
2601
+ */
2602
+ setValue(value) {
2603
+ const ret = wasm.rootnode_setValue(this.__wbg_ptr, value);
2604
+ if (ret[1]) {
2605
+ throw takeFromExternrefTable0(ret[0]);
2606
+ }
2607
+ }
2608
+ /**
2609
+ * Configures whether trailing commas should be used throughout the document.
2610
+ * When enabled, trailing commas are added for multiline formatting in objects and arrays.
2611
+ * @param enabled - Whether to enable trailing commas
2612
+ * @param {boolean} enabled
2613
+ */
2614
+ setTrailingCommas(enabled) {
2615
+ wasm.rootnode_setTrailingCommas(this.__wbg_ptr, enabled);
2616
+ }
2617
+ /**
2618
+ * Clears all children from the root node, leaving an empty document.
2619
+ */
2620
+ clearChildren() {
2621
+ wasm.rootnode_clearChildren(this.__wbg_ptr);
2622
+ }
2623
+ /**
2624
+ * Returns the indentation string used for a single level.
2625
+ * @returns The single-level indentation string (e.g., " " or "\t")
2626
+ * @returns {string | undefined}
2627
+ */
2628
+ singleIndentText() {
2629
+ const ret = wasm.rootnode_singleIndentText(this.__wbg_ptr);
2630
+ let v1;
2631
+ if (ret[0] !== 0) {
2632
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2633
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2634
+ }
2635
+ return v1;
2636
+ }
2637
+ /**
2638
+ * Returns the newline kind used in the document.
2639
+ * @returns Either "\n" or "\r\n"
2640
+ * @returns {string}
2641
+ */
2642
+ newlineKind() {
2643
+ const ret = wasm.rootnode_newlineKind(this.__wbg_ptr);
2644
+ return ret;
2645
+ }
2646
+ /**
2647
+ * Returns the parent node in the CST.
2648
+ * @returns The parent node, or undefined if this is the root
2649
+ * @returns {Node | undefined}
2650
+ */
2651
+ parent() {
2652
+ const ret = wasm.rootnode_parent(this.__wbg_ptr);
2653
+ return ret === 0 ? undefined : Node.__wrap(ret);
2654
+ }
2655
+ /**
2656
+ * Returns the index of this node within its parent's children.
2657
+ * @returns The child index
2658
+ * @returns {number}
2659
+ */
2660
+ childIndex() {
2661
+ const ret = wasm.rootnode_childIndex(this.__wbg_ptr);
2662
+ return ret >>> 0;
2663
+ }
2664
+ /**
2665
+ * Returns all ancestor nodes from parent to root.
2666
+ * @returns Array of ancestor nodes
2667
+ * @returns {Node[]}
2668
+ */
2669
+ ancestors() {
2670
+ const ret = wasm.rootnode_ancestors(this.__wbg_ptr);
2671
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2672
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2673
+ return v1;
2674
+ }
2675
+ /**
2676
+ * Returns the previous sibling node.
2677
+ * @returns The previous sibling, or undefined if this is the first child
2678
+ * @returns {Node | undefined}
2679
+ */
2680
+ previousSibling() {
2681
+ const ret = wasm.rootnode_previousSibling(this.__wbg_ptr);
2682
+ return ret === 0 ? undefined : Node.__wrap(ret);
2683
+ }
2684
+ /**
2685
+ * Returns all previous sibling nodes.
2686
+ * @returns Array of previous siblings
2687
+ * @returns {Node[]}
2688
+ */
2689
+ previousSiblings() {
2690
+ const ret = wasm.rootnode_previousSiblings(this.__wbg_ptr);
2691
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2692
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2693
+ return v1;
2694
+ }
2695
+ /**
2696
+ * Returns the next sibling node.
2697
+ * @returns The next sibling, or undefined if this is the last child
2698
+ * @returns {Node | undefined}
2699
+ */
2700
+ nextSibling() {
2701
+ const ret = wasm.rootnode_nextSibling(this.__wbg_ptr);
2702
+ return ret === 0 ? undefined : Node.__wrap(ret);
2703
+ }
2704
+ /**
2705
+ * Returns all next sibling nodes.
2706
+ * @returns Array of next siblings
2707
+ * @returns {Node[]}
2708
+ */
2709
+ nextSiblings() {
2710
+ const ret = wasm.rootnode_nextSiblings(this.__wbg_ptr);
2711
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2712
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2713
+ return v1;
2714
+ }
2715
+ /**
2716
+ * Returns the indentation string used at this node's depth.
2717
+ * @returns The indentation string, or undefined if not applicable
2718
+ * @returns {string | undefined}
2719
+ */
2720
+ indentText() {
2721
+ const ret = wasm.rootnode_indentText(this.__wbg_ptr);
2722
+ let v1;
2723
+ if (ret[0] !== 0) {
2724
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2725
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2726
+ }
2727
+ return v1;
2728
+ }
2729
+ /**
2730
+ * Returns whether this node's container uses trailing commas.
2731
+ * @returns true if trailing commas are used
2732
+ * @returns {boolean}
2733
+ */
2734
+ usesTrailingCommas() {
2735
+ const ret = wasm.rootnode_usesTrailingCommas(this.__wbg_ptr);
2736
+ return ret !== 0;
2737
+ }
2738
+ /**
2739
+ * Returns child nodes excluding whitespace, comments, and punctuation.
2740
+ * @returns Array of significant child nodes
2741
+ * @returns {Node[]}
2742
+ */
2743
+ childrenExcludeTriviaAndTokens() {
2744
+ const ret = wasm.rootnode_childrenExcludeTriviaAndTokens(this.__wbg_ptr);
2745
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2746
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
2747
+ return v1;
2748
+ }
2749
+ /**
2750
+ * Returns the child node at the specified index.
2751
+ * @param index - The child index
2752
+ * @returns The child node, or undefined if index is out of bounds
2753
+ * @param {number} index
2754
+ * @returns {Node | undefined}
2755
+ */
2756
+ childAtIndex(index) {
2757
+ const ret = wasm.rootnode_childAtIndex(this.__wbg_ptr, index);
2758
+ return ret === 0 ? undefined : Node.__wrap(ret);
2759
+ }
2760
+ /**
2761
+ * Converts the CST to a plain JavaScript value, similar to JSON.parse.
2762
+ * This recursively converts the root value to its JavaScript equivalent.
2763
+ * Comments and formatting information are discarded.
2764
+ * @returns The plain JavaScript value (object, array, string, number, boolean, or null)
2765
+ * @throws If the document contains invalid values that cannot be converted
2766
+ * @returns {any}
2767
+ */
2768
+ toValue() {
2769
+ const ret = wasm.rootnode_toValue(this.__wbg_ptr);
2770
+ return ret;
2771
+ }
2772
+ }
2773
+ const StringLitFinalization = (typeof FinalizationRegistry === "undefined")
2774
+ ? { register: () => { }, unregister: () => { } }
2775
+ : new FinalizationRegistry((ptr) => wasm.__wbg_stringlit_free(ptr >>> 0, 1));
2776
+ /**
2777
+ * Represents a string literal node in the CST.
2778
+ * Provides methods for manipulating string values and their formatting.
2779
+ */
2780
+ export class StringLit {
2781
+ static __wrap(ptr) {
2782
+ ptr = ptr >>> 0;
2783
+ const obj = Object.create(StringLit.prototype);
2784
+ obj.__wbg_ptr = ptr;
2785
+ StringLitFinalization.register(obj, obj.__wbg_ptr, obj);
2786
+ return obj;
2787
+ }
2788
+ __destroy_into_raw() {
2789
+ const ptr = this.__wbg_ptr;
2790
+ this.__wbg_ptr = 0;
2791
+ StringLitFinalization.unregister(this);
2792
+ return ptr;
2793
+ }
2794
+ free() {
2795
+ const ptr = this.__destroy_into_raw();
2796
+ wasm.__wbg_stringlit_free(ptr, 0);
2797
+ }
2798
+ /**
2799
+ * Returns the decoded string value (without quotes and with escape sequences processed).
2800
+ * @returns The decoded string value
2801
+ * @returns {string}
2802
+ */
2803
+ decodedValue() {
2804
+ let deferred2_0;
2805
+ let deferred2_1;
2806
+ try {
2807
+ const ret = wasm.stringlit_decodedValue(this.__wbg_ptr);
2808
+ var ptr1 = ret[0];
2809
+ var len1 = ret[1];
2810
+ if (ret[3]) {
2811
+ ptr1 = 0;
2812
+ len1 = 0;
2813
+ throw takeFromExternrefTable0(ret[2]);
2814
+ }
2815
+ deferred2_0 = ptr1;
2816
+ deferred2_1 = len1;
2817
+ return getStringFromWasm0(ptr1, len1);
2818
+ }
2819
+ finally {
2820
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2821
+ }
2822
+ }
2823
+ /**
2824
+ * Returns the raw string value including quotes and escape sequences.
2825
+ * @returns The raw string representation
2826
+ * @returns {string}
2827
+ */
2828
+ rawValue() {
2829
+ let deferred1_0;
2830
+ let deferred1_1;
2831
+ try {
2832
+ const ret = wasm.stringlit_rawValue(this.__wbg_ptr);
2833
+ deferred1_0 = ret[0];
2834
+ deferred1_1 = ret[1];
2835
+ return getStringFromWasm0(ret[0], ret[1]);
2836
+ }
2837
+ finally {
2838
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2839
+ }
2840
+ }
2841
+ /**
2842
+ * Sets the raw string value (should include quotes).
2843
+ * @param value - The new raw string value
2844
+ * @param {string} value
2845
+ */
2846
+ setRawValue(value) {
2847
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2848
+ const len0 = WASM_VECTOR_LEN;
2849
+ wasm.stringlit_setRawValue(this.__wbg_ptr, ptr0, len0);
2850
+ }
2851
+ /**
2852
+ * Replaces this string literal with a new value.
2853
+ * @param replacement - The new value to replace this string with
2854
+ * @returns The new node that replaced this one, or undefined if this was the root value
2855
+ * @param {any} replacement
2856
+ * @returns {Node | undefined}
2857
+ */
2858
+ replaceWith(replacement) {
2859
+ const ret = wasm.stringlit_replaceWith(this.__wbg_ptr, replacement);
2860
+ if (ret[2]) {
2861
+ throw takeFromExternrefTable0(ret[1]);
2862
+ }
2863
+ return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
2864
+ }
2865
+ /**
2866
+ * Removes this string literal from its parent.
2867
+ * After calling this method, the node is detached from the CST and can no longer be used.
1237
2868
  */
1238
- replaceWith(key, replacement) {
1239
- const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1240
- const len0 = WASM_VECTOR_LEN;
1241
- const ptr1 = passStringToWasm0(replacement, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1242
- const len1 = WASM_VECTOR_LEN;
1243
- const ret = wasm.objectprop_replaceWith(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1244
- return ret === 0 ? undefined : Node.__wrap(ret);
2869
+ remove() {
2870
+ const ptr = this.__destroy_into_raw();
2871
+ wasm.stringlit_remove(ptr);
1245
2872
  }
1246
2873
  /**
2874
+ * Returns the parent node in the CST.
2875
+ * @returns The parent node, or undefined if this is the root
1247
2876
  * @returns {Node | undefined}
1248
2877
  */
1249
2878
  parent() {
1250
- const ret = wasm.objectprop_parent(this.__wbg_ptr);
2879
+ const ret = wasm.stringlit_parent(this.__wbg_ptr);
1251
2880
  return ret === 0 ? undefined : Node.__wrap(ret);
1252
2881
  }
1253
2882
  /**
2883
+ * Returns all ancestor nodes from parent to root.
2884
+ * @returns Array of ancestor nodes
1254
2885
  * @returns {Node[]}
1255
2886
  */
1256
2887
  ancestors() {
1257
- const ret = wasm.objectprop_ancestors(this.__wbg_ptr);
2888
+ const ret = wasm.stringlit_ancestors(this.__wbg_ptr);
1258
2889
  var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1259
2890
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1260
2891
  return v1;
1261
2892
  }
1262
2893
  /**
2894
+ * Returns the index of this node within its parent's children.
2895
+ * @returns The child index
1263
2896
  * @returns {number}
1264
2897
  */
1265
2898
  childIndex() {
1266
- const ret = wasm.objectprop_childIndex(this.__wbg_ptr);
2899
+ const ret = wasm.stringlit_childIndex(this.__wbg_ptr);
1267
2900
  return ret >>> 0;
1268
2901
  }
1269
2902
  /**
2903
+ * Returns the previous sibling node.
2904
+ * @returns The previous sibling, or undefined if this is the first child
1270
2905
  * @returns {Node | undefined}
1271
2906
  */
1272
2907
  previousSibling() {
1273
- const ret = wasm.objectprop_previousSibling(this.__wbg_ptr);
2908
+ const ret = wasm.stringlit_previousSibling(this.__wbg_ptr);
1274
2909
  return ret === 0 ? undefined : Node.__wrap(ret);
1275
2910
  }
1276
2911
  /**
2912
+ * Returns all previous sibling nodes.
2913
+ * @returns Array of previous siblings
1277
2914
  * @returns {Node[]}
1278
2915
  */
1279
2916
  previousSiblings() {
1280
- const ret = wasm.objectprop_previousSiblings(this.__wbg_ptr);
2917
+ const ret = wasm.stringlit_previousSiblings(this.__wbg_ptr);
1281
2918
  var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1282
2919
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1283
2920
  return v1;
1284
2921
  }
1285
2922
  /**
2923
+ * Returns the next sibling node.
2924
+ * @returns The next sibling, or undefined if this is the last child
1286
2925
  * @returns {Node | undefined}
1287
2926
  */
1288
2927
  nextSibling() {
1289
- const ret = wasm.objectprop_nextSibling(this.__wbg_ptr);
2928
+ const ret = wasm.stringlit_nextSibling(this.__wbg_ptr);
1290
2929
  return ret === 0 ? undefined : Node.__wrap(ret);
1291
2930
  }
1292
2931
  /**
2932
+ * Returns all next sibling nodes.
2933
+ * @returns Array of next siblings
1293
2934
  * @returns {Node[]}
1294
2935
  */
1295
2936
  nextSiblings() {
1296
- const ret = wasm.objectprop_nextSiblings(this.__wbg_ptr);
2937
+ const ret = wasm.stringlit_nextSiblings(this.__wbg_ptr);
1297
2938
  var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1298
2939
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1299
2940
  return v1;
1300
2941
  }
1301
2942
  /**
1302
- * @returns {ObjectProp | undefined}
1303
- */
1304
- previousProperty() {
1305
- const ret = wasm.objectprop_previousProperty(this.__wbg_ptr);
1306
- return ret === 0 ? undefined : ObjectProp.__wrap(ret);
1307
- }
1308
- /**
1309
- * @returns {ObjectProp | undefined}
1310
- */
1311
- nextProperty() {
1312
- const ret = wasm.objectprop_nextProperty(this.__wbg_ptr);
1313
- return ret === 0 ? undefined : ObjectProp.__wrap(ret);
1314
- }
1315
- /**
2943
+ * Returns the root node of the document.
2944
+ * @returns The root node, or undefined if detached
1316
2945
  * @returns {RootNode | undefined}
1317
2946
  */
1318
2947
  rootNode() {
1319
- const ret = wasm.objectprop_rootNode(this.__wbg_ptr);
2948
+ const ret = wasm.stringlit_rootNode(this.__wbg_ptr);
1320
2949
  return ret === 0 ? undefined : RootNode.__wrap(ret);
1321
2950
  }
1322
2951
  /**
2952
+ * Returns the indentation string used at this node's depth.
2953
+ * @returns The indentation string, or undefined if not applicable
1323
2954
  * @returns {string | undefined}
1324
2955
  */
1325
2956
  indentText() {
1326
- const ret = wasm.objectprop_indentText(this.__wbg_ptr);
2957
+ const ret = wasm.stringlit_indentText(this.__wbg_ptr);
1327
2958
  let v1;
1328
2959
  if (ret[0] !== 0) {
1329
2960
  v1 = getStringFromWasm0(ret[0], ret[1]).slice();
@@ -1332,147 +2963,50 @@ export class ObjectProp {
1332
2963
  return v1;
1333
2964
  }
1334
2965
  /**
2966
+ * Returns whether this node's container uses trailing commas.
2967
+ * @returns true if trailing commas are used
1335
2968
  * @returns {boolean}
1336
2969
  */
1337
2970
  usesTrailingCommas() {
1338
- const ret = wasm.objectprop_usesTrailingCommas(this.__wbg_ptr);
2971
+ const ret = wasm.stringlit_usesTrailingCommas(this.__wbg_ptr);
1339
2972
  return ret !== 0;
1340
2973
  }
1341
- /**
1342
- * @returns {Node[]}
1343
- */
1344
- children() {
1345
- const ret = wasm.objectprop_children(this.__wbg_ptr);
1346
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1347
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1348
- return v1;
1349
- }
1350
- /**
1351
- * @returns {Node[]}
1352
- */
1353
- childrenExcludeTriviaAndTokens() {
1354
- const ret = wasm.objectprop_childrenExcludeTriviaAndTokens(this.__wbg_ptr);
1355
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1356
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1357
- return v1;
1358
- }
1359
- /**
1360
- * @param {number} index
1361
- * @returns {Node | undefined}
1362
- */
1363
- childAtIndex(index) {
1364
- const ret = wasm.objectprop_childAtIndex(this.__wbg_ptr, index);
1365
- return ret === 0 ? undefined : Node.__wrap(ret);
1366
- }
1367
2974
  }
1368
- const RootNodeFinalization = (typeof FinalizationRegistry === "undefined")
2975
+ const WordLitFinalization = (typeof FinalizationRegistry === "undefined")
1369
2976
  ? { register: () => { }, unregister: () => { } }
1370
- : new FinalizationRegistry((ptr) => wasm.__wbg_rootnode_free(ptr >>> 0, 1));
1371
- export class RootNode {
2977
+ : new FinalizationRegistry((ptr) => wasm.__wbg_wordlit_free(ptr >>> 0, 1));
2978
+ /**
2979
+ * Represents an unquoted word literal node in the CST.
2980
+ * Used for unquoted property names when `allowLooseObjectPropertyNames` is enabled.
2981
+ */
2982
+ export class WordLit {
1372
2983
  static __wrap(ptr) {
1373
2984
  ptr = ptr >>> 0;
1374
- const obj = Object.create(RootNode.prototype);
2985
+ const obj = Object.create(WordLit.prototype);
1375
2986
  obj.__wbg_ptr = ptr;
1376
- RootNodeFinalization.register(obj, obj.__wbg_ptr, obj);
2987
+ WordLitFinalization.register(obj, obj.__wbg_ptr, obj);
1377
2988
  return obj;
1378
2989
  }
1379
2990
  __destroy_into_raw() {
1380
2991
  const ptr = this.__wbg_ptr;
1381
2992
  this.__wbg_ptr = 0;
1382
- RootNodeFinalization.unregister(this);
2993
+ WordLitFinalization.unregister(this);
1383
2994
  return ptr;
1384
2995
  }
1385
2996
  free() {
1386
2997
  const ptr = this.__destroy_into_raw();
1387
- wasm.__wbg_rootnode_free(ptr, 0);
1388
- }
1389
- /**
1390
- * @returns {Node | undefined}
1391
- */
1392
- value() {
1393
- const ret = wasm.rootnode_value(this.__wbg_ptr);
1394
- return ret === 0 ? undefined : Node.__wrap(ret);
1395
- }
1396
- /**
1397
- * @returns {Node}
1398
- */
1399
- valueOrThrow() {
1400
- const ret = wasm.rootnode_valueOrThrow(this.__wbg_ptr);
1401
- if (ret[2]) {
1402
- throw takeFromExternrefTable0(ret[1]);
1403
- }
1404
- return Node.__wrap(ret[0]);
1405
- }
1406
- /**
1407
- * @returns {JsonObject | undefined}
1408
- */
1409
- asObject() {
1410
- const ret = wasm.rootnode_asObject(this.__wbg_ptr);
1411
- return ret === 0 ? undefined : JsonObject.__wrap(ret);
1412
- }
1413
- /**
1414
- * @returns {JsonObject}
1415
- */
1416
- asObjectOrThrow() {
1417
- const ret = wasm.rootnode_asObjectOrThrow(this.__wbg_ptr);
1418
- if (ret[2]) {
1419
- throw takeFromExternrefTable0(ret[1]);
1420
- }
1421
- return JsonObject.__wrap(ret[0]);
1422
- }
1423
- /**
1424
- * @returns {JsonObject | undefined}
1425
- */
1426
- asObjectValueOrCreate() {
1427
- const ret = wasm.rootnode_asObjectValueOrCreate(this.__wbg_ptr);
1428
- return ret === 0 ? undefined : JsonObject.__wrap(ret);
1429
- }
1430
- /**
1431
- * @returns {JsonObject}
1432
- */
1433
- asObjectValueOrForce() {
1434
- const ret = wasm.rootnode_asObjectValueOrForce(this.__wbg_ptr);
1435
- return JsonObject.__wrap(ret);
1436
- }
1437
- /**
1438
- * @returns {JsonArray | undefined}
1439
- */
1440
- asArray() {
1441
- const ret = wasm.rootnode_asArray(this.__wbg_ptr);
1442
- return ret === 0 ? undefined : JsonArray.__wrap(ret);
1443
- }
1444
- /**
1445
- * @returns {JsonArray}
1446
- */
1447
- asArrayOrThrow() {
1448
- const ret = wasm.rootnode_asArrayOrThrow(this.__wbg_ptr);
1449
- if (ret[2]) {
1450
- throw takeFromExternrefTable0(ret[1]);
1451
- }
1452
- return JsonArray.__wrap(ret[0]);
1453
- }
1454
- /**
1455
- * @returns {JsonArray | undefined}
1456
- */
1457
- asArrayOrCreate() {
1458
- const ret = wasm.rootnode_asArrayOrCreate(this.__wbg_ptr);
1459
- return ret === 0 ? undefined : JsonArray.__wrap(ret);
1460
- }
1461
- /**
1462
- * @returns {JsonArray}
1463
- */
1464
- asArrayOrForce() {
1465
- const ret = wasm.rootnode_asArrayOrForce(this.__wbg_ptr);
1466
- return JsonArray.__wrap(ret);
2998
+ wasm.__wbg_wordlit_free(ptr, 0);
1467
2999
  }
1468
3000
  /**
3001
+ * Returns the unquoted word value.
3002
+ * @returns The word literal as a string
1469
3003
  * @returns {string}
1470
3004
  */
1471
- toString() {
3005
+ value() {
1472
3006
  let deferred1_0;
1473
3007
  let deferred1_1;
1474
3008
  try {
1475
- const ret = wasm.rootnode_toString(this.__wbg_ptr);
3009
+ const ret = wasm.wordlit_value(this.__wbg_ptr);
1476
3010
  deferred1_0 = ret[0];
1477
3011
  deferred1_1 = ret[1];
1478
3012
  return getStringFromWasm0(ret[0], ret[1]);
@@ -1482,120 +3016,123 @@ export class RootNode {
1482
3016
  }
1483
3017
  }
1484
3018
  /**
1485
- * @returns {Node[]}
1486
- */
1487
- children() {
1488
- const ret = wasm.rootnode_children(this.__wbg_ptr);
1489
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1490
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1491
- return v1;
1492
- }
1493
- /**
1494
- * @param {any} root_value
1495
- */
1496
- setValue(root_value) {
1497
- const ret = wasm.rootnode_setValue(this.__wbg_ptr, root_value);
1498
- if (ret[1]) {
1499
- throw takeFromExternrefTable0(ret[0]);
1500
- }
1501
- }
1502
- /**
1503
- * @param {boolean} enabled
3019
+ * Sets the raw word value.
3020
+ * The value should be a valid unquoted identifier (alphanumeric and underscores).
3021
+ * @param value - The raw word string to set
3022
+ * @param {string} value
1504
3023
  */
1505
- setTrailingCommas(enabled) {
1506
- wasm.rootnode_setTrailingCommas(this.__wbg_ptr, enabled);
1507
- }
1508
- clearChildren() {
1509
- wasm.rootnode_clearChildren(this.__wbg_ptr);
3024
+ setRawValue(value) {
3025
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3026
+ const len0 = WASM_VECTOR_LEN;
3027
+ wasm.wordlit_setRawValue(this.__wbg_ptr, ptr0, len0);
1510
3028
  }
1511
3029
  /**
1512
- * @returns {string | undefined}
3030
+ * Replaces this word literal with a new value.
3031
+ * @param replacement - The new value to replace this word with
3032
+ * @returns The new node that replaced this one, or undefined if this was the root value
3033
+ * @param {any} replacement
3034
+ * @returns {Node | undefined}
1513
3035
  */
1514
- singleIndentText() {
1515
- const ret = wasm.rootnode_singleIndentText(this.__wbg_ptr);
1516
- let v1;
1517
- if (ret[0] !== 0) {
1518
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1519
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
3036
+ replaceWith(replacement) {
3037
+ const ret = wasm.wordlit_replaceWith(this.__wbg_ptr, replacement);
3038
+ if (ret[2]) {
3039
+ throw takeFromExternrefTable0(ret[1]);
1520
3040
  }
1521
- return v1;
3041
+ return ret[0] === 0 ? undefined : Node.__wrap(ret[0]);
1522
3042
  }
1523
3043
  /**
1524
- * @returns {string}
3044
+ * Removes this node from its parent.
3045
+ * After calling this method, the node is detached from the CST and can no longer be used.
1525
3046
  */
1526
- newlineKind() {
1527
- let deferred1_0;
1528
- let deferred1_1;
1529
- try {
1530
- const ret = wasm.rootnode_newlineKind(this.__wbg_ptr);
1531
- deferred1_0 = ret[0];
1532
- deferred1_1 = ret[1];
1533
- return getStringFromWasm0(ret[0], ret[1]);
1534
- }
1535
- finally {
1536
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1537
- }
3047
+ remove() {
3048
+ const ptr = this.__destroy_into_raw();
3049
+ wasm.wordlit_remove(ptr);
1538
3050
  }
1539
3051
  /**
3052
+ * Returns the parent node in the CST.
3053
+ * @returns The parent node, or undefined if this is the root
1540
3054
  * @returns {Node | undefined}
1541
3055
  */
1542
3056
  parent() {
1543
- const ret = wasm.rootnode_parent(this.__wbg_ptr);
3057
+ const ret = wasm.wordlit_parent(this.__wbg_ptr);
1544
3058
  return ret === 0 ? undefined : Node.__wrap(ret);
1545
3059
  }
1546
3060
  /**
1547
- * @returns {number}
1548
- */
1549
- childIndex() {
1550
- const ret = wasm.rootnode_childIndex(this.__wbg_ptr);
1551
- return ret >>> 0;
1552
- }
1553
- /**
3061
+ * Returns all ancestor nodes from parent to root.
3062
+ * @returns Array of ancestor nodes
1554
3063
  * @returns {Node[]}
1555
3064
  */
1556
3065
  ancestors() {
1557
- const ret = wasm.rootnode_ancestors(this.__wbg_ptr);
3066
+ const ret = wasm.wordlit_ancestors(this.__wbg_ptr);
1558
3067
  var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1559
3068
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1560
3069
  return v1;
1561
3070
  }
1562
3071
  /**
3072
+ * Returns the index of this node within its parent's children.
3073
+ * @returns The child index
3074
+ * @returns {number}
3075
+ */
3076
+ childIndex() {
3077
+ const ret = wasm.wordlit_childIndex(this.__wbg_ptr);
3078
+ return ret >>> 0;
3079
+ }
3080
+ /**
3081
+ * Returns the previous sibling node.
3082
+ * @returns The previous sibling, or undefined if this is the first child
1563
3083
  * @returns {Node | undefined}
1564
3084
  */
1565
3085
  previousSibling() {
1566
- const ret = wasm.rootnode_previousSibling(this.__wbg_ptr);
3086
+ const ret = wasm.wordlit_previousSibling(this.__wbg_ptr);
1567
3087
  return ret === 0 ? undefined : Node.__wrap(ret);
1568
3088
  }
1569
3089
  /**
3090
+ * Returns all previous sibling nodes.
3091
+ * @returns Array of previous siblings
1570
3092
  * @returns {Node[]}
1571
3093
  */
1572
3094
  previousSiblings() {
1573
- const ret = wasm.rootnode_previousSiblings(this.__wbg_ptr);
3095
+ const ret = wasm.wordlit_previousSiblings(this.__wbg_ptr);
1574
3096
  var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1575
3097
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1576
3098
  return v1;
1577
3099
  }
1578
3100
  /**
3101
+ * Returns the next sibling node.
3102
+ * @returns The next sibling, or undefined if this is the last child
1579
3103
  * @returns {Node | undefined}
1580
3104
  */
1581
3105
  nextSibling() {
1582
- const ret = wasm.rootnode_nextSibling(this.__wbg_ptr);
3106
+ const ret = wasm.wordlit_nextSibling(this.__wbg_ptr);
1583
3107
  return ret === 0 ? undefined : Node.__wrap(ret);
1584
3108
  }
1585
3109
  /**
3110
+ * Returns all next sibling nodes.
3111
+ * @returns Array of next siblings
1586
3112
  * @returns {Node[]}
1587
3113
  */
1588
3114
  nextSiblings() {
1589
- const ret = wasm.rootnode_nextSiblings(this.__wbg_ptr);
3115
+ const ret = wasm.wordlit_nextSiblings(this.__wbg_ptr);
1590
3116
  var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1591
3117
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1592
3118
  return v1;
1593
3119
  }
1594
3120
  /**
3121
+ * Returns the root node of the document.
3122
+ * @returns The root node, or undefined if detached
3123
+ * @returns {RootNode | undefined}
3124
+ */
3125
+ rootNode() {
3126
+ const ret = wasm.wordlit_rootNode(this.__wbg_ptr);
3127
+ return ret === 0 ? undefined : RootNode.__wrap(ret);
3128
+ }
3129
+ /**
3130
+ * Returns the indentation string used at this node's depth.
3131
+ * @returns The indentation string, or undefined if not applicable
1595
3132
  * @returns {string | undefined}
1596
3133
  */
1597
3134
  indentText() {
1598
- const ret = wasm.rootnode_indentText(this.__wbg_ptr);
3135
+ const ret = wasm.wordlit_indentText(this.__wbg_ptr);
1599
3136
  let v1;
1600
3137
  if (ret[0] !== 0) {
1601
3138
  v1 = getStringFromWasm0(ret[0], ret[1]).slice();
@@ -1604,29 +3141,14 @@ export class RootNode {
1604
3141
  return v1;
1605
3142
  }
1606
3143
  /**
3144
+ * Returns whether this node's container uses trailing commas.
3145
+ * @returns true if trailing commas are used
1607
3146
  * @returns {boolean}
1608
3147
  */
1609
3148
  usesTrailingCommas() {
1610
- const ret = wasm.rootnode_usesTrailingCommas(this.__wbg_ptr);
3149
+ const ret = wasm.wordlit_usesTrailingCommas(this.__wbg_ptr);
1611
3150
  return ret !== 0;
1612
3151
  }
1613
- /**
1614
- * @returns {Node[]}
1615
- */
1616
- childrenExcludeTriviaAndTokens() {
1617
- const ret = wasm.rootnode_childrenExcludeTriviaAndTokens(this.__wbg_ptr);
1618
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1619
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1620
- return v1;
1621
- }
1622
- /**
1623
- * @param {number} index
1624
- * @returns {Node | undefined}
1625
- */
1626
- childAtIndex(index) {
1627
- const ret = wasm.rootnode_childAtIndex(this.__wbg_ptr, index);
1628
- return ret === 0 ? undefined : Node.__wrap(ret);
1629
- }
1630
3152
  }
1631
3153
  export function __wbg_Error_90f14b053b2af32f(arg0, arg1) {
1632
3154
  const ret = Error(getStringFromWasm0(arg0, arg1));
@@ -1716,6 +3238,14 @@ export function __wbg_length_537fa63a6103cbdb(arg0) {
1716
3238
  const ret = arg0.length;
1717
3239
  return ret;
1718
3240
  }
3241
+ export function __wbg_new_1b925e0c0e1d30ba() {
3242
+ const ret = new Object();
3243
+ return ret;
3244
+ }
3245
+ export function __wbg_new_3c48ee6a683248da() {
3246
+ const ret = new Map();
3247
+ return ret;
3248
+ }
1719
3249
  export function __wbg_new_7c134f9c83abf3a4(arg0, arg1) {
1720
3250
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1721
3251
  return ret;
@@ -1724,6 +3254,10 @@ export function __wbg_new_d6b08dae7359cebb(arg0) {
1724
3254
  const ret = new Uint8Array(arg0);
1725
3255
  return ret;
1726
3256
  }
3257
+ export function __wbg_new_d8a154d0939e6bb4() {
3258
+ const ret = new Array();
3259
+ return ret;
3260
+ }
1727
3261
  export function __wbg_next_59846e169128a0ea(arg0) {
1728
3262
  const ret = arg0.next;
1729
3263
  return ret;
@@ -1745,6 +3279,16 @@ export function __wbg_objectprop_new(arg0) {
1745
3279
  export function __wbg_prototypesetcall_a81ac58a5b6e988c(arg0, arg1, arg2) {
1746
3280
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1747
3281
  }
3282
+ export function __wbg_set_038a8a067d895c6a(arg0, arg1, arg2) {
3283
+ arg0[arg1 >>> 0] = arg2;
3284
+ }
3285
+ export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
3286
+ arg0[arg1] = arg2;
3287
+ }
3288
+ export function __wbg_set_a15b7b524330d4f1(arg0, arg1, arg2) {
3289
+ const ret = arg0.set(arg1, arg2);
3290
+ return ret;
3291
+ }
1748
3292
  export function __wbg_value_4ae21701b6f5c482(arg0) {
1749
3293
  const ret = arg0.value;
1750
3294
  return ret;
@@ -1784,6 +3328,10 @@ export function __wbg_wbindgenisobject_bdb9aa7f2dd707ef(arg0) {
1784
3328
  const ret = typeof val === "object" && val !== null;
1785
3329
  return ret;
1786
3330
  }
3331
+ export function __wbg_wbindgenisstring_55b63daa584dc807(arg0) {
3332
+ const ret = typeof arg0 === "string";
3333
+ return ret;
3334
+ }
1787
3335
  export function __wbg_wbindgenjsvaleq_af67af1ed6574f4f(arg0, arg1) {
1788
3336
  const ret = arg0 === arg1;
1789
3337
  return ret;
@@ -1826,6 +3374,11 @@ export function __wbindgen_cast_9ae0607507abb057(arg0) {
1826
3374
  const ret = arg0;
1827
3375
  return ret;
1828
3376
  }
3377
+ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
3378
+ // Cast intrinsic for `F64 -> Externref`.
3379
+ const ret = arg0;
3380
+ return ret;
3381
+ }
1829
3382
  export function __wbindgen_init_externref_table() {
1830
3383
  const table = wasm.__wbindgen_export_4;
1831
3384
  const offset = table.grow(4);