seroval 1.2.0 → 1.3.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.
Files changed (52) hide show
  1. package/LICENSE +1 -1
  2. package/dist/cjs/development/index.cjs +283 -398
  3. package/dist/cjs/development/index.cjs.map +3 -3
  4. package/dist/cjs/production/index.cjs +5 -5
  5. package/dist/esm/development/index.mjs +283 -398
  6. package/dist/esm/development/index.mjs.map +3 -3
  7. package/dist/esm/production/index.mjs +5 -5
  8. package/dist/types/core/base-primitives.d.ts +1 -2
  9. package/dist/types/core/base-primitives.d.ts.map +1 -1
  10. package/dist/types/core/compat.d.ts +2 -3
  11. package/dist/types/core/compat.d.ts.map +1 -1
  12. package/dist/types/core/constants.d.ts +3 -6
  13. package/dist/types/core/constants.d.ts.map +1 -1
  14. package/dist/types/core/context/deserializer.d.ts +0 -3
  15. package/dist/types/core/context/deserializer.d.ts.map +1 -1
  16. package/dist/types/core/context/parser/async.d.ts +2 -2
  17. package/dist/types/core/context/parser/async.d.ts.map +1 -1
  18. package/dist/types/core/context/parser/stream.d.ts +8 -7
  19. package/dist/types/core/context/parser/stream.d.ts.map +1 -1
  20. package/dist/types/core/context/parser/sync.d.ts +3 -3
  21. package/dist/types/core/context/parser/sync.d.ts.map +1 -1
  22. package/dist/types/core/context/parser.d.ts +10 -12
  23. package/dist/types/core/context/parser.d.ts.map +1 -1
  24. package/dist/types/core/context/serializer.d.ts +1 -5
  25. package/dist/types/core/context/serializer.d.ts.map +1 -1
  26. package/dist/types/core/cross/index.d.ts.map +1 -1
  27. package/dist/types/core/function-string.d.ts +3 -0
  28. package/dist/types/core/function-string.d.ts.map +1 -0
  29. package/dist/types/core/special-reference.d.ts +4 -5
  30. package/dist/types/core/special-reference.d.ts.map +1 -1
  31. package/dist/types/core/tree/serializer.d.ts +1 -2
  32. package/dist/types/core/tree/serializer.d.ts.map +1 -1
  33. package/dist/types/core/types.d.ts +5 -19
  34. package/dist/types/core/types.d.ts.map +1 -1
  35. package/package.json +9 -9
  36. package/src/core/base-primitives.ts +2 -22
  37. package/src/core/compat.ts +6 -2
  38. package/src/core/constants.ts +2 -5
  39. package/src/core/context/deserializer.ts +2 -35
  40. package/src/core/context/parser/async.ts +67 -84
  41. package/src/core/context/parser/stream.ts +64 -109
  42. package/src/core/context/parser/sync.ts +66 -83
  43. package/src/core/context/parser.ts +24 -56
  44. package/src/core/context/serializer.ts +12 -128
  45. package/src/core/cross/index.ts +2 -6
  46. package/src/core/function-string.ts +31 -0
  47. package/src/core/special-reference.ts +96 -8
  48. package/src/core/tree/serializer.ts +0 -7
  49. package/src/core/types.ts +5 -27
  50. package/dist/types/core/abort-signal.d.ts +0 -2
  51. package/dist/types/core/abort-signal.d.ts.map +0 -1
  52. package/src/core/abort-signal.ts +0 -13
@@ -5,10 +5,9 @@ var Feature = /* @__PURE__ */ ((Feature2) => {
5
5
  Feature2[Feature2["ErrorPrototypeStack"] = 4] = "ErrorPrototypeStack";
6
6
  Feature2[Feature2["ObjectAssign"] = 8] = "ObjectAssign";
7
7
  Feature2[Feature2["BigIntTypedArray"] = 16] = "BigIntTypedArray";
8
- Feature2[Feature2["AbortSignal"] = 32] = "AbortSignal";
9
8
  return Feature2;
10
9
  })(Feature || {});
11
- var ALL_ENABLED = 47;
10
+ var ALL_ENABLED = 1 /* AggregateError */ | 2 /* ArrowFunction */ | 4 /* ErrorPrototypeStack */ | 8 /* ObjectAssign */ | 16 /* BigIntTypedArray */;
12
11
 
13
12
  // src/core/string.ts
