jsonc-morph 0.1.3 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,9 @@
1
1
  export function __wbg_set_wasm(val: any): void;
2
2
  /**
3
+ * Parses a JSONC (JSON with Comments) string into a concrete syntax tree.
4
+ * @param text - The JSONC text to parse
5
+ * @param options - Optional parsing options
6
+ * @returns The root node of the parsed CST
3
7
  * @param {string} text
4
8
  * @param {{ allowComments?: boolean; allowTrailingCommas?: boolean; allowLooseObjectPropertyNames?: boolean; } | null} [options]
5
9
  * @returns {RootNode}
@@ -8,7 +12,22 @@ export function parse(text: string, options?: {
8
12
  allowComments?: boolean;
9
13
  allowTrailingCommas?: boolean;
10
14
  allowLooseObjectPropertyNames?: boolean;
11
- } | null): RootNode;
15
+ } | null): any;
16
+ /**
17
+ * Parses a JSONC (JSON with Comments) string directly to a JavaScript object.
18
+ * @param text - The JSONC text to parse
19
+ * @param options - Optional parsing options
20
+ * @returns The plain JavaScript value (object, array, string, number, boolean, or null)
21
+ * @throws If the text cannot be parsed or converted
22
+ * @param {string} text
23
+ * @param {{ allowComments?: boolean; allowTrailingCommas?: boolean; allowLooseObjectPropertyNames?: boolean; } | null} [options]
24
+ * @returns {any}
25
+ */
26
+ export function parseToValue(text: string, options?: {
27
+ allowComments?: boolean;
28
+ allowTrailingCommas?: boolean;
29
+ allowLooseObjectPropertyNames?: boolean;
30
+ } | null): any;
12
31
  export function __wbg_Error_90f14b053b2af32f(arg0: any, arg1: any): Error;
13
32
  export function __wbg_String_8f0eb39a4a4c2f66(arg0: any, arg1: any): void;
14
33
  export function __wbg_call_90bf4b9978d51034(...args: any[]): any;
@@ -24,13 +43,19 @@ export function __wbg_isSafeInteger_342db8cae87edb4e(arg0: any): boolean;
24
43
  export function __wbg_iterator_fe047a6b04943f88(): symbol;
25
44
  export function __wbg_length_09646ad20ebb8534(arg0: any): any;
26
45
  export function __wbg_length_537fa63a6103cbdb(arg0: any): any;
46
+ export function __wbg_new_1b925e0c0e1d30ba(): Object;
47
+ export function __wbg_new_3c48ee6a683248da(): Map<any, any>;
27
48
  export function __wbg_new_7c134f9c83abf3a4(arg0: any, arg1: any): Error;
28
49
  export function __wbg_new_d6b08dae7359cebb(arg0: any): Uint8Array<any>;
50
+ export function __wbg_new_d8a154d0939e6bb4(): any[];
29
51
  export function __wbg_next_59846e169128a0ea(arg0: any): any;
30
52
  export function __wbg_next_c782e76a0400870a(...args: any[]): any;
31
53
  export function __wbg_node_new(arg0: any): any;
32
54
  export function __wbg_objectprop_new(arg0: any): any;
33
55
  export function __wbg_prototypesetcall_a81ac58a5b6e988c(arg0: any, arg1: any, arg2: any): void;
56
+ export function __wbg_set_038a8a067d895c6a(arg0: any, arg1: any, arg2: any): void;
57
+ export function __wbg_set_3f1d0b984ed272ed(arg0: any, arg1: any, arg2: any): void;
58
+ export function __wbg_set_a15b7b524330d4f1(arg0: any, arg1: any, arg2: any): any;
34
59
  export function __wbg_value_4ae21701b6f5c482(arg0: any): any;
35
60
  export function __wbg_wbindgenbigintgetasi64_d3d568a64e846827(arg0: any, arg1: any): void;
36
61
  export function __wbg_wbindgenbooleanget_527bfac1bf7c06df(arg0: any): 0 | 1 | 16777215;
@@ -39,6 +64,7 @@ export function __wbg_wbindgenin_ed944d66e9a43ef2(arg0: any, arg1: any): boolean
39
64
  export function __wbg_wbindgenisbigint_1a3fbe7ad37b3968(arg0: any): arg0 is bigint;
40
65
  export function __wbg_wbindgenisfunction_27a5c72d80bbdf07(arg0: any): boolean;
41
66
  export function __wbg_wbindgenisobject_bdb9aa7f2dd707ef(arg0: any): boolean;
67
+ export function __wbg_wbindgenisstring_55b63daa584dc807(arg0: any): arg0 is string;
42
68
  export function __wbg_wbindgenjsvaleq_af67af1ed6574f4f(arg0: any, arg1: any): boolean;
43
69
  export function __wbg_wbindgenjsvallooseeq_4f1ced8136023b79(arg0: any, arg1: any): boolean;
44
70
  export function __wbg_wbindgennumberget_41a5988c9fc46eeb(arg0: any, arg1: any): void;
@@ -47,636 +73,1642 @@ export function __wbg_wbindgenthrow_681185b504fabc8e(arg0: any, arg1: any): void
47
73
  export function __wbindgen_cast_2241b6af4c4b2941(arg0: any, arg1: any): any;
48
74
  export function __wbindgen_cast_4625c577ab2ec9ee(arg0: any): bigint;
49
75
  export function __wbindgen_cast_9ae0607507abb057(arg0: any): any;
76
+ export function __wbindgen_cast_d6cd19b81560fd6e(arg0: any): any;
50
77
  export function __wbindgen_init_externref_table(): void;
