seroval 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/dist/cjs/development/index.cjs +550 -180
- package/dist/cjs/development/index.cjs.map +4 -4
- package/dist/cjs/production/index.cjs +3 -3
- package/dist/esm/development/index.mjs +550 -180
- package/dist/esm/development/index.mjs.map +4 -4
- package/dist/esm/production/index.mjs +3 -3
- package/dist/types/compat.d.ts +1 -1
- package/dist/types/context.d.ts +11 -5
- package/dist/types/string.d.ts +3 -0
- package/dist/types/tree/primitives.d.ts +4 -1
- package/dist/types/tree/types.d.ts +52 -9
- package/dist/types/tree/web-api.d.ts +3 -1
- package/package.json +3 -2
- package/src/compat.ts +1 -1
- package/src/context.ts +14 -6
- package/src/{quote.ts → string.ts} +27 -30
- package/src/tree/async.ts +87 -8
- package/src/tree/deserialize.ts +176 -59
- package/src/tree/primitives.ts +84 -20
- package/src/tree/serialize.ts +211 -41
- package/src/tree/sync.ts +76 -7
- package/src/tree/types.ts +111 -10
- package/src/tree/web-api.ts +53 -3
- package/dist/types/quote.d.ts +0 -2
|
@@ -51,7 +51,7 @@ var Feature = /* @__PURE__ */ ((Feature2) => {
|
|
|
51
51
|
Feature2[Feature2["WebAPI"] = 8192] = "WebAPI";
|
|
52
52
|
return Feature2;
|
|
53
53
|
})(Feature || {});
|
|
54
|
-
var ALL_ENABLED =
|
|
54
|
+
var ALL_ENABLED = 16383;
|
|
55
55
|
|
|
56
56
|
// src/get-identifier.ts
|
|
57
57
|
var REF_START_CHARS = "hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_";
|
|
@@ -135,39 +135,43 @@ function assert(cond, error) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
// src/
|
|
139
|
-
function
|
|
138
|
+
// src/string.ts
|
|
139
|
+
function serializeChar(str) {
|
|
140
|
+
switch (str) {
|
|
141
|
+
case '"':
|
|
142
|
+
return '\\"';
|
|
143
|
+
case "\\":
|
|
144
|
+
return "\\\\";
|
|
145
|
+
case "\n":
|
|
146
|
+
return "\\n";
|
|
147
|
+
case "\r":
|
|
148
|
+
return "\\r";
|
|
149
|
+
case "\b":
|
|
150
|
+
return "\\b";
|
|
151
|
+
case " ":
|
|
152
|
+
return "\\t";
|
|
153
|
+
case "\f":
|
|
154
|
+
return "\\f";
|
|
155
|
+
case "<":
|
|
156
|
+
return "\\x3C";
|
|
157
|
+
case "\u2028":
|
|
158
|
+
return "\\u2028";
|
|
159
|
+
case "\u2029":
|
|
160
|
+
return "\\u2029";
|
|
161
|
+
default:
|
|
162
|
+
return void 0;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function serializeString(str) {
|
|
140
166
|
let result = "";
|
|
141
167
|
let lastPos = 0;
|
|
168
|
+
let replacement;
|
|
142
169
|
for (let i = 0, len = str.length; i < len; i++) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
break;
|
|
148
|
-
case "\\":
|
|
149
|
-
replacement = "\\\\";
|
|
150
|
-
break;
|
|
151
|
-
case "<":
|
|
152
|
-
replacement = "\\x3C";
|
|
153
|
-
break;
|
|
154
|
-
case "\n":
|
|
155
|
-
replacement = "\\n";
|
|
156
|
-
break;
|
|
157
|
-
case "\r":
|
|
158
|
-
replacement = "\\r";
|
|
159
|
-
break;
|
|
160
|
-
case "\u2028":
|
|
161
|
-
replacement = "\\u2028";
|
|
162
|
-
break;
|
|
163
|
-
case "\u2029":
|
|
164
|
-
replacement = "\\u2029";
|
|
165
|
-
break;
|
|
166
|
-
default:
|
|
167
|
-
continue;
|
|
170
|
+
replacement = serializeChar(str[i]);
|
|
171
|
+
if (replacement) {
|
|
172
|
+
result += str.slice(lastPos, i) + replacement;
|
|
173
|
+
lastPos = i + 1;
|
|
168
174
|
}
|
|
169
|
-
result += str.slice(lastPos, i) + replacement;
|
|
170
|
-
lastPos = i + 1;
|
|
171
175
|
}
|
|
172
176
|
if (lastPos === 0) {
|
|
173
177
|
result = str;
|
|
@@ -176,8 +180,8 @@ function quote(str) {
|
|
|
176
180
|
}
|
|
177
181
|
return result;
|
|
178
182
|
}
|
|
179
|
-
function
|
|
180
|
-
return str.replace(/\\"/g, '"').replace(/\\\\/g, "\\").replace(/\\
|
|
183
|
+
function deserializeString(str) {
|
|
184
|
+
return str.replace(/\\"/g, '"').replace(/\\\\/g, "\\").replace(/\\n/g, "\n").replace(/\\r/g, "\r").replace(/\\b/g, "\b").replace(/\\t/g, " ").replace(/\\f/g, "\f").replace(/\\x3C/g, "<").replace(/\\u2028/g, "\u2028").replace(/\\u2029/g, "\u2029");
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
// src/tree/reference.ts
|
|
@@ -290,7 +294,8 @@ var TRUE_NODE = {
|
|
|
290
294
|
m: void 0,
|
|
291
295
|
d: void 0,
|
|
292
296
|
a: void 0,
|
|
293
|
-
f: void 0
|
|
297
|
+
f: void 0,
|
|
298
|
+
b: void 0
|
|
294
299
|
};
|
|
295
300
|
var FALSE_NODE = {
|
|
296
301
|
t: 2 /* Boolean */,
|
|
@@ -301,7 +306,8 @@ var FALSE_NODE = {
|
|
|
301
306
|
m: void 0,
|
|
302
307
|
d: void 0,
|
|
303
308
|
a: void 0,
|
|
304
|
-
f: void 0
|
|
309
|
+
f: void 0,
|
|
310
|
+
b: void 0
|
|
305
311
|
};
|
|
306
312
|
var UNDEFINED_NODE = {
|
|
307
313
|
t: 4 /* Undefined */,
|
|
@@ -312,7 +318,8 @@ var UNDEFINED_NODE = {
|
|
|
312
318
|
m: void 0,
|
|
313
319
|
d: void 0,
|
|
314
320
|
a: void 0,
|
|
315
|
-
f: void 0
|
|
321
|
+
f: void 0,
|
|
322
|
+
b: void 0
|
|
316
323
|
};
|
|
317
324
|
var NULL_NODE = {
|
|
318
325
|
t: 3 /* Null */,
|
|
@@ -323,7 +330,8 @@ var NULL_NODE = {
|
|
|
323
330
|
m: void 0,
|
|
324
331
|
d: void 0,
|
|
325
332
|
a: void 0,
|
|
326
|
-
f: void 0
|
|
333
|
+
f: void 0,
|
|
334
|
+
b: void 0
|
|
327
335
|
};
|
|
328
336
|
var NEG_ZERO_NODE = {
|
|
329
337
|
t: 5 /* NegativeZero */,
|
|
@@ -334,7 +342,8 @@ var NEG_ZERO_NODE = {
|
|
|
334
342
|
m: void 0,
|
|
335
343
|
d: void 0,
|
|
336
344
|
a: void 0,
|
|
337
|
-
f: void 0
|
|
345
|
+
f: void 0,
|
|
346
|
+
b: void 0
|
|
338
347
|
};
|
|
339
348
|
var INFINITY_NODE = {
|
|
340
349
|
t: 6 /* Infinity */,
|
|
@@ -345,7 +354,8 @@ var INFINITY_NODE = {
|
|
|
345
354
|
m: void 0,
|
|
346
355
|
d: void 0,
|
|
347
356
|
a: void 0,
|
|
348
|
-
f: void 0
|
|
357
|
+
f: void 0,
|
|
358
|
+
b: void 0
|
|
349
359
|
};
|
|
350
360
|
var NEG_INFINITY_NODE = {
|
|
351
361
|
t: 7 /* NegativeInfinity */,
|
|
@@ -356,7 +366,8 @@ var NEG_INFINITY_NODE = {
|
|
|
356
366
|
m: void 0,
|
|
357
367
|
d: void 0,
|
|
358
368
|
a: void 0,
|
|
359
|
-
f: void 0
|
|
369
|
+
f: void 0,
|
|
370
|
+
b: void 0
|
|
360
371
|
};
|
|
361
372
|
var NAN_NODE = {
|
|
362
373
|
t: 8 /* NaN */,
|
|
@@ -367,7 +378,8 @@ var NAN_NODE = {
|
|
|
367
378
|
m: void 0,
|
|
368
379
|
d: void 0,
|
|
369
380
|
a: void 0,
|
|
370
|
-
f: void 0
|
|
381
|
+
f: void 0,
|
|
382
|
+
b: void 0
|
|
371
383
|
};
|
|
372
384
|
function createNumberNode(value) {
|
|
373
385
|
return {
|
|
@@ -379,20 +391,22 @@ function createNumberNode(value) {
|
|
|
379
391
|
m: void 0,
|
|
380
392
|
d: void 0,
|
|
381
393
|
a: void 0,
|
|
382
|
-
f: void 0
|
|
394
|
+
f: void 0,
|
|
395
|
+
b: void 0
|
|
383
396
|
};
|
|
384
397
|
}
|
|
385
398
|
function createStringNode(value) {
|
|
386
399
|
return {
|
|
387
400
|
t: 1 /* String */,
|
|
388
401
|
i: void 0,
|
|
389
|
-
s:
|
|
402
|
+
s: serializeString(value),
|
|
390
403
|
l: void 0,
|
|
391
404
|
c: void 0,
|
|
392
405
|
m: void 0,
|
|
393
406
|
d: void 0,
|
|
394
407
|
a: void 0,
|
|
395
|
-
f: void 0
|
|
408
|
+
f: void 0,
|
|
409
|
+
b: void 0
|
|
396
410
|
};
|
|
397
411
|
}
|
|
398
412
|
function createBigIntNode(ctx, current) {
|
|
@@ -406,7 +420,8 @@ function createBigIntNode(ctx, current) {
|
|
|
406
420
|
m: void 0,
|
|
407
421
|
d: void 0,
|
|
408
422
|
a: void 0,
|
|
409
|
-
f: void 0
|
|
423
|
+
f: void 0,
|
|
424
|
+
b: void 0
|
|
410
425
|
};
|
|
411
426
|
}
|
|
412
427
|
function createIndexedValueNode(id) {
|
|
@@ -419,7 +434,8 @@ function createIndexedValueNode(id) {
|
|
|
419
434
|
m: void 0,
|
|
420
435
|
d: void 0,
|
|
421
436
|
a: void 0,
|
|
422
|
-
f: void 0
|
|
437
|
+
f: void 0,
|
|
438
|
+
b: void 0
|
|
423
439
|
};
|
|
424
440
|
}
|
|
425
441
|
function createDateNode(id, current) {
|
|
@@ -432,7 +448,8 @@ function createDateNode(id, current) {
|
|
|
432
448
|
m: void 0,
|
|
433
449
|
d: void 0,
|
|
434
450
|
f: void 0,
|
|
435
|
-
a: void 0
|
|
451
|
+
a: void 0,
|
|
452
|
+
b: void 0
|
|
436
453
|
};
|
|
437
454
|
}
|
|
438
455
|
function createRegExpNode(id, current) {
|
|
@@ -445,27 +462,51 @@ function createRegExpNode(id, current) {
|
|
|
445
462
|
m: current.flags,
|
|
446
463
|
d: void 0,
|
|
447
464
|
a: void 0,
|
|
448
|
-
f: void 0
|
|
465
|
+
f: void 0,
|
|
466
|
+
b: void 0
|
|
449
467
|
};
|
|
450
468
|
}
|
|
451
|
-
function
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
const len = current.length;
|
|
469
|
+
function createArrayBufferNode(id, current) {
|
|
470
|
+
const bytes = new Uint8Array(current);
|
|
471
|
+
const len = bytes.length;
|
|
455
472
|
const values = new Array(len);
|
|
456
473
|
for (let i = 0; i < len; i++) {
|
|
457
|
-
values[i] =
|
|
474
|
+
values[i] = bytes[i];
|
|
458
475
|
}
|
|
459
476
|
return {
|
|
460
|
-
t:
|
|
477
|
+
t: 28 /* ArrayBuffer */,
|
|
461
478
|
i: id,
|
|
462
479
|
s: values,
|
|
463
|
-
l:
|
|
480
|
+
l: void 0,
|
|
481
|
+
c: void 0,
|
|
482
|
+
m: void 0,
|
|
483
|
+
d: void 0,
|
|
484
|
+
a: void 0,
|
|
485
|
+
f: void 0,
|
|
486
|
+
b: void 0
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function serializeArrayBuffer(ctx, current) {
|
|
490
|
+
const id = createIndexedValue(ctx, current);
|
|
491
|
+
if (ctx.markedRefs.has(id)) {
|
|
492
|
+
return createIndexedValueNode(id);
|
|
493
|
+
}
|
|
494
|
+
return createArrayBufferNode(id, current);
|
|
495
|
+
}
|
|
496
|
+
function createTypedArrayNode(ctx, id, current) {
|
|
497
|
+
const constructor = current.constructor.name;
|
|
498
|
+
assert(ctx.features & 2048 /* TypedArray */, `Unsupported value type "${constructor}"`);
|
|
499
|
+
return {
|
|
500
|
+
t: 22 /* TypedArray */,
|
|
501
|
+
i: id,
|
|
502
|
+
s: void 0,
|
|
503
|
+
l: current.length,
|
|
464
504
|
c: constructor,
|
|
465
505
|
m: void 0,
|
|
466
506
|
d: void 0,
|
|
467
507
|
a: void 0,
|
|
468
|
-
f:
|
|
508
|
+
f: serializeArrayBuffer(ctx, current.buffer),
|
|
509
|
+
b: current.byteOffset
|
|
469
510
|
};
|
|
470
511
|
}
|
|
471
512
|
var BIGINT_FLAG = 4096 /* BigIntTypedArray */ | 8 /* BigInt */;
|
|
@@ -475,21 +516,17 @@ function createBigIntTypedArrayNode(ctx, id, current) {
|
|
|
475
516
|
(ctx.features & BIGINT_FLAG) === BIGINT_FLAG,
|
|
476
517
|
`Unsupported value type "${constructor}"`
|
|
477
518
|
);
|
|
478
|
-
const len = current.length;
|
|
479
|
-
const values = new Array(len);
|
|
480
|
-
for (let i = 0; i < len; i++) {
|
|
481
|
-
values[i] = "" + current[i];
|
|
482
|
-
}
|
|
483
519
|
return {
|
|
484
520
|
t: 23 /* BigIntTypedArray */,
|
|
485
521
|
i: id,
|
|
486
|
-
s:
|
|
487
|
-
l: current.
|
|
522
|
+
s: void 0,
|
|
523
|
+
l: current.length,
|
|
488
524
|
c: constructor,
|
|
489
525
|
m: void 0,
|
|
490
526
|
d: void 0,
|
|
491
527
|
a: void 0,
|
|
492
|
-
f:
|
|
528
|
+
f: serializeArrayBuffer(ctx, current.buffer),
|
|
529
|
+
b: current.byteOffset
|
|
493
530
|
};
|
|
494
531
|
}
|
|
495
532
|
function createWKSymbolNode(ctx, current) {
|
|
@@ -504,20 +541,36 @@ function createWKSymbolNode(ctx, current) {
|
|
|
504
541
|
m: void 0,
|
|
505
542
|
d: void 0,
|
|
506
543
|
a: void 0,
|
|
507
|
-
f: void 0
|
|
544
|
+
f: void 0,
|
|
545
|
+
b: void 0
|
|
508
546
|
};
|
|
509
547
|
}
|
|
510
548
|
function createReferenceNode(id, ref) {
|
|
511
549
|
return {
|
|
512
550
|
t: 27 /* Reference */,
|
|
513
551
|
i: id,
|
|
514
|
-
s:
|
|
552
|
+
s: serializeString(getReferenceID(ref)),
|
|
515
553
|
l: void 0,
|
|
516
554
|
c: void 0,
|
|
517
555
|
m: void 0,
|
|
518
556
|
d: void 0,
|
|
519
557
|
a: void 0,
|
|
520
|
-
f: void 0
|
|
558
|
+
f: void 0,
|
|
559
|
+
b: void 0
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function createDataViewNode(ctx, id, current) {
|
|
563
|
+
return {
|
|
564
|
+
t: 29 /* DataView */,
|
|
565
|
+
i: id,
|
|
566
|
+
s: void 0,
|
|
567
|
+
l: current.byteLength,
|
|
568
|
+
c: void 0,
|
|
569
|
+
m: void 0,
|
|
570
|
+
d: void 0,
|
|
571
|
+
a: void 0,
|
|
572
|
+
f: serializeArrayBuffer(ctx, current.buffer),
|
|
573
|
+
b: current.byteOffset
|
|
521
574
|
};
|
|
522
575
|
}
|
|
523
576
|
|
|
@@ -665,13 +718,14 @@ function createURLNode(ctx, id, current) {
|
|
|
665
718
|
return {
|
|
666
719
|
t: 25 /* URL */,
|
|
667
720
|
i: id,
|
|
668
|
-
s: current.href,
|
|
721
|
+
s: serializeString(current.href),
|
|
669
722
|
l: void 0,
|
|
670
723
|
c: void 0,
|
|
671
724
|
m: void 0,
|
|
672
725
|
d: void 0,
|
|
673
726
|
f: void 0,
|
|
674
|
-
a: void 0
|
|
727
|
+
a: void 0,
|
|
728
|
+
b: void 0
|
|
675
729
|
};
|
|
676
730
|
}
|
|
677
731
|
function createURLSearchParamsNode(ctx, id, current) {
|
|
@@ -679,13 +733,44 @@ function createURLSearchParamsNode(ctx, id, current) {
|
|
|
679
733
|
return {
|
|
680
734
|
t: 26 /* URLSearchParams */,
|
|
681
735
|
i: id,
|
|
682
|
-
s: current.toString(),
|
|
736
|
+
s: serializeString(current.toString()),
|
|
683
737
|
l: void 0,
|
|
684
738
|
c: void 0,
|
|
685
739
|
m: void 0,
|
|
686
740
|
d: void 0,
|
|
687
741
|
f: void 0,
|
|
688
|
-
a: void 0
|
|
742
|
+
a: void 0,
|
|
743
|
+
b: void 0
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
async function createBlobNode(ctx, id, current) {
|
|
747
|
+
assert(ctx.features & 8192 /* WebAPI */, 'Unsupported type "Blob"');
|
|
748
|
+
return {
|
|
749
|
+
t: 30 /* Blob */,
|
|
750
|
+
i: id,
|
|
751
|
+
s: void 0,
|
|
752
|
+
l: void 0,
|
|
753
|
+
c: serializeString(current.type),
|
|
754
|
+
m: void 0,
|
|
755
|
+
d: void 0,
|
|
756
|
+
f: serializeArrayBuffer(ctx, await current.arrayBuffer()),
|
|
757
|
+
a: void 0,
|
|
758
|
+
b: void 0
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
async function createFileNode(ctx, id, current) {
|
|
762
|
+
assert(ctx.features & 8192 /* WebAPI */, 'Unsupported type "File"');
|
|
763
|
+
return {
|
|
764
|
+
t: 31 /* File */,
|
|
765
|
+
i: id,
|
|
766
|
+
s: void 0,
|
|
767
|
+
l: void 0,
|
|
768
|
+
c: serializeString(current.type),
|
|
769
|
+
m: serializeString(current.name),
|
|
770
|
+
d: void 0,
|
|
771
|
+
f: serializeArrayBuffer(ctx, await current.arrayBuffer()),
|
|
772
|
+
a: void 0,
|
|
773
|
+
b: current.lastModified
|
|
689
774
|
};
|
|
690
775
|
}
|
|
691
776
|
|
|
@@ -722,7 +807,8 @@ async function generateArrayNode(ctx, id, current) {
|
|
|
722
807
|
m: void 0,
|
|
723
808
|
d: void 0,
|
|
724
809
|
a: await generateNodeList(ctx, current),
|
|
725
|
-
f: void 0
|
|
810
|
+
f: void 0,
|
|
811
|
+
b: void 0
|
|
726
812
|
};
|
|
727
813
|
}
|
|
728
814
|
async function generateMapNode(ctx, id, current) {
|
|
@@ -758,7 +844,8 @@ async function generateMapNode(ctx, id, current) {
|
|
|
758
844
|
m: void 0,
|
|
759
845
|
d: { k: keyNodes, v: valueNodes, s: len },
|
|
760
846
|
a: void 0,
|
|
761
|
-
f: void 0
|
|
847
|
+
f: void 0,
|
|
848
|
+
b: void 0
|
|
762
849
|
};
|
|
763
850
|
}
|
|
764
851
|
async function generateSetNode(ctx, id, current) {
|
|
@@ -787,7 +874,8 @@ async function generateSetNode(ctx, id, current) {
|
|
|
787
874
|
m: void 0,
|
|
788
875
|
d: void 0,
|
|
789
876
|
a: nodes,
|
|
790
|
-
f: void 0
|
|
877
|
+
f: void 0,
|
|
878
|
+
b: void 0
|
|
791
879
|
};
|
|
792
880
|
}
|
|
793
881
|
async function generateProperties(ctx, properties) {
|
|
@@ -800,14 +888,16 @@ async function generateProperties(ctx, properties) {
|
|
|
800
888
|
let deferredSize = 0;
|
|
801
889
|
let nodesSize = 0;
|
|
802
890
|
let item;
|
|
891
|
+
let escaped;
|
|
803
892
|
for (const key of keys) {
|
|
804
893
|
item = properties[key];
|
|
894
|
+
escaped = serializeString(key);
|
|
805
895
|
if (isIterable(item)) {
|
|
806
|
-
deferredKeys[deferredSize] =
|
|
896
|
+
deferredKeys[deferredSize] = escaped;
|
|
807
897
|
deferredValues[deferredSize] = item;
|
|
808
898
|
deferredSize++;
|
|
809
899
|
} else {
|
|
810
|
-
keyNodes[nodesSize] =
|
|
900
|
+
keyNodes[nodesSize] = escaped;
|
|
811
901
|
valueNodes[nodesSize] = await parse(ctx, item);
|
|
812
902
|
nodesSize++;
|
|
813
903
|
}
|
|
@@ -836,7 +926,8 @@ async function generateIterableNode(ctx, id, current) {
|
|
|
836
926
|
// Parse options first before the items
|
|
837
927
|
d: options ? await generateProperties(ctx, options) : void 0,
|
|
838
928
|
a: await generateNodeList(ctx, array),
|
|
839
|
-
f: void 0
|
|
929
|
+
f: void 0,
|
|
930
|
+
b: void 0
|
|
840
931
|
};
|
|
841
932
|
}
|
|
842
933
|
async function generatePromiseNode(ctx, id, current) {
|
|
@@ -851,7 +942,8 @@ async function generatePromiseNode(ctx, id, current) {
|
|
|
851
942
|
// Parse options first before the items
|
|
852
943
|
d: void 0,
|
|
853
944
|
a: void 0,
|
|
854
|
-
f: await parse(ctx, value)
|
|
945
|
+
f: await parse(ctx, value),
|
|
946
|
+
b: void 0
|
|
855
947
|
}));
|
|
856
948
|
}
|
|
857
949
|
async function generateObjectNode(ctx, id, current, empty) {
|
|
@@ -870,7 +962,8 @@ async function generateObjectNode(ctx, id, current, empty) {
|
|
|
870
962
|
m: void 0,
|
|
871
963
|
d: await generateProperties(ctx, current),
|
|
872
964
|
a: void 0,
|
|
873
|
-
f: void 0
|
|
965
|
+
f: void 0,
|
|
966
|
+
b: void 0
|
|
874
967
|
};
|
|
875
968
|
}
|
|
876
969
|
async function generateAggregateErrorNode(ctx, id, current) {
|
|
@@ -880,12 +973,13 @@ async function generateAggregateErrorNode(ctx, id, current) {
|
|
|
880
973
|
t: 20 /* AggregateError */,
|
|
881
974
|
i: id,
|
|
882
975
|
s: void 0,
|
|
883
|
-
l:
|
|
976
|
+
l: void 0,
|
|
884
977
|
c: void 0,
|
|
885
|
-
m:
|
|
978
|
+
m: serializeString(current.message),
|
|
886
979
|
d: optionsNode,
|
|
887
|
-
a:
|
|
888
|
-
f: void 0
|
|
980
|
+
a: void 0,
|
|
981
|
+
f: void 0,
|
|
982
|
+
b: void 0
|
|
889
983
|
};
|
|
890
984
|
}
|
|
891
985
|
async function generateErrorNode(ctx, id, current) {
|
|
@@ -897,10 +991,49 @@ async function generateErrorNode(ctx, id, current) {
|
|
|
897
991
|
s: void 0,
|
|
898
992
|
l: void 0,
|
|
899
993
|
c: getErrorConstructorName(current),
|
|
900
|
-
m:
|
|
994
|
+
m: serializeString(current.message),
|
|
901
995
|
d: optionsNode,
|
|
902
996
|
a: void 0,
|
|
903
|
-
f: void 0
|
|
997
|
+
f: void 0,
|
|
998
|
+
b: void 0
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
async function generateHeadersNode(ctx, id, current) {
|
|
1002
|
+
assert(ctx.features & 8192 /* WebAPI */, 'Unsupported type "Headers"');
|
|
1003
|
+
const items = {};
|
|
1004
|
+
current.forEach((value, key) => {
|
|
1005
|
+
items[key] = value;
|
|
1006
|
+
});
|
|
1007
|
+
return {
|
|
1008
|
+
t: 32 /* Headers */,
|
|
1009
|
+
i: id,
|
|
1010
|
+
s: void 0,
|
|
1011
|
+
l: void 0,
|
|
1012
|
+
c: void 0,
|
|
1013
|
+
m: void 0,
|
|
1014
|
+
d: await generateProperties(ctx, items),
|
|
1015
|
+
a: void 0,
|
|
1016
|
+
f: void 0,
|
|
1017
|
+
b: void 0
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
async function generateFormDataNode(ctx, id, current) {
|
|
1021
|
+
assert(ctx.features & 8192 /* WebAPI */, 'Unsupported type "FormData"');
|
|
1022
|
+
const items = {};
|
|
1023
|
+
current.forEach((value, key) => {
|
|
1024
|
+
items[key] = value;
|
|
1025
|
+
});
|
|
1026
|
+
return {
|
|
1027
|
+
t: 33 /* FormData */,
|
|
1028
|
+
i: id,
|
|
1029
|
+
s: void 0,
|
|
1030
|
+
l: void 0,
|
|
1031
|
+
c: void 0,
|
|
1032
|
+
m: void 0,
|
|
1033
|
+
d: await generateProperties(ctx, items),
|
|
1034
|
+
a: void 0,
|
|
1035
|
+
f: void 0,
|
|
1036
|
+
b: void 0
|
|
904
1037
|
};
|
|
905
1038
|
}
|
|
906
1039
|
async function parse(ctx, current) {
|
|
@@ -949,6 +1082,8 @@ async function parse(ctx, current) {
|
|
|
949
1082
|
return createRegExpNode(id, current);
|
|
950
1083
|
case Promise:
|
|
951
1084
|
return generatePromiseNode(ctx, id, current);
|
|
1085
|
+
case ArrayBuffer:
|
|
1086
|
+
return createArrayBufferNode(id, current);
|
|
952
1087
|
case Int8Array:
|
|
953
1088
|
case Int16Array:
|
|
954
1089
|
case Int32Array:
|
|
@@ -962,6 +1097,8 @@ async function parse(ctx, current) {
|
|
|
962
1097
|
case BigInt64Array:
|
|
963
1098
|
case BigUint64Array:
|
|
964
1099
|
return createBigIntTypedArrayNode(ctx, id, current);
|
|
1100
|
+
case DataView:
|
|
1101
|
+
return createDataViewNode(ctx, id, current);
|
|
965
1102
|
case Map:
|
|
966
1103
|
return generateMapNode(
|
|
967
1104
|
ctx,
|
|
@@ -1005,6 +1142,14 @@ async function parse(ctx, current) {
|
|
|
1005
1142
|
return createURLNode(ctx, id, current);
|
|
1006
1143
|
case URLSearchParams:
|
|
1007
1144
|
return createURLSearchParamsNode(ctx, id, current);
|
|
1145
|
+
case Blob:
|
|
1146
|
+
return createBlobNode(ctx, id, current);
|
|
1147
|
+
case File:
|
|
1148
|
+
return createFileNode(ctx, id, current);
|
|
1149
|
+
case Headers:
|
|
1150
|
+
return generateHeadersNode(ctx, id, current);
|
|
1151
|
+
case FormData:
|
|
1152
|
+
return generateFormDataNode(ctx, id, current);
|
|
1008
1153
|
default:
|
|
1009
1154
|
break;
|
|
1010
1155
|
}
|
|
@@ -1057,18 +1202,10 @@ async function parseAsync(ctx, current) {
|
|
|
1057
1202
|
|
|
1058
1203
|
// src/tree/deserialize.ts
|
|
1059
1204
|
function assignIndexedValue(ctx, index, value) {
|
|
1060
|
-
ctx.
|
|
1061
|
-
|
|
1062
|
-
}
|
|
1063
|
-
function deserializeNodeList(ctx, node, result) {
|
|
1064
|
-
let item;
|
|
1065
|
-
for (let i = 0, len = node.a.length; i < len; i++) {
|
|
1066
|
-
item = node.a[i];
|
|
1067
|
-
if (item) {
|
|
1068
|
-
result[i] = deserializeTree(ctx, item);
|
|
1069
|
-
}
|
|
1205
|
+
if (ctx.markedRefs.has(index)) {
|
|
1206
|
+
ctx.valueMap.set(index, value);
|
|
1070
1207
|
}
|
|
1071
|
-
return
|
|
1208
|
+
return value;
|
|
1072
1209
|
}
|
|
1073
1210
|
function deserializeArray(ctx, node) {
|
|
1074
1211
|
const result = assignIndexedValue(
|
|
@@ -1076,9 +1213,13 @@ function deserializeArray(ctx, node) {
|
|
|
1076
1213
|
node.i,
|
|
1077
1214
|
new Array(node.l)
|
|
1078
1215
|
);
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1216
|
+
let item;
|
|
1217
|
+
for (let i = 0, len = node.l; i < len; i++) {
|
|
1218
|
+
item = node.a[i];
|
|
1219
|
+
if (item) {
|
|
1220
|
+
result[i] = deserializeTree(ctx, item);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1082
1223
|
return result;
|
|
1083
1224
|
}
|
|
1084
1225
|
function deserializeProperties(ctx, node, result) {
|
|
@@ -1086,7 +1227,7 @@ function deserializeProperties(ctx, node, result) {
|
|
|
1086
1227
|
return {};
|
|
1087
1228
|
}
|
|
1088
1229
|
for (let i = 0; i < node.s; i++) {
|
|
1089
|
-
result[node.k[i]] = deserializeTree(ctx, node.v[i]);
|
|
1230
|
+
result[deserializeString(node.k[i])] = deserializeTree(ctx, node.v[i]);
|
|
1090
1231
|
}
|
|
1091
1232
|
return result;
|
|
1092
1233
|
}
|
|
@@ -1096,25 +1237,19 @@ function deserializeNullConstructor(ctx, node) {
|
|
|
1096
1237
|
node.i,
|
|
1097
1238
|
/* @__PURE__ */ Object.create(null)
|
|
1098
1239
|
);
|
|
1099
|
-
ctx.stack.push(node.i);
|
|
1100
1240
|
deserializeProperties(ctx, node.d, result);
|
|
1101
|
-
ctx.stack.pop();
|
|
1102
1241
|
return result;
|
|
1103
1242
|
}
|
|
1104
1243
|
function deserializeObject(ctx, node) {
|
|
1105
1244
|
const result = assignIndexedValue(ctx, node.i, {});
|
|
1106
|
-
ctx.stack.push(node.i);
|
|
1107
1245
|
deserializeProperties(ctx, node.d, result);
|
|
1108
|
-
ctx.stack.pop();
|
|
1109
1246
|
return result;
|
|
1110
1247
|
}
|
|
1111
1248
|
function deserializeSet(ctx, node) {
|
|
1112
1249
|
const result = assignIndexedValue(ctx, node.i, /* @__PURE__ */ new Set());
|
|
1113
|
-
|
|
1114
|
-
for (let i = 0, len = node.a.length; i < len; i++) {
|
|
1250
|
+
for (let i = 0, len = node.l; i < len; i++) {
|
|
1115
1251
|
result.add(deserializeTree(ctx, node.a[i]));
|
|
1116
1252
|
}
|
|
1117
|
-
ctx.stack.pop();
|
|
1118
1253
|
return result;
|
|
1119
1254
|
}
|
|
1120
1255
|
function deserializeMap(ctx, node) {
|
|
@@ -1123,35 +1258,32 @@ function deserializeMap(ctx, node) {
|
|
|
1123
1258
|
node.i,
|
|
1124
1259
|
/* @__PURE__ */ new Map()
|
|
1125
1260
|
);
|
|
1126
|
-
|
|
1127
|
-
for (let i = 0; i < node.d.s; i++) {
|
|
1261
|
+
for (let i = 0, len = node.d.s; i < len; i++) {
|
|
1128
1262
|
result.set(
|
|
1129
1263
|
deserializeTree(ctx, node.d.k[i]),
|
|
1130
1264
|
deserializeTree(ctx, node.d.v[i])
|
|
1131
1265
|
);
|
|
1132
1266
|
}
|
|
1133
|
-
ctx.stack.pop();
|
|
1134
1267
|
return result;
|
|
1135
1268
|
}
|
|
1136
1269
|
function deserializeDictionary(ctx, node, result) {
|
|
1137
1270
|
if (node.d) {
|
|
1138
|
-
ctx.stack.push(node.i);
|
|
1139
1271
|
const fields = deserializeProperties(ctx, node.d, {});
|
|
1140
|
-
ctx.stack.pop();
|
|
1141
1272
|
Object.assign(result, fields);
|
|
1142
1273
|
}
|
|
1143
1274
|
return result;
|
|
1144
1275
|
}
|
|
1145
1276
|
function deserializeAggregateError(ctx, node) {
|
|
1146
|
-
const result = assignIndexedValue(
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1277
|
+
const result = assignIndexedValue(
|
|
1278
|
+
ctx,
|
|
1279
|
+
node.i,
|
|
1280
|
+
new AggregateError([], deserializeString(node.m))
|
|
1281
|
+
);
|
|
1150
1282
|
return deserializeDictionary(ctx, node, result);
|
|
1151
1283
|
}
|
|
1152
1284
|
function deserializeError(ctx, node) {
|
|
1153
1285
|
const ErrorConstructor = getErrorConstructor(node.c);
|
|
1154
|
-
const result = assignIndexedValue(ctx, node.i, new ErrorConstructor(
|
|
1286
|
+
const result = assignIndexedValue(ctx, node.i, new ErrorConstructor(deserializeString(node.m)));
|
|
1155
1287
|
return deserializeDictionary(ctx, node, result);
|
|
1156
1288
|
}
|
|
1157
1289
|
function createDeferred() {
|
|
@@ -1171,33 +1303,103 @@ function deserializePromise(ctx, node) {
|
|
|
1171
1303
|
deferred.resolve(deserializeTree(ctx, node.f));
|
|
1172
1304
|
return result;
|
|
1173
1305
|
}
|
|
1306
|
+
function deserializeArrayBuffer(ctx, node) {
|
|
1307
|
+
const bytes = new Uint8Array(node.s);
|
|
1308
|
+
const result = assignIndexedValue(ctx, node.i, bytes.buffer);
|
|
1309
|
+
return result;
|
|
1310
|
+
}
|
|
1174
1311
|
function deserializeTypedArray(ctx, node) {
|
|
1175
1312
|
const TypedArray = getTypedArrayConstructor(node.c);
|
|
1176
|
-
const
|
|
1313
|
+
const source = deserializeTree(ctx, node.f);
|
|
1177
1314
|
const result = assignIndexedValue(ctx, node.i, new TypedArray(
|
|
1178
|
-
|
|
1315
|
+
source,
|
|
1316
|
+
node.b,
|
|
1179
1317
|
node.l
|
|
1180
1318
|
));
|
|
1181
|
-
for (let i = 0, len = node.s.length; i < len; i++) {
|
|
1182
|
-
result[i] = node.t === 23 /* BigIntTypedArray */ ? BigInt(node.s[i]) : Number(node.s[i]);
|
|
1183
|
-
}
|
|
1184
1319
|
return result;
|
|
1185
1320
|
}
|
|
1186
1321
|
function deserializeIterable(ctx, node) {
|
|
1187
1322
|
const values = [];
|
|
1188
|
-
|
|
1323
|
+
let item;
|
|
1324
|
+
for (let i = 0, len = node.l; i < len; i++) {
|
|
1325
|
+
item = node.a[i];
|
|
1326
|
+
if (item) {
|
|
1327
|
+
values[i] = deserializeTree(ctx, item);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1189
1330
|
const result = assignIndexedValue(ctx, node.i, {
|
|
1190
1331
|
[Symbol.iterator]: () => values.values()
|
|
1191
1332
|
});
|
|
1192
1333
|
return deserializeDictionary(ctx, node, result);
|
|
1193
1334
|
}
|
|
1335
|
+
function deserializeDate(ctx, node) {
|
|
1336
|
+
return assignIndexedValue(ctx, node.i, new Date(node.s));
|
|
1337
|
+
}
|
|
1338
|
+
function deserializeRegExp(ctx, node) {
|
|
1339
|
+
return assignIndexedValue(ctx, node.i, new RegExp(node.c, node.m));
|
|
1340
|
+
}
|
|
1341
|
+
function deserializeURL(ctx, node) {
|
|
1342
|
+
return assignIndexedValue(ctx, node.i, new URL(deserializeString(node.s)));
|
|
1343
|
+
}
|
|
1344
|
+
function deserializeURLSearchParams(ctx, node) {
|
|
1345
|
+
return assignIndexedValue(ctx, node.i, new URLSearchParams(deserializeString(node.s)));
|
|
1346
|
+
}
|
|
1347
|
+
function deserializeReference(ctx, node) {
|
|
1348
|
+
return assignIndexedValue(ctx, node.i, getReference(deserializeString(node.s)));
|
|
1349
|
+
}
|
|
1350
|
+
function deserializeDataView(ctx, node) {
|
|
1351
|
+
const source = deserializeTree(ctx, node.f);
|
|
1352
|
+
const result = assignIndexedValue(ctx, node.i, new DataView(
|
|
1353
|
+
source,
|
|
1354
|
+
node.b,
|
|
1355
|
+
node.l
|
|
1356
|
+
));
|
|
1357
|
+
return result;
|
|
1358
|
+
}
|
|
1359
|
+
function deserializeBlob(ctx, node) {
|
|
1360
|
+
const source = deserializeTree(ctx, node.f);
|
|
1361
|
+
const result = assignIndexedValue(ctx, node.i, new Blob(
|
|
1362
|
+
[source],
|
|
1363
|
+
{ type: deserializeString(node.c) }
|
|
1364
|
+
));
|
|
1365
|
+
return result;
|
|
1366
|
+
}
|
|
1367
|
+
function deserializeFile(ctx, node) {
|
|
1368
|
+
const source = deserializeTree(ctx, node.f);
|
|
1369
|
+
const result = assignIndexedValue(ctx, node.i, new File(
|
|
1370
|
+
[source],
|
|
1371
|
+
deserializeString(node.m),
|
|
1372
|
+
{ type: deserializeString(node.c), lastModified: node.b }
|
|
1373
|
+
));
|
|
1374
|
+
return result;
|
|
1375
|
+
}
|
|
1376
|
+
function deserializeHeaders(ctx, node) {
|
|
1377
|
+
const result = assignIndexedValue(ctx, node.i, new Headers());
|
|
1378
|
+
for (let i = 0, len = node.d.s; i < len; i++) {
|
|
1379
|
+
result.set(
|
|
1380
|
+
deserializeString(node.d.k[i]),
|
|
1381
|
+
deserializeTree(ctx, node.d.v[i])
|
|
1382
|
+
);
|
|
1383
|
+
}
|
|
1384
|
+
return result;
|
|
1385
|
+
}
|
|
1386
|
+
function deserializeFormData(ctx, node) {
|
|
1387
|
+
const result = assignIndexedValue(ctx, node.i, new FormData());
|
|
1388
|
+
for (let i = 0, len = node.d.s; i < len; i++) {
|
|
1389
|
+
result.set(
|
|
1390
|
+
deserializeString(node.d.k[i]),
|
|
1391
|
+
deserializeTree(ctx, node.d.v[i])
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
return result;
|
|
1395
|
+
}
|
|
1194
1396
|
function deserializeTree(ctx, node) {
|
|
1195
1397
|
switch (node.t) {
|
|
1196
1398
|
case 0 /* Number */:
|
|
1197
1399
|
case 2 /* Boolean */:
|
|
1198
1400
|
return node.s;
|
|
1199
1401
|
case 1 /* String */:
|
|
1200
|
-
return
|
|
1402
|
+
return deserializeString(node.s);
|
|
1201
1403
|
case 4 /* Undefined */:
|
|
1202
1404
|
return void 0;
|
|
1203
1405
|
case 3 /* Null */:
|
|
@@ -1221,16 +1423,20 @@ function deserializeTree(ctx, node) {
|
|
|
1221
1423
|
case 17 /* NullConstructor */:
|
|
1222
1424
|
return deserializeNullConstructor(ctx, node);
|
|
1223
1425
|
case 11 /* Date */:
|
|
1224
|
-
return
|
|
1426
|
+
return deserializeDate(ctx, node);
|
|
1225
1427
|
case 12 /* RegExp */:
|
|
1226
|
-
return
|
|
1428
|
+
return deserializeRegExp(ctx, node);
|
|
1227
1429
|
case 13 /* Set */:
|
|
1228
1430
|
return deserializeSet(ctx, node);
|
|
1229
1431
|
case 14 /* Map */:
|
|
1230
1432
|
return deserializeMap(ctx, node);
|
|
1433
|
+
case 28 /* ArrayBuffer */:
|
|
1434
|
+
return deserializeArrayBuffer(ctx, node);
|
|
1231
1435
|
case 23 /* BigIntTypedArray */:
|
|
1232
1436
|
case 22 /* TypedArray */:
|
|
1233
1437
|
return deserializeTypedArray(ctx, node);
|
|
1438
|
+
case 29 /* DataView */:
|
|
1439
|
+
return deserializeDataView(ctx, node);
|
|
1234
1440
|
case 20 /* AggregateError */:
|
|
1235
1441
|
return deserializeAggregateError(ctx, node);
|
|
1236
1442
|
case 19 /* Error */:
|
|
@@ -1242,11 +1448,19 @@ function deserializeTree(ctx, node) {
|
|
|
1242
1448
|
case 24 /* WKSymbol */:
|
|
1243
1449
|
return SYMBOL_REF[node.s];
|
|
1244
1450
|
case 25 /* URL */:
|
|
1245
|
-
return
|
|
1451
|
+
return deserializeURL(ctx, node);
|
|
1246
1452
|
case 26 /* URLSearchParams */:
|
|
1247
|
-
return
|
|
1453
|
+
return deserializeURLSearchParams(ctx, node);
|
|
1248
1454
|
case 27 /* Reference */:
|
|
1249
|
-
return
|
|
1455
|
+
return deserializeReference(ctx, node);
|
|
1456
|
+
case 30 /* Blob */:
|
|
1457
|
+
return deserializeBlob(ctx, node);
|
|
1458
|
+
case 31 /* File */:
|
|
1459
|
+
return deserializeFile(ctx, node);
|
|
1460
|
+
case 32 /* Headers */:
|
|
1461
|
+
return deserializeHeaders(ctx, node);
|
|
1462
|
+
case 33 /* FormData */:
|
|
1463
|
+
return deserializeFormData(ctx, node);
|
|
1250
1464
|
default:
|
|
1251
1465
|
throw new Error("Unsupported type");
|
|
1252
1466
|
}
|
|
@@ -1257,10 +1471,12 @@ function getAssignmentExpression(assignment) {
|
|
|
1257
1471
|
switch (assignment.t) {
|
|
1258
1472
|
case "index":
|
|
1259
1473
|
return assignment.s + "=" + assignment.v;
|
|
1260
|
-
case "map":
|
|
1261
|
-
return assignment.s + ".set(" + assignment.k + "," + assignment.v + ")";
|
|
1262
1474
|
case "set":
|
|
1475
|
+
return assignment.s + ".set(" + assignment.k + "," + assignment.v + ")";
|
|
1476
|
+
case "add":
|
|
1263
1477
|
return assignment.s + ".add(" + assignment.v + ")";
|
|
1478
|
+
case "append":
|
|
1479
|
+
return assignment.s + ".append(" + assignment.k + "," + assignment.v + ")";
|
|
1264
1480
|
default:
|
|
1265
1481
|
return "";
|
|
1266
1482
|
}
|
|
@@ -1287,10 +1503,10 @@ function mergeAssignments(assignments) {
|
|
|
1287
1503
|
current = item;
|
|
1288
1504
|
}
|
|
1289
1505
|
break;
|
|
1290
|
-
case "
|
|
1506
|
+
case "set":
|
|
1291
1507
|
if (item.s === prev.s) {
|
|
1292
1508
|
current = {
|
|
1293
|
-
t: "
|
|
1509
|
+
t: "set",
|
|
1294
1510
|
s: getAssignmentExpression(current),
|
|
1295
1511
|
k: item.k,
|
|
1296
1512
|
v: item.v
|
|
@@ -1300,10 +1516,10 @@ function mergeAssignments(assignments) {
|
|
|
1300
1516
|
current = item;
|
|
1301
1517
|
}
|
|
1302
1518
|
break;
|
|
1303
|
-
case "
|
|
1519
|
+
case "add":
|
|
1304
1520
|
if (item.s === prev.s) {
|
|
1305
1521
|
current = {
|
|
1306
|
-
t: "
|
|
1522
|
+
t: "add",
|
|
1307
1523
|
s: getAssignmentExpression(current),
|
|
1308
1524
|
k: void 0,
|
|
1309
1525
|
v: item.v
|
|
@@ -1313,6 +1529,10 @@ function mergeAssignments(assignments) {
|
|
|
1313
1529
|
current = item;
|
|
1314
1530
|
}
|
|
1315
1531
|
break;
|
|
1532
|
+
case "append":
|
|
1533
|
+
newAssignments.push(current);
|
|
1534
|
+
current = item;
|
|
1535
|
+
break;
|
|
1316
1536
|
default:
|
|
1317
1537
|
break;
|
|
1318
1538
|
}
|
|
@@ -1347,26 +1567,31 @@ function createAssignment(ctx, source, value) {
|
|
|
1347
1567
|
v: value
|
|
1348
1568
|
});
|
|
1349
1569
|
}
|
|
1350
|
-
function
|
|
1351
|
-
markRef(ctx, ref);
|
|
1570
|
+
function createAddAssignment(ctx, ref, value) {
|
|
1352
1571
|
ctx.assignments.push({
|
|
1353
|
-
t: "
|
|
1572
|
+
t: "add",
|
|
1354
1573
|
s: getRefParam(ctx, ref),
|
|
1355
1574
|
k: void 0,
|
|
1356
1575
|
v: value
|
|
1357
1576
|
});
|
|
1358
1577
|
}
|
|
1359
|
-
function
|
|
1360
|
-
|
|
1578
|
+
function createSetAssignment(ctx, ref, key, value) {
|
|
1579
|
+
ctx.assignments.push({
|
|
1580
|
+
t: "set",
|
|
1581
|
+
s: getRefParam(ctx, ref),
|
|
1582
|
+
k: key,
|
|
1583
|
+
v: value
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
function createAppendAssignment(ctx, ref, key, value) {
|
|
1361
1587
|
ctx.assignments.push({
|
|
1362
|
-
t: "
|
|
1588
|
+
t: "append",
|
|
1363
1589
|
s: getRefParam(ctx, ref),
|
|
1364
1590
|
k: key,
|
|
1365
1591
|
v: value
|
|
1366
1592
|
});
|
|
1367
1593
|
}
|
|
1368
1594
|
function createArrayAssign(ctx, ref, index, value) {
|
|
1369
|
-
markRef(ctx, ref);
|
|
1370
1595
|
createAssignment(ctx, getRefParam(ctx, ref) + "[" + index + "]", value);
|
|
1371
1596
|
}
|
|
1372
1597
|
function createObjectAssign(ctx, ref, key, value) {
|
|
@@ -1394,6 +1619,7 @@ function serializeNodeList(ctx, node) {
|
|
|
1394
1619
|
item = node.a[i];
|
|
1395
1620
|
if (item) {
|
|
1396
1621
|
if (isIndexedValueInStack(ctx, item)) {
|
|
1622
|
+
markRef(ctx, node.i);
|
|
1397
1623
|
createArrayAssign(ctx, node.i, i, getRefParam(ctx, item.i));
|
|
1398
1624
|
isHoley = true;
|
|
1399
1625
|
} else {
|
|
@@ -1424,20 +1650,24 @@ function serializeProperties(ctx, sourceID, node) {
|
|
|
1424
1650
|
let isIdentifier;
|
|
1425
1651
|
let refParam;
|
|
1426
1652
|
let hasPrev = false;
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1653
|
+
const keys = node.k;
|
|
1654
|
+
const values = node.v;
|
|
1655
|
+
for (let i = 0, len = node.s; i < len; i++) {
|
|
1656
|
+
key = keys[i];
|
|
1657
|
+
val = values[i];
|
|
1430
1658
|
check = Number(key);
|
|
1431
1659
|
isIdentifier = check >= 0 || isValidIdentifier(key);
|
|
1432
1660
|
if (isIndexedValueInStack(ctx, val)) {
|
|
1433
1661
|
refParam = getRefParam(ctx, val.i);
|
|
1434
1662
|
if (isIdentifier && Number.isNaN(check)) {
|
|
1663
|
+
markRef(ctx, sourceID);
|
|
1435
1664
|
createObjectAssign(ctx, sourceID, key, refParam);
|
|
1436
1665
|
} else {
|
|
1437
|
-
|
|
1666
|
+
markRef(ctx, sourceID);
|
|
1667
|
+
createArrayAssign(ctx, sourceID, isIdentifier ? key : '"' + key + '"', refParam);
|
|
1438
1668
|
}
|
|
1439
1669
|
} else {
|
|
1440
|
-
result += (hasPrev ? "," : "") + (isIdentifier ? key : '"' +
|
|
1670
|
+
result += (hasPrev ? "," : "") + (isIdentifier ? key : '"' + key + '"') + ":" + serializeTree(ctx, val);
|
|
1441
1671
|
hasPrev = true;
|
|
1442
1672
|
}
|
|
1443
1673
|
}
|
|
@@ -1460,12 +1690,14 @@ function serializeAssignments(ctx, sourceID, node) {
|
|
|
1460
1690
|
let check;
|
|
1461
1691
|
let parentAssignment;
|
|
1462
1692
|
let isIdentifier;
|
|
1463
|
-
|
|
1693
|
+
const keys = node.k;
|
|
1694
|
+
const values = node.v;
|
|
1695
|
+
for (let i = 0, len = node.s; i < len; i++) {
|
|
1464
1696
|
parentStack = ctx.stack;
|
|
1465
1697
|
ctx.stack = [];
|
|
1466
|
-
refParam = serializeTree(ctx,
|
|
1698
|
+
refParam = serializeTree(ctx, values[i]);
|
|
1467
1699
|
ctx.stack = parentStack;
|
|
1468
|
-
key =
|
|
1700
|
+
key = keys[i];
|
|
1469
1701
|
check = Number(key);
|
|
1470
1702
|
parentAssignment = ctx.assignments;
|
|
1471
1703
|
ctx.assignments = mainAssignments;
|
|
@@ -1473,7 +1705,7 @@ function serializeAssignments(ctx, sourceID, node) {
|
|
|
1473
1705
|
if (isIdentifier && Number.isNaN(check)) {
|
|
1474
1706
|
createObjectAssign(ctx, sourceID, key, refParam);
|
|
1475
1707
|
} else {
|
|
1476
|
-
createArrayAssign(ctx, sourceID, isIdentifier ? key : '"' +
|
|
1708
|
+
createArrayAssign(ctx, sourceID, isIdentifier ? key : '"' + key + '"', refParam);
|
|
1477
1709
|
}
|
|
1478
1710
|
ctx.assignments = parentAssignment;
|
|
1479
1711
|
}
|
|
@@ -1511,7 +1743,8 @@ function serializeSet(ctx, node) {
|
|
|
1511
1743
|
for (let i = 0; i < size; i++) {
|
|
1512
1744
|
item = node.a[i];
|
|
1513
1745
|
if (isIndexedValueInStack(ctx, item)) {
|
|
1514
|
-
|
|
1746
|
+
markRef(ctx, node.i);
|
|
1747
|
+
createAddAssignment(ctx, node.i, getRefParam(ctx, item.i));
|
|
1515
1748
|
} else {
|
|
1516
1749
|
result += (hasPrev ? "," : "") + serializeTree(ctx, item);
|
|
1517
1750
|
hasPrev = true;
|
|
@@ -1540,20 +1773,22 @@ function serializeMap(ctx, node) {
|
|
|
1540
1773
|
val = node.d.v[i];
|
|
1541
1774
|
if (isIndexedValueInStack(ctx, key)) {
|
|
1542
1775
|
keyRef = getRefParam(ctx, key.i);
|
|
1776
|
+
markRef(ctx, node.i);
|
|
1543
1777
|
if (isIndexedValueInStack(ctx, val)) {
|
|
1544
1778
|
valueRef = getRefParam(ctx, val.i);
|
|
1545
|
-
|
|
1779
|
+
createSetAssignment(ctx, node.i, keyRef, valueRef);
|
|
1546
1780
|
} else {
|
|
1547
1781
|
parent = ctx.stack;
|
|
1548
1782
|
ctx.stack = [];
|
|
1549
|
-
|
|
1783
|
+
createSetAssignment(ctx, node.i, keyRef, serializeTree(ctx, val));
|
|
1550
1784
|
ctx.stack = parent;
|
|
1551
1785
|
}
|
|
1552
1786
|
} else if (isIndexedValueInStack(ctx, val)) {
|
|
1553
1787
|
valueRef = getRefParam(ctx, val.i);
|
|
1788
|
+
markRef(ctx, node.i);
|
|
1554
1789
|
parent = ctx.stack;
|
|
1555
1790
|
ctx.stack = [];
|
|
1556
|
-
|
|
1791
|
+
createSetAssignment(ctx, node.i, serializeTree(ctx, key), valueRef);
|
|
1557
1792
|
ctx.stack = parent;
|
|
1558
1793
|
} else {
|
|
1559
1794
|
result += (hasPrev ? ",[" : "[") + serializeTree(ctx, key) + "," + serializeTree(ctx, val) + "]";
|
|
@@ -1569,12 +1804,12 @@ function serializeMap(ctx, node) {
|
|
|
1569
1804
|
}
|
|
1570
1805
|
function serializeAggregateError(ctx, node) {
|
|
1571
1806
|
ctx.stack.push(node.i);
|
|
1572
|
-
const serialized =
|
|
1807
|
+
const serialized = 'new AggregateError([],"' + node.m + '")';
|
|
1573
1808
|
ctx.stack.pop();
|
|
1574
1809
|
return serializeDictionary(ctx, node.i, node.d, serialized);
|
|
1575
1810
|
}
|
|
1576
1811
|
function serializeError(ctx, node) {
|
|
1577
|
-
const serialized = "new " + node.c + '("' +
|
|
1812
|
+
const serialized = "new " + node.c + '("' + node.m + '")';
|
|
1578
1813
|
return serializeDictionary(ctx, node.i, node.d, serialized);
|
|
1579
1814
|
}
|
|
1580
1815
|
function serializePromise(ctx, node) {
|
|
@@ -1594,13 +1829,19 @@ function serializePromise(ctx, node) {
|
|
|
1594
1829
|
}
|
|
1595
1830
|
return assignIndexedValue2(ctx, node.i, serialized);
|
|
1596
1831
|
}
|
|
1597
|
-
function
|
|
1598
|
-
let result = "";
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1832
|
+
function serializeArrayBuffer2(ctx, node) {
|
|
1833
|
+
let result = "new Uint8Array(";
|
|
1834
|
+
if (node.s.length) {
|
|
1835
|
+
result += "[";
|
|
1836
|
+
for (let i = 0, len = node.s.length; i < len; i++) {
|
|
1837
|
+
result += (i > 0 ? "," : "") + node.s[i];
|
|
1838
|
+
}
|
|
1839
|
+
result += "]";
|
|
1602
1840
|
}
|
|
1603
|
-
|
|
1841
|
+
return assignIndexedValue2(ctx, node.i, result + ").buffer");
|
|
1842
|
+
}
|
|
1843
|
+
function serializeTypedArray(ctx, node) {
|
|
1844
|
+
const args = serializeTree(ctx, node.f) + "," + node.b + "," + node.l;
|
|
1604
1845
|
return assignIndexedValue2(ctx, node.i, "new " + node.c + "(" + args + ")");
|
|
1605
1846
|
}
|
|
1606
1847
|
function serializeIterable(ctx, node) {
|
|
@@ -1623,6 +1864,68 @@ function serializeIterable(ctx, node) {
|
|
|
1623
1864
|
}
|
|
1624
1865
|
return serializeDictionary(ctx, node.i, node.d, serialized);
|
|
1625
1866
|
}
|
|
1867
|
+
function serializeDate(ctx, node) {
|
|
1868
|
+
return assignIndexedValue2(ctx, node.i, 'new Date("' + node.s + '")');
|
|
1869
|
+
}
|
|
1870
|
+
function serializeRegExp(ctx, node) {
|
|
1871
|
+
return assignIndexedValue2(ctx, node.i, "/" + node.c + "/" + node.m);
|
|
1872
|
+
}
|
|
1873
|
+
function serializeURL(ctx, node) {
|
|
1874
|
+
return assignIndexedValue2(ctx, node.i, 'new URL("' + node.s + '")');
|
|
1875
|
+
}
|
|
1876
|
+
function serializeURLSearchParams(ctx, node) {
|
|
1877
|
+
return assignIndexedValue2(ctx, node.i, node.s ? 'new URLSearchParams("' + node.s + '")' : "new URLSearchParams");
|
|
1878
|
+
}
|
|
1879
|
+
function serializeReference(ctx, node) {
|
|
1880
|
+
return assignIndexedValue2(ctx, node.i, GLOBAL_KEY + '.get("' + node.s + '")');
|
|
1881
|
+
}
|
|
1882
|
+
function serializeDataView(ctx, node) {
|
|
1883
|
+
const args = serializeTree(ctx, node.f) + "," + node.b + "," + node.l;
|
|
1884
|
+
return assignIndexedValue2(ctx, node.i, "new DataView(" + args + ")");
|
|
1885
|
+
}
|
|
1886
|
+
function serializeBlob(ctx, node) {
|
|
1887
|
+
const args = "[" + serializeTree(ctx, node.f) + '],{type:"' + node.c + '"}';
|
|
1888
|
+
return assignIndexedValue2(ctx, node.i, "new Blob(" + args + ")");
|
|
1889
|
+
}
|
|
1890
|
+
function serializeFile(ctx, node) {
|
|
1891
|
+
const options = '{type:"' + node.c + '",lastModified:' + node.b + "}";
|
|
1892
|
+
const args = "[" + serializeTree(ctx, node.f) + '],"' + node.m + '",' + options;
|
|
1893
|
+
return assignIndexedValue2(ctx, node.i, "new File(" + args + ")");
|
|
1894
|
+
}
|
|
1895
|
+
function serializeHeaders(ctx, node) {
|
|
1896
|
+
return assignIndexedValue2(ctx, node.i, "new Headers(" + serializeProperties(ctx, node.i, node.d) + ")");
|
|
1897
|
+
}
|
|
1898
|
+
function serializeFormDataEntries(ctx, node) {
|
|
1899
|
+
ctx.stack.push(node.i);
|
|
1900
|
+
const mainAssignments = [];
|
|
1901
|
+
let parentStack;
|
|
1902
|
+
let value;
|
|
1903
|
+
let key;
|
|
1904
|
+
let parentAssignment;
|
|
1905
|
+
for (let i = 0; i < node.d.s; i++) {
|
|
1906
|
+
parentStack = ctx.stack;
|
|
1907
|
+
ctx.stack = [];
|
|
1908
|
+
value = serializeTree(ctx, node.d.v[i]);
|
|
1909
|
+
key = node.d.k[i];
|
|
1910
|
+
ctx.stack = parentStack;
|
|
1911
|
+
parentAssignment = ctx.assignments;
|
|
1912
|
+
ctx.assignments = mainAssignments;
|
|
1913
|
+
createAppendAssignment(ctx, node.i, '"' + key + '"', value);
|
|
1914
|
+
ctx.assignments = parentAssignment;
|
|
1915
|
+
}
|
|
1916
|
+
ctx.stack.pop();
|
|
1917
|
+
return resolveAssignments(mainAssignments);
|
|
1918
|
+
}
|
|
1919
|
+
function serializeFormData(ctx, node) {
|
|
1920
|
+
if (node.d.s) {
|
|
1921
|
+
markRef(ctx, node.i);
|
|
1922
|
+
}
|
|
1923
|
+
const result = assignIndexedValue2(ctx, node.i, "new FormData()");
|
|
1924
|
+
if (node.d.s) {
|
|
1925
|
+
return "(" + result + "," + serializeFormDataEntries(ctx, node) + getRefParam(ctx, node.i) + ")";
|
|
1926
|
+
}
|
|
1927
|
+
return result;
|
|
1928
|
+
}
|
|
1626
1929
|
function serializeTree(ctx, node) {
|
|
1627
1930
|
switch (node.t) {
|
|
1628
1931
|
case 0 /* Number */:
|
|
@@ -1654,16 +1957,20 @@ function serializeTree(ctx, node) {
|
|
|
1654
1957
|
case 17 /* NullConstructor */:
|
|
1655
1958
|
return serializeNullConstructor(ctx, node);
|
|
1656
1959
|
case 11 /* Date */:
|
|
1657
|
-
return
|
|
1960
|
+
return serializeDate(ctx, node);
|
|
1658
1961
|
case 12 /* RegExp */:
|
|
1659
|
-
return
|
|
1962
|
+
return serializeRegExp(ctx, node);
|
|
1660
1963
|
case 13 /* Set */:
|
|
1661
1964
|
return serializeSet(ctx, node);
|
|
1662
1965
|
case 14 /* Map */:
|
|
1663
1966
|
return serializeMap(ctx, node);
|
|
1967
|
+
case 28 /* ArrayBuffer */:
|
|
1968
|
+
return serializeArrayBuffer2(ctx, node);
|
|
1664
1969
|
case 23 /* BigIntTypedArray */:
|
|
1665
1970
|
case 22 /* TypedArray */:
|
|
1666
1971
|
return serializeTypedArray(ctx, node);
|
|
1972
|
+
case 29 /* DataView */:
|
|
1973
|
+
return serializeDataView(ctx, node);
|
|
1667
1974
|
case 20 /* AggregateError */:
|
|
1668
1975
|
return serializeAggregateError(ctx, node);
|
|
1669
1976
|
case 19 /* Error */:
|
|
@@ -1675,11 +1982,19 @@ function serializeTree(ctx, node) {
|
|
|
1675
1982
|
case 24 /* WKSymbol */:
|
|
1676
1983
|
return SYMBOL_STRING[node.s];
|
|
1677
1984
|
case 25 /* URL */:
|
|
1678
|
-
return
|
|
1985
|
+
return serializeURL(ctx, node);
|
|
1679
1986
|
case 26 /* URLSearchParams */:
|
|
1680
|
-
return
|
|
1987
|
+
return serializeURLSearchParams(ctx, node);
|
|
1681
1988
|
case 27 /* Reference */:
|
|
1682
|
-
return
|
|
1989
|
+
return serializeReference(ctx, node);
|
|
1990
|
+
case 30 /* Blob */:
|
|
1991
|
+
return serializeBlob(ctx, node);
|
|
1992
|
+
case 31 /* File */:
|
|
1993
|
+
return serializeFile(ctx, node);
|
|
1994
|
+
case 32 /* Headers */:
|
|
1995
|
+
return serializeHeaders(ctx, node);
|
|
1996
|
+
case 33 /* FormData */:
|
|
1997
|
+
return serializeFormData(ctx, node);
|
|
1683
1998
|
default:
|
|
1684
1999
|
throw new Error("Unsupported type");
|
|
1685
2000
|
}
|
|
@@ -1718,7 +2033,8 @@ function generateArrayNode2(ctx, id, current) {
|
|
|
1718
2033
|
m: void 0,
|
|
1719
2034
|
d: void 0,
|
|
1720
2035
|
a: generateNodeList2(ctx, current),
|
|
1721
|
-
f: void 0
|
|
2036
|
+
f: void 0,
|
|
2037
|
+
b: void 0
|
|
1722
2038
|
};
|
|
1723
2039
|
}
|
|
1724
2040
|
function generateMapNode2(ctx, id, current) {
|
|
@@ -1754,7 +2070,8 @@ function generateMapNode2(ctx, id, current) {
|
|
|
1754
2070
|
m: void 0,
|
|
1755
2071
|
d: { k: keyNodes, v: valueNodes, s: len },
|
|
1756
2072
|
a: void 0,
|
|
1757
|
-
f: void 0
|
|
2073
|
+
f: void 0,
|
|
2074
|
+
b: void 0
|
|
1758
2075
|
};
|
|
1759
2076
|
}
|
|
1760
2077
|
function generateSetNode2(ctx, id, current) {
|
|
@@ -1783,7 +2100,8 @@ function generateSetNode2(ctx, id, current) {
|
|
|
1783
2100
|
m: void 0,
|
|
1784
2101
|
d: void 0,
|
|
1785
2102
|
a: nodes,
|
|
1786
|
-
f: void 0
|
|
2103
|
+
f: void 0,
|
|
2104
|
+
b: void 0
|
|
1787
2105
|
};
|
|
1788
2106
|
}
|
|
1789
2107
|
function generateProperties2(ctx, properties) {
|
|
@@ -1796,14 +2114,16 @@ function generateProperties2(ctx, properties) {
|
|
|
1796
2114
|
let deferredSize = 0;
|
|
1797
2115
|
let nodesSize = 0;
|
|
1798
2116
|
let item;
|
|
2117
|
+
let escaped;
|
|
1799
2118
|
for (const key of keys) {
|
|
1800
2119
|
item = properties[key];
|
|
2120
|
+
escaped = serializeString(key);
|
|
1801
2121
|
if (isIterable(item)) {
|
|
1802
|
-
deferredKeys[deferredSize] =
|
|
2122
|
+
deferredKeys[deferredSize] = escaped;
|
|
1803
2123
|
deferredValues[deferredSize] = item;
|
|
1804
2124
|
deferredSize++;
|
|
1805
2125
|
} else {
|
|
1806
|
-
keyNodes[nodesSize] =
|
|
2126
|
+
keyNodes[nodesSize] = escaped;
|
|
1807
2127
|
valueNodes[nodesSize] = parse2(ctx, item);
|
|
1808
2128
|
nodesSize++;
|
|
1809
2129
|
}
|
|
@@ -1832,7 +2152,8 @@ function generateIterableNode2(ctx, id, current) {
|
|
|
1832
2152
|
// Parse options first before the items
|
|
1833
2153
|
d: options ? generateProperties2(ctx, options) : void 0,
|
|
1834
2154
|
a: generateNodeList2(ctx, array),
|
|
1835
|
-
f: void 0
|
|
2155
|
+
f: void 0,
|
|
2156
|
+
b: void 0
|
|
1836
2157
|
};
|
|
1837
2158
|
}
|
|
1838
2159
|
function generateObjectNode2(ctx, id, current, empty) {
|
|
@@ -1848,7 +2169,8 @@ function generateObjectNode2(ctx, id, current, empty) {
|
|
|
1848
2169
|
m: void 0,
|
|
1849
2170
|
d: generateProperties2(ctx, current),
|
|
1850
2171
|
a: void 0,
|
|
1851
|
-
f: void 0
|
|
2172
|
+
f: void 0,
|
|
2173
|
+
b: void 0
|
|
1852
2174
|
};
|
|
1853
2175
|
}
|
|
1854
2176
|
function generateAggregateErrorNode2(ctx, id, current) {
|
|
@@ -1858,12 +2180,13 @@ function generateAggregateErrorNode2(ctx, id, current) {
|
|
|
1858
2180
|
t: 20 /* AggregateError */,
|
|
1859
2181
|
i: id,
|
|
1860
2182
|
s: void 0,
|
|
1861
|
-
l:
|
|
2183
|
+
l: void 0,
|
|
1862
2184
|
c: void 0,
|
|
1863
|
-
m:
|
|
2185
|
+
m: serializeString(current.message),
|
|
1864
2186
|
d: optionsNode,
|
|
1865
|
-
a:
|
|
1866
|
-
f: void 0
|
|
2187
|
+
a: void 0,
|
|
2188
|
+
f: void 0,
|
|
2189
|
+
b: void 0
|
|
1867
2190
|
};
|
|
1868
2191
|
}
|
|
1869
2192
|
function generateErrorNode2(ctx, id, current) {
|
|
@@ -1875,10 +2198,49 @@ function generateErrorNode2(ctx, id, current) {
|
|
|
1875
2198
|
s: void 0,
|
|
1876
2199
|
l: void 0,
|
|
1877
2200
|
c: getErrorConstructorName(current),
|
|
1878
|
-
m:
|
|
2201
|
+
m: serializeString(current.message),
|
|
1879
2202
|
d: optionsNode,
|
|
1880
2203
|
a: void 0,
|
|
1881
|
-
f: void 0
|
|
2204
|
+
f: void 0,
|
|
2205
|
+
b: void 0
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
function generateHeadersNode2(ctx, id, current) {
|
|
2209
|
+
assert(ctx.features & 8192 /* WebAPI */, 'Unsupported type "Headers"');
|
|
2210
|
+
const items = {};
|
|
2211
|
+
current.forEach((value, key) => {
|
|
2212
|
+
items[key] = value;
|
|
2213
|
+
});
|
|
2214
|
+
return {
|
|
2215
|
+
t: 32 /* Headers */,
|
|
2216
|
+
i: id,
|
|
2217
|
+
s: void 0,
|
|
2218
|
+
l: void 0,
|
|
2219
|
+
c: void 0,
|
|
2220
|
+
m: void 0,
|
|
2221
|
+
d: generateProperties2(ctx, items),
|
|
2222
|
+
a: void 0,
|
|
2223
|
+
f: void 0,
|
|
2224
|
+
b: void 0
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
2227
|
+
function generateFormDataNode2(ctx, id, current) {
|
|
2228
|
+
assert(ctx.features & 8192 /* WebAPI */, 'Unsupported type "FormData"');
|
|
2229
|
+
const items = {};
|
|
2230
|
+
current.forEach((value, key) => {
|
|
2231
|
+
items[key] = value;
|
|
2232
|
+
});
|
|
2233
|
+
return {
|
|
2234
|
+
t: 33 /* FormData */,
|
|
2235
|
+
i: id,
|
|
2236
|
+
s: void 0,
|
|
2237
|
+
l: void 0,
|
|
2238
|
+
c: void 0,
|
|
2239
|
+
m: void 0,
|
|
2240
|
+
d: generateProperties2(ctx, items),
|
|
2241
|
+
a: void 0,
|
|
2242
|
+
f: void 0,
|
|
2243
|
+
b: void 0
|
|
1882
2244
|
};
|
|
1883
2245
|
}
|
|
1884
2246
|
function parse2(ctx, current) {
|
|
@@ -1925,6 +2287,8 @@ function parse2(ctx, current) {
|
|
|
1925
2287
|
return createDateNode(id, current);
|
|
1926
2288
|
case RegExp:
|
|
1927
2289
|
return createRegExpNode(id, current);
|
|
2290
|
+
case ArrayBuffer:
|
|
2291
|
+
return createArrayBufferNode(id, current);
|
|
1928
2292
|
case Int8Array:
|
|
1929
2293
|
case Int16Array:
|
|
1930
2294
|
case Int32Array:
|
|
@@ -1938,6 +2302,8 @@ function parse2(ctx, current) {
|
|
|
1938
2302
|
case BigInt64Array:
|
|
1939
2303
|
case BigUint64Array:
|
|
1940
2304
|
return createBigIntTypedArrayNode(ctx, id, current);
|
|
2305
|
+
case DataView:
|
|
2306
|
+
return createDataViewNode(ctx, id, current);
|
|
1941
2307
|
case Map:
|
|
1942
2308
|
return generateMapNode2(ctx, id, current);
|
|
1943
2309
|
case Set:
|
|
@@ -1973,6 +2339,10 @@ function parse2(ctx, current) {
|
|
|
1973
2339
|
return createURLNode(ctx, id, current);
|
|
1974
2340
|
case URLSearchParams:
|
|
1975
2341
|
return createURLSearchParamsNode(ctx, id, current);
|
|
2342
|
+
case Headers:
|
|
2343
|
+
return generateHeadersNode2(ctx, id, current);
|
|
2344
|
+
case FormData:
|
|
2345
|
+
return generateFormDataNode2(ctx, id, current);
|
|
1976
2346
|
default:
|
|
1977
2347
|
break;
|
|
1978
2348
|
}
|