seroval 1.6.1 → 1.6.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/dev/index.cjs +11 -13
- package/dist/dev/index.js +11 -13
- package/dist/index.cjs +11 -13
- package/dist/index.js +11 -13
- package/package.json +1 -1
package/dist/dev/index.cjs
CHANGED
|
@@ -1243,6 +1243,9 @@ function guardIndexedValue(ctx, id) {
|
|
|
1243
1243
|
});
|
|
1244
1244
|
if (ctx.refs.has(id)) throw new Error("Conflicted ref id: " + id);
|
|
1245
1245
|
}
|
|
1246
|
+
function isThennable(value) {
|
|
1247
|
+
return !!value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
1248
|
+
}
|
|
1246
1249
|
function assignIndexedValueVanilla(ctx, id, value) {
|
|
1247
1250
|
guardIndexedValue(ctx.base, id);
|
|
1248
1251
|
if (ctx.state.marked.has(id)) ctx.base.refs.set(id, value);
|
|
@@ -1405,6 +1408,7 @@ function deserializePromise(ctx, depth, node) {
|
|
|
1405
1408
|
const deferred = PROMISE_CONSTRUCTOR();
|
|
1406
1409
|
const result = assignIndexedValue$1(ctx, node.i, deferred.p);
|
|
1407
1410
|
const deserialized = deserialize$1(ctx, depth, node.f);
|
|
1411
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.f);
|
|
1408
1412
|
if (node.s) deferred.s(deserialized);
|
|
1409
1413
|
else deferred.f(deserialized);
|
|
1410
1414
|
return result;
|
|
@@ -1428,20 +1432,14 @@ function deserializePromiseConstructor(ctx, node) {
|
|
|
1428
1432
|
assignNodeType(ctx, node.s, 22);
|
|
1429
1433
|
return value;
|
|
1430
1434
|
}
|
|
1431
|
-
function
|
|
1432
|
-
const deferred = ctx.base.refs.get(node.i);
|
|
1433
|
-
if (deferred) {
|
|
1434
|
-
validateNodeType(ctx, node, node.i, 22);
|
|
1435
|
-
deferred.s(deserialize$1(ctx, depth, node.a[1]));
|
|
1436
|
-
return;
|
|
1437
|
-
}
|
|
1438
|
-
throw new SerovalMissingInstanceError("Promise");
|
|
1439
|
-
}
|
|
1440
|
-
function deserializePromiseReject(ctx, depth, node) {
|
|
1435
|
+
function deserializePromiseFulfill(ctx, depth, node) {
|
|
1441
1436
|
const deferred = ctx.base.refs.get(node.i);
|
|
1442
1437
|
if (deferred) {
|
|
1443
1438
|
validateNodeType(ctx, node, node.i, 22);
|
|
1444
|
-
|
|
1439
|
+
const deserialized = deserialize$1(ctx, depth, node.a[1]);
|
|
1440
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.a[1]);
|
|
1441
|
+
if (node.t === 23) deferred.s(deserialized);
|
|
1442
|
+
else deferred.f(deserialized);
|
|
1445
1443
|
return;
|
|
1446
1444
|
}
|
|
1447
1445
|
throw new SerovalMissingInstanceError("Promise");
|
|
@@ -1530,8 +1528,8 @@ function deserialize$1(ctx, depth, node) {
|
|
|
1530
1528
|
case 21: return deserializeBoxed(ctx, depth, node);
|
|
1531
1529
|
case 25: return deserializePlugin(ctx, depth, node);
|
|
1532
1530
|
case 22: return deserializePromiseConstructor(ctx, node);
|
|
1533
|
-
case 23:
|
|
1534
|
-
case 24: return
|
|
1531
|
+
case 23:
|
|
1532
|
+
case 24: return deserializePromiseFulfill(ctx, depth, node);
|
|
1535
1533
|
case 28: return deserializeIteratorFactoryInstance(ctx, depth, node);
|
|
1536
1534
|
case 30: return deserializeAsyncIteratorFactoryInstance(ctx, depth, node);
|
|
1537
1535
|
case 31: return deserializeStreamConstructor(ctx, depth, node);
|
package/dist/dev/index.js
CHANGED
|
@@ -1242,6 +1242,9 @@ function guardIndexedValue(ctx, id) {
|
|
|
1242
1242
|
});
|
|
1243
1243
|
if (ctx.refs.has(id)) throw new Error("Conflicted ref id: " + id);
|
|
1244
1244
|
}
|
|
1245
|
+
function isThennable(value) {
|
|
1246
|
+
return !!value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
1247
|
+
}
|
|
1245
1248
|
function assignIndexedValueVanilla(ctx, id, value) {
|
|
1246
1249
|
guardIndexedValue(ctx.base, id);
|
|
1247
1250
|
if (ctx.state.marked.has(id)) ctx.base.refs.set(id, value);
|
|
@@ -1404,6 +1407,7 @@ function deserializePromise(ctx, depth, node) {
|
|
|
1404
1407
|
const deferred = PROMISE_CONSTRUCTOR();
|
|
1405
1408
|
const result = assignIndexedValue$1(ctx, node.i, deferred.p);
|
|
1406
1409
|
const deserialized = deserialize$1(ctx, depth, node.f);
|
|
1410
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.f);
|
|
1407
1411
|
if (node.s) deferred.s(deserialized);
|
|
1408
1412
|
else deferred.f(deserialized);
|
|
1409
1413
|
return result;
|
|
@@ -1427,20 +1431,14 @@ function deserializePromiseConstructor(ctx, node) {
|
|
|
1427
1431
|
assignNodeType(ctx, node.s, 22);
|
|
1428
1432
|
return value;
|
|
1429
1433
|
}
|
|
1430
|
-
function
|
|
1431
|
-
const deferred = ctx.base.refs.get(node.i);
|
|
1432
|
-
if (deferred) {
|
|
1433
|
-
validateNodeType(ctx, node, node.i, 22);
|
|
1434
|
-
deferred.s(deserialize$1(ctx, depth, node.a[1]));
|
|
1435
|
-
return;
|
|
1436
|
-
}
|
|
1437
|
-
throw new SerovalMissingInstanceError("Promise");
|
|
1438
|
-
}
|
|
1439
|
-
function deserializePromiseReject(ctx, depth, node) {
|
|
1434
|
+
function deserializePromiseFulfill(ctx, depth, node) {
|
|
1440
1435
|
const deferred = ctx.base.refs.get(node.i);
|
|
1441
1436
|
if (deferred) {
|
|
1442
1437
|
validateNodeType(ctx, node, node.i, 22);
|
|
1443
|
-
|
|
1438
|
+
const deserialized = deserialize$1(ctx, depth, node.a[1]);
|
|
1439
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.a[1]);
|
|
1440
|
+
if (node.t === 23) deferred.s(deserialized);
|
|
1441
|
+
else deferred.f(deserialized);
|
|
1444
1442
|
return;
|
|
1445
1443
|
}
|
|
1446
1444
|
throw new SerovalMissingInstanceError("Promise");
|
|
@@ -1529,8 +1527,8 @@ function deserialize$1(ctx, depth, node) {
|
|
|
1529
1527
|
case 21: return deserializeBoxed(ctx, depth, node);
|
|
1530
1528
|
case 25: return deserializePlugin(ctx, depth, node);
|
|
1531
1529
|
case 22: return deserializePromiseConstructor(ctx, node);
|
|
1532
|
-
case 23:
|
|
1533
|
-
case 24: return
|
|
1530
|
+
case 23:
|
|
1531
|
+
case 24: return deserializePromiseFulfill(ctx, depth, node);
|
|
1534
1532
|
case 28: return deserializeIteratorFactoryInstance(ctx, depth, node);
|
|
1535
1533
|
case 30: return deserializeAsyncIteratorFactoryInstance(ctx, depth, node);
|
|
1536
1534
|
case 31: return deserializeStreamConstructor(ctx, depth, node);
|
package/dist/index.cjs
CHANGED
|
@@ -1236,6 +1236,9 @@ function guardIndexedValue(ctx, id) {
|
|
|
1236
1236
|
});
|
|
1237
1237
|
if (ctx.refs.has(id)) throw new Error("Conflicted ref id: " + id);
|
|
1238
1238
|
}
|
|
1239
|
+
function isThennable(value) {
|
|
1240
|
+
return !!value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
1241
|
+
}
|
|
1239
1242
|
function assignIndexedValueVanilla(ctx, id, value) {
|
|
1240
1243
|
guardIndexedValue(ctx.base, id);
|
|
1241
1244
|
if (ctx.state.marked.has(id)) ctx.base.refs.set(id, value);
|
|
@@ -1398,6 +1401,7 @@ function deserializePromise(ctx, depth, node) {
|
|
|
1398
1401
|
const deferred = PROMISE_CONSTRUCTOR();
|
|
1399
1402
|
const result = assignIndexedValue$1(ctx, node.i, deferred.p);
|
|
1400
1403
|
const deserialized = deserialize$1(ctx, depth, node.f);
|
|
1404
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.f);
|
|
1401
1405
|
if (node.s) deferred.s(deserialized);
|
|
1402
1406
|
else deferred.f(deserialized);
|
|
1403
1407
|
return result;
|
|
@@ -1421,20 +1425,14 @@ function deserializePromiseConstructor(ctx, node) {
|
|
|
1421
1425
|
assignNodeType(ctx, node.s, 22);
|
|
1422
1426
|
return value;
|
|
1423
1427
|
}
|
|
1424
|
-
function
|
|
1425
|
-
const deferred = ctx.base.refs.get(node.i);
|
|
1426
|
-
if (deferred) {
|
|
1427
|
-
validateNodeType(ctx, node, node.i, 22);
|
|
1428
|
-
deferred.s(deserialize$1(ctx, depth, node.a[1]));
|
|
1429
|
-
return;
|
|
1430
|
-
}
|
|
1431
|
-
throw new SerovalMissingInstanceError("Promise");
|
|
1432
|
-
}
|
|
1433
|
-
function deserializePromiseReject(ctx, depth, node) {
|
|
1428
|
+
function deserializePromiseFulfill(ctx, depth, node) {
|
|
1434
1429
|
const deferred = ctx.base.refs.get(node.i);
|
|
1435
1430
|
if (deferred) {
|
|
1436
1431
|
validateNodeType(ctx, node, node.i, 22);
|
|
1437
|
-
|
|
1432
|
+
const deserialized = deserialize$1(ctx, depth, node.a[1]);
|
|
1433
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.a[1]);
|
|
1434
|
+
if (node.t === 23) deferred.s(deserialized);
|
|
1435
|
+
else deferred.f(deserialized);
|
|
1438
1436
|
return;
|
|
1439
1437
|
}
|
|
1440
1438
|
throw new SerovalMissingInstanceError("Promise");
|
|
@@ -1523,8 +1521,8 @@ function deserialize$1(ctx, depth, node) {
|
|
|
1523
1521
|
case 21: return deserializeBoxed(ctx, depth, node);
|
|
1524
1522
|
case 25: return deserializePlugin(ctx, depth, node);
|
|
1525
1523
|
case 22: return deserializePromiseConstructor(ctx, node);
|
|
1526
|
-
case 23:
|
|
1527
|
-
case 24: return
|
|
1524
|
+
case 23:
|
|
1525
|
+
case 24: return deserializePromiseFulfill(ctx, depth, node);
|
|
1528
1526
|
case 28: return deserializeIteratorFactoryInstance(ctx, depth, node);
|
|
1529
1527
|
case 30: return deserializeAsyncIteratorFactoryInstance(ctx, depth, node);
|
|
1530
1528
|
case 31: return deserializeStreamConstructor(ctx, depth, node);
|
package/dist/index.js
CHANGED
|
@@ -1235,6 +1235,9 @@ function guardIndexedValue(ctx, id) {
|
|
|
1235
1235
|
});
|
|
1236
1236
|
if (ctx.refs.has(id)) throw new Error("Conflicted ref id: " + id);
|
|
1237
1237
|
}
|
|
1238
|
+
function isThennable(value) {
|
|
1239
|
+
return !!value && typeof value === "object" && "then" in value && typeof value.then === "function";
|
|
1240
|
+
}
|
|
1238
1241
|
function assignIndexedValueVanilla(ctx, id, value) {
|
|
1239
1242
|
guardIndexedValue(ctx.base, id);
|
|
1240
1243
|
if (ctx.state.marked.has(id)) ctx.base.refs.set(id, value);
|
|
@@ -1397,6 +1400,7 @@ function deserializePromise(ctx, depth, node) {
|
|
|
1397
1400
|
const deferred = PROMISE_CONSTRUCTOR();
|
|
1398
1401
|
const result = assignIndexedValue$1(ctx, node.i, deferred.p);
|
|
1399
1402
|
const deserialized = deserialize$1(ctx, depth, node.f);
|
|
1403
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.f);
|
|
1400
1404
|
if (node.s) deferred.s(deserialized);
|
|
1401
1405
|
else deferred.f(deserialized);
|
|
1402
1406
|
return result;
|
|
@@ -1420,20 +1424,14 @@ function deserializePromiseConstructor(ctx, node) {
|
|
|
1420
1424
|
assignNodeType(ctx, node.s, 22);
|
|
1421
1425
|
return value;
|
|
1422
1426
|
}
|
|
1423
|
-
function
|
|
1424
|
-
const deferred = ctx.base.refs.get(node.i);
|
|
1425
|
-
if (deferred) {
|
|
1426
|
-
validateNodeType(ctx, node, node.i, 22);
|
|
1427
|
-
deferred.s(deserialize$1(ctx, depth, node.a[1]));
|
|
1428
|
-
return;
|
|
1429
|
-
}
|
|
1430
|
-
throw new SerovalMissingInstanceError("Promise");
|
|
1431
|
-
}
|
|
1432
|
-
function deserializePromiseReject(ctx, depth, node) {
|
|
1427
|
+
function deserializePromiseFulfill(ctx, depth, node) {
|
|
1433
1428
|
const deferred = ctx.base.refs.get(node.i);
|
|
1434
1429
|
if (deferred) {
|
|
1435
1430
|
validateNodeType(ctx, node, node.i, 22);
|
|
1436
|
-
|
|
1431
|
+
const deserialized = deserialize$1(ctx, depth, node.a[1]);
|
|
1432
|
+
if (isThennable(deserialized)) throw new SerovalMalformedNodeError(node.a[1]);
|
|
1433
|
+
if (node.t === 23) deferred.s(deserialized);
|
|
1434
|
+
else deferred.f(deserialized);
|
|
1437
1435
|
return;
|
|
1438
1436
|
}
|
|
1439
1437
|
throw new SerovalMissingInstanceError("Promise");
|
|
@@ -1522,8 +1520,8 @@ function deserialize$1(ctx, depth, node) {
|
|
|
1522
1520
|
case 21: return deserializeBoxed(ctx, depth, node);
|
|
1523
1521
|
case 25: return deserializePlugin(ctx, depth, node);
|
|
1524
1522
|
case 22: return deserializePromiseConstructor(ctx, node);
|
|
1525
|
-
case 23:
|
|
1526
|
-
case 24: return
|
|
1523
|
+
case 23:
|
|
1524
|
+
case 24: return deserializePromiseFulfill(ctx, depth, node);
|
|
1527
1525
|
case 28: return deserializeIteratorFactoryInstance(ctx, depth, node);
|
|
1528
1526
|
case 30: return deserializeAsyncIteratorFactoryInstance(ctx, depth, node);
|
|
1529
1527
|
case 31: return deserializeStreamConstructor(ctx, depth, node);
|