78
+ /**
79
+ * Represents a boolean literal node in the CST.
80
+ * Provides methods for manipulating boolean values.
81
+ */
82
+ export class BooleanLit {
83
+ static __wrap(ptr: any): any;
84
+ __destroy_into_raw(): number | undefined;
85
+ __wbg_ptr: number | undefined;
86
+ free(): void;
87
+ /**
88
+ * Returns the boolean value (true or false).
89
+ * @returns The boolean value
90
+ * @returns {boolean}
91
+ */
92
+ value(): boolean;
93
+ /**
94
+ * Sets the boolean value.
95
+ * @param value - The new boolean value (true or false)
96
+ * @param {boolean} value
97
+ */
98
+ setValue(value: boolean): void;
99
+ /**
100
+ * Replaces this boolean literal with a new value.
101
+ * @param replacement - The new value to replace this boolean with
102
+ * @returns The new node that replaced this one, or undefined if this was the root value
103
+ * @param {any} replacement
104
+ * @returns {Node | undefined}
105
+ */
106
+ replaceWith(replacement: any): any;
107
+ /**
108
+ * Removes this node from its parent.
109
+ * After calling this method, the node is detached from the CST and can no longer be used.
110
+ */
111
+ remove(): void;
112
+ /**
113
+ * Returns the parent node in the CST.
114
+ * @returns The parent node, or undefined if this is the root
115
+ * @returns {Node | undefined}
116
+ */
117
+ parent(): any;
118
+ /**
119
+ * Returns all ancestor nodes from parent to root.
120
+ * @returns Array of ancestor nodes
121
+ * @returns {Node[]}
122
+ */
123
+ ancestors(): any[];
124
+ /**
125
+ * Returns the index of this node within its parent's children.
126
+ * @returns The child index
127
+ * @returns {number}
128
+ */
129
+ childIndex(): number;
130
+ /**
131
+ * Returns the previous sibling node.
132
+ * @returns The previous sibling, or undefined if this is the first child
133
+ * @returns {Node | undefined}
134
+ */
135
+ previousSibling(): any;
136
+ /**
137
+ * Returns all previous sibling nodes.
138
+ * @returns Array of previous siblings
139
+ * @returns {Node[]}
140
+ */
141
+ previousSiblings(): any[];
142
+ /**
143
+ * Returns the next sibling node.
144
+ * @returns The next sibling, or undefined if this is the last child
145
+ * @returns {Node | undefined}
146
+ */
147
+ nextSibling(): any;
148
+ /**
149
+ * Returns all next sibling nodes.
150
+ * @returns Array of next siblings
151
+ * @returns {Node[]}
152
+ */
153
+ nextSiblings(): any[];
154
+ /**
155
+ * Returns the root node of the document.
156
+ * @returns The root node, or undefined if detached
157
+ * @returns {RootNode | undefined}
158
+ */
159
+ rootNode(): any;
160
+ /**
161
+ * Returns the indentation string used at this node's depth.
162
+ * @returns The indentation string, or undefined if not applicable
163
+ * @returns {string | undefined}
164
+ */
165
+ indentText(): any;
166
+ /**
167
+ * Returns whether this node's container uses trailing commas.
168
+ * @returns true if trailing commas are used
169
+ * @returns {boolean}
170
+ */
171
+ usesTrailingCommas(): boolean;
172
+ }
173
+ /**
174
+ * Represents a JSON array node in the CST.
175
+ * Provides methods for manipulating array elements.
176
+ */
51
177
  export class JsonArray {
52
178
  static __wrap(ptr: any): any;
53
179
  __destroy_into_raw(): number | undefined;
54
180
  __wbg_ptr: number | undefined;
55
181
  free(): void;
56
182
  /**
183
+ * Returns all element nodes in the array.
184
+ * @returns Array of element nodes
57
185
  * @returns {Node[]}
58
186
  */
59
- elements(): Node[];
187
+ elements(): any[];
188
+ /**
189
+ * Removes this array from its parent.
190
+ * After calling this method, the array is detached from the CST and can no longer be used.
191
+ */
60
192
  remove(): void;
193
+ /**
194
+ * Ensures the array is formatted with each element on its own line.
195
+ */
61
196
  ensureMultiline(): void;
62
197
  /**
198
+ * Returns all child nodes including whitespace and punctuation.
199
+ * @returns Array of all child nodes
63
200
  * @returns {Node[]}
64
201
  */
65
- children(): Node[];
202
+ children(): any[];
66
203
  /**
204
+ * Appends a new element to the end of the array.
205
+ * @param value - The value to append
206
+ * @returns The newly created element node
67
207
  * @param {any} value
68
208
  * @returns {Node}
69
209
  */
70
- append(value: any): Node;
210
+ append(value: any): any;
71
211
  /**
212
+ * Inserts a new element at the specified index.
213
+ * @param index - The position to insert at
214
+ * @param value - The value to insert
215
+ * @returns The newly created element node
72
216
  * @param {number} index
73
217
  * @param {any} value
74
218
  * @returns {Node}
75
219
  */
76
- insert(index: number, value: any): Node;
220
+ insert(index: number, value: any): any;
77
221
  /**
222
+ * Configures whether trailing commas should be used in this array.
223
+ * When enabled, trailing commas are added for multiline formatting.
224
+ * @param enabled - Whether to enable trailing commas
78
225
  * @param {boolean} enabled
79
226
  */
80
227
  setTrailingCommas(enabled: boolean): void;
81
228
  /**
229
+ * Replaces this array with a new value.
230
+ * @param value - The new value to replace this array with
231
+ * @returns The new node that replaced this one, or undefined if this was the root value
82
232
  * @param {any} value
83
233
  * @returns {Node | undefined}
84
234
  */
85
- replaceWith(value: any): Node | undefined;
235
+ replaceWith(value: any): any;
86
236
  /**
237
+ * Returns the parent node in the CST.
238
+ * @returns The parent node, or undefined if this is the root
87
239
  * @returns {Node | undefined}
88
240
  */
89
- parent(): Node | undefined;
241
+ parent(): any;
90
242
  /**
243
+ * Returns the index of this node within its parent's children.
244
+ * @returns The child index
91
245
  * @returns {number}
92
246
  */
93
247
  childIndex(): number;
94
248
  /**
249
+ * Returns all ancestor nodes from parent to root.
250
+ * @returns Array of ancestor nodes
95
251
  * @returns {Node[]}
96
252
  */
97
- ancestors(): Node[];
253
+ ancestors(): any[];
98
254
  /**
255
+ * Returns the previous sibling node.
256
+ * @returns The previous sibling, or undefined if this is the first child
99
257
  * @returns {Node | undefined}
100
258
  */
101
- previousSibling(): Node | undefined;
259
+ previousSibling(): any;
102
260
  /**
261
+ * Returns all previous sibling nodes.
262
+ * @returns Array of previous siblings
103
263
  * @returns {Node[]}
104
264
  */
105
- previousSiblings(): Node[];
265
+ previousSiblings(): any[];
106
266
  /**
267
+ * Returns the next sibling node.
268
+ * @returns The next sibling, or undefined if this is the last child
107
269
  * @returns {Node | undefined}
108
270
  */
109
- nextSibling(): Node | undefined;
271
+ nextSibling(): any;
110
272
  /**
273
+ * Returns all next sibling nodes.
274
+ * @returns Array of next siblings
111
275
  * @returns {Node[]}
112
276
  */
113
- nextSiblings(): Node[];
277
+ nextSiblings(): any[];
114
278
  /**
279
+ * Returns the root node of the document.
280
+ * @returns The root node, or undefined if detached
115
281
  * @returns {RootNode | undefined}
116
282
  */
117
- rootNode(): RootNode | undefined;
283
+ rootNode(): any;
118
284
  /**
285
+ * Returns the indentation string used at this node's depth.
286
+ * @returns The indentation string, or undefined if not applicable
119
287
  * @returns {string | undefined}
120
288
  */
121
- indentText(): string | undefined;
289
+ indentText(): any;
122
290
  /**
291
+ * Returns whether this node's container uses trailing commas.
292
+ * @returns true if trailing commas are used
123
293
  * @returns {boolean}
124
294
  */
125
295
  usesTrailingCommas(): boolean;
126
296
  /**
297
+ * Returns child nodes excluding whitespace, comments, and punctuation.
298
+ * @returns Array of significant child nodes
127
299
  * @returns {Node[]}
128
300
  */
129
- childrenExcludeTriviaAndTokens(): Node[];
301
+ childrenExcludeTriviaAndTokens(): any[];
130
302
  /**
303
+ * Returns the child node at the specified index.
304
+ * @param index - The child index
305
+ * @returns The child node, or undefined if index is out of bounds
131
306
  * @param {number} index
132
307
  * @returns {Node | undefined}
133
308
  */
134
- childAtIndex(index: number): Node | undefined;
309
+ childAtIndex(index: number): any;
135
310
  }
