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