jsonc-morph 0.1.0 → 0.2.0

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