311
+ /**
312
+ * Represents a JSON object node in the CST.
313
+ * Provides methods for manipulating object properties.
314
+ */
136
315
  export class JsonObject {
137
316
  static __wrap(ptr: any): any;
138
317
  __destroy_into_raw(): number | undefined;
139
318
  __wbg_ptr: number | undefined;
140
319
  free(): void;
141
320
  /**
321
+ * Returns all properties in the object.
322
+ * @returns Array of object properties
142
323
  * @returns {ObjectProp[]}
143
324
  */
144
- properties(): ObjectProp[];
325
+ properties(): any[];
145
326
  /**
327
+ * Gets a property by name.
328
+ * @param key - The property name to look up
329
+ * @returns The property, or undefined if not found
146
330
  * @param {string} key
147
331
  * @returns {ObjectProp | undefined}
148
332
  */
149
- get(key: string): ObjectProp | undefined;
333
+ get(key: string): any;
150
334
  /**
335
+ * Gets a property by name, throwing if not found.
336
+ * @param key - The property name to look up
337
+ * @returns The property
338
+ * @throws If the property is not found
151
339
  * @param {string} key
152
340
  * @returns {ObjectProp}
153
341
  */
154
- getOrThrow(key: string): ObjectProp;
342
+ getOrThrow(key: string): any;
155
343
  /**
344
+ * Gets a property value if it's an object.
345
+ * @param name - The property name to look up
346
+ * @returns The object value, or undefined if property doesn't exist or is not an object
156
347
  * @param {string} name
157
348
  * @returns {JsonObject | undefined}
158
349
  */
159
- getIfObject(name: string): JsonObject | undefined;
350
+ getIfObject(name: string): any;
160
351
  /**
352
+ * Gets a property value as an object, throwing if not found or wrong type.
353
+ * @param name - The property name to look up
354
+ * @returns The object value
355
+ * @throws If the property doesn't exist or is not an object
161
356
  * @param {string} name
162
357
  * @returns {JsonObject}
163
358
  */
164
- getIfObjectOrThrow(name: string): JsonObject;
359
+ getIfObjectOrThrow(name: string): any;
165
360
  /**
361
+ * Gets a property value as an object, creating an empty object if the property doesn't exist.
362
+ * Returns undefined if the property exists but has a non-object value.
363
+ * @param name - The property name to get
364
+ * @returns The object value, or undefined if property has a non-object value
166
365
  * @param {string} name
167
366
  * @returns {JsonObject | undefined}
168
367
  */
169
- getIfObjectOrCreate(name: string): JsonObject | undefined;
368
+ getIfObjectOrCreate(name: string): any;
170
369
  /**
370
+ * Gets a property value as an object, creating or replacing the value with an empty object if needed.
371
+ * Unlike getIfObjectOrCreate, this always returns an object by replacing non-object values.
372
+ * @param name - The property name to get
373
+ * @returns The object value (always succeeds)
171
374
  * @param {string} name
172
375
  * @returns {JsonObject}
173
376
  */
174
- getIfObjectOrForce(name: string): JsonObject;
377
+ getIfObjectOrForce(name: string): any;
175
378
  /**
379
+ * Gets a property value if it's an array.
380
+ * @param name - The property name to look up
381
+ * @returns The array value, or undefined if property doesn't exist or is not an array
176
382
  * @param {string} name
177
383
  * @returns {JsonArray | undefined}
178
384
  */
179
- getIfArray(name: string): JsonArray | undefined;
385
+ getIfArray(name: string): any;
180
386
  /**
387
+ * Gets a property value as an array, throwing if not found or wrong type.
388
+ * @param name - The property name to look up
389
+ * @returns The array value
390
+ * @throws If the property doesn't exist or is not an array
181
391
  * @param {string} name
182
392
  * @returns {JsonArray}
183
393
  */
184
- getIfArrayOrThrow(name: string): JsonArray;
394
+ getIfArrayOrThrow(name: string): any;
185
395
  /**
396
+ * Gets a property value as an array, creating an empty array if the property doesn't exist.
397
+ * Returns undefined if the property exists but has a non-array value.
398
+ * @param name - The property name to get
399
+ * @returns The array value, or undefined if property has a non-array value
186
400
  * @param {string} name
187
401
  * @returns {JsonArray | undefined}
188
402
  */
189
- getIfArrayOrCreate(name: string): JsonArray | undefined;
403
+ getIfArrayOrCreate(name: string): any;
190
404
  /**
405
+ * Gets a property value as an array, creating or replacing the value with an empty array if needed.
406
+ * Unlike getIfArrayOrCreate, this always returns an array by replacing non-array values.
407
+ * @param name - The property name to get
408
+ * @returns The array value (always succeeds)
191
409
  * @param {string} name
192
410
  * @returns {JsonArray}
193
411
  */
194
- getIfArrayOrForce(name: string): JsonArray;
412
+ getIfArrayOrForce(name: string): any;
413
+ /**
414
+ * Removes this object from its parent.
415
+ * After calling this method, the object is detached from the CST and can no longer be used.
416
+ */
195
417
  remove(): void;
196
418
  /**
419
+ * Returns all child nodes including whitespace and punctuation.
420
+ * @returns Array of all child nodes
197
421
  * @returns {Node[]}
198
422
  */
199
- children(): Node[];
423
+ children(): any[];
200
424
  /**
201
- * @param {string} prop_name
425
+ * Appends a new property to the object.
426
+ * @param key - The name of the property to add
427
+ * @param value - The value to set for the property
428
+ * @returns The newly created property
429
+ * @param {string} key
202
430
  * @param {any} value
203
431
  * @returns {ObjectProp}
204
432
  */
205
- append(prop_name: string, value: any): ObjectProp;
433
+ append(key: string, value: any): any;
206
434
  /**
435
+ * Inserts a new property at the specified index.
436
+ * @param index - The position to insert the property at
437
+ * @param key - The name of the property to add
438
+ * @param value - The value to set for the property
439
+ * @returns The newly created property
207
440
  * @param {number} index
208
- * @param {string} prop_name
441
+ * @param {string} key
209
442
  * @param {any} value
210
443
  * @returns {ObjectProp}
211
444
  */
212
- insert(index: number, prop_name: string, value: any): ObjectProp;
445
+ insert(index: number, key: string, value: any): any;
213
446
  /**
447
+ * Configures whether trailing commas should be used in this object.
448
+ * When enabled, trailing commas are added for multiline formatting.
449
+ * @param enabled - Whether to enable trailing commas
214
450
  * @param {boolean} enabled
215
451
  */
216
452
  setTrailingCommas(enabled: boolean): void;
453
+ /**
454
+ * Ensures the object is formatted with each property on its own line.
455
+ */
217
456
  ensureMultiline(): void;
218
457
  /**
219
- * @param {string} replacement
458
+ * Replaces this object with a new value.
459
+ * @param replacement - The new value to replace this object with
460
+ * @returns The new node that replaced this one, or undefined if this was the root value
461
+ * @param {any} replacement
220
462
  * @returns {Node | undefined}
221
463
  */
222
- replaceWith(replacement: string): Node | undefined;
464
+ replaceWith(replacement: any): any;
223
465
  /**
466
+ * Returns the parent node in the CST.
467
+ * @returns The parent node, or undefined if this is the root
224
468
  * @returns {Node | undefined}
225
469
  */
226
- parent(): Node | undefined;
470
+ parent(): any;
227
471
  /**
472
+ * Returns all ancestor nodes from parent to root.
473
+ * @returns Array of ancestor nodes
228
474
  * @returns {Node[]}
229
475
  */
230
- ancestors(): Node[];
476
+ ancestors(): any[];
231
477
  /**
478
+ * Returns the index of this node within its parent's children.
479
+ * @returns The child index
232
480
  * @returns {number}
233
481
  */
234
482
  childIndex(): number;
235
483
  /**
484
+ * Returns the previous sibling node.
485
+ * @returns The previous sibling, or undefined if this is the first child
236
486
  * @returns {Node | undefined}
237
487
  */
238
- previousSibling(): Node | undefined;
488
+ previousSibling(): any;
239
489
  /**
490
+ * Returns all previous sibling nodes.
491
+ * @returns Array of previous siblings
240
492
  * @returns {Node[]}
241
493
  */
242
- previousSiblings(): Node[];
494
+ previousSiblings(): any[];
243
495
  /**
496
+ * Returns the next sibling node.
497
+ * @returns The next sibling, or undefined if this is the last child
244
498
  * @returns {Node | undefined}
245
499
  */
246
- nextSibling(): Node | undefined;
500
+ nextSibling(): any;
247
501
  /**
502
+ * Returns all next sibling nodes.
503
+ * @returns Array of next siblings
248
504
  * @returns {Node[]}
249
505
  */
250
- nextSiblings(): Node[];
506
+ nextSiblings(): any[];
251
507
  /**
508
+ * Returns the root node of the document.
509
+ * @returns The root node, or undefined if detached
252
510
  * @returns {RootNode | undefined}
253
511
  */
254
- rootNode(): RootNode | undefined;
512
+ rootNode(): any;
255
513
  /**
514
+ * Returns the indentation string used at this node's depth.
515
+ * @returns The indentation string, or undefined if not applicable
256
516
  * @returns {string | undefined}
257
517
  */
258
- indentText(): string | undefined;
518
+ indentText(): any;
259
519
  /**
520
+ * Returns whether this node's container uses trailing commas.
521
+ * @returns true if trailing commas are used
260
522
  * @returns {boolean}
261
523
  */
262
524
  usesTrailingCommas(): boolean;
263
525
  /**
526
+ * Returns child nodes excluding whitespace, comments, and punctuation.
527
+ * @returns Array of significant child nodes
264
528
  * @returns {Node[]}
265
529
  */
266
- childrenExcludeTriviaAndTokens(): Node[];
530
+ childrenExcludeTriviaAndTokens(): any[];
267
531
  /**
532
+ * Returns the child node at the specified index.
533
+ * @param index - The child index
534
+ * @returns The child node, or undefined if index is out of bounds
268
535
  * @param {number} index
269
536
  * @returns {Node | undefined}
270
537
  */
271
- childAtIndex(index: number): Node | undefined;
538
+ childAtIndex(index: number): any;
272
539
  }
