seroval 1.0.4 → 1.0.6

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 (63) hide show
  1. package/dist/cjs/development/index.cjs +270 -270
  2. package/dist/cjs/development/index.cjs.map +3 -3
  3. package/dist/cjs/production/index.cjs +4 -4
  4. package/dist/esm/development/index.mjs +270 -270
  5. package/dist/esm/development/index.mjs.map +3 -3
  6. package/dist/esm/production/index.mjs +5 -5
  7. package/dist/types/core/Serializer.d.ts.map +1 -1
  8. package/dist/types/core/base-primitives.d.ts.map +1 -1
  9. package/dist/types/core/constants.d.ts +4 -4
  10. package/dist/types/core/constants.d.ts.map +1 -1
  11. package/dist/types/core/context/deserializer.d.ts +1 -1
  12. package/dist/types/core/context/deserializer.d.ts.map +1 -1
  13. package/dist/types/core/context/parser/async.d.ts +1 -1
  14. package/dist/types/core/context/parser/async.d.ts.map +1 -1
  15. package/dist/types/core/context/parser/stream.d.ts +2 -2
  16. package/dist/types/core/context/parser/stream.d.ts.map +1 -1
  17. package/dist/types/core/context/parser/sync.d.ts +3 -3
  18. package/dist/types/core/context/parser/sync.d.ts.map +1 -1
  19. package/dist/types/core/context/parser.d.ts.map +1 -1
  20. package/dist/types/core/context/serializer.d.ts +1 -1
  21. package/dist/types/core/context/serializer.d.ts.map +1 -1
  22. package/dist/types/core/cross/async.d.ts +1 -1
  23. package/dist/types/core/cross/async.d.ts.map +1 -1
  24. package/dist/types/core/cross/deserializer.d.ts +1 -1
  25. package/dist/types/core/cross/deserializer.d.ts.map +1 -1
  26. package/dist/types/core/cross/serializer.d.ts +1 -1
  27. package/dist/types/core/cross/serializer.d.ts.map +1 -1
  28. package/dist/types/core/errors.d.ts +1 -1
  29. package/dist/types/core/errors.d.ts.map +1 -1
  30. package/dist/types/core/plugin.d.ts +1 -1
  31. package/dist/types/core/plugin.d.ts.map +1 -1
  32. package/dist/types/core/tree/async.d.ts +1 -1
  33. package/dist/types/core/tree/async.d.ts.map +1 -1
  34. package/dist/types/core/tree/deserializer.d.ts +1 -1
  35. package/dist/types/core/tree/deserializer.d.ts.map +1 -1
  36. package/dist/types/core/tree/index.d.ts.map +1 -1
  37. package/dist/types/core/tree/serializer.d.ts +1 -1
  38. package/dist/types/core/tree/serializer.d.ts.map +1 -1
  39. package/dist/types/core/types.d.ts +1 -1
  40. package/dist/types/core/types.d.ts.map +1 -1
  41. package/package.json +4 -5
  42. package/src/core/Serializer.ts +5 -5
  43. package/src/core/base-primitives.ts +4 -4
  44. package/src/core/constants.ts +12 -12
  45. package/src/core/context/deserializer.ts +20 -20
  46. package/src/core/context/parser/async.ts +27 -27
  47. package/src/core/context/parser/stream.ts +5 -5
  48. package/src/core/context/parser/sync.ts +16 -16
  49. package/src/core/context/parser.ts +3 -3
  50. package/src/core/context/serializer.ts +24 -24
  51. package/src/core/cross/async.ts +1 -1
  52. package/src/core/cross/deserializer.ts +1 -1
  53. package/src/core/cross/serializer.ts +2 -2
  54. package/src/core/errors.ts +5 -2
  55. package/src/core/literals.ts +4 -4
  56. package/src/core/plugin.ts +1 -1
  57. package/src/core/reference.ts +2 -2
  58. package/src/core/stream.ts +2 -2
  59. package/src/core/tree/async.ts +1 -1
  60. package/src/core/tree/deserializer.ts +1 -1
  61. package/src/core/tree/index.ts +8 -2
  62. package/src/core/tree/serializer.ts +5 -5
  63. package/src/core/types.ts +2 -2