14
13
  function serializeChar(str) {
@@ -184,21 +183,6 @@ function resolvePlugins(plugins) {
184
183
  return void 0;
185
184
  }
186
185
 
187
- // src/core/abort-signal.ts
188
- function abortSignalToPromise(signal) {
189
- return new Promise((resolve) => {
190
- signal.addEventListener(
191
- "abort",
192
- () => {
193
- resolve(signal.reason);
194
- },
195
- {
196
- once: true
197
- }
198
- );
199
- });
200
- }
201
-
202
186
  // src/core/constants.ts
203
187
  var SYMBOL_STRING = {
204
188
  [0 /* AsyncIterator */]: "Symbol.asyncIterator",
@@ -487,10 +471,11 @@ function createIndexedValueNode(id) {
487
471
  );
488
472
  }
489
473
  function createDateNode(id, current) {
474
+ const timestamp = current.valueOf();
490
475
  return createSerovalNode(
491
476
  5 /* Date */,
492
477
  id,
493
- current.toISOString(),
478
+ timestamp !== timestamp ? "" : current.toISOString(),
494
479
  NIL,
495
480
  NIL,
496
481
  NIL,
@@ -906,18 +891,96 @@ var OpaqueReference = class {
906
891
  }
907
892
  };
908
893
 
894
+ // src/core/function-string.ts
895
+ function createFunction(features, parameters, body) {
896
+ if (features & 2 /* ArrowFunction */) {
897
+ const joined = parameters.length === 1 ? parameters[0] : "(" + parameters.join(",") + ")";
898
+ return joined + "=>" + (body.startsWith("{") ? "(" + body + ")" : body);
899
+ }
900
+ return "function(" + parameters.join(",") + "){return " + body + "}";
901
+ }
902
+ function createEffectfulFunction(features, parameters, body) {
903
+ if (features & 2 /* ArrowFunction */) {
904
+ const joined = parameters.length === 1 ? parameters[0] : "(" + parameters.join(",") + ")";
905
+ return joined + "=>{" + body + "}";
906
+ }
907
+ return "function(" + parameters.join(",") + "){" + body + "}";
908
+ }
909
+
909
910
  // src/core/special-reference.ts
910
911
  var ITERATOR = {};
911
912
  var ASYNC_ITERATOR = {};
912
913
  var SPECIAL_REFS = {
913
914
  [0 /* MapSentinel */]: {},
914
915
  [1 /* PromiseConstructor */]: {},
915
- [2 /* PromiseResolve */]: {},
916
- [3 /* PromiseReject */]: {},
917
- [4 /* StreamConstructor */]: {},
918
- [5 /* AbortSignalConstructor */]: {},
919
- [6 /* AbortSignalAbort */]: {}
916
+ [2 /* PromiseSuccess */]: {},
917
+ [3 /* PromiseFailure */]: {},
918
+ [4 /* StreamConstructor */]: {}
920
919
  };
920
+ function serializePromiseConstructor(features) {
921
+ return createFunction(
922
+ features,
923
+ ["r"],
924
+ "(r.p=new Promise(" + createEffectfulFunction(features, ["s", "f"], "r.s=s,r.f=f") + "))"
925
+ );
926
+ }
927
+ function serializePromiseSuccess(features) {
928
+ return createEffectfulFunction(
929
+ features,
930
+ ["r", "d"],
931
+ "r.s(d),r.p.s=1,r.p.v=d"
932
+ );
933
+ }
934
+ function serializePromiseFailure(features) {
935
+ return createEffectfulFunction(
936
+ features,
937
+ ["r", "d"],
938
+ "r.f(d),r.p.s=2,r.p.v=d"
939
+ );
940
+ }
941
+ function serializeStreamConstructor(features) {
942
+ return createFunction(
943
+ features,
944
+ ["b", "a", "s", "l", "p", "f", "e", "n"],
945
+ "(b=[],a=!0,s=!1,l=[],p=0,f=" + createEffectfulFunction(
946
+ features,
947
+ ["v", "m", "x"],
948
+ "for(x=0;x<p;x++)l[x]&&l[x][m](v)"
949
+ ) + ",n=" + createEffectfulFunction(
950
+ features,
951
+ ["o", "x", "z", "c"],
952
+ 'for(x=0,z=b.length;x<z;x++)(c=b[x],(!a&&x===z-1)?o[s?"return":"throw"](c):o.next(c))'
953
+ ) + ",e=" + createFunction(
954
+ features,
955
+ ["o", "t"],
956
+ "(a&&(l[t=p++]=o),n(o)," + createEffectfulFunction(features, [], "a&&(l[t]=void 0)") + ")"
957
+ ) + ",{__SEROVAL_STREAM__:!0,on:" + createFunction(features, ["o"], "e(o)") + ",next:" + createEffectfulFunction(features, ["v"], 'a&&(b.push(v),f(v,"next"))') + ",throw:" + createEffectfulFunction(
958
+ features,
959
+ ["v"],
960
+ 'a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)'
961
+ ) + ",return:" + createEffectfulFunction(
962
+ features,
963
+ ["v"],
964
+ 'a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)'
965
+ ) + "})"
966
+ );
967
+ }
968
+ function serializeSpecialReferenceValue(features, ref) {
969
+ switch (ref) {
970
+ case 0 /* MapSentinel */:
971
+ return "[]";
972
+ case 1 /* PromiseConstructor */:
973
+ return serializePromiseConstructor(features);
974
+ case 2 /* PromiseSuccess */:
975
+ return serializePromiseSuccess(features);
976
+ case 3 /* PromiseFailure */:
977
+ return serializePromiseFailure(features);
978
+ case 4 /* StreamConstructor */:
979
+ return serializeStreamConstructor(features);
980
+ default:
981
+ return "";
982
+ }
983
+ }
921
984
 
922
985
  // src/core/utils/deferred.ts
923
986
  function createDeferred() {
@@ -1181,6 +1244,11 @@ var BaseParserContext = class {
1181
1244
  isMarked(id) {
1182
1245
  return this.marked.has(id);
1183
1246
  }
1247
+ createIndex(current) {
1248
+ const id = this.refs.size;
1249
+ this.refs.set(current, id);
1250
+ return id;
1251
+ }
1184
1252
  getIndexedValue(current) {
1185
1253
  const registeredId = this.refs.get(current);
1186
1254
  if (registeredId != null) {
@@ -1190,11 +1258,9 @@ var BaseParserContext = class {
1190
1258
  value: createIndexedValueNode(registeredId)
1191
1259
  };
1192
1260
  }
1193
- const id = this.refs.size;
1194
- this.refs.set(current, id);
1195
1261
  return {
1196
1262
  type: 0 /* Fresh */,
1197
- value: id
1263
+ value: this.createIndex(current)
1198
1264
  };
1199
1265
  }
1200
1266
  getReference(current) {
@@ -1210,17 +1276,6 @@ var BaseParserContext = class {
1210
1276
  }
1211
1277
  return indexed;
1212
1278
  }
1213
- getStrictReference(current) {
1214
- assert(hasReferenceID(current), new SerovalUnsupportedTypeError(current));
1215
- const result = this.getIndexedValue(current);
1216
- if (result.type === 1 /* Indexed */) {
1217
- return result.value;
1218
- }
1219
- return createReferenceNode(result.value, current);
1220
- }
1221
- parseFunction(current) {
1222
- return this.getStrictReference(current);
1223
- }
1224
1279
  parseWellKnownSymbol(current) {
1225
1280
  const ref = this.getReference(current);
1226
1281
  if (ref.type !== 0 /* Fresh */) {
@@ -1324,11 +1379,11 @@ var BaseParserContext = class {
1324
1379
  NIL
1325
1380
  );
1326
1381
  }
1327
- createPromiseConstructorNode(id) {
1382
+ createPromiseConstructorNode(id, resolver) {
1328
1383
  return createSerovalNode(
1329
1384
  22 /* PromiseConstructor */,
1330
1385
  id,
1331
- NIL,
1386
+ resolver,
1332
1387
  NIL,
1333
1388
  NIL,
1334
1389
  NIL,
@@ -1340,22 +1395,6 @@ var BaseParserContext = class {
1340
1395
  NIL
1341
1396
  );
1342
1397
  }
1343
- createAbortSignalConstructorNode(id) {
1344
- return createSerovalNode(
1345
- 35 /* AbortSignalConstructor */,
1346
- id,
1347
- NIL,
1348
- NIL,
1349
- NIL,
1350
- NIL,
1351
- NIL,
1352
- NIL,
1353
- NIL,
1354
- this.parseSpecialReference(5 /* AbortSignalConstructor */),
1355
- NIL,
1356
- NIL
1357
- );
1358
- }
1359
1398
  };
1360
1399
 
1361
1400
  // src/core/context/parser/async.ts
@@ -1364,7 +1403,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1364
1403
  const nodes = [];
1365
1404
  for (let i = 0, len = current.length; i < len; i++) {
1366
1405
  if (i in current) {
1367
- nodes[i] = await this.parse(current[i]);
1406
+ nodes[i] = await this.parseTop(current[i]);
1368
1407
  }
1369
1408
  }
1370
1409
  return nodes;
@@ -1378,7 +1417,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1378
1417
  const valueNodes = [];
1379
1418
  for (let i = 0, len = entries.length; i < len; i++) {
1380
1419
  keyNodes.push(serializeString(entries[i][0]));
1381
- valueNodes.push(await this.parse(entries[i][1]));
1420
+ valueNodes.push(await this.parseTop(entries[i][1]));
1382
1421
  }
1383
1422
  let symbol = Symbol.iterator;
1384
1423
  if (symbol in properties) {
@@ -1386,7 +1425,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1386
1425
  valueNodes.push(
1387
1426
  createIteratorFactoryInstanceNode(
1388
1427
  this.parseIteratorFactory(),
1389
- await this.parse(
1428
+ await this.parseTop(
1390
1429
  iteratorToSequence(properties)
1391
1430
  )
1392
1431
  )
@@ -1398,7 +1437,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1398
1437
  valueNodes.push(
1399
1438
  createAsyncIteratorFactoryInstanceNode(
1400
1439
  this.parseAsyncIteratorFactory(),
1401
- await this.parse(
1440
+ await this.parseTop(
1402
1441
  createStreamFromAsyncIterable(
1403
1442
  properties
1404
1443
  )
@@ -1431,20 +1470,24 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1431
1470
  );
1432
1471
  }
1433
1472
  async parseBoxed(id, current) {
1434
- return createBoxedNode(id, await this.parse(current.valueOf()));
1473
+ return createBoxedNode(id, await this.parseTop(current.valueOf()));
1435
1474
  }
1436
1475
  async parseTypedArray(id, current) {
1437
- return createTypedArrayNode(id, current, await this.parse(current.buffer));
1476
+ return createTypedArrayNode(
1477
+ id,
1478
+ current,
1479
+ await this.parseTop(current.buffer)
1480
+ );
1438
1481
  }
1439
1482
  async parseBigIntTypedArray(id, current) {
1440
1483
  return createBigIntTypedArrayNode(
1441
1484
  id,
1442
1485
  current,
1443
- await this.parse(current.buffer)
1486
+ await this.parseTop(current.buffer)
1444
1487
  );
1445
1488
  }
1446
1489
  async parseDataView(id, current) {
1447
- return createDataViewNode(id, current, await this.parse(current.buffer));
1490
+ return createDataViewNode(id, current, await this.parseTop(current.buffer));
1448
1491
  }
1449
1492
  async parseError(id, current) {
1450
1493
  const options = getErrorOptions(current, this.features);
@@ -1466,15 +1509,15 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1466
1509
  const keyNodes = [];
1467
1510
  const valueNodes = [];
1468
1511
  for (const [key, value] of current.entries()) {
1469
- keyNodes.push(await this.parse(key));
1470
- valueNodes.push(await this.parse(value));
1512
+ keyNodes.push(await this.parseTop(key));
1513
+ valueNodes.push(await this.parseTop(value));
1471
1514
  }
1472
1515
  return this.createMapNode(id, keyNodes, valueNodes, current.size);
1473
1516
  }
1474
1517
  async parseSet(id, current) {
1475
1518
  const items = [];
1476
1519
  for (const item of current.keys()) {
1477
- items.push(await this.parse(item));
1520
+ items.push(await this.parseTop(item));
1478
1521
  }
1479
1522
  return createSetNode(id, current.size, items);
1480
1523
  }
@@ -1490,7 +1533,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1490
1533
  NIL,
1491
1534
  NIL,
1492
1535
  NIL,
1493
- await this.parse(result),
1536
+ await this.parseTop(result),
1494
1537
  NIL,
1495
1538
  NIL
1496
1539
  );
@@ -1522,7 +1565,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1522
1565
  const cleanup = current.on({
1523
1566
  next: (value) => {
1524
1567
  this.markRef(id);
1525
- this.parse(value).then(
1568
+ this.parseTop(value).then(
1526
1569
  (data) => {
1527
1570
  sequence.push(createStreamNextNode(id, data));
1528
1571
  },
@@ -1534,7 +1577,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1534
1577
  },
1535
1578
  throw: (value) => {
1536
1579
  this.markRef(id);
1537
- this.parse(value).then(
1580
+ this.parseTop(value).then(
1538
1581
  (data) => {
1539
1582
  sequence.push(createStreamThrowNode(id, data));
1540
1583
  resolve(sequence);
@@ -1548,7 +1591,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1548
1591
  },
1549
1592
  return: (value) => {
1550
1593
  this.markRef(id);
1551
- this.parse(value).then(
1594
+ this.parseTop(value).then(
1552
1595
  (data) => {
1553
1596
  sequence.push(createStreamReturnNode(id, data));
1554
1597
  resolve(sequence);
@@ -1564,28 +1607,6 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1564
1607
  })
1565
1608
  );
1566
1609
  }
1567
- async parseAbortSignalSync(id, current) {
1568
- return createSerovalNode(
1569
- 37 /* AbortSignalSync */,
1570
- id,
1571
- NIL,
1572
- NIL,
1573
- NIL,
1574
- NIL,
1575
- NIL,
1576
- NIL,
1577
- NIL,
1578
- await this.parse(current.reason),
1579
- NIL,
1580
- NIL
1581
- );
1582
- }
1583
- async parseAbortSignal(id, current) {
1584
- if (!current.aborted) {
1585
- await abortSignalToPromise(current);
1586
- }
1587
- return this.parseAbortSignalSync(id, current);
1588
- }
1589
1610
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: ehh
1590
1611
  async parseObject(id, current) {
1591
1612
  if (Array.isArray(current)) {
@@ -1596,7 +1617,7 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1596
1617
  }
1597
1618
  const currentClass = current.constructor;
1598
1619
  if (currentClass === OpaqueReference) {
1599
- return this.parse(
1620
+ return this.parseTop(
1600
1621
  current.replacement
1601
1622
  );
1602
1623
  }
@@ -1659,9 +1680,6 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1659
1680
  return this.parsePromise(id, current);
1660
1681
  }
1661
1682
  const currentFeatures = this.features;
1662
- if (currentFeatures & 32 /* AbortSignal */ && typeof AbortSignal !== "undefined" && currentClass === AbortSignal) {
1663
- return this.parseAbortSignal(id, current);
1664
- }
1665
1683
  if (currentFeatures & 16 /* BigIntTypedArray */) {
1666
1684
  switch (currentClass) {
1667
1685
  case BigInt64Array:
@@ -1685,35 +1703,49 @@ var BaseAsyncParserContext = class extends BaseParserContext {
1685
1703
  }
1686
1704
  throw new SerovalUnsupportedTypeError(current);
1687
1705
  }
1688
- async parse(current) {
1689
- try {
1690
- switch (typeof current) {
1691
- case "boolean":
1692
- return current ? TRUE_NODE : FALSE_NODE;
1693
- case "undefined":
1694
- return UNDEFINED_NODE;
1695
- case "string":
1696
- return createStringNode(current);
1697
- case "number":
1698
- return createNumberNode(current);
1699
- case "bigint":
1700
- return createBigIntNode(current);
1701
- case "object": {
1702
- if (current) {
1703
- const ref = this.getReference(current);
1704
- return ref.type === 0 ? await this.parseObject(ref.value, current) : ref.value;
1705
- }
1706
- return NULL_NODE;
1706
+ async parseFunction(current) {
1707
+ const ref = this.getReference(current);
1708
+ if (ref.type !== 0 /* Fresh */) {
1709
+ return ref.value;
1710
+ }
1711
+ const plugin = await this.parsePlugin(ref.value, current);
1712
+ if (plugin) {
1713
+ return plugin;
1714
+ }
1715
+ throw new SerovalUnsupportedTypeError(current);
1716
+ }
1717
+ async parseTop(current) {
1718
+ switch (typeof current) {
1719
+ case "boolean":
1720
+ return current ? TRUE_NODE : FALSE_NODE;
1721
+ case "undefined":
1722
+ return UNDEFINED_NODE;
1723
+ case "string":
1724
+ return createStringNode(current);
1725
+ case "number":
1726
+ return createNumberNode(current);
1727
+ case "bigint":
1728
+ return createBigIntNode(current);
1729
+ case "object": {
1730
+ if (current) {
1731
+ const ref = this.getReference(current);
1732
+ return ref.type === 0 ? await this.parseObject(ref.value, current) : ref.value;
1707
1733
  }
1708
- case "symbol":
1709
- return this.parseWellKnownSymbol(current);
1710
- case "function":
1711
- return this.parseFunction(current);
1712
- default:
1713
- throw new SerovalUnsupportedTypeError(current);
1734
+ return NULL_NODE;
1714
1735
  }
1736
+ case "symbol":
1737
+ return this.parseWellKnownSymbol(current);
1738
+ case "function":
1739
+ return this.parseFunction(current);
1740
+ default:
1741
+ throw new SerovalUnsupportedTypeError(current);
1742
+ }
1743
+ }
1744
+ async parse(current) {
1745
+ try {
1746
+ return await this.parseTop(current);
1715
1747
  } catch (error) {
1716
- throw new SerovalParserError(error);
1748
+ throw error instanceof SerovalParserError ? error : new SerovalParserError(error);
1717
1749
  }
1718
1750
  }
1719
1751
  };
@@ -1984,21 +2016,6 @@ var BaseDeserializerContext = class {
1984
2016
  this.deserialize(node.a[1]);
1985
2017
  return void 0;
1986
2018
  }
1987
- deserializeAbortSignalConstructor(node) {
1988
- return this.assignIndexedValue(node.i, new AbortController()).signal;
1989
- }
1990
- deserializeAbortSignalAbort(node) {
1991
- const controller = this.refs.get(node.i);
1992
- assert(controller, new SerovalMissingInstanceError("AbortSignal"));
1993
- controller.abort(this.deserialize(node.a[1]));
1994
- return void 0;
1995
- }
1996
- deserializeAbortSignalSync(node) {
1997
- return this.assignIndexedValue(
1998
- node.i,
1999
- AbortSignal.abort(this.deserialize(node.f))
2000
- );
2001
- }
2002
2019
  deserialize(node) {
2003
2020
  try {
2004
2021
  switch (node.t) {
@@ -2048,9 +2065,9 @@ var BaseDeserializerContext = class {
2048
2065
  return this.deserializePlugin(node);
2049
2066
  case 22 /* PromiseConstructor */:
2050
2067
  return this.deserializePromiseConstructor(node);
2051
- case 23 /* PromiseResolve */:
2068
+ case 23 /* PromiseSuccess */:
2052
2069
  return this.deserializePromiseResolve(node);
2053
- case 24 /* PromiseReject */:
2070
+ case 24 /* PromiseFailure */:
2054
2071
  return this.deserializePromiseReject(node);
2055
2072
  case 28 /* IteratorFactoryInstance */:
2056
2073
  return this.deserializeIteratorFactoryInstance(node);
@@ -2068,12 +2085,6 @@ var BaseDeserializerContext = class {
2068
2085
  return this.deserializeIteratorFactory(node);
2069
2086
  case 29 /* AsyncIteratorFactory */:
2070
2087
  return this.deserializeAsyncIteratorFactory(node);
2071
- case 36 /* AbortSignalAbort */:
2072
- return this.deserializeAbortSignalAbort(node);
2073
- case 35 /* AbortSignalConstructor */:
2074
- return this.deserializeAbortSignalConstructor(node);
2075
- case 37 /* AbortSignalSync */:
2076
- return this.deserializeAbortSignalSync(node);
2077
2088
  // case SerovalNodeType.SpecialReference:
2078
2089
  default:
2079
2090
  throw new SerovalUnsupportedNodeError(node);
@@ -2204,18 +2215,10 @@ var BaseSerializerContext = class {
2204
2215
  this.marked = new Set(options.markedRefs);
2205
2216
  }
2206
2217
  createFunction(parameters, body) {
2207
- if (this.features & 2 /* ArrowFunction */) {
2208
- const joined = parameters.length === 1 ? parameters[0] : "(" + parameters.join(",") + ")";
2209
- return joined + "=>" + (body.startsWith("{") ? "(" + body + ")" : body);
2210
- }
2211
- return "function(" + parameters.join(",") + "){return " + body + "}";
2218
+ return createFunction(this.features, parameters, body);
2212
2219
  }
2213
2220
  createEffectfulFunction(parameters, body) {
2214
- if (this.features & 2 /* ArrowFunction */) {
2215
- const joined = parameters.length === 1 ? parameters[0] : "(" + parameters.join(",") + ")";
2216
- return joined + "=>{" + body + "}";
2217
- }
2218
- return "function(" + parameters.join(",") + "){" + body + "}";
2221
+ return createEffectfulFunction(this.features, parameters, body);
2219
2222
  }
2220
2223
  /**
2221
2224
  * A tiny function that tells if a reference
@@ -2684,7 +2687,11 @@ var BaseSerializerContext = class {
2684
2687
  return current === this.getRefParam(node.i) ? current : "(" + current + ")";
2685
2688
  }
2686
2689
  serializePromiseConstructor(node) {
2687
- return this.assignIndexedValue(node.i, this.getConstructor(node.f) + "()");
2690
+ const resolver = this.assignIndexedValue(node.s, "{p:0,s:0,f:0}");
2691
+ return this.assignIndexedValue(
2692
+ node.i,
2693
+ this.getConstructor(node.f) + "(" + resolver + ")"
2694
+ );
2688
2695
  }
2689
2696
  serializePromiseResolve(node) {
2690
2697
  return this.getConstructor(node.a[0]) + "(" + this.getRefParam(node.i) + "," + this.serialize(node.a[1]) + ")";
@@ -2692,63 +2699,10 @@ var BaseSerializerContext = class {
2692
2699
  serializePromiseReject(node) {
2693
2700
  return this.getConstructor(node.a[0]) + "(" + this.getRefParam(node.i) + "," + this.serialize(node.a[1]) + ")";
2694
2701
  }
2695
- serializeSpecialReferenceValue(ref) {
2696
- switch (ref) {
2697
- case 0 /* MapSentinel */:
2698
- return "[]";
2699
- case 1 /* PromiseConstructor */:
2700
- return this.createFunction(
2701
- ["s", "f", "p"],
2702
- "((p=new Promise(" + this.createEffectfulFunction(["a", "b"], "s=a,f=b") + ")).s=s,p.f=f,p)"
2703
- );
2704
- case 2 /* PromiseResolve */:
2705
- return this.createEffectfulFunction(
2706
- ["p", "d"],
2707
- 'p.s(d),p.status="success",p.value=d;delete p.s;delete p.f'
2708
- );
2709
- case 3 /* PromiseReject */:
2710
- return this.createEffectfulFunction(
2711
- ["p", "d"],
2712
- 'p.f(d),p.status="failure",p.value=d;delete p.s;delete p.f'
2713
- );
2714
- case 4 /* StreamConstructor */:
2715
- return this.createFunction(
2716
- ["b", "a", "s", "l", "p", "f", "e", "n"],
2717
- "(b=[],a=!0,s=!1,l=[],p=0,f=" + this.createEffectfulFunction(
2718
- ["v", "m", "x"],
2719
- "for(x=0;x<p;x++)l[x]&&l[x][m](v)"
2720
- ) + ",n=" + this.createEffectfulFunction(
2721
- ["o", "x", "z", "c"],
2722
- 'for(x=0,z=b.length;x<z;x++)(c=b[x],(!a&&x===z-1)?o[s?"return":"throw"](c):o.next(c))'
2723
- ) + ",e=" + this.createFunction(
2724
- ["o", "t"],
2725
- "(a&&(l[t=p++]=o),n(o)," + this.createEffectfulFunction([], "a&&(l[t]=void 0)") + ")"
2726
- ) + ",{__SEROVAL_STREAM__:!0,on:" + this.createFunction(["o"], "e(o)") + ",next:" + this.createEffectfulFunction(["v"], 'a&&(b.push(v),f(v,"next"))') + ",throw:" + this.createEffectfulFunction(
2727
- ["v"],
2728
- 'a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)'
2729
- ) + ",return:" + this.createEffectfulFunction(
2730
- ["v"],
2731
- 'a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)'
2732
- ) + "})"
2733
- );
2734
- case 5 /* AbortSignalConstructor */:
2735
- return this.createFunction(
2736
- ["a", "s"],
2737
- "((s=(a=new AbortController).signal).a=a,s)"
2738
- );
2739
- case 6 /* AbortSignalAbort */:
2740
- return this.createEffectfulFunction(
2741
- ["s", "r"],
2742
- "s.a.abort(r);delete s.a"
2743
- );
2744
- default:
2745
- return "";
2746
- }
2747
- }
2748
2702
  serializeSpecialReference(node) {
2749
2703
  return this.assignIndexedValue(
2750
2704
  node.i,
2751
- this.serializeSpecialReferenceValue(node.s)
2705
+ serializeSpecialReferenceValue(this.features, node.s)
2752
2706
  );
2753
2707
  }
2754
2708
  serializeIteratorFactory(node) {
@@ -2852,18 +2806,6 @@ var BaseSerializerContext = class {
2852
2806
  serializeStreamReturn(node) {
2853
2807
  return this.getRefParam(node.i) + ".return(" + this.serialize(node.f) + ")";
2854
2808
  }
2855
- serializeAbortSignalSync(node) {
2856
- return this.assignIndexedValue(
2857
- node.i,
2858
- "AbortSignal.abort(" + this.serialize(node.f) + ")"
2859
- );
2860
- }
2861
- serializeAbortSignalConstructor(node) {
2862
- return this.assignIndexedValue(node.i, this.getConstructor(node.f) + "()");
2863
- }
2864
- serializeAbortSignalAbort(node) {
2865
- return this.getConstructor(node.a[0]) + "(" + this.getRefParam(node.i) + "," + this.serialize(node.a[1]) + ")";
2866
- }
2867
2809
  serialize(node) {
2868
2810
  try {
2869
2811
  switch (node.t) {
@@ -2912,9 +2854,9 @@ var BaseSerializerContext = class {
2912
2854
  return this.serializeBoxed(node);
2913
2855
  case 22 /* PromiseConstructor */:
2914
2856
  return this.serializePromiseConstructor(node);
2915
- case 23 /* PromiseResolve */:
2857
+ case 23 /* PromiseSuccess */:
2916
2858
  return this.serializePromiseResolve(node);
2917
- case 24 /* PromiseReject */:
2859
+ case 24 /* PromiseFailure */:
2918
2860
  return this.serializePromiseReject(node);
2919
2861
  case 25 /* Plugin */:
2920
2862
  return this.serializePlugin(node);
@@ -2936,12 +2878,6 @@ var BaseSerializerContext = class {
2936
2878
  return this.serializeStreamThrow(node);
2937
2879
  case 34 /* StreamReturn */:
2938
2880
  return this.serializeStreamReturn(node);
2939
- case 36 /* AbortSignalAbort */:
2940
- return this.serializeAbortSignalAbort(node);
2941
- case 35 /* AbortSignalConstructor */:
2942
- return this.serializeAbortSignalConstructor(node);
2943
- case 37 /* AbortSignalSync */:
2944
- return this.serializeAbortSignalSync(node);
2945
2881
  default:
2946
2882
  throw new SerovalUnsupportedNodeError(node);
2947
2883
  }
@@ -2991,7 +2927,7 @@ var BaseSyncParserContext = class extends BaseParserContext {
2991
2927
  const nodes = [];
2992
2928
  for (let i = 0, len = current.length; i < len; i++) {
2993
2929
  if (i in current) {
2994
- nodes[i] = this.parse(current[i]);
2930
+ nodes[i] = this.parseTop(current[i]);
2995
2931
  }
2996
2932
  }
2997
2933
  return nodes;
@@ -3005,7 +2941,7 @@ var BaseSyncParserContext = class extends BaseParserContext {
3005
2941
  const valueNodes = [];
3006
2942
  for (let i = 0, len = entries.length; i < len; i++) {
3007
2943
  keyNodes.push(serializeString(entries[i][0]));
3008
- valueNodes.push(this.parse(entries[i][1]));
2944
+ valueNodes.push(this.parseTop(entries[i][1]));
3009
2945
  }
3010
2946
  let symbol = Symbol.iterator;
3011
2947
  if (symbol in properties) {
@@ -3013,7 +2949,7 @@ var BaseSyncParserContext = class extends BaseParserContext {
3013
2949
  valueNodes.push(
3014
2950
  createIteratorFactoryInstanceNode(
3015
2951
  this.parseIteratorFactory(),
3016
- this.parse(
2952
+ this.parseTop(
3017
2953
  iteratorToSequence(properties)
3018
2954
  )
3019
2955
  )
@@ -3025,7 +2961,7 @@ var BaseSyncParserContext = class extends BaseParserContext {
3025
2961
  valueNodes.push(
3026
2962
  createAsyncIteratorFactoryInstanceNode(
3027
2963
  this.parseAsyncIteratorFactory(),
3028
- this.parse(createStream())
2964
+ this.parseTop(createStream())
3029
2965
  )
3030
2966
  );
3031
2967
  }
@@ -3054,16 +2990,20 @@ var BaseSyncParserContext = class extends BaseParserContext {
3054
2990
  );
3055
2991
  }
3056
2992
  parseBoxed(id, current) {
3057
- return createBoxedNode(id, this.parse(current.valueOf()));
2993
+ return createBoxedNode(id, this.parseTop(current.valueOf()));
3058
2994
  }
3059
2995
  parseTypedArray(id, current) {
3060
- return createTypedArrayNode(id, current, this.parse(current.buffer));
2996
+ return createTypedArrayNode(id, current, this.parseTop(current.buffer));
3061
2997
  }
3062
2998
  parseBigIntTypedArray(id, current) {
3063
- return createBigIntTypedArrayNode(id, current, this.parse(current.buffer));
2999
+ return createBigIntTypedArrayNode(
3000
+ id,
3001
+ current,
3002
+ this.parseTop(current.buffer)
3003
+ );
3064
3004
  }
3065
3005
  parseDataView(id, current) {
3066
- return createDataViewNode(id, current, this.parse(current.buffer));
3006
+ return createDataViewNode(id, current, this.parseTop(current.buffer));
3067
3007
  }
3068
3008
  parseError(id, current) {
3069
3009
  const options = getErrorOptions(current, this.features);
@@ -3085,15 +3025,15 @@ var BaseSyncParserContext = class extends BaseParserContext {
3085
3025
  const keyNodes = [];
3086
3026
  const valueNodes = [];
3087
3027
  for (const [key, value] of current.entries()) {
3088
- keyNodes.push(this.parse(key));
3089
- valueNodes.push(this.parse(value));
3028
+ keyNodes.push(this.parseTop(key));
3029
+ valueNodes.push(this.parseTop(value));
3090
3030
  }
3091
3031
  return this.createMapNode(id, keyNodes, valueNodes, current.size);
3092
3032
  }
3093
3033
  parseSet(id, current) {
3094
3034
  const items = [];
3095
3035
  for (const item of current.keys()) {
3096
- items.push(this.parse(item));
3036
+ items.push(this.parseTop(item));
3097
3037
  }
3098
3038
  return createSetNode(id, current.size, items);
3099
3039
  }
@@ -3123,29 +3063,7 @@ var BaseSyncParserContext = class extends BaseParserContext {
3123
3063
  );
3124
3064
  }
3125
3065
  parsePromise(id, _current) {
3126
- return this.createPromiseConstructorNode(id);
3127
- }
3128
- parseAbortSignalSync(id, current) {
3129
- return createSerovalNode(
3130
- 37 /* AbortSignalSync */,
3131
- id,
3132
- NIL,
3133
- NIL,
3134
- NIL,
3135
- NIL,
3136
- NIL,
3137
- NIL,
3138
- NIL,
3139
- this.parse(current.reason),
3140
- NIL,
3141
- NIL
3142
- );
3143
- }
3144
- parseAbortSignal(id, current) {
3145
- if (current.aborted) {
3146
- return this.parseAbortSignalSync(id, current);
3147
- }
3148
- return this.createAbortSignalConstructorNode(id);
3066
+ return this.createPromiseConstructorNode(id, this.createIndex({}));
3149
3067
  }
3150
3068
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: ehh
3151
3069
  parseObject(id, current) {
@@ -3157,7 +3075,7 @@ var BaseSyncParserContext = class extends BaseParserContext {
3157
3075
  }
3158
3076
  const currentClass = current.constructor;
3159
3077
  if (currentClass === OpaqueReference) {
3160
- return this.parse(
3078
+ return this.parseTop(
3161
3079
  current.replacement
3162
3080
  );
3163
3081
  }
@@ -3220,9 +3138,6 @@ var BaseSyncParserContext = class extends BaseParserContext {
3220
3138
  return this.parsePromise(id, current);
3221
3139
  }
3222
3140
  const currentFeatures = this.features;
3223
- if (currentFeatures & 32 /* AbortSignal */ && typeof AbortSignal !== "undefined" && currentClass === AbortSignal) {
3224
- return this.parseAbortSignal(id, current);
3225
- }
3226
3141
  if (currentFeatures & 16 /* BigIntTypedArray */) {
3227
3142
  switch (currentClass) {
3228
3143
  case BigInt64Array:
@@ -3246,35 +3161,50 @@ var BaseSyncParserContext = class extends BaseParserContext {
3246
3161
  }
3247
3162
  throw new SerovalUnsupportedTypeError(current);
3248
3163
  }
3249
- parse(current) {
3250
- try {
3251
- switch (typeof current) {
3252
- case "boolean":
3253
- return current ? TRUE_NODE : FALSE_NODE;
3254
- case "undefined":
3255
- return UNDEFINED_NODE;
3256
- case "string":
3257
- return createStringNode(current);
3258
- case "number":
3259
- return createNumberNode(current);
3260
- case "bigint":
3261
- return createBigIntNode(current);
3262
- case "object": {
3263
- if (current) {
3264
- const ref = this.getReference(current);
3265
- return ref.type === 0 ? this.parseObject(ref.value, current) : ref.value;
3266
- }
3267
- return NULL_NODE;
3164
+ parseFunction(current) {
3165
+ const ref = this.getReference(current);
3166
+ if (ref.type !== 0 /* Fresh */) {
3167
+ return ref.value;
3168
+ }
3169
+ const plugin = this.parsePlugin(ref.value, current);
3170
+ if (plugin) {
3171
+ return plugin;
3172
+ }
3173
+ throw new SerovalUnsupportedTypeError(current);
3174
+ }
3175
+ parseTop(current) {
3176
+ switch (typeof current) {
3177
+ case "boolean":
3178
+ return current ? TRUE_NODE : FALSE_NODE;
3179
+ case "undefined":
3180
+ return UNDEFINED_NODE;
3181
+ case "string":
3182
+ return createStringNode(current);
3183
+ case "number":
3184
+ return createNumberNode(current);
3185
+ case "bigint":
3186
+ return createBigIntNode(current);
3187
+ case "object": {
3188
+ if (current) {
3189
+ const ref = this.getReference(current);
3190
+ return ref.type === 0 /* Fresh */ ? this.parseObject(ref.value, current) : ref.value;
3268
3191
  }
3269
- case "symbol":
3270
- return this.parseWellKnownSymbol(current);
3271
- case "function":
3272
- return this.parseFunction(current);
3273
- default:
3274
- throw new SerovalUnsupportedTypeError(current);
3192
+ return NULL_NODE;
3193
+ }
3194
+ case "symbol":
3195
+ return this.parseWellKnownSymbol(current);
3196
+ case "function": {
3197
+ return this.parseFunction(current);
3275
3198
  }
3199
+ default:
3200
+ throw new SerovalUnsupportedTypeError(current);
3201
+ }
3202
+ }
3203
+ parse(current) {
3204
+ try {
3205
+ return this.parseTop(current);
3276
3206
  } catch (error) {
3277
- throw new SerovalParserError(error);
3207
+ throw error instanceof SerovalParserError ? error : new SerovalParserError(error);
3278
3208
  }
3279
3209
  }
3280
3210
  };
@@ -3338,7 +3268,7 @@ var BaseStreamParserContext = class extends BaseSyncParserContext {
3338
3268
  const valueNodes = [];
3339
3269
  for (let i = 0, len = entries.length; i < len; i++) {
3340
3270
  keyNodes.push(serializeString(entries[i][0]));
3341
- valueNodes.push(this.parse(entries[i][1]));
3271
+ valueNodes.push(this.parseTop(entries[i][1]));
3342
3272
  }
3343
3273
  let symbol = Symbol.iterator;
3344
3274
  if (symbol in properties) {
@@ -3346,7 +3276,7 @@ var BaseStreamParserContext = class extends BaseSyncParserContext {
3346
3276
  valueNodes.push(
3347
3277
  createIteratorFactoryInstanceNode(
3348
3278
  this.parseIteratorFactory(),
3349
- this.parse(
3279
+ this.parseTop(
3350
3280
  iteratorToSequence(properties)
3351
3281
  )
3352
3282
  )
@@ -3358,7 +3288,7 @@ var BaseStreamParserContext = class extends BaseSyncParserContext {
3358
3288
  valueNodes.push(
3359
3289
  createAsyncIteratorFactoryInstanceNode(
3360
3290
  this.parseAsyncIteratorFactory(),
3361
- this.parse(
3291
+ this.parseTop(
3362
3292
  createStreamFromAsyncIterable(
3363
3293
  properties
3364
3294
  )
@@ -3382,63 +3312,63 @@ var BaseStreamParserContext = class extends BaseSyncParserContext {
3382
3312
  s: keyNodes.length
3383
3313
  };
3384
3314
  }
3315
+ handlePromiseSuccess(id, data) {
3316
+ const parsed = this.parseWithError(data);
3317
+ if (parsed) {
3318
+ this.onParse(
3319
+ createSerovalNode(
3320
+ 23 /* PromiseSuccess */,
3321
+ id,
3322
+ NIL,
3323
+ NIL,
3324
+ NIL,
3325
+ NIL,
3326
+ NIL,
3327
+ NIL,
3328
+ [this.parseSpecialReference(2 /* PromiseSuccess */), parsed],
3329
+ NIL,
3330
+ NIL,
3331
+ NIL
3332
+ )
3333
+ );
3334
+ }
3335
+ this.popPendingState();
3336
+ }
3337
+ handlePromiseFailure(id, data) {
3338
+ if (this.alive) {
3339
+ const parsed = this.parseWithError(data);
3340
+ if (parsed) {
3341
+ this.onParse(
3342
+ createSerovalNode(
3343
+ 24 /* PromiseFailure */,
3344
+ id,
3345
+ NIL,
3346
+ NIL,
3347
+ NIL,
3348
+ NIL,
3349
+ NIL,
3350
+ NIL,
3351
+ [
3352
+ this.parseSpecialReference(3 /* PromiseFailure */),
3353
+ parsed
3354
+ ],
3355
+ NIL,
3356
+ NIL,
3357
+ NIL
3358
+ )
3359
+ );
3360
+ }
3361
+ }
3362
+ this.popPendingState();
3363
+ }
3385
3364
  parsePromise(id, current) {
3365
+ const resolver = this.createIndex({});
3386
3366
  current.then(
3387
- (data) => {
3388
- const parsed = this.parseWithError(data);
3389
- if (parsed) {
3390
- this.onParse(
3391
- createSerovalNode(
3392
- 23 /* PromiseResolve */,
3393
- id,
3394
- NIL,
3395
- NIL,
3396
- NIL,
3397
- NIL,
3398
- NIL,
3399
- NIL,
3400
- [
3401
- this.parseSpecialReference(2 /* PromiseResolve */),
3402
- parsed
3403
- ],
3404
- NIL,
3405
- NIL,
3406
- NIL
3407
- )
3408
- );
3409
- }
3410
- this.popPendingState();
3411
- },
3412
- (data) => {
3413
- if (this.alive) {
3414
- const parsed = this.parseWithError(data);
3415
- if (parsed) {
3416
- this.onParse(
3417
- createSerovalNode(
3418
- 24 /* PromiseReject */,
3419
- id,
3420
- NIL,
3421
- NIL,
3422
- NIL,
3423
- NIL,
3424
- NIL,
3425
- NIL,
3426
- [
3427
- this.parseSpecialReference(3 /* PromiseReject */),
3428
- parsed
3429
- ],
3430
- NIL,
3431
- NIL,
3432
- NIL
3433
- )
3434
- );
3435
- }
3436
- }
3437
- this.popPendingState();
3438
- }
3367
+ this.handlePromiseSuccess.bind(this, resolver),
3368
+ this.handlePromiseFailure.bind(this, resolver)
3439
3369
  );
3440
3370
  this.pushPendingState();
3441
- return this.createPromiseConstructorNode(id);
3371
+ return this.createPromiseConstructorNode(id, resolver);
3442
3372
  }
3443
3373
  parsePlugin(id, current) {
3444
3374
  const currentPlugins = this.plugins;
@@ -3495,47 +3425,9 @@ var BaseStreamParserContext = class extends BaseSyncParserContext {
3495
3425
  });
3496
3426
  return result;
3497
3427
  }
3498
- parseAbortSignal(id, current) {
3499
- if (current.aborted) {
3500
- return this.parseAbortSignalSync(id, current);
3501
- }
3502
- this.pushPendingState();
3503
- current.addEventListener(
3504
- "abort",
3505
- () => {
3506
- if (this.alive) {
3507
- const parsed = this.parseWithError(current.reason);
3508
- if (parsed) {
3509
- this.onParse(
3510
- createSerovalNode(
3511
- 36 /* AbortSignalAbort */,
3512
- id,
3513
- NIL,
3514
- NIL,
3515
- NIL,
3516
- NIL,
3517
- NIL,
3518
- NIL,
3519
- [
3520
- this.parseSpecialReference(6 /* AbortSignalAbort */),
3521
- parsed
3522
- ],
3523
- NIL,
3524
- NIL,
3525
- NIL
3526
- )
3527
- );
3528
- }
3529
- }
3530
- this.popPendingState();
3531
- },
3532
- { once: true }
3533
- );
3534
- return this.createAbortSignalConstructorNode(id);
3535
- }
3536
3428
  parseWithError(current) {
3537
3429
  try {
3538
- return this.parse(current);
3430
+ return this.parseTop(current);
3539
3431
  } catch (err) {
3540
3432
  this.onError(err);
3541
3433
  return NIL;
@@ -3664,9 +3556,7 @@ function crossSerializeStream(source, options) {
3664
3556
  onDone: options.onDone
3665
3557
  });
3666
3558
  ctx.start(source);
3667
- return () => {
3668
- ctx.destroy();
3669
- };
3559
+ return ctx.destroy.bind(ctx);
3670
3560
  }
3671
3561
  function toCrossJSONStream(source, options) {
3672
3562
  const plugins = resolvePlugins(options.plugins);
@@ -3679,9 +3569,7 @@ function toCrossJSONStream(source, options) {
3679
3569
  onDone: options.onDone
3680
3570
  });
3681
3571
  ctx.start(source);
3682
- return () => {
3683
- ctx.destroy();
3684
- };
3572
+ return ctx.destroy.bind(ctx);
3685
3573
  }
3686
3574
  function fromCrossJSON(source, options) {
3687
3575
  const plugins = resolvePlugins(options.plugins);
@@ -3780,9 +3668,6 @@ var VanillaSerializerContext = class extends BaseSerializerContext {
3780
3668
  serializePromiseReject(node) {
3781
3669
  throw new SerovalUnsupportedNodeError(node);
3782
3670
  }
3783
- serializeAbortSignalAbort(node) {
3784
- throw new SerovalUnsupportedNodeError(node);
3785
- }
3786
3671
  serializeTop(tree) {
3787
3672
  const result = this.serialize(tree);
3788
3673
  if (tree.i != null && this.vars.length) {