540
+ /**
541
+ * Represents a generic node in the CST.
542
+ * Can be a container node (object, array, property) or a leaf node (string, number, boolean, null).
543
+ */
273
544
  export class Node {
274
545
  static __wrap(ptr: any): any;
275
546
  __destroy_into_raw(): number | undefined;
276
547
  __wbg_ptr: number | undefined;
277
548
  free(): void;
278
549
  /**
550
+ * Returns true if this node is a container (object, array, or property).
551
+ * @returns true if this is a container node
279
552
  * @returns {boolean}
280
553
  */
281
554
  isContainer(): boolean;
282
555
  /**
556
+ * Returns true if this node is a leaf value (string, number, boolean, null).
557
+ * @returns true if this is a leaf node
283
558
  * @returns {boolean}
284
559
  */
285
560
  isLeaf(): boolean;
286
561
  /**
562
+ * Converts this node to an object if it is one.
563
+ * @returns The object, or undefined if this node is not an object
287
564
  * @returns {JsonObject | undefined}
288
565
  */
289
- asObject(): JsonObject | undefined;
566
+ asObject(): any;
290
567
  /**
568
+ * Converts this node to an object, throwing if it's not an object.
569
+ * @returns The object
570
+ * @throws If this node is not an object
291
571
  * @returns {JsonObject}
292
572
  */
293
- asObjectOrThrow(): JsonObject;
573
+ asObjectOrThrow(): any;
294
574
  /**
575
+ * Converts this node to an array if it is one.
576
+ * @returns The array, or undefined if this node is not an array
295
577
  * @returns {JsonArray | undefined}
296
578
  */
297
- asArray(): JsonArray | undefined;
579
+ asArray(): any;
298
580
  /**
581
+ * Converts this node to an array, throwing if it's not an array.
582
+ * @returns The array
583
+ * @throws If this node is not an array
299
584
  * @returns {JsonArray}
300
585
  */
301
- asArrayOrThrow(): JsonArray;
586
+ asArrayOrThrow(): any;
302
587
  /**
588
+ * Converts this node to the root node if it is one.
589
+ * @returns The root node, or undefined if this is not a root node
303
590
  * @returns {RootNode | undefined}
304
591
  */
305
- asRootNode(): RootNode | undefined;
592
+ asRootNode(): any;
306
593
  /**
594
+ * Converts this node to the root node, throwing if it's not a root node.
595
+ * @returns The root node
596
+ * @throws If this node is not a root node
307
597
  * @returns {RootNode}
308
598
  */
309
- asRootNodeOrThrow(): RootNode;
599
+ asRootNodeOrThrow(): any;
310
600
  /**
601
+ * Returns the decoded string value if this node is a string literal.
602
+ * @returns The string value, or undefined if this node is not a string
311
603
  * @returns {string | undefined}
312
604
  */
313
- asString(): string | undefined;
605
+ asString(): any;
314
606
  /**
607
+ * Returns the decoded string value, throwing if not a string.
608
+ * @returns The string value
609
+ * @throws If this node is not a string
315
610
  * @returns {string}
316
611
  */
317
- asStringOrThrow(): string;
612
+ asStringOrThrow(): any;
318
613
  /**
614
+ * Returns the raw string representation of a number literal.
615
+ * Returns a string to preserve the exact formatting (e.g., "1.0" vs "1", "1e10" vs "10000000000").
616
+ * @returns The number as a string, or undefined if this node is not a number
319
617
  * @returns {string | undefined}
320
618
  */
321
- numberValue(): string | undefined;
619
+ numberValue(): any;
322
620
  /**
621
+ * Returns the raw string representation of a number literal, throwing if not a number.
622
+ * Returns a string to preserve the exact formatting (e.g., "1.0" vs "1", "1e10" vs "10000000000").
623
+ * @returns The number as a string
624
+ * @throws If this node is not a number
323
625
  * @returns {string}
324
626
  */
325
- numberValueOrThrow(): string;
627
+ numberValueOrThrow(): any;
326
628
  /**
629
+ * Returns the boolean value if this node is a boolean literal.
630
+ * @returns The boolean value, or undefined if this node is not a boolean
327
631
  * @returns {boolean | undefined}
328
632
  */
329
633
  asBoolean(): boolean | undefined;
330
634
  /**
635
+ * Returns the boolean value, throwing if not a boolean.
636
+ * @returns The boolean value
637
+ * @throws If this node is not a boolean
331
638
  * @returns {boolean}
332
639
  */
333
640
  asBooleanOrThrow(): boolean;
334
641
  /**
642
+ * Returns true if this node is a null keyword.
643
+ * @returns true if this node represents null
335
644
  * @returns {boolean}
336
645
  */
337
646
  isNull(): boolean;
338
647
  /**
648
+ * Returns true if this node is a string literal.
649
+ * @returns true if this node is a string
339
650
  * @returns {boolean}
340
651
  */
341
652
  isString(): boolean;
342
653
  /**
654
+ * Returns true if this node is a number literal.
655
+ * @returns true if this node is a number
343
656
  * @returns {boolean}
344
657
  */
345
658
  isNumber(): boolean;
346
659
  /**
660
+ * Returns true if this node is a boolean literal.
661
+ * @returns true if this node is a boolean
347
662
  * @returns {boolean}
348
663
  */
349
664
  isBoolean(): boolean;
350
665
  /**
666
+ * Returns this node as a StringLit if it is one.
667
+ * @returns The StringLit, or undefined if this node is not a string literal
668
+ * @returns {StringLit | undefined}
669
+ */
670
+ asStringLit(): any;
671
+ /**
672
+ * Returns this node as a StringLit, throwing if it's not a string literal.
673
+ * @returns The StringLit
674
+ * @throws If this node is not a string literal
675
+ * @returns {StringLit}
676
+ */
677
+ asStringLitOrThrow(): any;
678
+ /**
679
+ * Returns this node as a NumberLit if it is one.
680
+ * @returns The NumberLit, or undefined if this node is not a number literal
681
+ * @returns {NumberLit | undefined}
682
+ */
683
+ asNumberLit(): any;
684
+ /**
685
+ * Returns this node as a NumberLit, throwing if it's not a number literal.
686
+ * @returns The NumberLit
687
+ * @throws If this node is not a number literal
688
+ * @returns {NumberLit}
689
+ */
690
+ asNumberLitOrThrow(): any;
691
+ /**
692
+ * Returns this node as a BooleanLit if it is one.
693
+ * @returns The BooleanLit, or undefined if this node is not a boolean literal
694
+ * @returns {BooleanLit | undefined}
695
+ */
696
+ asBooleanLit(): any;
697
+ /**
698
+ * Returns this node as a BooleanLit, throwing if it's not a boolean literal.
699
+ * @returns The BooleanLit
700
+ * @throws If this node is not a boolean literal
701
+ * @returns {BooleanLit}
702
+ */
703
+ asBooleanLitOrThrow(): any;
704
+ /**
705
+ * Returns this node as a NullKeyword if it is one.
706
+ * @returns The NullKeyword, or undefined if this node is not a null keyword
707
+ * @returns {NullKeyword | undefined}
708
+ */
709
+ asNullKeyword(): any;
710
+ /**
711
+ * Returns this node as a NullKeyword, throwing if it's not a null keyword.
712
+ * @returns The NullKeyword
713
+ * @throws If this node is not a null keyword
714
+ * @returns {NullKeyword}
715
+ */
716
+ asNullKeywordOrThrow(): any;
717
+ /**
718
+ * Returns this node as a WordLit if it is one.
719
+ * @returns The WordLit, or undefined if this node is not a word literal
720
+ * @returns {WordLit | undefined}
721
+ */
722
+ asWordLit(): any;
723
+ /**
724
+ * Returns this node as a WordLit, throwing if it's not a word literal.
725
+ * @returns The WordLit
726
+ * @throws If this node is not a word literal
727
+ * @returns {WordLit}
728
+ */
729
+ asWordLitOrThrow(): any;
730
+ /**
731
+ * Returns the parent node in the CST.
732
+ * @returns The parent node, or undefined if this is the root
351
733
  * @returns {Node | undefined}
352
734
  */
353
- parent(): Node | undefined;
735
+ parent(): any;
354
736
  /**
737
+ * Returns the parent node, throwing if this is the root.
738
+ * @returns The parent node
739
+ * @throws If this node has no parent
355
740
  * @returns {Node}
356
741
  */
357
- parentOrThrow(): Node;
742
+ parentOrThrow(): any;
358
743
  /**
744
+ * Returns the index of this node within its parent's children.
745
+ * @returns The child index
359
746
  * @returns {number}
360
747
  */
361
748
  childIndex(): number;
362
749
  /**
750
+ * Returns all ancestor nodes from parent to root.
751
+ * @returns Array of ancestor nodes
363
752
  * @returns {Node[]}
364
753
  */
365
- ancestors(): Node[];
754
+ ancestors(): any[];
366
755
  /**
756
+ * Returns the previous sibling node.
757
+ * @returns The previous sibling, or undefined if this is the first child
367
758
  * @returns {Node | undefined}
368
759
  */
369
- previousSibling(): Node | undefined;
760
+ previousSibling(): any;
370
761
  /**
762
+ * Returns all previous sibling nodes.
763
+ * @returns Array of previous siblings
371
764
  * @returns {Node[]}
372
765
  */
373
- previousSiblings(): Node[];
766
+ previousSiblings(): any[];
374
767
  /**
768
+ * Returns the next sibling node.
769
+ * @returns The next sibling, or undefined if this is the last child
375
770
  * @returns {Node | undefined}
376
771
  */
377
- nextSibling(): Node | undefined;
772
+ nextSibling(): any;
378
773
  /**
774
+ * Returns all next sibling nodes.
775
+ * @returns Array of next siblings
379
776
  * @returns {Node[]}
380
777
  */
381
- nextSiblings(): Node[];
778
+ nextSiblings(): any[];
382
779
  /**
780
+ * Returns the root node of the document.
781
+ * @returns The root node, or undefined if detached
383
782
  * @returns {RootNode | undefined}
384
783
  */
385
- rootNode(): RootNode | undefined;
784
+ rootNode(): any;
386
785
  /**
786
+ * Returns the root node, throwing if detached.
787
+ * @returns The root node
788
+ * @throws If this node is detached from the CST
387
789
  * @returns {RootNode}
388
790
  */
389
- rootNodeOrThrow(): RootNode;
791
+ rootNodeOrThrow(): any;
390
792
  /**
793
+ * Returns the indentation string used at this node's depth.
794
+ * @returns The indentation string, or undefined if not applicable
391
795
  * @returns {string | undefined}
392
796
  */
393
- indentText(): string | undefined;
797
+ indentText(): any;
394
798
  /**
799
+ * Returns whether this node's container uses trailing commas.
800
+ * @returns true if trailing commas are used
395
801
  * @returns {boolean}
396
802
  */
397
803
  usesTrailingCommas(): boolean;
398
804
  /**
805
+ * Returns true if this node is trivia (whitespace or comments).
806
+ * @returns true if this node is trivia
399
807
  * @returns {boolean}
400
808
  */
401
809
  isTrivia(): boolean;
402
810
  /**
811
+ * Returns true if this node is a newline character.
812
+ * @returns true if this node is a newline
403
813
  * @returns {boolean}
404
814
  */
405
815
  isNewline(): boolean;
406
816
  /**
817
+ * Returns true if this node is a comma token.
818
+ * @returns true if this node is a comma
407
819
  * @returns {boolean}
408
820
  */
409
821
  isComma(): boolean;
410
822
  /**
823
+ * Returns true if this node is a comment.
824
+ * @returns true if this node is a comment
411
825
  * @returns {boolean}
412
826
  */
413
827
  isComment(): boolean;
414
828
  /**
829
+ * Returns true if this node is a punctuation token (bracket, brace, colon, comma).
830
+ * @returns true if this node is a token
415
831
  * @returns {boolean}
416
832
  */
417
833
  isToken(): boolean;
418
834
  /**
835
+ * Returns true if this node is whitespace.
836
+ * @returns true if this node is whitespace
419
837
  * @returns {boolean}
420
838
  */
421
839
  isWhitespace(): boolean;
422
840
  /**
841
+ * Returns the character if this node is a single-character token.
842
+ * @returns The token character, or undefined if not a token
423
843
  * @returns {string | undefined}
424
844
  */
425
- tokenChar(): string | undefined;
845
+ tokenChar(): any;
426
846
  /**
847
+ * Returns the element index if this node is an array element.
848
+ * @returns The element index, or undefined if not an array element
427
849
  * @returns {number | undefined}
428
850
  */
429
- elementIndex(): number | undefined;
851
+ elementIndex(): any;
430
852
  /**
853
+ * Returns all child nodes including whitespace and punctuation.
854
+ * @returns Array of all child nodes
431
855
  * @returns {Node[]}
432
856
  */
433
- children(): Node[];
857
+ children(): any[];
434
858
  /**
859
+ * Returns child nodes excluding whitespace, comments, and punctuation.
860
+ * @returns Array of significant child nodes
435
861
  * @returns {Node[]}
436
862
  */
437
- childrenExcludeTriviaAndTokens(): Node[];
863
+ childrenExcludeTriviaAndTokens(): any[];
438
864
  /**
865
+ * Returns the child node at the specified index.
866
+ * @param index - The child index
867
+ * @returns The child node, or undefined if index is out of bounds
439
868
  * @param {number} index
440
869
  * @returns {Node | undefined}
441
870
  */
442
- childAtIndex(index: number): Node | undefined;
871
+ childAtIndex(index: number): any;
872
+ /**
873
+ * Converts this CST node to a plain JavaScript value.
874
+ * This recursively converts objects, arrays, and primitives to their JavaScript equivalents.
875
+ * Comments and formatting information are discarded.
876
+ * @returns The plain JavaScript value (object, array, string, number, boolean, or null)
877
+ * @throws If the node contains invalid values that cannot be converted
878
+ * @returns {any}
879
+ */
880
+ toValue(): any;
443
881
  }