@@ -66,13 +66,6 @@ var Feature = /* @__PURE__ */ ((Feature2) => {
66
66
  })(Feature || {});
67
67
  var ALL_ENABLED = 31;
68
68
 
69
- // src/core/utils/assert.ts
70
- function assert(cond, error) {
71
- if (!cond) {
72
- throw error;
73
- }
74
- }
75
-
76
69
  // src/core/string.ts
77
70
  function serializeChar(str) {
78
71
  switch (str) {
@@ -164,6 +157,13 @@ function getCrossReferenceHeader(id) {
164
157
  )}"]=[]`;
165
158
  }
166
159
 
160
+ // src/core/utils/assert.ts
161
+ function assert(cond, error) {
162
+ if (!cond) {
163
+ throw error;
164
+ }
165
+ }
166
+
167
167
  // src/core/reference.ts
168
168
  var REFERENCE = /* @__PURE__ */ new Map();
169
169
  var INV_REFERENCE = /* @__PURE__ */ new Map();
@@ -291,20 +291,20 @@ var CONSTANT_STRING = {
291
291
  [3 /* False */]: "!1",
292
292
  [1 /* Undefined */]: "void 0",
293
293
  [0 /* Null */]: "null",
294
- [4 /* NegativeZero */]: "-0",
295
- [5 /* Infinity */]: "1/0",
296
- [6 /* NegativeInfinity */]: "-1/0",
297
- [7 /* NaN */]: "0/0"
294
+ [4 /* NegZero */]: "-0",
295
+ [5 /* Inf */]: "1/0",
296
+ [6 /* NegInf */]: "-1/0",
297
+ [7 /* Nan */]: "0/0"
298
298
  };
299
299
  var CONSTANT_VAL = {
300
300
  [2 /* True */]: true,
301
301
  [3 /* False */]: false,
302
302
  [1 /* Undefined */]: void 0,
303
303
  [0 /* Null */]: null,
304
- [4 /* NegativeZero */]: -0,
305
- [5 /* Infinity */]: Infinity,
306
- [6 /* NegativeInfinity */]: -Infinity,
307
- [7 /* NaN */]: NaN
304
+ [4 /* NegZero */]: -0,
305
+ [5 /* Inf */]: Number.POSITIVE_INFINITY,
306
+ [6 /* NegInf */]: Number.NEGATIVE_INFINITY,
307
+ [7 /* Nan */]: Number.NaN
308
308
  };
