seroval 0.11.0 → 0.11.2
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/dist/cjs/development/index.cjs +123 -113
- package/dist/cjs/development/index.cjs.map +3 -3
- package/dist/cjs/production/index.cjs +3 -3
- package/dist/esm/development/index.mjs +123 -113
- package/dist/esm/development/index.mjs.map +3 -3
- package/dist/esm/production/index.mjs +3 -3
- package/dist/types/core/base-primitives.d.ts +2 -3
- package/dist/types/core/shared.d.ts +1 -1
- package/package.json +3 -3
- package/src/core/base-primitives.ts +0 -7
- package/src/core/cross/async.ts +6 -6
- package/src/core/cross/primitives.ts +1 -10
- package/src/core/cross/stream.ts +61 -59
- package/src/core/cross/sync.ts +6 -6
- package/src/core/cross/web-api.ts +0 -5
- package/src/core/shared.ts +44 -18
- package/src/core/tree/async.ts +6 -6
- package/src/core/tree/primitives.ts +1 -1
- package/src/core/tree/sync.ts +6 -6
- package/src/core/tree/web-api.ts +0 -5
- package/src/core/header.js +0 -61
|
@@ -400,8 +400,7 @@ function createStringNode(value) {
|
|
|
400
400
|
o: void 0
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
-
function createBigIntNode(
|
|
404
|
-
assert(ctx.features & 8 /* BigInt */, new UnsupportedTypeError(current));
|
|
403
|
+
function createBigIntNode(current) {
|
|
405
404
|
return {
|
|
406
405
|
t: 3 /* BigInt */,
|
|
407
406
|
i: void 0,
|
|
@@ -487,8 +486,7 @@ function createArrayBufferNode(id, current) {
|
|
|
487
486
|
o: void 0
|
|
488
487
|
};
|
|
489
488
|
}
|
|
490
|
-
function createWKSymbolNode(
|
|
491
|
-
assert(ctx.features & 1024 /* Symbol */, new UnsupportedTypeError(current));
|
|
489
|
+
function createWKSymbolNode(id, current) {
|
|
492
490
|
assert(current in INV_SYMBOL_REF, new Error("Only well-known symbols are supported."));
|
|
493
491
|
return {
|
|
494
492
|
t: 17 /* WKSymbol */,
|
|
@@ -586,7 +584,7 @@ function createSymbolNode(ctx, current) {
|
|
|
586
584
|
if (hasReferenceID(current)) {
|
|
587
585
|
return createReferenceNode(id, current);
|
|
588
586
|
}
|
|
589
|
-
return createWKSymbolNode(
|
|
587
|
+
return createWKSymbolNode(id, current);
|
|
590
588
|
}
|
|
591
589
|
function createFunctionNode(ctx, current) {
|
|
592
590
|
assert(hasReferenceID(current), new Error("Cannot serialize function without reference ID."));
|
|
@@ -663,30 +661,53 @@ function getErrorOptions(ctx, error) {
|
|
|
663
661
|
}
|
|
664
662
|
return options;
|
|
665
663
|
}
|
|
666
|
-
function isIterable(value) {
|
|
664
|
+
function isIterable(ctx, value) {
|
|
667
665
|
if (!value || typeof value !== "object") {
|
|
668
666
|
return false;
|
|
669
667
|
}
|
|
670
668
|
if (Array.isArray(value)) {
|
|
671
669
|
return false;
|
|
672
670
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
671
|
+
const currentClass = value.constructor;
|
|
672
|
+
if (ctx.features & 2048 /* TypedArray */) {
|
|
673
|
+
switch (currentClass) {
|
|
674
|
+
case Int8Array:
|
|
675
|
+
case Int16Array:
|
|
676
|
+
case Int32Array:
|
|
677
|
+
case Uint8Array:
|
|
678
|
+
case Uint16Array:
|
|
679
|
+
case Uint32Array:
|
|
680
|
+
case Uint8ClampedArray:
|
|
681
|
+
case Float32Array:
|
|
682
|
+
case Float64Array:
|
|
683
|
+
return false;
|
|
684
|
+
default:
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
if ((ctx.features & BIGINT_FLAG) === BIGINT_FLAG) {
|
|
689
|
+
switch (currentClass) {
|
|
690
|
+
case BigInt64Array:
|
|
691
|
+
case BigUint64Array:
|
|
692
|
+
return false;
|
|
693
|
+
default:
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (ctx.features & 32 /* Map */ && currentClass === Map) {
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
700
|
+
if (ctx.features & 512 /* Set */ && currentClass === Set) {
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
if (ctx.features & 8192 /* WebAPI */) {
|
|
704
|
+
switch (currentClass) {
|
|
705
|
+
case Headers:
|
|
706
|
+
case File:
|
|
707
|
+
return false;
|
|
708
|
+
default:
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
690
711
|
}
|
|
691
712
|
return Symbol.iterator in value;
|
|
692
713
|
}
|
|
@@ -738,7 +759,6 @@ function getObjectFlag(obj) {
|
|
|
738
759
|
|
|
739
760
|
// src/core/tree/web-api.ts
|
|
740
761
|
async function createBlobNode(ctx, id, current) {
|
|
741
|
-
assert(ctx.features & 8192 /* WebAPI */, new UnsupportedTypeError(current));
|
|
742
762
|
return {
|
|
743
763
|
t: 23 /* Blob */,
|
|
744
764
|
i: id,
|
|
@@ -755,7 +775,6 @@ async function createBlobNode(ctx, id, current) {
|
|
|
755
775
|
};
|
|
756
776
|
}
|
|
757
777
|
async function createFileNode(ctx, id, current) {
|
|
758
|
-
assert(ctx.features & 8192 /* WebAPI */, new UnsupportedTypeError(current));
|
|
759
778
|
return {
|
|
760
779
|
t: 24 /* File */,
|
|
761
780
|
i: id,
|
|
@@ -879,7 +898,7 @@ async function generateNodeList(ctx, current) {
|
|
|
879
898
|
for (let i = 0; i < size; i++) {
|
|
880
899
|
if (i in current) {
|
|
881
900
|
item = current[i];
|
|
882
|
-
if (isIterable(item)) {
|
|
901
|
+
if (isIterable(ctx, item)) {
|
|
883
902
|
deferred[i] = item;
|
|
884
903
|
} else {
|
|
885
904
|
nodes[i] = await parseAsync(ctx, item);
|
|
@@ -918,7 +937,7 @@ async function generateMapNode(ctx, id, current) {
|
|
|
918
937
|
let deferredSize = 0;
|
|
919
938
|
let nodeSize = 0;
|
|
920
939
|
for (const [key, value] of current.entries()) {
|
|
921
|
-
if (isIterable(key) || isIterable(value)) {
|
|
940
|
+
if (isIterable(ctx, key) || isIterable(ctx, value)) {
|
|
922
941
|
deferredKey[deferredSize] = key;
|
|
923
942
|
deferredValue[deferredSize] = value;
|
|
924
943
|
deferredSize++;
|
|
@@ -954,7 +973,7 @@ async function generateSetNode(ctx, id, current) {
|
|
|
954
973
|
let deferredSize = 0;
|
|
955
974
|
let nodeSize = 0;
|
|
956
975
|
for (const item of current.keys()) {
|
|
957
|
-
if (isIterable(item)) {
|
|
976
|
+
if (isIterable(ctx, item)) {
|
|
958
977
|
deferred[deferredSize++] = item;
|
|
959
978
|
} else {
|
|
960
979
|
nodes[nodeSize++] = await parseAsync(ctx, item);
|
|
@@ -992,7 +1011,7 @@ async function generateProperties(ctx, properties) {
|
|
|
992
1011
|
for (const key of keys) {
|
|
993
1012
|
item = properties[key];
|
|
994
1013
|
escaped = serializeString(key);
|
|
995
|
-
if (isIterable(item)) {
|
|
1014
|
+
if (isIterable(ctx, item)) {
|
|
996
1015
|
deferredKeys[deferredSize] = escaped;
|
|
997
1016
|
deferredValues[deferredSize] = item;
|
|
998
1017
|
deferredSize++;
|
|
@@ -1038,7 +1057,7 @@ async function generatePlainProperties(ctx, properties) {
|
|
|
1038
1057
|
for (const key of keys) {
|
|
1039
1058
|
item = properties[key];
|
|
1040
1059
|
escaped = serializeString(key);
|
|
1041
|
-
if (isIterable(item)) {
|
|
1060
|
+
if (isIterable(ctx, item)) {
|
|
1042
1061
|
deferredKeys[deferredSize] = escaped;
|
|
1043
1062
|
deferredValues[deferredSize] = item;
|
|
1044
1063
|
deferredSize++;
|
|
@@ -1391,7 +1410,7 @@ async function parseObject(ctx, current) {
|
|
|
1391
1410
|
async function parseAsync(ctx, current) {
|
|
1392
1411
|
const t = typeof current;
|
|
1393
1412
|
if (ctx.features & 8 /* BigInt */ && t === "bigint") {
|
|
1394
|
-
return createBigIntNode(
|
|
1413
|
+
return createBigIntNode(current);
|
|
1395
1414
|
}
|
|
1396
1415
|
switch (t) {
|
|
1397
1416
|
case "boolean":
|
|
@@ -2437,7 +2456,7 @@ function generateNodeList2(ctx, current) {
|
|
|
2437
2456
|
for (let i = 0; i < size; i++) {
|
|
2438
2457
|
if (i in current) {
|
|
2439
2458
|
item = current[i];
|
|
2440
|
-
if (isIterable(item)) {
|
|
2459
|
+
if (isIterable(ctx, item)) {
|
|
2441
2460
|
deferred[i] = item;
|
|
2442
2461
|
} else {
|
|
2443
2462
|
nodes[i] = parseSync(ctx, item);
|
|
@@ -2476,7 +2495,7 @@ function generateMapNode2(ctx, id, current) {
|
|
|
2476
2495
|
let deferredSize = 0;
|
|
2477
2496
|
let nodeSize = 0;
|
|
2478
2497
|
for (const [key, value] of current.entries()) {
|
|
2479
|
-
if (isIterable(key) || isIterable(value)) {
|
|
2498
|
+
if (isIterable(ctx, key) || isIterable(ctx, value)) {
|
|
2480
2499
|
deferredKey[deferredSize] = key;
|
|
2481
2500
|
deferredValue[deferredSize] = value;
|
|
2482
2501
|
deferredSize++;
|
|
@@ -2512,7 +2531,7 @@ function generateSetNode2(ctx, id, current) {
|
|
|
2512
2531
|
let deferredSize = 0;
|
|
2513
2532
|
let nodeSize = 0;
|
|
2514
2533
|
for (const item of current.keys()) {
|
|
2515
|
-
if (isIterable(item)) {
|
|
2534
|
+
if (isIterable(ctx, item)) {
|
|
2516
2535
|
deferred[deferredSize++] = item;
|
|
2517
2536
|
} else {
|
|
2518
2537
|
nodes[nodeSize++] = parseSync(ctx, item);
|
|
@@ -2550,7 +2569,7 @@ function generateProperties2(ctx, properties) {
|
|
|
2550
2569
|
for (const key of keys) {
|
|
2551
2570
|
item = properties[key];
|
|
2552
2571
|
escaped = serializeString(key);
|
|
2553
|
-
if (isIterable(item)) {
|
|
2572
|
+
if (isIterable(ctx, item)) {
|
|
2554
2573
|
deferredKeys[deferredSize] = escaped;
|
|
2555
2574
|
deferredValues[deferredSize] = item;
|
|
2556
2575
|
deferredSize++;
|
|
@@ -2593,7 +2612,7 @@ function generatePlainProperties2(ctx, properties) {
|
|
|
2593
2612
|
for (const key of keys) {
|
|
2594
2613
|
item = properties[key];
|
|
2595
2614
|
escaped = serializeString(key);
|
|
2596
|
-
if (isIterable(item)) {
|
|
2615
|
+
if (isIterable(ctx, item)) {
|
|
2597
2616
|
deferredKeys[deferredSize] = escaped;
|
|
2598
2617
|
deferredValues[deferredSize] = item;
|
|
2599
2618
|
deferredSize++;
|
|
@@ -2872,7 +2891,7 @@ function parseObject2(ctx, current) {
|
|
|
2872
2891
|
function parseSync(ctx, current) {
|
|
2873
2892
|
const t = typeof current;
|
|
2874
2893
|
if (ctx.features & 8 /* BigInt */ && t === "bigint") {
|
|
2875
|
-
return createBigIntNode(
|
|
2894
|
+
return createBigIntNode(current);
|
|
2876
2895
|
}
|
|
2877
2896
|
switch (t) {
|
|
2878
2897
|
case "boolean":
|
|
@@ -3042,7 +3061,6 @@ function serializeArrayBuffer3(ctx, current) {
|
|
|
3042
3061
|
return createArrayBufferNode(newID, current);
|
|
3043
3062
|
}
|
|
3044
3063
|
function createTypedArrayNode2(ctx, id, current) {
|
|
3045
|
-
assert(ctx.features & 2048 /* TypedArray */, new UnsupportedTypeError(current));
|
|
3046
3064
|
return {
|
|
3047
3065
|
t: 15 /* TypedArray */,
|
|
3048
3066
|
i: id,
|
|
@@ -3058,12 +3076,7 @@ function createTypedArrayNode2(ctx, id, current) {
|
|
|
3058
3076
|
o: void 0
|
|
3059
3077
|
};
|
|
3060
3078
|
}
|
|
3061
|
-
var BIGINT_FLAG2 = 4096 /* BigIntTypedArray */ | 8 /* BigInt */;
|
|
3062
3079
|
function createBigIntTypedArrayNode2(ctx, id, current) {
|
|
3063
|
-
assert(
|
|
3064
|
-
(ctx.features & BIGINT_FLAG2) === BIGINT_FLAG2,
|
|
3065
|
-
new UnsupportedTypeError(current)
|
|
3066
|
-
);
|
|
3067
3080
|
return {
|
|
3068
3081
|
t: 16 /* BigIntTypedArray */,
|
|
3069
3082
|
i: id,
|
|
@@ -3105,7 +3118,7 @@ function createSymbolNode2(ctx, current) {
|
|
|
3105
3118
|
if (hasReferenceID(current)) {
|
|
3106
3119
|
return createReferenceNode(newID, current);
|
|
3107
3120
|
}
|
|
3108
|
-
return createWKSymbolNode(
|
|
3121
|
+
return createWKSymbolNode(newID, current);
|
|
3109
3122
|
}
|
|
3110
3123
|
function createFunctionNode2(ctx, current) {
|
|
3111
3124
|
assert(hasReferenceID(current), new Error("Cannot serialize function without reference ID."));
|
|
@@ -3120,7 +3133,6 @@ function createFunctionNode2(ctx, current) {
|
|
|
3120
3133
|
|
|
3121
3134
|
// src/core/cross/web-api.ts
|
|
3122
3135
|
async function createBlobNode2(ctx, id, current) {
|
|
3123
|
-
assert(ctx.features & 8192 /* WebAPI */, new UnsupportedTypeError(current));
|
|
3124
3136
|
return {
|
|
3125
3137
|
t: 23 /* Blob */,
|
|
3126
3138
|
i: id,
|
|
@@ -3137,7 +3149,6 @@ async function createBlobNode2(ctx, id, current) {
|
|
|
3137
3149
|
};
|
|
3138
3150
|
}
|
|
3139
3151
|
async function createFileNode2(ctx, id, current) {
|
|
3140
|
-
assert(ctx.features & 8192 /* WebAPI */, new UnsupportedTypeError(current));
|
|
3141
3152
|
return {
|
|
3142
3153
|
t: 24 /* File */,
|
|
3143
3154
|
i: id,
|
|
@@ -3163,7 +3174,7 @@ async function generateNodeList3(ctx, current) {
|
|
|
3163
3174
|
for (let i = 0; i < size; i++) {
|
|
3164
3175
|
if (i in current) {
|
|
3165
3176
|
item = current[i];
|
|
3166
|
-
if (isIterable(item)) {
|
|
3177
|
+
if (isIterable(ctx, item)) {
|
|
3167
3178
|
deferred[i] = item;
|
|
3168
3179
|
} else {
|
|
3169
3180
|
nodes[i] = await crossParseAsync(ctx, item);
|
|
@@ -3202,7 +3213,7 @@ async function generateMapNode3(ctx, id, current) {
|
|
|
3202
3213
|
let deferredSize = 0;
|
|
3203
3214
|
let nodeSize = 0;
|
|
3204
3215
|
for (const [key, value] of current.entries()) {
|
|
3205
|
-
if (isIterable(key) || isIterable(value)) {
|
|
3216
|
+
if (isIterable(ctx, key) || isIterable(ctx, value)) {
|
|
3206
3217
|
deferredKey[deferredSize] = key;
|
|
3207
3218
|
deferredValue[deferredSize] = value;
|
|
3208
3219
|
deferredSize++;
|
|
@@ -3238,7 +3249,7 @@ async function generateSetNode3(ctx, id, current) {
|
|
|
3238
3249
|
let deferredSize = 0;
|
|
3239
3250
|
let nodeSize = 0;
|
|
3240
3251
|
for (const item of current.keys()) {
|
|
3241
|
-
if (isIterable(item)) {
|
|
3252
|
+
if (isIterable(ctx, item)) {
|
|
3242
3253
|
deferred[deferredSize++] = item;
|
|
3243
3254
|
} else {
|
|
3244
3255
|
nodes[nodeSize++] = await crossParseAsync(ctx, item);
|
|
@@ -3276,7 +3287,7 @@ async function generateProperties3(ctx, properties) {
|
|
|
3276
3287
|
for (const key of keys) {
|
|
3277
3288
|
item = properties[key];
|
|
3278
3289
|
escaped = serializeString(key);
|
|
3279
|
-
if (isIterable(item)) {
|
|
3290
|
+
if (isIterable(ctx, item)) {
|
|
3280
3291
|
deferredKeys[deferredSize] = escaped;
|
|
3281
3292
|
deferredValues[deferredSize] = item;
|
|
3282
3293
|
deferredSize++;
|
|
@@ -3322,7 +3333,7 @@ async function generatePlainProperties3(ctx, properties) {
|
|
|
3322
3333
|
for (const key of keys) {
|
|
3323
3334
|
item = properties[key];
|
|
3324
3335
|
escaped = serializeString(key);
|
|
3325
|
-
if (isIterable(item)) {
|
|
3336
|
+
if (isIterable(ctx, item)) {
|
|
3326
3337
|
deferredKeys[deferredSize] = escaped;
|
|
3327
3338
|
deferredValues[deferredSize] = item;
|
|
3328
3339
|
deferredSize++;
|
|
@@ -3677,7 +3688,7 @@ async function parseObject3(ctx, current) {
|
|
|
3677
3688
|
async function crossParseAsync(ctx, current) {
|
|
3678
3689
|
const t = typeof current;
|
|
3679
3690
|
if (ctx.features & 8 /* BigInt */ && t === "bigint") {
|
|
3680
|
-
return createBigIntNode(
|
|
3691
|
+
return createBigIntNode(current);
|
|
3681
3692
|
}
|
|
3682
3693
|
switch (t) {
|
|
3683
3694
|
case "boolean":
|
|
@@ -4289,7 +4300,7 @@ function generateNodeList4(ctx, current) {
|
|
|
4289
4300
|
for (let i = 0; i < size; i++) {
|
|
4290
4301
|
if (i in current) {
|
|
4291
4302
|
item = current[i];
|
|
4292
|
-
if (isIterable(item)) {
|
|
4303
|
+
if (isIterable(ctx, item)) {
|
|
4293
4304
|
deferred[i] = item;
|
|
4294
4305
|
} else {
|
|
4295
4306
|
nodes[i] = crossParseStream(ctx, item);
|
|
@@ -4328,7 +4339,7 @@ function generateMapNode4(ctx, id, current) {
|
|
|
4328
4339
|
let deferredSize = 0;
|
|
4329
4340
|
let nodeSize = 0;
|
|
4330
4341
|
for (const [key, value] of current.entries()) {
|
|
4331
|
-
if (isIterable(key) || isIterable(value)) {
|
|
4342
|
+
if (isIterable(ctx, key) || isIterable(ctx, value)) {
|
|
4332
4343
|
deferredKey[deferredSize] = key;
|
|
4333
4344
|
deferredValue[deferredSize] = value;
|
|
4334
4345
|
deferredSize++;
|
|
@@ -4364,7 +4375,7 @@ function generateSetNode4(ctx, id, current) {
|
|
|
4364
4375
|
let deferredSize = 0;
|
|
4365
4376
|
let nodeSize = 0;
|
|
4366
4377
|
for (const item of current.keys()) {
|
|
4367
|
-
if (isIterable(item)) {
|
|
4378
|
+
if (isIterable(ctx, item)) {
|
|
4368
4379
|
deferred[deferredSize++] = item;
|
|
4369
4380
|
} else {
|
|
4370
4381
|
nodes[nodeSize++] = crossParseStream(ctx, item);
|
|
@@ -4402,7 +4413,7 @@ function generateProperties4(ctx, properties) {
|
|
|
4402
4413
|
for (const key of keys) {
|
|
4403
4414
|
item = properties[key];
|
|
4404
4415
|
escaped = serializeString(key);
|
|
4405
|
-
if (isIterable(item)) {
|
|
4416
|
+
if (isIterable(ctx, item)) {
|
|
4406
4417
|
deferredKeys[deferredSize] = escaped;
|
|
4407
4418
|
deferredValues[deferredSize] = item;
|
|
4408
4419
|
deferredSize++;
|
|
@@ -4448,7 +4459,7 @@ function generatePlainProperties4(ctx, properties) {
|
|
|
4448
4459
|
for (const key of keys) {
|
|
4449
4460
|
item = properties[key];
|
|
4450
4461
|
escaped = serializeString(key);
|
|
4451
|
-
if (isIterable(item)) {
|
|
4462
|
+
if (isIterable(ctx, item)) {
|
|
4452
4463
|
deferredKeys[deferredSize] = escaped;
|
|
4453
4464
|
deferredValues[deferredSize] = item;
|
|
4454
4465
|
deferredSize++;
|
|
@@ -4633,52 +4644,13 @@ function generateBoxedNode4(ctx, id, current) {
|
|
|
4633
4644
|
o: void 0
|
|
4634
4645
|
};
|
|
4635
4646
|
}
|
|
4636
|
-
function
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
(data) => {
|
|
4642
|
-
if (ctx.alive) {
|
|
4643
|
-
if (data.done) {
|
|
4644
|
-
ctx.onParse({
|
|
4645
|
-
t: 33 /* ReadableStreamClose */,
|
|
4646
|
-
i: id,
|
|
4647
|
-
s: void 0,
|
|
4648
|
-
l: void 0,
|
|
4649
|
-
c: void 0,
|
|
4650
|
-
m: void 0,
|
|
4651
|
-
p: void 0,
|
|
4652
|
-
e: void 0,
|
|
4653
|
-
a: void 0,
|
|
4654
|
-
f: void 0,
|
|
4655
|
-
b: void 0,
|
|
4656
|
-
o: void 0
|
|
4657
|
-
}, false);
|
|
4658
|
-
popPendingState(ctx);
|
|
4659
|
-
} else {
|
|
4660
|
-
ctx.onParse({
|
|
4661
|
-
t: 32 /* ReadableStreamEnqueue */,
|
|
4662
|
-
i: id,
|
|
4663
|
-
s: void 0,
|
|
4664
|
-
l: void 0,
|
|
4665
|
-
c: void 0,
|
|
4666
|
-
m: void 0,
|
|
4667
|
-
p: void 0,
|
|
4668
|
-
e: void 0,
|
|
4669
|
-
a: void 0,
|
|
4670
|
-
f: crossParseStream(ctx, data.value),
|
|
4671
|
-
b: void 0,
|
|
4672
|
-
o: void 0
|
|
4673
|
-
}, false);
|
|
4674
|
-
push();
|
|
4675
|
-
}
|
|
4676
|
-
}
|
|
4677
|
-
},
|
|
4678
|
-
(value) => {
|
|
4679
|
-
if (ctx.alive) {
|
|
4647
|
+
function pushReadableStreamState(ctx, id, reader) {
|
|
4648
|
+
reader.read().then(
|
|
4649
|
+
(data) => {
|
|
4650
|
+
if (ctx.alive) {
|
|
4651
|
+
if (data.done) {
|
|
4680
4652
|
ctx.onParse({
|
|
4681
|
-
t:
|
|
4653
|
+
t: 33 /* ReadableStreamClose */,
|
|
4682
4654
|
i: id,
|
|
4683
4655
|
s: void 0,
|
|
4684
4656
|
l: void 0,
|
|
@@ -4687,16 +4659,54 @@ function generateReadableStreamNode(ctx, id, current) {
|
|
|
4687
4659
|
p: void 0,
|
|
4688
4660
|
e: void 0,
|
|
4689
4661
|
a: void 0,
|
|
4690
|
-
f:
|
|
4662
|
+
f: void 0,
|
|
4691
4663
|
b: void 0,
|
|
4692
4664
|
o: void 0
|
|
4693
4665
|
}, false);
|
|
4694
4666
|
popPendingState(ctx);
|
|
4667
|
+
} else {
|
|
4668
|
+
ctx.onParse({
|
|
4669
|
+
t: 32 /* ReadableStreamEnqueue */,
|
|
4670
|
+
i: id,
|
|
4671
|
+
s: void 0,
|
|
4672
|
+
l: void 0,
|
|
4673
|
+
c: void 0,
|
|
4674
|
+
m: void 0,
|
|
4675
|
+
p: void 0,
|
|
4676
|
+
e: void 0,
|
|
4677
|
+
a: void 0,
|
|
4678
|
+
f: crossParseStream(ctx, data.value),
|
|
4679
|
+
b: void 0,
|
|
4680
|
+
o: void 0
|
|
4681
|
+
}, false);
|
|
4682
|
+
pushReadableStreamState(ctx, id, reader);
|
|
4695
4683
|
}
|
|
4696
4684
|
}
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4685
|
+
},
|
|
4686
|
+
(value) => {
|
|
4687
|
+
if (ctx.alive) {
|
|
4688
|
+
ctx.onParse({
|
|
4689
|
+
t: 34 /* ReadableStreamError */,
|
|
4690
|
+
i: id,
|
|
4691
|
+
s: void 0,
|
|
4692
|
+
l: void 0,
|
|
4693
|
+
c: void 0,
|
|
4694
|
+
m: void 0,
|
|
4695
|
+
p: void 0,
|
|
4696
|
+
e: void 0,
|
|
4697
|
+
a: void 0,
|
|
4698
|
+
f: crossParseStream(ctx, value),
|
|
4699
|
+
b: void 0,
|
|
4700
|
+
o: void 0
|
|
4701
|
+
}, false);
|
|
4702
|
+
popPendingState(ctx);
|
|
4703
|
+
}
|
|
4704
|
+
}
|
|
4705
|
+
);
|
|
4706
|
+
}
|
|
4707
|
+
function generateReadableStreamNode(ctx, id, current) {
|
|
4708
|
+
pushPendingState(ctx);
|
|
4709
|
+
pushReadableStreamState(ctx, id, current.getReader());
|
|
4700
4710
|
return {
|
|
4701
4711
|
t: 31 /* ReadableStreamConstructor */,
|
|
4702
4712
|
i: id,
|
|
@@ -4914,7 +4924,7 @@ function parseObject4(ctx, current) {
|
|
|
4914
4924
|
function crossParseStream(ctx, current) {
|
|
4915
4925
|
const t = typeof current;
|
|
4916
4926
|
if (ctx.features & 8 /* BigInt */ && t === "bigint") {
|
|
4917
|
-
return createBigIntNode(
|
|
4927
|
+
return createBigIntNode(current);
|
|
4918
4928
|
}
|
|
4919
4929
|
switch (t) {
|
|
4920
4930
|
case "boolean":
|
|
@@ -4945,7 +4955,7 @@ function generateNodeList5(ctx, current) {
|
|
|
4945
4955
|
for (let i = 0; i < size; i++) {
|
|
4946
4956
|
if (i in current) {
|
|
4947
4957
|
item = current[i];
|
|
4948
|
-
if (isIterable(item)) {
|
|
4958
|
+
if (isIterable(ctx, item)) {
|
|
4949
4959
|
deferred[i] = item;
|
|
4950
4960
|
} else {
|
|
4951
4961
|
nodes[i] = crossParseSync(ctx, item);
|
|
@@ -4984,7 +4994,7 @@ function generateMapNode5(ctx, id, current) {
|
|
|
4984
4994
|
let deferredSize = 0;
|
|
4985
4995
|
let nodeSize = 0;
|
|
4986
4996
|
for (const [key, value] of current.entries()) {
|
|
4987
|
-
if (isIterable(key) || isIterable(value)) {
|
|
4997
|
+
if (isIterable(ctx, key) || isIterable(ctx, value)) {
|
|
4988
4998
|
deferredKey[deferredSize] = key;
|
|
4989
4999
|
deferredValue[deferredSize] = value;
|
|
4990
5000
|
deferredSize++;
|
|
@@ -5020,7 +5030,7 @@ function generateSetNode5(ctx, id, current) {
|
|
|
5020
5030
|
let deferredSize = 0;
|
|
5021
5031
|
let nodeSize = 0;
|
|
5022
5032
|
for (const item of current.keys()) {
|
|
5023
|
-
if (isIterable(item)) {
|
|
5033
|
+
if (isIterable(ctx, item)) {
|
|
5024
5034
|
deferred[deferredSize++] = item;
|
|
5025
5035
|
} else {
|
|
5026
5036
|
nodes[nodeSize++] = crossParseSync(ctx, item);
|
|
@@ -5058,7 +5068,7 @@ function generateProperties5(ctx, properties) {
|
|
|
5058
5068
|
for (const key of keys) {
|
|
5059
5069
|
item = properties[key];
|
|
5060
5070
|
escaped = serializeString(key);
|
|
5061
|
-
if (isIterable(item)) {
|
|
5071
|
+
if (isIterable(ctx, item)) {
|
|
5062
5072
|
deferredKeys[deferredSize] = escaped;
|
|
5063
5073
|
deferredValues[deferredSize] = item;
|
|
5064
5074
|
deferredSize++;
|
|
@@ -5100,7 +5110,7 @@ function generatePlainProperties5(ctx, properties) {
|
|
|
5100
5110
|
for (const key of keys) {
|
|
5101
5111
|
item = properties[key];
|
|
5102
5112
|
escaped = serializeString(key);
|
|
5103
|
-
if (isIterable(item)) {
|
|
5113
|
+
if (isIterable(ctx, item)) {
|
|
5104
5114
|
deferredKeys[deferredSize] = escaped;
|
|
5105
5115
|
deferredValues[deferredSize] = item;
|
|
5106
5116
|
deferredSize++;
|
|
@@ -5381,7 +5391,7 @@ function parseObject5(ctx, current) {
|
|
|
5381
5391
|
function crossParseSync(ctx, current) {
|
|
5382
5392
|
const t = typeof current;
|
|
5383
5393
|
if (ctx.features & 8 /* BigInt */ && t === "bigint") {
|
|
5384
|
-
return createBigIntNode(
|
|
5394
|
+
return createBigIntNode(current);
|
|
5385
5395
|
}
|
|
5386
5396
|
switch (t) {
|
|
5387
5397
|
case "boolean":
|