444
- export class ObjectProp {
882
+ /**
883
+ * Represents a null keyword node in the CST.
884
+ */
885
+ export class NullKeyword {
445
886
  static __wrap(ptr: any): any;
446
887
  __destroy_into_raw(): number | undefined;
447
888
  __wbg_ptr: number | undefined;
448
889
  free(): void;
449
890
  /**
891
+ * Replaces this null keyword with a new value.
892
+ * @param replacement - The new value to replace this null with
893
+ * @returns The new node that replaced this one, or undefined if this was the root value
894
+ * @param {any} replacement
895
+ * @returns {Node | undefined}
896
+ */
897
+ replaceWith(replacement: any): any;
898
+ /**
899
+ * Removes this node from its parent.
900
+ * After calling this method, the node is detached from the CST and can no longer be used.
901
+ */
902
+ remove(): void;
903
+ /**
904
+ * Returns the parent node in the CST.
905
+ * @returns The parent node, or undefined if this is the root
906
+ * @returns {Node | undefined}
907
+ */
908
+ parent(): any;
909
+ /**
910
+ * Returns all ancestor nodes from parent to root.
911
+ * @returns Array of ancestor nodes
912
+ * @returns {Node[]}
913
+ */
914
+ ancestors(): any[];
915
+ /**
916
+ * Returns the index of this node within its parent's children.
917
+ * @returns The child index
918
+ * @returns {number}
919
+ */
920
+ childIndex(): number;
921
+ /**
922
+ * Returns the previous sibling node.
923
+ * @returns The previous sibling, or undefined if this is the first child
924
+ * @returns {Node | undefined}
925
+ */
926
+ previousSibling(): any;
927
+ /**
928
+ * Returns all previous sibling nodes.
929
+ * @returns Array of previous siblings
930
+ * @returns {Node[]}
931
+ */
932
+ previousSiblings(): any[];
933
+ /**
934
+ * Returns the next sibling node.
935
+ * @returns The next sibling, or undefined if this is the last child
936
+ * @returns {Node | undefined}
937
+ */
938
+ nextSibling(): any;
939
+ /**
940
+ * Returns all next sibling nodes.
941
+ * @returns Array of next siblings
942
+ * @returns {Node[]}
943
+ */
944
+ nextSiblings(): any[];
945
+ /**
946
+ * Returns the root node of the document.
947
+ * @returns The root node, or undefined if detached
948
+ * @returns {RootNode | undefined}
949
+ */
950
+ rootNode(): any;
951
+ /**
952
+ * Returns the indentation string used at this node's depth.
953
+ * @returns The indentation string, or undefined if not applicable
450
954
  * @returns {string | undefined}
451
955
  */
452
- name(): string | undefined;
956
+ indentText(): any;
453
957
  /**
958
+ * Returns whether this node's container uses trailing commas.
959
+ * @returns true if trailing commas are used
960
+ * @returns {boolean}
961
+ */
962
+ usesTrailingCommas(): boolean;
963
+ }
964
+ /**
965
+ * Represents a number literal node in the CST.
966
+ * Provides methods for manipulating number values.
967
+ */
968
+ export class NumberLit {
969
+ static __wrap(ptr: any): any;
970
+ __destroy_into_raw(): number | undefined;
971
+ __wbg_ptr: number | undefined;
972
+ free(): void;
973
+ /**
974
+ * Returns the raw string representation of the number.
975
+ * Returns a string to preserve the exact formatting (e.g., "1.0" vs "1", "1e10" vs "10000000000").
976
+ * @returns The number as a string
454
977
  * @returns {string}
455
978
  */
456
- nameOrThrow(): string;
979
+ value(): any;
980
+ /**
981
+ * Sets the raw number value.
982
+ * The value should be a valid JSON number string (e.g., "42", "3.14", "1e10").
983
+ * @param value - The raw number string to set
984
+ * @param {string} value
985
+ */
986
+ setRawValue(value: string): void;
987
+ /**
988
+ * Replaces this number literal with a new value.
989
+ * @param replacement - The new value to replace this number with
990
+ * @returns The new node that replaced this one, or undefined if this was the root value
991
+ * @param {any} replacement
992
+ * @returns {Node | undefined}
993
+ */
994
+ replaceWith(replacement: any): any;
995
+ /**
996
+ * Removes this node from its parent.
997
+ * After calling this method, the node is detached from the CST and can no longer be used.
998
+ */
999
+ remove(): void;
1000
+ /**
1001
+ * Returns the parent node in the CST.
1002
+ * @returns The parent node, or undefined if this is the root
1003
+ * @returns {Node | undefined}
1004
+ */
1005
+ parent(): any;
1006
+ /**
1007
+ * Returns all ancestor nodes from parent to root.
1008
+ * @returns Array of ancestor nodes
1009
+ * @returns {Node[]}
1010
+ */
1011
+ ancestors(): any[];
457
1012
  /**
1013
+ * Returns the index of this node within its parent's children.
1014
+ * @returns The child index
1015
+ * @returns {number}
1016
+ */
1017
+ childIndex(): number;
1018
+ /**
1019
+ * Returns the previous sibling node.
1020
+ * @returns The previous sibling, or undefined if this is the first child
458
1021
  * @returns {Node | undefined}
459
1022
  */
460
- value(): Node | undefined;
1023
+ previousSibling(): any;
1024
+ /**
1025
+ * Returns all previous sibling nodes.
1026
+ * @returns Array of previous siblings
1027
+ * @returns {Node[]}
1028
+ */
1029
+ previousSiblings(): any[];
461
1030
  /**
1031
+ * Returns the next sibling node.
1032
+ * @returns The next sibling, or undefined if this is the last child
1033
+ * @returns {Node | undefined}
1034
+ */
1035
+ nextSibling(): any;
1036
+ /**
1037
+ * Returns all next sibling nodes.
1038
+ * @returns Array of next siblings
1039
+ * @returns {Node[]}
1040
+ */
1041
+ nextSiblings(): any[];
1042
+ /**
1043
+ * Returns the root node of the document.
1044
+ * @returns The root node, or undefined if detached
1045
+ * @returns {RootNode | undefined}
1046
+ */
1047
+ rootNode(): any;
1048
+ /**
1049
+ * Returns the indentation string used at this node's depth.
1050
+ * @returns The indentation string, or undefined if not applicable
1051
+ * @returns {string | undefined}
1052
+ */
1053
+ indentText(): any;
1054
+ /**
1055
+ * Returns whether this node's container uses trailing commas.
1056
+ * @returns true if trailing commas are used
1057
+ * @returns {boolean}
1058
+ */
1059
+ usesTrailingCommas(): boolean;
1060
+ }
1061
+ /**
1062
+ * Represents an object property (key-value pair) in the CST.
1063
+ * Provides methods for accessing and manipulating both the property name and its value.
1064
+ */
1065
+ export class ObjectProp {
1066
+ static __wrap(ptr: any): any;
1067
+ __destroy_into_raw(): number | undefined;
1068
+ __wbg_ptr: number | undefined;
1069
+ free(): void;
1070
+ /**
1071
+ * Returns the property name.
1072
+ * @returns The property name, or undefined if malformed
1073
+ * @returns {ObjectPropName | undefined}
1074
+ */
1075
+ name(): any;
1076
+ /**
1077
+ * Returns the property name, throwing if malformed.
1078
+ * @returns The property name
1079
+ * @throws If the property name is malformed
1080
+ * @returns {ObjectPropName}
1081
+ */
1082
+ nameOrThrow(): any;
1083
+ /**
1084
+ * Returns the property value.
1085
+ * @returns The property value, or undefined if malformed
1086
+ * @returns {Node | undefined}
1087
+ */
1088
+ value(): any;
1089
+ /**
1090
+ * Returns the property value, throwing if malformed.
1091
+ * @returns The property value
1092
+ * @throws If the property value is malformed
462
1093
  * @returns {Node}
463
1094
  */
464
- valueOrThrow(): Node;
1095
+ valueOrThrow(): any;
465
1096
  /**
1097
+ * Returns the property value if it's an object.
1098
+ * @returns The object value, or undefined if not an object
466
1099
  * @returns {JsonObject | undefined}
467
1100
  */
468
- valueIfObject(): JsonObject | undefined;
1101
+ valueIfObject(): any;
469
1102
  /**
1103
+ * Returns the property value as an object, throwing if not an object.
1104
+ * @returns The object value
1105
+ * @throws If the property value is not an object
470
1106
  * @returns {JsonObject}
471
1107
  */
472
- valueIfObjectOrThrow(): JsonObject;
1108
+ valueIfObjectOrThrow(): any;
473
1109
  /**
1110
+ * Gets the property value as an object, replacing the value with an empty object if needed.
1111
+ * Always returns an object by replacing non-object values.
1112
+ * @returns The object value (always succeeds)
474
1113
  * @returns {JsonObject}
475
1114
  */
476
- valueIfObjectOrForce(): JsonObject;
1115
+ valueIfObjectOrForce(): any;
477
1116
  /**
1117
+ * Returns the property value if it's an array.
1118
+ * @returns The array value, or undefined if not an array
478
1119
  * @returns {JsonArray | undefined}
479
1120
  */
480
- valueIfArray(): JsonArray | undefined;
1121
+ valueIfArray(): any;
481
1122
  /**
1123
+ * Returns the property value as an array, throwing if not an array.
1124
+ * @returns The array value
1125
+ * @throws If the property value is not an array
482
1126
  * @returns {JsonArray}
483
1127
  */
484
- valueIfArrayOrThrow(): JsonArray;
1128
+ valueIfArrayOrThrow(): any;
485
1129
  /**
1130
+ * Gets the property value as an array, replacing the value with an empty array if needed.
1131
+ * Always returns an array by replacing non-array values.
1132
+ * @returns The array value (always succeeds)
486
1133
  * @returns {JsonArray}
487
1134
  */
488
- valueIfArrayOrForce(): JsonArray;
1135
+ valueIfArrayOrForce(): any;
1136
+ /**
1137
+ * Removes this property from its parent object.
1138
+ * After calling this method, the property is detached from the CST and can no longer be used.
1139
+ */
489
1140
  remove(): void;
490
1141
  /**
1142
+ * Returns the index of this property within its parent object.
1143
+ * @returns The property index
491
1144
  * @returns {number}
492
1145
  */
493
1146
  propertyIndex(): number;
494
1147
  /**
1148
+ * Sets the value of this property.
1149
+ * @param value - The new value to set
495
1150
  * @param {any} value
496
1151
  */
497
1152
  setValue(value: any): void;
498
1153
  /**
1154
+ * Replaces this property with a new property.
1155
+ * This allows changing both the property name and its value.
1156
+ * @param key - The new property name
1157
+ * @param replacement - The new value for the property
1158
+ * @returns The new node that replaced this property, or undefined if this was the root value
499
1159
  * @param {string} key
500
- * @param {string} replacement
1160
+ * @param {any} replacement
501
1161
  * @returns {Node | undefined}
502
1162
  */
503
- replaceWith(key: string, replacement: string): Node | undefined;
1163
+ replaceWith(key: string, replacement: any): any;
504
1164
  /**
1165
+ * Returns the parent node in the CST.
1166
+ * @returns The parent node, or undefined if this is the root
505
1167
  * @returns {Node | undefined}
506
1168
  */
507
- parent(): Node | undefined;
1169
+ parent(): any;
508
1170
  /**
1171
+ * Returns all ancestor nodes from parent to root.
1172
+ * @returns Array of ancestor nodes
509
1173
  * @returns {Node[]}
510
1174
  */
511
- ancestors(): Node[];
1175
+ ancestors(): any[];
512
1176
  /**
1177
+ * Returns the index of this node within its parent's children.
1178
+ * @returns The child index
513
1179
  * @returns {number}
514
1180
  */
515
1181
  childIndex(): number;
516
1182
  /**
1183
+ * Returns the previous sibling node.
1184
+ * @returns The previous sibling, or undefined if this is the first child
517
1185
  * @returns {Node | undefined}
518
1186
  */
519
- previousSibling(): Node | undefined;
1187
+ previousSibling(): any;
520
1188
  /**
1189
+ * Returns all previous sibling nodes.
1190
+ * @returns Array of previous siblings
521
1191
  * @returns {Node[]}
522
1192
  */
523
- previousSiblings(): Node[];
1193
+ previousSiblings(): any[];
524
1194
  /**
1195
+ * Returns the next sibling node.
1196
+ * @returns The next sibling, or undefined if this is the last child
525
1197
  * @returns {Node | undefined}
526
1198
  */
527
- nextSibling(): Node | undefined;
1199
+ nextSibling(): any;
528
1200
  /**
1201
+ * Returns all next sibling nodes.
1202
+ * @returns Array of next siblings
529
1203
  * @returns {Node[]}
530
1204
  */
531
- nextSiblings(): Node[];
1205
+ nextSiblings(): any[];
532
1206
  /**
1207
+ * Returns the previous property in the same object.
1208
+ * @returns The previous property, or undefined if this is the first property
533
1209
  * @returns {ObjectProp | undefined}
534
1210
  */
535
- previousProperty(): ObjectProp | undefined;
1211
+ previousProperty(): any;
536
1212
  /**
1213
+ * Returns the next property in the same object.
1214
+ * @returns The next property, or undefined if this is the last property
537
1215
  * @returns {ObjectProp | undefined}
538
1216
  */
539
- nextProperty(): ObjectProp | undefined;
1217
+ nextProperty(): any;
540
1218
  /**
1219
+ * Returns the root node of the document.
1220
+ * @returns The root node, or undefined if detached
541
1221
  * @returns {RootNode | undefined}
542
1222
  */
543
- rootNode(): RootNode | undefined;
1223
+ rootNode(): any;
544
1224
  /**
1225
+ * Returns the indentation string used at this node's depth.
1226
+ * @returns The indentation string, or undefined if not applicable
545
1227
  * @returns {string | undefined}
546
1228
  */
547
- indentText(): string | undefined;
1229
+ indentText(): any;
548
1230
  /**
1231
+ * Returns whether this node's container uses trailing commas.
1232
+ * @returns true if trailing commas are used
549
1233
  * @returns {boolean}
550
1234
  */
551
1235
  usesTrailingCommas(): boolean;
552
1236
  /**
1237
+ * Returns all child nodes including whitespace and punctuation.
1238
+ * @returns Array of all child nodes
553
1239
  * @returns {Node[]}
554
1240
  */
555
- children(): Node[];
1241
+ children(): any[];
556
1242
  /**
1243
+ * Returns child nodes excluding whitespace, comments, and punctuation.
1244
+ * @returns Array of significant child nodes
557
1245
  * @returns {Node[]}
558
1246
  */
559
- childrenExcludeTriviaAndTokens(): Node[];
1247
+ childrenExcludeTriviaAndTokens(): any[];
560
1248
  /**
1249
+ * Returns the child node at the specified index.
1250
+ * @param index - The child index
1251
+ * @returns The child node, or undefined if index is out of bounds
561
1252
  * @param {number} index
562
1253
  * @returns {Node | undefined}
563
1254
  */
564
- childAtIndex(index: number): Node | undefined;
1255
+ childAtIndex(index: number): any;
565
1256
  }
1257
+ /**
1258
+ * Represents the name part of an object property in the CST.
1259
+ * Can be either a quoted string or an unquoted word literal (when allowLooseObjectPropertyNames is enabled).
1260
+ */
1261
+ export class ObjectPropName {
1262
+ static __wrap(ptr: any): any;
1263
+ __destroy_into_raw(): number | undefined;
1264
+ __wbg_ptr: number | undefined;
1265
+ free(): void;
1266
+ /**
1267
+ * Returns the decoded property name (unquoted and unescaped).
1268
+ * @returns The decoded property name
1269
+ * @returns {string}
1270
+ */
1271
+ decodedValue(): any;
1272
+ /**
1273
+ * Returns the parent node in the CST.
1274
+ * @returns The parent node, or undefined if this is the root
1275
+ * @returns {Node | undefined}
1276
+ */
1277
+ parent(): any;
1278
+ /**
1279
+ * Returns the root node of the document.
1280
+ * @returns The root node, or undefined if detached
1281
+ * @returns {RootNode | undefined}
1282
+ */
1283
+ rootNode(): any;
1284
+ /**
1285
+ * Returns the index of this node within its parent's children.
1286
+ * @returns The child index
1287
+ * @returns {number}
1288
+ */
1289
+ childIndex(): number;
1290
+ /**
1291
+ * Returns all ancestor nodes from parent to root.
1292
+ * @returns Array of ancestor nodes
1293
+ * @returns {Node[]}
1294
+ */
1295
+ ancestors(): any[];
1296
+ /**
1297
+ * Returns the previous sibling node.
1298
+ * @returns The previous sibling, or undefined if this is the first child
1299
+ * @returns {Node | undefined}
1300
+ */
1301
+ previousSibling(): any;
1302
+ /**
1303
+ * Returns the next sibling node.
1304
+ * @returns The next sibling, or undefined if this is the last child
1305
+ * @returns {Node | undefined}
1306
+ */
1307
+ nextSibling(): any;
1308
+ /**
1309
+ * Returns the indentation string used at this node's depth.
1310
+ * @returns The indentation string, or undefined if not applicable
1311
+ * @returns {string | undefined}
1312
+ */
1313
+ indentText(): any;
1314
+ /**
1315
+ * Returns whether this node's container uses trailing commas.
1316
+ * @returns true if trailing commas are used
1317
+ * @returns {boolean}
1318
+ */
1319
+ usesTrailingCommas(): boolean;
1320
+ }
1321
+ /**
1322
+ * Represents the root node of a JSONC document.
1323
+ * This is the entry point for manipulating the concrete syntax tree.
1324
+ */
566
1325
  export class RootNode {
567
1326
  static __wrap(ptr: any): any;
568
1327
  __destroy_into_raw(): number | undefined;
569
1328
  __wbg_ptr: number | undefined;
570
1329
  free(): void;
571
1330
  /**
1331
+ * Returns the root value node.
1332
+ * @returns The root value, or undefined if the document is empty
572
1333
  * @returns {Node | undefined}
573
1334
  */
574
- value(): Node | undefined;
1335
+ value(): any;
575
1336
  /**
1337
+ * Returns the root value node, throwing if empty.
1338
+ * @returns The root value
1339
+ * @throws If the document is empty
576
1340
  * @returns {Node}
577
1341
  */
578
- valueOrThrow(): Node;
1342
+ valueOrThrow(): any;
579
1343
  /**
1344
+ * Returns the root value as an object if it is one.
1345
+ * @returns The object, or undefined if root is not an object
580
1346
  * @returns {JsonObject | undefined}
581
1347
  */
582
- asObject(): JsonObject | undefined;
1348
+ asObject(): any;
583
1349
  /**
1350
+ * Returns the root value as an object, throwing if it's not an object.
1351
+ * @returns The object
1352
+ * @throws If the root is not an object
584
1353
  * @returns {JsonObject}
585
1354
  */
586
- asObjectOrThrow(): JsonObject;
1355
+ asObjectOrThrow(): any;
587
1356
  /**
1357
+ * Returns the root value as an object, creating an empty object if the root is empty.
1358
+ * Returns undefined if the root contains a value of a different type.
1359
+ * @returns The object, or undefined if a non-object value exists
588
1360
  * @returns {JsonObject | undefined}
589
1361
  */
590
- asObjectValueOrCreate(): JsonObject | undefined;
1362
+ asObjectOrCreate(): any;
591
1363
  /**
1364
+ * Returns the root value as an object, replacing any existing value with an empty object if needed.
1365
+ * Unlike asObjectOrCreate, this always returns an object by replacing non-object values.
1366
+ * @returns The object (always succeeds)
592
1367
  * @returns {JsonObject}
593
1368
  */
594
- asObjectValueOrForce(): JsonObject;
1369
+ asObjectOrForce(): any;
595
1370
  /**
1371
+ * Returns the root value as an array if it is one.
1372
+ * @returns The array, or undefined if root is not an array
596
1373
  * @returns {JsonArray | undefined}
597
1374
  */
598
- asArray(): JsonArray | undefined;
1375
+ asArray(): any;
599
1376
  /**
1377
+ * Returns the root value as an array, throwing if it's not an array.
1378
+ * @returns The array
1379
+ * @throws If the root is not an array
600
1380
  * @returns {JsonArray}
601
1381
  */
602
- asArrayOrThrow(): JsonArray;
1382
+ asArrayOrThrow(): any;
603
1383
  /**
1384
+ * Returns the root value as an array, creating an empty array if the root is empty.
1385
+ * Returns undefined if the root contains a value of a different type.
1386
+ * @returns The array, or undefined if a non-array value exists
604
1387
  * @returns {JsonArray | undefined}
605
1388
  */
606
- asArrayOrCreate(): JsonArray | undefined;
1389
+ asArrayOrCreate(): any;
607
1390
  /**
1391
+ * Returns the root value as an array, replacing any existing value with an empty array if needed.
1392
+ * Unlike asArrayOrCreate, this always returns an array by replacing non-array values.
1393
+ * @returns The array (always succeeds)
608
1394
  * @returns {JsonArray}
609
1395
  */
610
- asArrayOrForce(): JsonArray;
1396
+ asArrayOrForce(): any;
611
1397
  /**
1398
+ * Converts the CST back to a string representation.
1399
+ * @returns The JSONC string
612
1400
  * @returns {string}
613
1401
  */
614
- toString(): string;
1402
+ toString(): any;
615
1403
  /**
1404
+ * Returns all child nodes including whitespace and punctuation.
1405
+ * @returns Array of all child nodes
616
1406
  * @returns {Node[]}
617
1407
  */
618
- children(): Node[];
1408
+ children(): any[];
619
1409
  /**
620
- * @param {any} root_value
1410
+ * Sets the root value of the document.
1411
+ * Accepts any JSON value: string, number, boolean, null, array, or object.
1412
+ * @param value - The new value to set
1413
+ * @param {any} value
621
1414
  */
622
- setValue(root_value: any): void;
1415
+ setValue(value: any): void;
623
1416
  /**
1417
+ * Configures whether trailing commas should be used throughout the document.
1418
+ * When enabled, trailing commas are added for multiline formatting in objects and arrays.
1419
+ * @param enabled - Whether to enable trailing commas
624
1420
  * @param {boolean} enabled
625
1421
  */
626
1422
  setTrailingCommas(enabled: boolean): void;
1423
+ /**
1424
+ * Clears all children from the root node, leaving an empty document.
1425
+ */
627
1426
  clearChildren(): void;
628
1427
  /**
1428
+ * Returns the indentation string used for a single level.
1429
+ * @returns The single-level indentation string (e.g., " " or "\t")
629
1430
  * @returns {string | undefined}
630
1431
  */
631
- singleIndentText(): string | undefined;
1432
+ singleIndentText(): any;
632
1433
  /**
1434
+ * Returns the newline kind used in the document.
1435
+ * @returns Either "\n" or "\r\n"
633
1436
  * @returns {string}
634
1437
  */
635
- newlineKind(): string;
1438
+ newlineKind(): any;
636
1439
  /**
1440
+ * Returns the parent node in the CST.
1441
+ * @returns The parent node, or undefined if this is the root
637
1442
  * @returns {Node | undefined}
638
1443
  */
639
- parent(): Node | undefined;
1444
+ parent(): any;
640
1445
  /**
1446
+ * Returns the index of this node within its parent's children.
1447
+ * @returns The child index
641
1448
  * @returns {number}
642
1449
  */
643
1450
  childIndex(): number;
644
1451
  /**
1452
+ * Returns all ancestor nodes from parent to root.
1453
+ * @returns Array of ancestor nodes
645
1454
  * @returns {Node[]}
646
1455
  */
647
- ancestors(): Node[];
1456
+ ancestors(): any[];
648
1457
  /**
1458
+ * Returns the previous sibling node.
1459
+ * @returns The previous sibling, or undefined if this is the first child
649
1460
  * @returns {Node | undefined}
650
1461
  */
651
- previousSibling(): Node | undefined;
1462
+ previousSibling(): any;
652
1463
  /**
1464
+ * Returns all previous sibling nodes.
1465
+ * @returns Array of previous siblings
653
1466
  * @returns {Node[]}
654
1467
  */
655
- previousSiblings(): Node[];
1468
+ previousSiblings(): any[];
656
1469
  /**
1470
+ * Returns the next sibling node.
1471
+ * @returns The next sibling, or undefined if this is the last child
657
1472
  * @returns {Node | undefined}
658
1473
  */
659
- nextSibling(): Node | undefined;
1474
+ nextSibling(): any;
660
1475
  /**
1476
+ * Returns all next sibling nodes.
1477
+ * @returns Array of next siblings
661
1478
  * @returns {Node[]}
662
1479
  */
663
- nextSiblings(): Node[];
1480
+ nextSiblings(): any[];
664
1481
  /**
1482
+ * Returns the indentation string used at this node's depth.
1483
+ * @returns The indentation string, or undefined if not applicable
665
1484
  * @returns {string | undefined}
666
1485
  */
667
- indentText(): string | undefined;
1486
+ indentText(): any;
668
1487
  /**
1488
+ * Returns whether this node's container uses trailing commas.
1489
+ * @returns true if trailing commas are used
669
1490
  * @returns {boolean}
670
1491
  */
671
1492
  usesTrailingCommas(): boolean;
672
1493
  /**
1494
+ * Returns child nodes excluding whitespace, comments, and punctuation.
1495
+ * @returns Array of significant child nodes
673
1496
  * @returns {Node[]}
674
1497
  */
675
- childrenExcludeTriviaAndTokens(): Node[];
1498
+ childrenExcludeTriviaAndTokens(): any[];
676
1499
  /**
1500
+ * Returns the child node at the specified index.
1501
+ * @param index - The child index
1502
+ * @returns The child node, or undefined if index is out of bounds
677
1503
  * @param {number} index
678
1504
  * @returns {Node | undefined}
679
1505
  */
680
- childAtIndex(index: number): Node | undefined;
1506
+ childAtIndex(index: number): any;
1507
+ /**
1508
+ * Converts the CST to a plain JavaScript value, similar to JSON.parse.
1509
+ * This recursively converts the root value to its JavaScript equivalent.
1510
+ * Comments and formatting information are discarded.
1511
+ * @returns The plain JavaScript value (object, array, string, number, boolean, or null)
1512
+ * @throws If the document contains invalid values that cannot be converted
1513
+ * @returns {any}
1514
+ */
1515
+ toValue(): any;
1516
+ }
1517
+ /**
1518
+ * Represents a string literal node in the CST.
1519
+ * Provides methods for manipulating string values and their formatting.
1520
+ */
1521
+ export class StringLit {
1522
+ static __wrap(ptr: any): any;
1523
+ __destroy_into_raw(): number | undefined;
1524
+ __wbg_ptr: number | undefined;
1525
+ free(): void;
1526
+ /**
1527
+ * Returns the decoded string value (without quotes and with escape sequences processed).
1528
+ * @returns The decoded string value
1529
+ * @returns {string}
1530
+ */
1531
+ decodedValue(): any;
1532
+ /**
1533
+ * Returns the raw string value including quotes and escape sequences.
1534
+ * @returns The raw string representation
1535
+ * @returns {string}
1536
+ */
1537
+ rawValue(): any;
1538
+ /**
1539
+ * Sets the raw string value (should include quotes).
1540
+ * @param value - The new raw string value
1541
+ * @param {string} value
1542
+ */
1543
+ setRawValue(value: string): void;
1544
+ /**
1545
+ * Replaces this string literal with a new value.
1546
+ * @param replacement - The new value to replace this string with
1547
+ * @returns The new node that replaced this one, or undefined if this was the root value
1548
+ * @param {any} replacement
1549
+ * @returns {Node | undefined}
1550
+ */
1551
+ replaceWith(replacement: any): any;
1552
+ /**
1553
+ * Removes this string literal from its parent.
1554
+ * After calling this method, the node is detached from the CST and can no longer be used.
1555
+ */
1556
+ remove(): void;
1557
+ /**
1558
+ * Returns the parent node in the CST.
1559
+ * @returns The parent node, or undefined if this is the root
1560
+ * @returns {Node | undefined}
1561
+ */
1562
+ parent(): any;
1563
+ /**
1564
+ * Returns all ancestor nodes from parent to root.
1565
+ * @returns Array of ancestor nodes
1566
+ * @returns {Node[]}
1567
+ */
1568
+ ancestors(): any[];
1569
+ /**
1570
+ * Returns the index of this node within its parent's children.
1571
+ * @returns The child index
1572
+ * @returns {number}
1573
+ */
1574
+ childIndex(): number;
1575
+ /**
1576
+ * Returns the previous sibling node.
1577
+ * @returns The previous sibling, or undefined if this is the first child
1578
+ * @returns {Node | undefined}
1579
+ */
1580
+ previousSibling(): any;
1581
+ /**
1582
+ * Returns all previous sibling nodes.
1583
+ * @returns Array of previous siblings
1584
+ * @returns {Node[]}
1585
+ */
1586
+ previousSiblings(): any[];
1587
+ /**
1588
+ * Returns the next sibling node.
1589
+ * @returns The next sibling, or undefined if this is the last child
1590
+ * @returns {Node | undefined}
1591
+ */
1592
+ nextSibling(): any;
1593
+ /**
1594
+ * Returns all next sibling nodes.
1595
+ * @returns Array of next siblings
1596
+ * @returns {Node[]}
1597
+ */
1598
+ nextSiblings(): any[];
1599
+ /**
1600
+ * Returns the root node of the document.
1601
+ * @returns The root node, or undefined if detached
1602
+ * @returns {RootNode | undefined}
1603
+ */
1604
+ rootNode(): any;
1605
+ /**
1606
+ * Returns the indentation string used at this node's depth.
1607
+ * @returns The indentation string, or undefined if not applicable
1608
+ * @returns {string | undefined}
1609
+ */
1610
+ indentText(): any;
1611
+ /**
1612
+ * Returns whether this node's container uses trailing commas.
1613
+ * @returns true if trailing commas are used
1614
+ * @returns {boolean}
1615
+ */
1616
+ usesTrailingCommas(): boolean;
1617
+ }
1618
+ /**
1619
+ * Represents an unquoted word literal node in the CST.
1620
+ * Used for unquoted property names when `allowLooseObjectPropertyNames` is enabled.
1621
+ */
1622
+ export class WordLit {
1623
+ static __wrap(ptr: any): any;
1624
+ __destroy_into_raw(): number | undefined;
1625
+ __wbg_ptr: number | undefined;
1626
+ free(): void;
1627
+ /**
1628
+ * Returns the unquoted word value.
1629
+ * @returns The word literal as a string
1630
+ * @returns {string}
1631
+ */
1632
+ value(): any;
1633
+ /**
1634
+ * Sets the raw word value.
1635
+ * The value should be a valid unquoted identifier (alphanumeric and underscores).
1636
+ * @param value - The raw word string to set
1637
+ * @param {string} value
1638
+ */
1639
+ setRawValue(value: string): void;
1640
+ /**
1641
+ * Replaces this word literal with a new value.
1642
+ * @param replacement - The new value to replace this word with
1643
+ * @returns The new node that replaced this one, or undefined if this was the root value
1644
+ * @param {any} replacement
1645
+ * @returns {Node | undefined}
1646
+ */
1647
+ replaceWith(replacement: any): any;
1648
+ /**
1649
+ * Removes this node from its parent.
1650
+ * After calling this method, the node is detached from the CST and can no longer be used.
1651
+ */
1652
+ remove(): void;
1653
+ /**
1654
+ * Returns the parent node in the CST.
1655
+ * @returns The parent node, or undefined if this is the root
1656
+ * @returns {Node | undefined}
1657
+ */
1658
+ parent(): any;
1659
+ /**
1660
+ * Returns all ancestor nodes from parent to root.
1661
+ * @returns Array of ancestor nodes
1662
+ * @returns {Node[]}
1663
+ */
1664
+ ancestors(): any[];
1665
+ /**
1666
+ * Returns the index of this node within its parent's children.
1667
+ * @returns The child index
1668
+ * @returns {number}
1669
+ */
1670
+ childIndex(): number;
1671
+ /**
1672
+ * Returns the previous sibling node.
1673
+ * @returns The previous sibling, or undefined if this is the first child
1674
+ * @returns {Node | undefined}
1675
+ */
1676
+ previousSibling(): any;
1677
+ /**
1678
+ * Returns all previous sibling nodes.
1679
+ * @returns Array of previous siblings
1680
+ * @returns {Node[]}
1681
+ */
1682
+ previousSiblings(): any[];
1683
+ /**
1684
+ * Returns the next sibling node.
1685
+ * @returns The next sibling, or undefined if this is the last child
1686
+ * @returns {Node | undefined}
1687
+ */
1688
+ nextSibling(): any;
1689
+ /**
1690
+ * Returns all next sibling nodes.
1691
+ * @returns Array of next siblings
1692
+ * @returns {Node[]}
1693
+ */
1694
+ nextSiblings(): any[];
1695
+ /**
1696
+ * Returns the root node of the document.
1697
+ * @returns The root node, or undefined if detached
1698
+ * @returns {RootNode | undefined}
1699
+ */
1700
+ rootNode(): any;
1701
+ /**
1702
+ * Returns the indentation string used at this node's depth.
1703
+ * @returns The indentation string, or undefined if not applicable
1704
+ * @returns {string | undefined}
1705
+ */
1706
+ indentText(): any;
1707
+ /**
1708
+ * Returns whether this node's container uses trailing commas.
1709
+ * @returns true if trailing commas are used
1710
+ * @returns {boolean}
1711
+ */
1712
+ usesTrailingCommas(): boolean;
681
1713
  }
682
1714
  //# sourceMappingURL=rs_lib.internal.d.ts.map