309
309
  var ERROR_CONSTRUCTOR_STRING = {
310
310
  [0 /* Error */]: "Error",
@@ -355,15 +355,15 @@ var NULL_NODE = /* @__PURE__ */ createConstantNode(
355
355
  0 /* Null */
356
356
  );
357
357
  var NEG_ZERO_NODE = /* @__PURE__ */ createConstantNode(
358
- 4 /* NegativeZero */
358
+ 4 /* NegZero */
359
359
  );
360
360
  var INFINITY_NODE = /* @__PURE__ */ createConstantNode(
361
- 5 /* Infinity */
361
+ 5 /* Inf */
362
362
  );
363
363
  var NEG_INFINITY_NODE = /* @__PURE__ */ createConstantNode(
364
- 6 /* NegativeInfinity */
364
+ 6 /* NegInf */
365
365
  );
366
- var NAN_NODE = /* @__PURE__ */ createConstantNode(7 /* NaN */);
366
+ var NAN_NODE = /* @__PURE__ */ createConstantNode(7 /* Nan */);
367
367
 
368
368
  // src/core/utils/error.ts
369
369
  function getErrorConstructor(error) {
@@ -434,9 +434,9 @@ function getObjectFlag(obj) {
434
434
  // src/core/base-primitives.ts
435
435
  function createNumberNode(value) {
436
436
  switch (value) {
437
- case Infinity:
437
+ case Number.POSITIVE_INFINITY:
438
438
  return INFINITY_NODE;
439
- case -Infinity:
439
+ case Number.NEGATIVE_INFINITY:
440
440
  return NEG_INFINITY_NODE;
441
441
  }
442
442
  if (value !== value) {
@@ -835,70 +835,6 @@ function createStreamReturnNode(id, parsed) {
835
835
  };
836
836
  }
837
837
 
838
- // src/core/utils/iterator-to-sequence.ts
839
- function iteratorToSequence(source) {
840
- const values = [];
841
- let throwsAt = -1;
842
- let doneAt = -1;
843
- const iterator = source[Symbol.iterator]();
844
- while (true) {
845
- try {
846
- const value = iterator.next();
847
- values.push(value.value);
848
- if (value.done) {
849
- doneAt = values.length - 1;
850
- break;
851
- }
852
- } catch (error) {
853
- throwsAt = values.length;
854
- values.push(error);
855
- }
856
- }
857
- return {
858
- v: values,
859
- t: throwsAt,
860
- d: doneAt
861
- };
862
- }
863
- function sequenceToIterator(sequence) {
864
- return () => {
865
- let index = 0;
866
- return {
867
- [Symbol.iterator]() {
868
- return this;
869
- },
870
- next() {
871
- if (index > sequence.d) {
872
- return {
873
- done: true,
874
- value: void 0
875
- };
876
- }
877
- const currentIndex = index++;
878
- const currentItem = sequence.v[currentIndex];
879
- if (currentIndex === sequence.t) {
880
- throw currentItem;
881
- }
882
- return {
883
- done: currentIndex === sequence.d,
884
- value: currentItem
885
- };
886
- }
887
- };
888
- };
889
- }
890
-
891
- // src/core/special-reference.ts
892
- var ITERATOR = {};
893
- var ASYNC_ITERATOR = {};
894
- var SPECIAL_REFS = {
895
- [0 /* MapSentinel */]: {},
896
- [1 /* PromiseConstructor */]: {},
897
- [2 /* PromiseResolve */]: {},
898
- [3 /* PromiseReject */]: {},
899
- [4 /* StreamConstructor */]: {}
900
- };
901
-
902
838
  // src/core/errors.ts
903
839
  var { toString: objectToString } = Object.prototype;
904
840
  function getErrorMessage(type, cause) {
@@ -984,190 +920,17 @@ var SerovalUnknownTypedArrayError = class extends Error {
984
920
  }
985
921
  };
986
922
 
987
- // src/core/context/parser.ts
988
- var BaseParserContext = class {
989
- constructor(options) {
990
- this.marked = /* @__PURE__ */ new Set();
991
- this.plugins = options.plugins;
992
- this.features = ALL_ENABLED ^ (options.disabledFeatures || 0);
993
- this.refs = options.refs || /* @__PURE__ */ new Map();
994
- }
995
- markRef(id) {
996
- this.marked.add(id);
997
- }
998
- isMarked(id) {
999
- return this.marked.has(id);
1000
- }
1001
- getIndexedValue(current) {
1002
- const registeredId = this.refs.get(current);
1003
- if (registeredId != null) {
1004
- this.markRef(registeredId);
1005
- return {
1006
- type: 1 /* Indexed */,
1007
- value: createIndexedValueNode(registeredId)
1008
- };
1009
- }
1010
- const id = this.refs.size;
1011
- this.refs.set(current, id);
1012
- return {
1013
- type: 0 /* Fresh */,
1014
- value: id
1015
- };
1016
- }
1017
- getReference(current) {
1018
- const indexed = this.getIndexedValue(current);
1019
- if (indexed.type === 1 /* Indexed */) {
1020
- return indexed;
1021
- }
1022
- if (hasReferenceID(current)) {
1023
- return {
1024
- type: 2 /* Referenced */,
1025
- value: createReferenceNode(indexed.value, current)
1026
- };
1027
- }
1028
- return indexed;
1029
- }
1030
- getStrictReference(current) {
1031
- assert(hasReferenceID(current), new SerovalUnsupportedTypeError(current));
1032
- const result = this.getIndexedValue(current);
1033
- if (result.type === 1 /* Indexed */) {
1034
- return result.value;
1035
- }
1036
- return createReferenceNode(result.value, current);
1037
- }
1038
- parseFunction(current) {
1039
- return this.getStrictReference(current);
1040
- }
1041
- parseWellKnownSymbol(current) {
1042
- const ref = this.getReference(current);
1043
- if (ref.type !== 0 /* Fresh */) {
1044
- return ref.value;
1045
- }
1046
- assert(current in INV_SYMBOL_REF, new SerovalUnsupportedTypeError(current));
1047
- return createWKSymbolNode(ref.value, current);
1048
- }
1049
- parseSpecialReference(ref) {
1050
- const result = this.getIndexedValue(SPECIAL_REFS[ref]);
1051
- if (result.type === 1 /* Indexed */) {
1052
- return result.value;
1053
- }
1054
- return {
1055
- t: 26 /* SpecialReference */,
1056
- i: result.value,
1057
- s: ref,
1058
- l: void 0,
1059
- c: void 0,
1060
- m: void 0,
1061
- p: void 0,
1062
- e: void 0,
1063
- a: void 0,
1064
- f: void 0,
1065
- b: void 0,
1066
- o: void 0
1067
- };
1068
- }
1069
- parseIteratorFactory() {
1070
- const result = this.getIndexedValue(ITERATOR);
1071
- if (result.type === 1 /* Indexed */) {
1072
- return result.value;
1073
- }
1074
- return {
1075
- t: 27 /* IteratorFactory */,
1076
- i: result.value,
1077
- s: void 0,
1078
- l: void 0,
1079
- c: void 0,
1080
- m: void 0,
1081
- p: void 0,
1082
- e: void 0,
1083
- a: void 0,
1084
- f: this.parseWellKnownSymbol(Symbol.iterator),
1085
- b: void 0,
1086
- o: void 0
1087
- };
1088
- }
1089
- parseAsyncIteratorFactory() {
1090
- const result = this.getIndexedValue(ASYNC_ITERATOR);
1091
- if (result.type === 1 /* Indexed */) {
1092
- return result.value;
1093
- }
1094
- return {
1095
- t: 29 /* AsyncIteratorFactory */,
1096
- i: result.value,
1097
- s: void 0,
1098
- l: void 0,
1099
- c: void 0,
1100
- m: void 0,
1101
- p: void 0,
1102
- e: void 0,
1103
- a: [
1104
- this.parseSpecialReference(1 /* PromiseConstructor */),
1105
- this.parseWellKnownSymbol(Symbol.asyncIterator)
1106
- ],
1107
- f: void 0,
1108
- b: void 0,
1109
- o: void 0
1110
- };
1111
- }
1112
- createObjectNode(id, current, empty, record) {
1113
- return {
1114
- t: empty ? 11 /* NullConstructor */ : 10 /* Object */,
1115
- i: id,
1116
- s: void 0,
1117
- l: void 0,
1118
- c: void 0,
1119
- m: void 0,
1120
- p: record,
1121
- e: void 0,
1122
- a: void 0,
1123
- f: void 0,
1124
- b: void 0,
1125
- o: getObjectFlag(current)
1126
- };
1127
- }
1128
- createMapNode(id, k, v, s) {
1129
- return {
1130
- t: 8 /* Map */,
1131
- i: id,
1132
- s: void 0,
1133
- l: void 0,
1134
- c: void 0,
1135
- m: void 0,
1136
- p: void 0,
1137
- e: { k, v, s },
1138
- a: void 0,
1139
- f: this.parseSpecialReference(0 /* MapSentinel */),
1140
- b: void 0,
1141
- o: void 0
1142
- };
1143
- }
1144
- createPromiseConstructorNode(id) {
1145
- return {
1146
- t: 22 /* PromiseConstructor */,
1147
- i: id,
1148
- s: void 0,
1149
- l: void 0,
1150
- c: void 0,
1151
- m: void 0,
1152
- p: void 0,
1153
- e: void 0,
1154
- a: void 0,
1155
- f: this.parseSpecialReference(1 /* PromiseConstructor */),
1156
- b: void 0,
1157
- o: void 0
1158
- };
1159
- }
923
+ // src/core/special-reference.ts
924
+ var ITERATOR = {};
925
+ var ASYNC_ITERATOR = {};
926
+ var SPECIAL_REFS = {
927
+ [0 /* MapSentinel */]: {},
928
+ [1 /* PromiseConstructor */]: {},
929
+ [2 /* PromiseResolve */]: {},
930
+ [3 /* PromiseReject */]: {},
931
+ [4 /* StreamConstructor */]: {}
1160
932
  };
1161
933
 
1162
- // src/core/utils/promise-to-result.ts
1163
- async function promiseToResult(current) {
1164
- try {
1165
- return [1, await current];
1166
- } catch (e) {
1167
- return [0, e];
1168
- }
1169
- }
1170
-
1171
934
  // src/core/utils/deferred.ts
1172
935
  function createDeferred() {
1173
936
  let resolve;
@@ -1194,7 +957,7 @@ function createStream() {
1194
957
  const listeners = /* @__PURE__ */ new Set();
1195
958
  const buffer = [];
1196
959
  let alive = true;
1197
- let success = false;
960
+ let success = true;
1198
961
  function flushNext(value) {
1199
962
  for (const listener of listeners.keys()) {
1200
963
  listener.next(value);
@@ -1218,7 +981,7 @@ function createStream() {
1218
981
  }
1219
982
  for (let i = 0, len = buffer.length; i < len; i++) {
1220
983
  const value = buffer[i];
1221
- if (i === len - 1) {
984
+ if (i === len - 1 && !alive) {
1222
985
  if (success) {
1223
986
  listener.return(value);
1224
987
  } else {
@@ -1354,6 +1117,243 @@ function streamToAsyncIterable(stream) {
1354
1117
  };
1355
1118
  }
1356
1119
 
1120
+ // src/core/utils/iterator-to-sequence.ts
1121
+ function iteratorToSequence(source) {
1122
+ const values = [];
1123
+ let throwsAt = -1;
1124
+ let doneAt = -1;
1125
+ const iterator = source[Symbol.iterator]();
1126
+ while (true) {
1127
+ try {
1128
+ const value = iterator.next();
1129
+ values.push(value.value);
1130
+ if (value.done) {
1131
+ doneAt = values.length - 1;
1132
+ break;
1133
+ }
1134
+ } catch (error) {
1135
+ throwsAt = values.length;
1136
+ values.push(error);
1137
+ }
1138
+ }
1139
+ return {
1140
+ v: values,
1141
+ t: throwsAt,
1142
+ d: doneAt
1143
+ };
1144
+ }
1145
+ function sequenceToIterator(sequence) {
1146
+ return () => {
1147
+ let index = 0;
1148
+ return {
1149
+ [Symbol.iterator]() {
1150
+ return this;
1151
+ },
1152
+ next() {
1153
+ if (index > sequence.d) {
1154
+ return {
1155
+ done: true,
1156
+ value: void 0
1157
+ };
1158
+ }
1159
+ const currentIndex = index++;
1160
+ const currentItem = sequence.v[currentIndex];
1161
+ if (currentIndex === sequence.t) {
1162
+ throw currentItem;
1163
+ }
1164
+ return {
1165
+ done: currentIndex === sequence.d,
1166
+ value: currentItem
1167
+ };
1168
+ }
1169
+ };
1170
+ };
1171
+ }
1172
+
1173
+ // src/core/utils/promise-to-result.ts
1174
+ async function promiseToResult(current) {
1175
+ try {
1176
+ return [1, await current];
1177
+ } catch (e) {
1178
+ return [0, e];
1179
+ }
1180
+ }
1181
+
1182
+ // src/core/context/parser.ts
1183
+ var BaseParserContext = class {
1184
+ constructor(options) {
1185
+ this.marked = /* @__PURE__ */ new Set();
1186
+ this.plugins = options.plugins;
1187
+ this.features = ALL_ENABLED ^ (options.disabledFeatures || 0);
1188
+ this.refs = options.refs || /* @__PURE__ */ new Map();
1189
+ }
1190
+ markRef(id) {
1191
+ this.marked.add(id);
1192
+ }
1193
+ isMarked(id) {
1194
+ return this.marked.has(id);
1195
+ }
1196
+ getIndexedValue(current) {
1197
+ const registeredId = this.refs.get(current);
1198
+ if (registeredId != null) {
1199
+ this.markRef(registeredId);
1200
+ return {
1201
+ type: 1 /* Indexed */,
1202
+ value: createIndexedValueNode(registeredId)
1203
+ };
1204
+ }
1205
+ const id = this.refs.size;
1206
+ this.refs.set(current, id);
1207
+ return {
1208
+ type: 0 /* Fresh */,
1209
+ value: id
1210
+ };
1211
+ }
1212
+ getReference(current) {
1213
+ const indexed = this.getIndexedValue(current);
1214
+ if (indexed.type === 1 /* Indexed */) {
1215
+ return indexed;
1216
+ }
1217
+ if (hasReferenceID(current)) {
1218
+ return {
1219
+ type: 2 /* Referenced */,
1220
+ value: createReferenceNode(indexed.value, current)
1221
+ };
1222
+ }
1223
+ return indexed;
1224
+ }
1225
+ getStrictReference(current) {
1226
+ assert(hasReferenceID(current), new SerovalUnsupportedTypeError(current));
1227
+ const result = this.getIndexedValue(current);
1228
+ if (result.type === 1 /* Indexed */) {
1229
+ return result.value;
1230
+ }
1231
+ return createReferenceNode(result.value, current);
1232
+ }
1233
+ parseFunction(current) {
1234
+ return this.getStrictReference(current);
1235
+ }
1236
+ parseWellKnownSymbol(current) {
1237
+ const ref = this.getReference(current);
1238
+ if (ref.type !== 0 /* Fresh */) {
1239
+ return ref.value;
1240
+ }
1241
+ assert(current in INV_SYMBOL_REF, new SerovalUnsupportedTypeError(current));
1242
+ return createWKSymbolNode(ref.value, current);
1243
+ }
1244
+ parseSpecialReference(ref) {
1245
+ const result = this.getIndexedValue(SPECIAL_REFS[ref]);
1246
+ if (result.type === 1 /* Indexed */) {
1247
+ return result.value;
1248
+ }
1249
+ return {
1250
+ t: 26 /* SpecialReference */,
1251
+ i: result.value,
1252
+ s: ref,
1253
+ l: void 0,
1254
+ c: void 0,
1255
+ m: void 0,
1256
+ p: void 0,
1257
+ e: void 0,
1258
+ a: void 0,
1259
+ f: void 0,
1260
+ b: void 0,
1261
+ o: void 0
1262
+ };
1263
+ }
1264
+ parseIteratorFactory() {
1265
+ const result = this.getIndexedValue(ITERATOR);
1266
+ if (result.type === 1 /* Indexed */) {
1267
+ return result.value;
1268
+ }
1269
+ return {
1270
+ t: 27 /* IteratorFactory */,
1271
+ i: result.value,
1272
+ s: void 0,
1273
+ l: void 0,
1274
+ c: void 0,
1275
+ m: void 0,
1276
+ p: void 0,
1277
+ e: void 0,
1278
+ a: void 0,
1279
+ f: this.parseWellKnownSymbol(Symbol.iterator),
1280
+ b: void 0,
1281
+ o: void 0
1282
+ };
1283
+ }
1284
+ parseAsyncIteratorFactory() {
1285
+ const result = this.getIndexedValue(ASYNC_ITERATOR);
1286
+ if (result.type === 1 /* Indexed */) {
1287
+ return result.value;
1288
+ }
1289
+ return {
1290
+ t: 29 /* AsyncIteratorFactory */,
1291
+ i: result.value,
1292
+ s: void 0,
1293
+ l: void 0,
1294
+ c: void 0,
1295
+ m: void 0,
1296
+ p: void 0,
1297
+ e: void 0,
1298
+ a: [
1299
+ this.parseSpecialReference(1 /* PromiseConstructor */),
1300
+ this.parseWellKnownSymbol(Symbol.asyncIterator)
1301
+ ],
1302
+ f: void 0,
1303
+ b: void 0,
1304
+ o: void 0
1305
+ };
1306
+ }
1307
+ createObjectNode(id, current, empty, record) {
1308
+ return {
1309
+ t: empty ? 11 /* NullConstructor */ : 10 /* Object */,
1310
+ i: id,
1311
+ s: void 0,
1312
+ l: void 0,
1313
+ c: void 0,
1314
+ m: void 0,
1315
+ p: record,
1316
+ e: void 0,
1317
+ a: void 0,
1318
+ f: void 0,
1319
+ b: void 0,
1320
+ o: getObjectFlag(current)
1321
+ };
1322
+ }
1323
+ createMapNode(id, k, v, s) {
1324
+ return {
1325
+ t: 8 /* Map */,
1326
+ i: id,
1327
+ s: void 0,
1328
+ l: void 0,
1329
+ c: void 0,
1330
+ m: void 0,
1331
+ p: void 0,
1332
+ e: { k, v, s },
1333
+ a: void 0,
1334
+ f: this.parseSpecialReference(0 /* MapSentinel */),
1335
+ b: void 0,
1336
+ o: void 0
1337
+ };
1338
+ }
1339
+ createPromiseConstructorNode(id) {
1340
+ return {
1341
+ t: 22 /* PromiseConstructor */,
1342
+ i: id,
1343
+ s: void 0,
1344
+ l: void 0,
1345
+ c: void 0,
1346
+ m: void 0,
1347
+ p: void 0,
1348
+ e: void 0,
1349
+ a: void 0,
1350
+ f: this.parseSpecialReference(1 /* PromiseConstructor */),
1351
+ b: void 0,
1352
+ o: void 0
1353
+ };
1354
+ }
1355
+ };
1356
+
1357
1357
  // src/core/context/parser/async.ts
1358
1358
  var BaseAsyncParserContext = class extends BaseParserContext {
1359
1359
  async parseItems(current) {
@@ -2663,7 +2663,7 @@ var BaseSerializerContext = class {
2663
2663
  "for(x=0;x<p;x++)l[x]&&l[x][m](v)"
2664
2664
  ) + ",n=" + this.createEffectfulFunction(
2665
2665
  ["o", "x", "z", "c"],
2666
- 'for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))'
2666
+ 'for(x=0,z=b.length;x<z;x++)(c=b[x],(!a&&x===z-1)?o[s?"return":"throw"](c):o.next(c))'
2667
2667
  ) + ",e=" + this.createFunction(
2668
2668
  ["o", "t"],
2669
2669
  "(a&&(l[t=p++]=o),n(o)," + this.createEffectfulFunction([], "a&&(l[t]=void 0)") + ")"