package.dist.esm.development.index.mjs.map Maven / Gradle / Ivy
{
"version": 3,
"sources": ["../../../src/core/compat.ts", "../../../src/core/string.ts", "../../../src/core/keys.ts", "../../../src/core/utils/assert.ts", "../../../src/core/reference.ts", "../../../src/core/plugin.ts", "../../../src/core/constants.ts", "../../../src/core/literals.ts", "../../../src/core/utils/error.ts", "../../../src/core/utils/get-object-flag.ts", "../../../src/core/base-primitives.ts", "../../../src/core/errors.ts", "../../../src/core/special-reference.ts", "../../../src/core/utils/deferred.ts", "../../../src/core/stream.ts", "../../../src/core/utils/iterator-to-sequence.ts", "../../../src/core/utils/promise-to-result.ts", "../../../src/core/context/parser.ts", "../../../src/core/context/parser/async.ts", "../../../src/core/tree/async.ts", "../../../src/core/utils/typed-array.ts", "../../../src/core/context/deserializer.ts", "../../../src/core/tree/deserializer.ts", "../../../src/core/utils/is-valid-identifier.ts", "../../../src/core/context/serializer.ts", "../../../src/core/utils/get-identifier.ts", "../../../src/core/tree/serializer.ts", "../../../src/core/context/parser/sync.ts", "../../../src/core/tree/sync.ts", "../../../src/core/tree/index.ts", "../../../src/core/cross/async.ts", "../../../src/core/cross/deserializer.ts", "../../../src/core/cross/serializer.ts", "../../../src/core/context/parser/stream.ts", "../../../src/core/cross/stream.ts", "../../../src/core/cross/sync.ts", "../../../src/core/cross/index.ts", "../../../src/core/Serializer.ts"],
"sourcesContent": ["/**\n * References\n * - https://compat-table.github.io/compat-table/es6/\n * - MDN\n */\n\nexport const enum Feature {\n AggregateError = 0x01,\n ArrowFunction = 0x02,\n ErrorPrototypeStack = 0x04,\n ObjectAssign = 0x08,\n BigIntTypedArray = 0x10,\n}\n\nexport const ALL_ENABLED = 0x1f;\n", "export function serializeChar(str: string): string | undefined {\n switch (str) {\n case '\"':\n return '\\\\\"';\n case '\\\\':\n return '\\\\\\\\';\n case '\\n':\n return '\\\\n';\n case '\\r':\n return '\\\\r';\n case '\\b':\n return '\\\\b';\n case '\\t':\n return '\\\\t';\n case '\\f':\n return '\\\\f';\n case '<':\n return '\\\\x3C';\n case '\\u2028':\n return '\\\\u2028';\n case '\\u2029':\n return '\\\\u2029';\n default:\n return undefined;\n }\n}\n\n// Written by https://github.com/DylanPiercey and is distributed under the MIT license.\n// Creates a JavaScript double quoted string and escapes all characters\n// not listed as DoubleStringCharacters on\n// Also includes \"<\" to escape \"\" and \"\\\" to avoid invalid escapes in the output.\n// http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\nexport function serializeString(str: string): string {\n let result = '';\n let lastPos = 0;\n let replacement: string | undefined;\n for (let i = 0, len = str.length; i < len; i++) {\n replacement = serializeChar(str[i]);\n if (replacement) {\n result += str.slice(lastPos, i) + replacement;\n lastPos = i + 1;\n }\n }\n if (lastPos === 0) {\n result = str;\n } else {\n result += str.slice(lastPos);\n }\n return result;\n}\n\nfunction deserializeReplacer(str: string): string {\n switch (str) {\n case '\\\\\\\\':\n return '\\\\';\n case '\\\\\"':\n return '\"';\n case '\\\\n':\n return '\\n';\n case '\\\\r':\n return '\\r';\n case '\\\\b':\n return '\\b';\n case '\\\\t':\n return '\\t';\n case '\\\\f':\n return '\\f';\n case '\\\\x3C':\n return '\\x3C';\n case '\\\\u2028':\n return '\\u2028';\n case '\\\\u2029':\n return '\\u2029';\n default:\n return str;\n }\n}\n\nexport function deserializeString(str: string): string {\n return str.replace(\n /(\\\\\\\\|\\\\\"|\\\\n|\\\\r|\\\\b|\\\\t|\\\\f|\\\\u2028|\\\\u2029|\\\\x3C)/g,\n deserializeReplacer,\n );\n}\n", "import { serializeString } from './string';\n\n// Used for mapping isomorphic references\nexport const REFERENCES_KEY = '__SEROVAL_REFS__';\n\nexport const GLOBAL_CONTEXT_REFERENCES = '$R';\n\nconst GLOBAL_CONTEXT_R = `self.${GLOBAL_CONTEXT_REFERENCES}`;\n\nexport function getCrossReferenceHeader(id?: string): string {\n if (id == null) {\n return `${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||[]`;\n }\n return `(${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||{})[\"${serializeString(\n id,\n )}\"]=[]`;\n}\n", "export default function assert(cond: unknown, error: Error): asserts cond {\n if (!cond) {\n throw error;\n }\n}\n", "import {\n SerovalMissingReferenceError,\n SerovalMissingReferenceForIdError,\n} from '..';\nimport { REFERENCES_KEY } from './keys';\nimport assert from './utils/assert';\n\nconst REFERENCE = new Map();\nconst INV_REFERENCE = new Map();\n\nexport function createReference(id: string, value: T): T {\n REFERENCE.set(value, id);\n INV_REFERENCE.set(id, value);\n return value;\n}\n\nexport function hasReferenceID(value: T): boolean {\n return REFERENCE.has(value);\n}\n\nexport function hasReference(id: string): boolean {\n return INV_REFERENCE.has(id);\n}\n\nexport function getReferenceID(value: T): string {\n assert(hasReferenceID(value), new SerovalMissingReferenceError(value));\n return REFERENCE.get(value)!;\n}\n\nexport function getReference(id: string): T {\n assert(hasReference(id), new SerovalMissingReferenceForIdError(id));\n return INV_REFERENCE.get(id) as T;\n}\n\nif (typeof globalThis !== 'undefined') {\n Object.defineProperty(globalThis, REFERENCES_KEY, {\n value: INV_REFERENCE,\n configurable: true,\n writable: false,\n enumerable: false,\n });\n} else if (typeof window !== 'undefined') {\n Object.defineProperty(window, REFERENCES_KEY, {\n value: INV_REFERENCE,\n configurable: true,\n writable: false,\n enumerable: false,\n });\n} else if (typeof self !== 'undefined') {\n Object.defineProperty(self, REFERENCES_KEY, {\n value: INV_REFERENCE,\n configurable: true,\n writable: false,\n enumerable: false,\n });\n} else if (typeof global !== 'undefined') {\n Object.defineProperty(global, REFERENCES_KEY, {\n value: INV_REFERENCE,\n configurable: true,\n writable: false,\n enumerable: false,\n });\n}\n", "import type BaseDeserializerContext from './context/deserializer';\nimport type BaseAsyncParserContext from './context/parser/async';\nimport type BaseStreamParserContext from './context/parser/stream';\nimport type BaseSyncParserContext from './context/parser/sync';\nimport type BaseSerializerContext from './context/serializer';\n\nexport type SerovalMode = 'vanilla' | 'cross';\n\nexport interface PluginData {\n id: number;\n}\n\nexport interface Plugin {\n /**\n * A unique string that helps idenfity the plugin\n */\n tag: string;\n /**\n * List of dependency plugins\n */\n extends?: Plugin[];\n /**\n * Method to test if a value is an expected value of the plugin\n * @param value\n */\n test(value: unknown): boolean;\n /**\n * Parsing modes\n */\n parse: {\n sync?: (value: Value, ctx: BaseSyncParserContext, data: PluginData) => Node;\n async?: (\n value: Value,\n ctx: BaseAsyncParserContext,\n data: PluginData,\n ) => Promise;\n stream?: (\n value: Value,\n ctx: BaseStreamParserContext,\n data: PluginData,\n ) => Node;\n };\n /**\n * Convert the parsed node into a JS string\n */\n serialize(node: Node, ctx: BaseSerializerContext, data: PluginData): string;\n /**\n * Convert the parsed node into its runtime equivalent.\n */\n deserialize(\n node: Node,\n ctx: BaseDeserializerContext,\n data: PluginData,\n ): Value;\n}\n\nexport function createPlugin(\n plugin: Plugin,\n): Plugin {\n return plugin;\n}\n\nexport interface PluginAccessOptions {\n plugins?: Plugin[];\n}\n\nfunction dedupePlugins(\n deduped: Set>,\n plugins: Plugin[],\n): void {\n for (let i = 0, len = plugins.length; i < len; i++) {\n const current = plugins[i];\n if (!deduped.has(current)) {\n deduped.add(current);\n if (current.extends) {\n dedupePlugins(deduped, current.extends);\n }\n }\n }\n}\n\nexport function resolvePlugins(\n plugins?: Plugin[],\n): Plugin[] | undefined {\n if (plugins) {\n const deduped = new Set>();\n dedupePlugins(deduped, plugins);\n return [...deduped];\n }\n return undefined;\n}\n", "export const enum SerovalConstant {\n Null = 0,\n Undefined = 1,\n True = 2,\n False = 3,\n NegZero = 4,\n Inf = 5,\n NegInf = 6,\n Nan = 7,\n}\n\nexport const enum SerovalNodeType {\n Number = 0,\n String = 1,\n Constant = 2,\n BigInt = 3,\n IndexedValue = 4,\n Date = 5,\n RegExp = 6,\n Set = 7,\n Map = 8,\n Array = 9,\n Object = 10,\n NullConstructor = 11,\n Promise = 12,\n Error = 13,\n AggregateError = 14,\n TypedArray = 15,\n BigIntTypedArray = 16,\n WKSymbol = 17,\n Reference = 18,\n ArrayBuffer = 19,\n DataView = 20,\n Boxed = 21,\n PromiseConstructor = 22,\n PromiseResolve = 23,\n PromiseReject = 24,\n Plugin = 25,\n SpecialReference = 26,\n IteratorFactory = 27,\n IteratorFactoryInstance = 28,\n AsyncIteratorFactory = 29,\n AsyncIteratorFactoryInstance = 30,\n StreamConstructor = 31,\n StreamNext = 32,\n StreamThrow = 33,\n StreamReturn = 34,\n}\n\nexport const enum SerovalObjectFlags {\n None = 0,\n NonExtensible = 1,\n Sealed = 2,\n Frozen = 3,\n}\n\nexport const enum Symbols {\n AsyncIterator = 0,\n HasInstance = 1,\n IsConcatSpreadable = 2,\n Iterator = 3,\n Match = 4,\n MatchAll = 5,\n Replace = 6,\n Search = 7,\n Species = 8,\n Split = 9,\n ToPrimitive = 10,\n ToStringTag = 11,\n Unscopables = 12,\n}\n\nexport const SYMBOL_STRING: Record = {\n [Symbols.AsyncIterator]: 'Symbol.asyncIterator',\n [Symbols.HasInstance]: 'Symbol.hasInstance',\n [Symbols.IsConcatSpreadable]: 'Symbol.isConcatSpreadable',\n [Symbols.Iterator]: 'Symbol.iterator',\n [Symbols.Match]: 'Symbol.match',\n [Symbols.MatchAll]: 'Symbol.matchAll',\n [Symbols.Replace]: 'Symbol.replace',\n [Symbols.Search]: 'Symbol.search',\n [Symbols.Species]: 'Symbol.species',\n [Symbols.Split]: 'Symbol.split',\n [Symbols.ToPrimitive]: 'Symbol.toPrimitive',\n [Symbols.ToStringTag]: 'Symbol.toStringTag',\n [Symbols.Unscopables]: 'Symbol.unscopables',\n};\n\nexport const INV_SYMBOL_REF = /* @__PURE__ */ {\n [Symbol.asyncIterator]: Symbols.AsyncIterator,\n [Symbol.hasInstance]: Symbols.HasInstance,\n [Symbol.isConcatSpreadable]: Symbols.IsConcatSpreadable,\n [Symbol.iterator]: Symbols.Iterator,\n [Symbol.match]: Symbols.Match,\n [Symbol.matchAll]: Symbols.MatchAll,\n [Symbol.replace]: Symbols.Replace,\n [Symbol.search]: Symbols.Search,\n [Symbol.species]: Symbols.Species,\n [Symbol.split]: Symbols.Split,\n [Symbol.toPrimitive]: Symbols.ToPrimitive,\n [Symbol.toStringTag]: Symbols.ToStringTag,\n [Symbol.unscopables]: Symbols.Unscopables,\n};\n\nexport type WellKnownSymbols = keyof typeof INV_SYMBOL_REF;\n\nexport const SYMBOL_REF: Record = {\n [Symbols.AsyncIterator]: Symbol.asyncIterator,\n [Symbols.HasInstance]: Symbol.hasInstance,\n [Symbols.IsConcatSpreadable]: Symbol.isConcatSpreadable,\n [Symbols.Iterator]: Symbol.iterator,\n [Symbols.Match]: Symbol.match,\n [Symbols.MatchAll]: Symbol.matchAll,\n [Symbols.Replace]: Symbol.replace,\n [Symbols.Search]: Symbol.search,\n [Symbols.Species]: Symbol.species,\n [Symbols.Split]: Symbol.split,\n [Symbols.ToPrimitive]: Symbol.toPrimitive,\n [Symbols.ToStringTag]: Symbol.toStringTag,\n [Symbols.Unscopables]: Symbol.unscopables,\n};\n\nexport const CONSTANT_STRING: Record = {\n [SerovalConstant.True]: '!0',\n [SerovalConstant.False]: '!1',\n [SerovalConstant.Undefined]: 'void 0',\n [SerovalConstant.Null]: 'null',\n [SerovalConstant.NegZero]: '-0',\n [SerovalConstant.Inf]: '1/0',\n [SerovalConstant.NegInf]: '-1/0',\n [SerovalConstant.Nan]: '0/0',\n};\n\nexport const CONSTANT_VAL: Record = {\n [SerovalConstant.True]: true,\n [SerovalConstant.False]: false,\n [SerovalConstant.Undefined]: undefined,\n [SerovalConstant.Null]: null,\n [SerovalConstant.NegZero]: -0,\n [SerovalConstant.Inf]: Number.POSITIVE_INFINITY,\n [SerovalConstant.NegInf]: Number.NEGATIVE_INFINITY,\n [SerovalConstant.Nan]: Number.NaN,\n};\n\nexport const enum ErrorConstructorTag {\n Error = 0,\n EvalError = 1,\n RangeError = 2,\n ReferenceError = 3,\n SyntaxError = 4,\n TypeError = 5,\n URIError = 6,\n}\n\nexport const ERROR_CONSTRUCTOR_STRING: Record = {\n [ErrorConstructorTag.Error]: 'Error',\n [ErrorConstructorTag.EvalError]: 'EvalError',\n [ErrorConstructorTag.RangeError]: 'RangeError',\n [ErrorConstructorTag.ReferenceError]: 'ReferenceError',\n [ErrorConstructorTag.SyntaxError]: 'SyntaxError',\n [ErrorConstructorTag.TypeError]: 'TypeError',\n [ErrorConstructorTag.URIError]: 'URIError',\n};\n\ntype ErrorConstructors =\n | ErrorConstructor\n | EvalErrorConstructor\n | RangeErrorConstructor\n | ReferenceErrorConstructor\n | SyntaxErrorConstructor\n | TypeErrorConstructor\n | URIErrorConstructor;\n\nexport const ERROR_CONSTRUCTOR: Record =\n {\n [ErrorConstructorTag.Error]: Error,\n [ErrorConstructorTag.EvalError]: EvalError,\n [ErrorConstructorTag.RangeError]: RangeError,\n [ErrorConstructorTag.ReferenceError]: ReferenceError,\n [ErrorConstructorTag.SyntaxError]: SyntaxError,\n [ErrorConstructorTag.TypeError]: TypeError,\n [ErrorConstructorTag.URIError]: URIError,\n };\n", "import { SerovalConstant, SerovalNodeType } from './constants';\nimport type { SerovalConstantNode } from './types';\n\nfunction createConstantNode(value: SerovalConstant): SerovalConstantNode {\n return {\n t: SerovalNodeType.Constant,\n i: undefined,\n s: value,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport const TRUE_NODE = /* @__PURE__ */ createConstantNode(\n SerovalConstant.True,\n);\nexport const FALSE_NODE = /* @__PURE__ */ createConstantNode(\n SerovalConstant.False,\n);\nexport const UNDEFINED_NODE = /* @__PURE__ */ createConstantNode(\n SerovalConstant.Undefined,\n);\nexport const NULL_NODE = /* @__PURE__ */ createConstantNode(\n SerovalConstant.Null,\n);\nexport const NEG_ZERO_NODE = /* @__PURE__ */ createConstantNode(\n SerovalConstant.NegZero,\n);\nexport const INFINITY_NODE = /* @__PURE__ */ createConstantNode(\n SerovalConstant.Inf,\n);\nexport const NEG_INFINITY_NODE = /* @__PURE__ */ createConstantNode(\n SerovalConstant.NegInf,\n);\nexport const NAN_NODE = /* @__PURE__ */ createConstantNode(SerovalConstant.Nan);\n", "import { Feature } from '../compat';\nimport { ERROR_CONSTRUCTOR_STRING, ErrorConstructorTag } from '../constants';\n\ntype ErrorValue =\n | Error\n | AggregateError\n | EvalError\n | RangeError\n | ReferenceError\n | TypeError\n | SyntaxError\n | URIError;\n\nexport function getErrorConstructor(error: ErrorValue): ErrorConstructorTag {\n if (error instanceof EvalError) {\n return ErrorConstructorTag.EvalError;\n }\n if (error instanceof RangeError) {\n return ErrorConstructorTag.RangeError;\n }\n if (error instanceof ReferenceError) {\n return ErrorConstructorTag.ReferenceError;\n }\n if (error instanceof SyntaxError) {\n return ErrorConstructorTag.SyntaxError;\n }\n if (error instanceof TypeError) {\n return ErrorConstructorTag.TypeError;\n }\n if (error instanceof URIError) {\n return ErrorConstructorTag.URIError;\n }\n return ErrorConstructorTag.Error;\n}\n\nfunction getInitialErrorOptions(\n error: Error,\n): Record | undefined {\n const construct = ERROR_CONSTRUCTOR_STRING[getErrorConstructor(error)];\n // Name has been modified\n if (error.name !== construct) {\n return { name: error.name };\n }\n if (error.constructor.name !== construct) {\n // Otherwise, name is overriden because\n // the Error class is extended\n return { name: error.constructor.name };\n }\n return {};\n}\n\nexport function getErrorOptions(\n error: Error,\n features: number,\n): Record | undefined {\n let options = getInitialErrorOptions(error);\n const names = Object.getOwnPropertyNames(error);\n for (let i = 0, len = names.length, name: string; i < len; i++) {\n name = names[i];\n if (name !== 'name' && name !== 'message') {\n if (name === 'stack') {\n if (features & Feature.ErrorPrototypeStack) {\n options = options || {};\n options[name] = error[name as keyof Error];\n }\n } else {\n options = options || {};\n options[name] = error[name as keyof Error];\n }\n }\n }\n return options;\n}\n", "import { SerovalObjectFlags } from '../constants';\n\nexport function getObjectFlag(obj: unknown): SerovalObjectFlags {\n if (Object.isFrozen(obj)) {\n return SerovalObjectFlags.Frozen;\n }\n if (Object.isSealed(obj)) {\n return SerovalObjectFlags.Sealed;\n }\n if (Object.isExtensible(obj)) {\n return SerovalObjectFlags.None;\n }\n return SerovalObjectFlags.NonExtensible;\n}\n", "import type { WellKnownSymbols } from './constants';\nimport { INV_SYMBOL_REF, SerovalNodeType } from './constants';\nimport {\n INFINITY_NODE,\n NAN_NODE,\n NEG_INFINITY_NODE,\n NEG_ZERO_NODE,\n} from './literals';\nimport { getReferenceID } from './reference';\nimport { serializeString } from './string';\nimport type {\n SerovalAggregateErrorNode,\n SerovalArrayBufferNode,\n SerovalArrayNode,\n SerovalAsyncIteratorFactoryInstanceNode,\n SerovalBigIntNode,\n SerovalBigIntTypedArrayNode,\n SerovalBoxedNode,\n SerovalConstantNode,\n SerovalDataViewNode,\n SerovalDateNode,\n SerovalErrorNode,\n SerovalIndexedValueNode,\n SerovalIteratorFactoryInstanceNode,\n SerovalNode,\n SerovalNodeWithID,\n SerovalNumberNode,\n SerovalObjectRecordNode,\n SerovalPluginNode,\n SerovalReferenceNode,\n SerovalRegExpNode,\n SerovalSetNode,\n SerovalStreamConstructorNode,\n SerovalStreamNextNode,\n SerovalStreamReturnNode,\n SerovalStreamThrowNode,\n SerovalStringNode,\n SerovalTypedArrayNode,\n SerovalWKSymbolNode,\n} from './types';\nimport { getErrorConstructor } from './utils/error';\nimport { getObjectFlag } from './utils/get-object-flag';\nimport type {\n BigIntTypedArrayValue,\n TypedArrayValue,\n} from './utils/typed-array';\n\nexport function createNumberNode(\n value: number,\n): SerovalConstantNode | SerovalNumberNode {\n switch (value) {\n case Number.POSITIVE_INFINITY:\n return INFINITY_NODE;\n case Number.NEGATIVE_INFINITY:\n return NEG_INFINITY_NODE;\n }\n if (value !== value) {\n return NAN_NODE;\n }\n if (Object.is(value, -0)) {\n return NEG_ZERO_NODE;\n }\n return {\n t: SerovalNodeType.Number,\n i: undefined,\n s: value,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createStringNode(value: string): SerovalStringNode {\n return {\n t: SerovalNodeType.String,\n i: undefined,\n s: serializeString(value),\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createBigIntNode(current: bigint): SerovalBigIntNode {\n return {\n t: SerovalNodeType.BigInt,\n i: undefined,\n s: '' + current,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createIndexedValueNode(id: number): SerovalIndexedValueNode {\n return {\n t: SerovalNodeType.IndexedValue,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createDateNode(id: number, current: Date): SerovalDateNode {\n return {\n t: SerovalNodeType.Date,\n i: id,\n s: current.toISOString(),\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n f: undefined,\n a: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createRegExpNode(\n id: number,\n current: RegExp,\n): SerovalRegExpNode {\n return {\n t: SerovalNodeType.RegExp,\n i: id,\n s: undefined,\n l: undefined,\n c: serializeString(current.source),\n m: current.flags,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createArrayBufferNode(\n id: number,\n current: ArrayBuffer,\n): SerovalArrayBufferNode {\n const bytes = new Uint8Array(current);\n const len = bytes.length;\n const values = new Array(len);\n for (let i = 0; i < len; i++) {\n values[i] = bytes[i];\n }\n return {\n t: SerovalNodeType.ArrayBuffer,\n i: id,\n s: values,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createWKSymbolNode(\n id: number,\n current: WellKnownSymbols,\n): SerovalWKSymbolNode {\n return {\n t: SerovalNodeType.WKSymbol,\n i: id,\n s: INV_SYMBOL_REF[current],\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createReferenceNode(\n id: number,\n ref: T,\n): SerovalReferenceNode {\n return {\n t: SerovalNodeType.Reference,\n i: id,\n s: serializeString(getReferenceID(ref)),\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createPluginNode(\n id: number,\n tag: string,\n value: unknown,\n): SerovalPluginNode {\n return {\n t: SerovalNodeType.Plugin,\n i: id,\n s: value,\n l: undefined,\n c: serializeString(tag),\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createArrayNode(\n id: number,\n current: unknown[],\n parsedItems: SerovalNode[],\n): SerovalArrayNode {\n return {\n t: SerovalNodeType.Array,\n i: id,\n s: undefined,\n l: current.length,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: parsedItems,\n f: undefined,\n b: undefined,\n o: getObjectFlag(current),\n };\n}\n\nexport function createBoxedNode(\n id: number,\n boxed: SerovalNode,\n): SerovalBoxedNode {\n return {\n t: SerovalNodeType.Boxed,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: boxed,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createTypedArrayNode(\n id: number,\n current: TypedArrayValue,\n buffer: SerovalNode,\n): SerovalTypedArrayNode {\n return {\n t: SerovalNodeType.TypedArray,\n i: id,\n s: undefined,\n l: current.length,\n c: current.constructor.name,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: buffer,\n b: current.byteOffset,\n o: undefined,\n };\n}\n\nexport function createBigIntTypedArrayNode(\n id: number,\n current: BigIntTypedArrayValue,\n buffer: SerovalNode,\n): SerovalBigIntTypedArrayNode {\n return {\n t: SerovalNodeType.BigIntTypedArray,\n i: id,\n s: undefined,\n l: current.length,\n c: current.constructor.name,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: buffer,\n b: current.byteOffset,\n o: undefined,\n };\n}\n\nexport function createDataViewNode(\n id: number,\n current: DataView,\n buffer: SerovalNode,\n): SerovalDataViewNode {\n return {\n t: SerovalNodeType.DataView,\n i: id,\n s: undefined,\n l: current.byteLength,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: buffer,\n b: current.byteOffset,\n o: undefined,\n };\n}\n\nexport function createErrorNode(\n id: number,\n current: Error,\n options: SerovalObjectRecordNode | undefined,\n): SerovalErrorNode {\n return {\n t: SerovalNodeType.Error,\n i: id,\n s: getErrorConstructor(current),\n l: undefined,\n c: undefined,\n m: serializeString(current.message),\n p: options,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createAggregateErrorNode(\n id: number,\n current: AggregateError,\n options: SerovalObjectRecordNode | undefined,\n): SerovalAggregateErrorNode {\n return {\n t: SerovalNodeType.AggregateError,\n i: id,\n s: getErrorConstructor(current),\n l: undefined,\n c: undefined,\n m: serializeString(current.message),\n p: options,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createSetNode(\n id: number,\n size: number,\n items: SerovalNode[],\n): SerovalSetNode {\n return {\n t: SerovalNodeType.Set,\n i: id,\n s: undefined,\n l: size,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: items,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createIteratorFactoryInstanceNode(\n factory: SerovalNodeWithID,\n items: SerovalNode,\n): SerovalIteratorFactoryInstanceNode {\n return {\n t: SerovalNodeType.IteratorFactoryInstance,\n i: undefined,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: [factory, items],\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createAsyncIteratorFactoryInstanceNode(\n factory: SerovalNodeWithID,\n items: SerovalNode,\n): SerovalAsyncIteratorFactoryInstanceNode {\n return {\n t: SerovalNodeType.AsyncIteratorFactoryInstance,\n i: undefined,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: [factory, items],\n f: undefined,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createStreamConstructorNode(\n id: number,\n factory: SerovalNodeWithID,\n sequence: SerovalNode[],\n): SerovalStreamConstructorNode {\n return {\n t: SerovalNodeType.StreamConstructor,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: sequence,\n f: factory,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createStreamNextNode(\n id: number,\n parsed: SerovalNode,\n): SerovalStreamNextNode {\n return {\n t: SerovalNodeType.StreamNext,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: parsed,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createStreamThrowNode(\n id: number,\n parsed: SerovalNode,\n): SerovalStreamThrowNode {\n return {\n t: SerovalNodeType.StreamThrow,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: parsed,\n b: undefined,\n o: undefined,\n };\n}\n\nexport function createStreamReturnNode(\n id: number,\n parsed: SerovalNode,\n): SerovalStreamReturnNode {\n return {\n t: SerovalNodeType.StreamReturn,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: parsed,\n b: undefined,\n o: undefined,\n };\n}\n", "import { serializeString } from './string';\nimport type { SerovalNode } from './types';\n\nconst { toString: objectToString } = /* @__PURE__ */ Object.prototype;\n\nfunction getErrorMessage(type: string, cause: any): string {\n if (cause instanceof Error) {\n return `Seroval caught an error during the ${type} process.\n \n${cause.name}\n${cause.message}\n\n- For more information, please check the \"cause\" property of this error.\n- If you believe this is an error in Seroval, please submit an issue at https://github.com/lxsmnsyc/seroval/issues/new`;\n }\n return `Seroval caught an error during the ${type} process.\n\n\"${objectToString.call(cause)}\"\n\nFor more information, please check the \"cause\" property of this error.`;\n}\n\nexport class SerovalError extends Error {\n constructor(\n type: string,\n public cause: any,\n ) {\n super(getErrorMessage(type, cause));\n }\n}\n\nexport class SerovalParserError extends SerovalError {\n constructor(cause: any) {\n super('parsing', cause);\n }\n}\n\nexport class SerovalSerializationError extends SerovalError {\n constructor(cause: any) {\n super('serialization', cause);\n }\n}\n\nexport class SerovalDeserializationError extends SerovalError {\n constructor(cause: any) {\n super('deserialization', cause);\n }\n}\n\nexport class SerovalUnsupportedTypeError extends Error {\n constructor(public value: unknown) {\n super(\n `The value ${objectToString.call(value)} of type \"${typeof value}\" cannot be parsed/serialized.\n \nThere are few workarounds for this problem:\n- Transform the value in a way that it can be serialized.\n- If the reference is present on multiple runtimes (isomorphic), you can use the Reference API to map the references.`,\n );\n }\n}\n\nexport class SerovalUnsupportedNodeError extends Error {\n constructor(node: SerovalNode) {\n super('Unsupported node type \"' + node.t + '\".');\n }\n}\n\nexport class SerovalMissingPluginError extends Error {\n constructor(tag: string) {\n super('Missing plugin for tag \"' + tag + '\".');\n }\n}\n\nexport class SerovalMissingInstanceError extends Error {\n constructor(tag: string) {\n super('Missing \"' + tag + '\" instance.');\n }\n}\n\nexport class SerovalMissingReferenceError extends Error {\n constructor(public value: unknown) {\n super(\n 'Missing reference for the value \"' +\n objectToString.call(value) +\n '\" of type \"' +\n typeof value +\n '\"',\n );\n }\n}\n\nexport class SerovalMissingReferenceForIdError extends Error {\n constructor(id: string) {\n super('Missing reference for id \"' + serializeString(id) + '\"');\n }\n}\n\nexport class SerovalUnknownTypedArrayError extends Error {\n constructor(name: string) {\n super('Unknown TypedArray \"' + name + '\"');\n }\n}\n", "export const ITERATOR = {};\n\nexport const ASYNC_ITERATOR = {};\n\nexport const enum SpecialReference {\n MapSentinel = 0,\n PromiseConstructor = 1,\n PromiseResolve = 2,\n PromiseReject = 3,\n StreamConstructor = 4,\n}\n\nexport const SPECIAL_REFS: Record = {\n [SpecialReference.MapSentinel]: {},\n [SpecialReference.PromiseConstructor]: {},\n [SpecialReference.PromiseResolve]: {},\n [SpecialReference.PromiseReject]: {},\n [SpecialReference.StreamConstructor]: {},\n};\n", "export interface Deferred {\n promise: Promise;\n resolve(value: unknown): void;\n reject(value: unknown): void;\n}\n\nexport function createDeferred(): Deferred {\n let resolve: Deferred['resolve'];\n let reject: Deferred['reject'];\n return {\n promise: new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n }),\n resolve(value): void {\n resolve(value);\n },\n reject(value): void {\n reject(value);\n },\n };\n}\n", "import type { Deferred } from './utils/deferred';\nimport { createDeferred } from './utils/deferred';\n\ninterface StreamListener {\n next(value: T): void;\n throw(value: unknown): void;\n return(value: T): void;\n}\n\nexport interface Stream {\n __SEROVAL_STREAM__: true;\n\n on(listener: StreamListener): () => void;\n\n next(value: T): void;\n throw(value: unknown): void;\n return(value: T): void;\n}\n\nexport function isStream(value: object): value is Stream {\n return '__SEROVAL_STREAM__' in value;\n}\n\nexport function createStream(): Stream {\n const listeners = new Set>();\n const buffer: unknown[] = [];\n let alive = true;\n let success = false;\n\n function flushNext(value: T): void {\n for (const listener of listeners.keys()) {\n listener.next(value);\n }\n }\n\n function flushThrow(value: unknown): void {\n for (const listener of listeners.keys()) {\n listener.throw(value);\n }\n }\n\n function flushReturn(value: T): void {\n for (const listener of listeners.keys()) {\n listener.return(value);\n }\n }\n\n return {\n __SEROVAL_STREAM__: true,\n on(listener: StreamListener): () => void {\n if (alive) {\n listeners.add(listener);\n }\n for (let i = 0, len = buffer.length; i < len; i++) {\n const value = buffer[i];\n if (i === len - 1) {\n if (success) {\n listener.return(value as T);\n } else {\n listener.throw(value);\n }\n } else {\n listener.next(value as T);\n }\n }\n return () => {\n if (alive) {\n listeners.delete(listener);\n }\n };\n },\n next(value): void {\n if (alive) {\n buffer.push(value);\n flushNext(value);\n }\n },\n throw(value): void {\n if (alive) {\n buffer.push(value);\n flushThrow(value);\n alive = false;\n success = false;\n listeners.clear();\n }\n },\n return(value): void {\n if (alive) {\n buffer.push(value);\n flushReturn(value);\n alive = false;\n success = true;\n listeners.clear();\n }\n },\n };\n}\n\nexport function createStreamFromAsyncIterable(\n iterable: AsyncIterable,\n): Stream {\n const stream = createStream();\n\n const iterator = iterable[Symbol.asyncIterator]();\n\n async function push(): Promise {\n try {\n const value = await iterator.next();\n if (value.done) {\n stream.return(value.value as T);\n } else {\n stream.next(value.value);\n await push();\n }\n } catch (error) {\n stream.throw(error);\n }\n }\n\n push().catch(() => {\n // no-op\n });\n\n return stream;\n}\n\nexport function streamToAsyncIterable(\n stream: Stream,\n): () => AsyncIterableIterator {\n return (): AsyncIterableIterator => {\n const buffer: T[] = [];\n const pending: Deferred[] = [];\n let count = 0;\n let doneAt = -1;\n let isThrow = false;\n\n function resolveAll(): void {\n for (let i = 0, len = pending.length; i < len; i++) {\n pending[i].resolve({ done: true, value: undefined });\n }\n }\n\n stream.on({\n next(value) {\n const current = pending.shift();\n if (current) {\n current.resolve({ done: false, value });\n }\n buffer.push(value);\n },\n throw(value) {\n const current = pending.shift();\n if (current) {\n current.reject(value);\n }\n resolveAll();\n doneAt = buffer.length;\n buffer.push(value as T);\n isThrow = true;\n },\n return(value) {\n const current = pending.shift();\n if (current) {\n current.resolve({ done: true, value });\n }\n resolveAll();\n doneAt = buffer.length;\n buffer.push(value);\n },\n });\n\n function finalize() {\n const current = count++;\n const value = buffer[current];\n if (current !== doneAt) {\n return { done: false, value };\n }\n if (isThrow) {\n throw value;\n }\n return { done: true, value };\n }\n\n return {\n [Symbol.asyncIterator](): AsyncIterableIterator {\n return this;\n },\n async next(): Promise> {\n if (doneAt === -1) {\n const current = count++;\n if (current >= buffer.length) {\n const deferred = createDeferred();\n pending.push(deferred);\n return (await deferred.promise) as Promise>;\n }\n return { done: false, value: buffer[current] };\n }\n if (count > doneAt) {\n return { done: true, value: undefined };\n }\n return finalize();\n },\n };\n };\n}\n", "export interface Sequence {\n v: unknown[];\n t: number;\n d: number;\n}\n\nexport function iteratorToSequence(source: Iterable): Sequence {\n const values: unknown[] = [];\n let throwsAt = -1;\n let doneAt = -1;\n\n const iterator = source[Symbol.iterator]();\n\n while (true) {\n try {\n const value = iterator.next();\n values.push(value.value);\n if (value.done) {\n doneAt = values.length - 1;\n break;\n }\n } catch (error) {\n throwsAt = values.length;\n values.push(error);\n }\n }\n\n return {\n v: values,\n t: throwsAt,\n d: doneAt,\n };\n}\n\nexport function sequenceToIterator(\n sequence: Sequence,\n): () => IterableIterator {\n return (): IterableIterator => {\n let index = 0;\n\n return {\n [Symbol.iterator](): IterableIterator {\n return this;\n },\n next(): IteratorResult {\n if (index > sequence.d) {\n return {\n done: true,\n value: undefined,\n };\n }\n const currentIndex = index++;\n const currentItem = sequence.v[currentIndex];\n if (currentIndex === sequence.t) {\n throw currentItem;\n }\n return {\n done: currentIndex === sequence.d,\n value: currentItem as T,\n };\n },\n };\n };\n}\n", "export default async function promiseToResult(\n current: Promise,\n): Promise<[0 | 1, unknown]> {\n try {\n return [1, await current];\n } catch (e) {\n return [0, e];\n }\n}\n", "import {\n createIndexedValueNode,\n createReferenceNode,\n createWKSymbolNode,\n} from '../base-primitives';\nimport { ALL_ENABLED } from '../compat';\nimport type { WellKnownSymbols } from '../constants';\nimport { INV_SYMBOL_REF, SerovalNodeType } from '../constants';\nimport { SerovalUnsupportedTypeError } from '../errors';\nimport type { Plugin, PluginAccessOptions, SerovalMode } from '../plugin';\nimport { hasReferenceID } from '../reference';\nimport {\n ASYNC_ITERATOR,\n ITERATOR,\n SPECIAL_REFS,\n SpecialReference,\n} from '../special-reference';\nimport type {\n SerovalAsyncIteratorFactoryNode,\n SerovalIndexedValueNode,\n SerovalIteratorFactoryNode,\n SerovalMapNode,\n SerovalNode,\n SerovalNullConstructorNode,\n SerovalObjectNode,\n SerovalObjectRecordNode,\n SerovalPromiseConstructorNode,\n SerovalReferenceNode,\n SerovalSpecialReferenceNode,\n SerovalWKSymbolNode,\n} from '../types';\nimport assert from '../utils/assert';\nimport { getObjectFlag } from '../utils/get-object-flag';\n\nexport interface BaseParserContextOptions extends PluginAccessOptions {\n disabledFeatures?: number;\n refs?: Map;\n}\n\nconst enum NodeType {\n Fresh = 0,\n Indexed = 1,\n Referenced = 2,\n}\n\ninterface FreshNode {\n type: NodeType.Fresh;\n value: number;\n}\n\ninterface IndexedNode {\n type: NodeType.Indexed;\n value: SerovalIndexedValueNode;\n}\n\ninterface ReferencedNode {\n type: NodeType.Referenced;\n value: SerovalReferenceNode;\n}\n\ntype ObjectNode = FreshNode | IndexedNode | ReferencedNode;\n\nexport abstract class BaseParserContext implements PluginAccessOptions {\n abstract readonly mode: SerovalMode;\n\n features: number;\n\n marked = new Set();\n\n refs: Map;\n\n plugins?: Plugin[] | undefined;\n\n constructor(options: BaseParserContextOptions) {\n this.plugins = options.plugins;\n this.features = ALL_ENABLED ^ (options.disabledFeatures || 0);\n this.refs = options.refs || new Map();\n }\n\n protected markRef(id: number): void {\n this.marked.add(id);\n }\n\n protected isMarked(id: number): boolean {\n return this.marked.has(id);\n }\n\n protected getIndexedValue(current: T): FreshNode | IndexedNode {\n const registeredId = this.refs.get(current);\n if (registeredId != null) {\n this.markRef(registeredId);\n return {\n type: NodeType.Indexed,\n value: createIndexedValueNode(registeredId),\n };\n }\n const id = this.refs.size;\n this.refs.set(current, id);\n return {\n type: NodeType.Fresh,\n value: id,\n };\n }\n\n protected getReference(current: T): ObjectNode {\n const indexed = this.getIndexedValue(current);\n if (indexed.type === NodeType.Indexed) {\n return indexed;\n }\n if (hasReferenceID(current)) {\n return {\n type: NodeType.Referenced,\n value: createReferenceNode(indexed.value, current),\n };\n }\n return indexed;\n }\n\n protected getStrictReference(\n current: T,\n ): SerovalIndexedValueNode | SerovalReferenceNode {\n assert(hasReferenceID(current), new SerovalUnsupportedTypeError(current));\n const result = this.getIndexedValue(current);\n if (result.type === NodeType.Indexed) {\n return result.value;\n }\n return createReferenceNode(result.value, current);\n }\n\n protected parseFunction(\n current: (...args: unknown[]) => unknown,\n ): SerovalNode {\n return this.getStrictReference(current);\n }\n\n protected parseWellKnownSymbol(\n current: symbol,\n ): SerovalIndexedValueNode | SerovalWKSymbolNode | SerovalReferenceNode {\n const ref = this.getReference(current);\n if (ref.type !== NodeType.Fresh) {\n return ref.value;\n }\n assert(current in INV_SYMBOL_REF, new SerovalUnsupportedTypeError(current));\n return createWKSymbolNode(ref.value, current as WellKnownSymbols);\n }\n\n protected parseSpecialReference(\n ref: SpecialReference,\n ): SerovalIndexedValueNode | SerovalSpecialReferenceNode {\n const result = this.getIndexedValue(SPECIAL_REFS[ref]);\n if (result.type === NodeType.Indexed) {\n return result.value;\n }\n return {\n t: SerovalNodeType.SpecialReference,\n i: result.value,\n s: ref,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: undefined,\n };\n }\n\n protected parseIteratorFactory():\n | SerovalIndexedValueNode\n | SerovalIteratorFactoryNode {\n const result = this.getIndexedValue(ITERATOR);\n if (result.type === NodeType.Indexed) {\n return result.value;\n }\n return {\n t: SerovalNodeType.IteratorFactory,\n i: result.value,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: this.parseWellKnownSymbol(Symbol.iterator),\n b: undefined,\n o: undefined,\n };\n }\n\n protected parseAsyncIteratorFactory():\n | SerovalIndexedValueNode\n | SerovalAsyncIteratorFactoryNode {\n const result = this.getIndexedValue(ASYNC_ITERATOR);\n if (result.type === NodeType.Indexed) {\n return result.value;\n }\n return {\n t: SerovalNodeType.AsyncIteratorFactory,\n i: result.value,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: [\n this.parseSpecialReference(SpecialReference.PromiseConstructor),\n this.parseWellKnownSymbol(Symbol.asyncIterator),\n ],\n f: undefined,\n b: undefined,\n o: undefined,\n };\n }\n\n protected createObjectNode(\n id: number,\n current: Record,\n empty: boolean,\n record: SerovalObjectRecordNode,\n ): SerovalObjectNode | SerovalNullConstructorNode {\n return {\n t: empty ? SerovalNodeType.NullConstructor : SerovalNodeType.Object,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: record,\n e: undefined,\n a: undefined,\n f: undefined,\n b: undefined,\n o: getObjectFlag(current),\n };\n }\n\n protected createMapNode(\n id: number,\n k: SerovalNode[],\n v: SerovalNode[],\n s: number,\n ): SerovalMapNode {\n return {\n t: SerovalNodeType.Map,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: { k, v, s },\n a: undefined,\n f: this.parseSpecialReference(SpecialReference.MapSentinel),\n b: undefined,\n o: undefined,\n };\n }\n\n protected createPromiseConstructorNode(\n id: number,\n ): SerovalPromiseConstructorNode {\n return {\n t: SerovalNodeType.PromiseConstructor,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: this.parseSpecialReference(SpecialReference.PromiseConstructor),\n b: undefined,\n o: undefined,\n };\n }\n}\n", "import {\n createAggregateErrorNode,\n createArrayBufferNode,\n createArrayNode,\n createAsyncIteratorFactoryInstanceNode,\n createBigIntNode,\n createBigIntTypedArrayNode,\n createBoxedNode,\n createDataViewNode,\n createDateNode,\n createErrorNode,\n createIteratorFactoryInstanceNode,\n createNumberNode,\n createPluginNode,\n createRegExpNode,\n createSetNode,\n createStreamConstructorNode,\n createStreamNextNode,\n createStreamReturnNode,\n createStreamThrowNode,\n createStringNode,\n createTypedArrayNode,\n} from '../../base-primitives';\nimport { Feature } from '../../compat';\nimport { SerovalNodeType } from '../../constants';\nimport { SerovalParserError, SerovalUnsupportedTypeError } from '../../errors';\nimport {\n FALSE_NODE,\n NULL_NODE,\n TRUE_NODE,\n UNDEFINED_NODE,\n} from '../../literals';\nimport { SpecialReference } from '../../special-reference';\nimport type { Stream } from '../../stream';\nimport { createStreamFromAsyncIterable, isStream } from '../../stream';\nimport { serializeString } from '../../string';\nimport type {\n SerovalAggregateErrorNode,\n SerovalArrayNode,\n SerovalBigIntTypedArrayNode,\n SerovalBoxedNode,\n SerovalDataViewNode,\n SerovalErrorNode,\n SerovalMapNode,\n SerovalNode,\n SerovalNullConstructorNode,\n SerovalObjectNode,\n SerovalObjectRecordKey,\n SerovalObjectRecordNode,\n SerovalPluginNode,\n SerovalPromiseNode,\n SerovalSetNode,\n SerovalStreamConstructorNode,\n SerovalTypedArrayNode,\n} from '../../types';\nimport { getErrorOptions } from '../../utils/error';\nimport { iteratorToSequence } from '../../utils/iterator-to-sequence';\nimport promiseToResult from '../../utils/promise-to-result';\nimport type {\n BigIntTypedArrayValue,\n TypedArrayValue,\n} from '../../utils/typed-array';\nimport { BaseParserContext } from '../parser';\n\ntype ObjectLikeNode =\n | SerovalObjectNode\n | SerovalNullConstructorNode\n | SerovalPromiseNode;\n\nexport default abstract class BaseAsyncParserContext extends BaseParserContext {\n private async parseItems(current: unknown[]): Promise {\n const nodes = [];\n for (let i = 0, len = current.length; i < len; i++) {\n // For consistency in holes\n if (i in current) {\n nodes[i] = await this.parse(current[i]);\n }\n }\n return nodes;\n }\n\n private async parseArray(\n id: number,\n current: unknown[],\n ): Promise {\n return createArrayNode(id, current, await this.parseItems(current));\n }\n\n private async parseProperties(\n properties: Record,\n ): Promise {\n const entries = Object.entries(properties);\n const keyNodes: SerovalObjectRecordKey[] = [];\n const valueNodes: SerovalNode[] = [];\n for (let i = 0, len = entries.length; i < len; i++) {\n keyNodes.push(serializeString(entries[i][0]));\n valueNodes.push(await this.parse(entries[i][1]));\n }\n // Check special properties\n let symbol = Symbol.iterator;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(\n createIteratorFactoryInstanceNode(\n this.parseIteratorFactory(),\n await this.parse(\n iteratorToSequence(properties as unknown as Iterable),\n ),\n ),\n );\n }\n symbol = Symbol.asyncIterator;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(\n createAsyncIteratorFactoryInstanceNode(\n this.parseAsyncIteratorFactory(),\n await this.parse(\n createStreamFromAsyncIterable(\n properties as unknown as AsyncIterable,\n ),\n ),\n ),\n );\n }\n symbol = Symbol.toStringTag;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(createStringNode(properties[symbol] as string));\n }\n symbol = Symbol.isConcatSpreadable;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(properties[symbol] ? TRUE_NODE : FALSE_NODE);\n }\n return {\n k: keyNodes,\n v: valueNodes,\n s: keyNodes.length,\n };\n }\n\n private async parsePlainObject(\n id: number,\n current: Record,\n empty: boolean,\n ): Promise {\n return this.createObjectNode(\n id,\n current,\n empty,\n await this.parseProperties(current),\n );\n }\n\n private async parseBoxed(\n id: number,\n current: object,\n ): Promise {\n return createBoxedNode(id, await this.parse(current.valueOf()));\n }\n\n private async parseTypedArray(\n id: number,\n current: TypedArrayValue,\n ): Promise {\n return createTypedArrayNode(id, current, await this.parse(current.buffer));\n }\n\n private async parseBigIntTypedArray(\n id: number,\n current: BigIntTypedArrayValue,\n ): Promise {\n return createBigIntTypedArrayNode(\n id,\n current,\n await this.parse(current.buffer),\n );\n }\n\n private async parseDataView(\n id: number,\n current: DataView,\n ): Promise {\n return createDataViewNode(id, current, await this.parse(current.buffer));\n }\n\n private async parseError(\n id: number,\n current: Error,\n ): Promise {\n const options = getErrorOptions(current, this.features);\n return createErrorNode(\n id,\n current,\n options ? await this.parseProperties(options) : undefined,\n );\n }\n\n private async parseAggregateError(\n id: number,\n current: AggregateError,\n ): Promise {\n const options = getErrorOptions(current, this.features);\n return createAggregateErrorNode(\n id,\n current,\n options ? await this.parseProperties(options) : undefined,\n );\n }\n\n private async parseMap(\n id: number,\n current: Map,\n ): Promise {\n const keyNodes: SerovalNode[] = [];\n const valueNodes: SerovalNode[] = [];\n for (const [key, value] of current.entries()) {\n keyNodes.push(await this.parse(key));\n valueNodes.push(await this.parse(value));\n }\n return this.createMapNode(id, keyNodes, valueNodes, current.size);\n }\n\n private async parseSet(\n id: number,\n current: Set,\n ): Promise {\n const items: SerovalNode[] = [];\n for (const item of current.keys()) {\n items.push(await this.parse(item));\n }\n return createSetNode(id, current.size, items);\n }\n\n private async parsePromise(\n id: number,\n current: Promise,\n ): Promise {\n const [status, result] = await promiseToResult(current);\n return {\n t: SerovalNodeType.Promise,\n i: id,\n s: status,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: undefined,\n f: await this.parse(result),\n b: undefined,\n o: undefined,\n };\n }\n\n private async parsePlugin(\n id: number,\n current: unknown,\n ): Promise {\n const currentPlugins = this.plugins;\n if (currentPlugins) {\n for (let i = 0, len = currentPlugins.length; i < len; i++) {\n const plugin = currentPlugins[i];\n if (plugin.parse.async && plugin.test(current)) {\n return createPluginNode(\n id,\n plugin.tag,\n await plugin.parse.async(current, this, {\n id,\n }),\n );\n }\n }\n }\n return undefined;\n }\n\n private async parseStream(\n id: number,\n current: Stream,\n ): Promise {\n return createStreamConstructorNode(\n id,\n this.parseSpecialReference(SpecialReference.StreamConstructor),\n await new Promise((resolve, reject) => {\n const sequence: SerovalNode[] = [];\n const cleanup = current.on({\n next: value => {\n this.markRef(id);\n this.parse(value).then(\n data => {\n sequence.push(createStreamNextNode(id, data));\n },\n data => {\n reject(data);\n cleanup();\n },\n );\n },\n throw: value => {\n this.markRef(id);\n this.parse(value).then(\n data => {\n sequence.push(createStreamThrowNode(id, data));\n resolve(sequence);\n cleanup();\n },\n data => {\n reject(data);\n cleanup();\n },\n );\n },\n return: value => {\n this.markRef(id);\n this.parse(value).then(\n data => {\n sequence.push(createStreamReturnNode(id, data));\n resolve(sequence);\n cleanup();\n },\n data => {\n reject(data);\n cleanup();\n },\n );\n },\n });\n }),\n );\n }\n\n private async parseObject(id: number, current: object): Promise {\n if (Array.isArray(current)) {\n return this.parseArray(id, current);\n }\n if (isStream(current)) {\n return this.parseStream(id, current);\n }\n const parsed = await this.parsePlugin(id, current);\n if (parsed) {\n return parsed;\n }\n const currentClass = current.constructor;\n switch (currentClass) {\n case Object:\n return this.parsePlainObject(\n id,\n current as Record,\n false,\n );\n case undefined:\n return this.parsePlainObject(\n id,\n current as Record,\n true,\n );\n case Date:\n return createDateNode(id, current as unknown as Date);\n case RegExp:\n return createRegExpNode(id, current as unknown as RegExp);\n case Error:\n case EvalError:\n case RangeError:\n case ReferenceError:\n case SyntaxError:\n case TypeError:\n case URIError:\n return this.parseError(id, current as unknown as Error);\n case Number:\n case Boolean:\n case String:\n case BigInt:\n return this.parseBoxed(id, current);\n case ArrayBuffer:\n return createArrayBufferNode(id, current as unknown as ArrayBuffer);\n case Int8Array:\n case Int16Array:\n case Int32Array:\n case Uint8Array:\n case Uint16Array:\n case Uint32Array:\n case Uint8ClampedArray:\n case Float32Array:\n case Float64Array:\n return this.parseTypedArray(id, current as unknown as TypedArrayValue);\n case DataView:\n return this.parseDataView(id, current as unknown as DataView);\n case Map:\n return this.parseMap(id, current as unknown as Map);\n case Set:\n return this.parseSet(id, current as unknown as Set);\n default:\n break;\n }\n // Promises\n if (currentClass === Promise || current instanceof Promise) {\n return this.parsePromise(id, current as unknown as Promise);\n }\n const currentFeatures = this.features;\n // BigInt Typed Arrays\n if (currentFeatures & Feature.BigIntTypedArray) {\n switch (currentClass) {\n case BigInt64Array:\n case BigUint64Array:\n return this.parseBigIntTypedArray(\n id,\n current as unknown as BigIntTypedArrayValue,\n );\n default:\n break;\n }\n }\n if (\n currentFeatures & Feature.AggregateError &&\n typeof AggregateError !== 'undefined' &&\n (currentClass === AggregateError || current instanceof AggregateError)\n ) {\n return this.parseAggregateError(id, current as unknown as AggregateError);\n }\n // Slow path. We only need to handle Errors and Iterators\n // since they have very broad implementations.\n if (current instanceof Error) {\n return this.parseError(id, current);\n }\n // Generator functions don't have a global constructor\n // despite existing\n if (Symbol.iterator in current || Symbol.asyncIterator in current) {\n return this.parsePlainObject(id, current, !!currentClass);\n }\n throw new SerovalUnsupportedTypeError(current);\n }\n\n async parse(current: T): Promise {\n try {\n switch (typeof current) {\n case 'boolean':\n return current ? TRUE_NODE : FALSE_NODE;\n case 'undefined':\n return UNDEFINED_NODE;\n case 'string':\n return createStringNode(current as string);\n case 'number':\n return createNumberNode(current as number);\n case 'bigint':\n return createBigIntNode(current as bigint);\n case 'object': {\n if (current) {\n const ref = this.getReference(current);\n return ref.type === 0\n ? await this.parseObject(ref.value, current as object)\n : ref.value;\n }\n return NULL_NODE;\n }\n case 'symbol':\n return this.parseWellKnownSymbol(current);\n case 'function':\n return this.parseFunction(current as (...args: unknown[]) => unknown);\n default:\n throw new SerovalUnsupportedTypeError(current);\n }\n } catch (error) {\n throw new SerovalParserError(error);\n }\n }\n}\n", "import type { BaseParserContextOptions } from '../context/parser';\nimport BaseAsyncParserContext from '../context/parser/async';\nimport type { SerovalMode } from '../plugin';\n\nexport type AsyncParserContextOptions = Omit;\n\nexport default class AsyncParserContext extends BaseAsyncParserContext {\n readonly mode: SerovalMode = 'vanilla';\n}\n", "import { SerovalUnknownTypedArrayError } from '../errors';\n\ntype TypedArrayConstructor =\n | Int8ArrayConstructor\n | Int16ArrayConstructor\n | Int32ArrayConstructor\n | Uint8ArrayConstructor\n | Uint16ArrayConstructor\n | Uint32ArrayConstructor\n | Uint8ClampedArrayConstructor\n | Float32ArrayConstructor\n | Float64ArrayConstructor\n | BigInt64ArrayConstructor\n | BigUint64ArrayConstructor;\n\nexport type TypedArrayValue =\n | Int8Array\n | Int16Array\n | Int32Array\n | Uint8Array\n | Uint16Array\n | Uint32Array\n | Uint8ClampedArray\n | Float32Array\n | Float64Array;\n\nexport type BigIntTypedArrayValue = BigInt64Array | BigUint64Array;\n\nexport function getTypedArrayConstructor(name: string): TypedArrayConstructor {\n switch (name) {\n case 'Int8Array':\n return Int8Array;\n case 'Int16Array':\n return Int16Array;\n case 'Int32Array':\n return Int32Array;\n case 'Uint8Array':\n return Uint8Array;\n case 'Uint16Array':\n return Uint16Array;\n case 'Uint32Array':\n return Uint32Array;\n case 'Uint8ClampedArray':\n return Uint8ClampedArray;\n case 'Float32Array':\n return Float32Array;\n case 'Float64Array':\n return Float64Array;\n case 'BigInt64Array':\n return BigInt64Array;\n case 'BigUint64Array':\n return BigUint64Array;\n default:\n throw new SerovalUnknownTypedArrayError(name);\n }\n}\n", "import {\n CONSTANT_VAL,\n ERROR_CONSTRUCTOR,\n SYMBOL_REF,\n SerovalNodeType,\n SerovalObjectFlags,\n} from '../constants';\nimport {\n SerovalDeserializationError,\n SerovalMissingInstanceError,\n SerovalMissingPluginError,\n SerovalUnsupportedNodeError,\n} from '../errors';\nimport type { Plugin, PluginAccessOptions, SerovalMode } from '../plugin';\nimport { getReference } from '../reference';\nimport type { Stream } from '../stream';\nimport { createStream, streamToAsyncIterable } from '../stream';\nimport { deserializeString } from '../string';\nimport type {\n SerovalAggregateErrorNode,\n SerovalArrayBufferNode,\n SerovalArrayNode,\n SerovalAsyncIteratorFactoryInstanceNode,\n SerovalAsyncIteratorFactoryNode,\n SerovalBigIntTypedArrayNode,\n SerovalBoxedNode,\n SerovalDataViewNode,\n SerovalDateNode,\n SerovalErrorNode,\n SerovalIteratorFactoryInstanceNode,\n SerovalIteratorFactoryNode,\n SerovalMapNode,\n SerovalNode,\n SerovalNullConstructorNode,\n SerovalObjectNode,\n SerovalObjectRecordKey,\n SerovalObjectRecordNode,\n SerovalPluginNode,\n SerovalPromiseConstructorNode,\n SerovalPromiseNode,\n SerovalPromiseRejectNode,\n SerovalPromiseResolveNode,\n SerovalReferenceNode,\n SerovalRegExpNode,\n SerovalSetNode,\n SerovalStreamConstructorNode,\n SerovalStreamNextNode,\n SerovalStreamReturnNode,\n SerovalStreamThrowNode,\n SerovalTypedArrayNode,\n} from '../types';\nimport assert from '../utils/assert';\nimport type { Deferred } from '../utils/deferred';\nimport { createDeferred } from '../utils/deferred';\nimport type { Sequence } from '../utils/iterator-to-sequence';\nimport { sequenceToIterator } from '../utils/iterator-to-sequence';\nimport type {\n BigIntTypedArrayValue,\n TypedArrayValue,\n} from '../utils/typed-array';\nimport { getTypedArrayConstructor } from '../utils/typed-array';\n\nfunction applyObjectFlag(obj: unknown, flag: SerovalObjectFlags): unknown {\n switch (flag) {\n case SerovalObjectFlags.Frozen:\n return Object.freeze(obj);\n case SerovalObjectFlags.NonExtensible:\n return Object.preventExtensions(obj);\n case SerovalObjectFlags.Sealed:\n return Object.seal(obj);\n default:\n return obj;\n }\n}\n\ntype AssignableValue = AggregateError | Error | Iterable;\ntype AssignableNode = SerovalAggregateErrorNode | SerovalErrorNode;\n\nexport interface BaseDeserializerOptions extends PluginAccessOptions {\n refs?: Map;\n}\n\nexport default abstract class BaseDeserializerContext\n implements PluginAccessOptions\n{\n abstract readonly mode: SerovalMode;\n\n /**\n * Mapping ids to values\n * @private\n */\n refs: Map;\n\n plugins?: Plugin[] | undefined;\n\n constructor(options: BaseDeserializerOptions) {\n this.plugins = options.plugins;\n this.refs = options.refs || new Map();\n }\n\n protected abstract assignIndexedValue(id: number, value: T): T;\n\n private deserializeReference(node: SerovalReferenceNode): unknown {\n return this.assignIndexedValue(\n node.i,\n getReference(deserializeString(node.s)),\n );\n }\n\n private deserializeArray(node: SerovalArrayNode): unknown[] {\n const len = node.l;\n const result: unknown[] = this.assignIndexedValue(\n node.i,\n new Array(len),\n );\n let item: SerovalNode | undefined;\n for (let i = 0; i < len; i++) {\n item = node.a[i];\n if (item) {\n result[i] = this.deserialize(item);\n }\n }\n applyObjectFlag(result, node.o);\n return result;\n }\n\n private deserializeProperties(\n node: SerovalObjectRecordNode,\n result: Record,\n ): Record {\n const len = node.s;\n if (len) {\n const keys = node.k;\n const vals = node.v;\n for (let i = 0, key: SerovalObjectRecordKey; i < len; i++) {\n key = keys[i];\n if (typeof key === 'string') {\n result[deserializeString(key)] = this.deserialize(vals[i]);\n } else {\n result[this.deserialize(key) as symbol] = this.deserialize(vals[i]);\n }\n }\n }\n return result;\n }\n\n private deserializeObject(\n node: SerovalObjectNode | SerovalNullConstructorNode,\n ): Record {\n const result = this.assignIndexedValue(\n node.i,\n (node.t === SerovalNodeType.Object ? {} : Object.create(null)) as Record<\n string,\n unknown\n >,\n );\n this.deserializeProperties(node.p, result);\n applyObjectFlag(result, node.o);\n return result;\n }\n\n private deserializeDate(node: SerovalDateNode): Date {\n return this.assignIndexedValue(node.i, new Date(node.s));\n }\n\n private deserializeRegExp(node: SerovalRegExpNode): RegExp {\n return this.assignIndexedValue(\n node.i,\n new RegExp(deserializeString(node.c), node.m),\n );\n }\n\n private deserializeSet(node: SerovalSetNode): Set {\n const result = this.assignIndexedValue(node.i, new Set());\n const items = node.a;\n for (let i = 0, len = node.l; i < len; i++) {\n result.add(this.deserialize(items[i]));\n }\n return result;\n }\n\n private deserializeMap(node: SerovalMapNode): Map {\n const result = this.assignIndexedValue(node.i, new Map());\n const keys = node.e.k;\n const vals = node.e.v;\n for (let i = 0, len = node.e.s; i < len; i++) {\n result.set(this.deserialize(keys[i]), this.deserialize(vals[i]));\n }\n return result;\n }\n\n private deserializeArrayBuffer(node: SerovalArrayBufferNode): ArrayBuffer {\n const bytes = new Uint8Array(node.s);\n const result = this.assignIndexedValue(node.i, bytes.buffer);\n return result;\n }\n\n private deserializeTypedArray(\n node: SerovalTypedArrayNode | SerovalBigIntTypedArrayNode,\n ): TypedArrayValue | BigIntTypedArrayValue {\n const construct = getTypedArrayConstructor(node.c);\n const source = this.deserialize(node.f) as ArrayBuffer;\n const result = this.assignIndexedValue(\n node.i,\n new construct(source, node.b, node.l),\n );\n return result;\n }\n\n private deserializeDataView(node: SerovalDataViewNode): DataView {\n const source = this.deserialize(node.f) as ArrayBuffer;\n const result = this.assignIndexedValue(\n node.i,\n new DataView(source, node.b, node.l),\n );\n return result;\n }\n\n private deserializeDictionary(\n node: AssignableNode,\n result: T,\n ): T {\n if (node.p) {\n const fields = this.deserializeProperties(node.p, {});\n Object.assign(result, fields);\n }\n return result;\n }\n\n private deserializeAggregateError(\n node: SerovalAggregateErrorNode,\n ): AggregateError {\n // Serialize the required arguments\n const result = this.assignIndexedValue(\n node.i,\n new AggregateError([], deserializeString(node.m)),\n );\n // `AggregateError` might've been extended\n // either through class or custom properties\n // Make sure to assign extra properties\n return this.deserializeDictionary(node, result);\n }\n\n private deserializeError(node: SerovalErrorNode): Error {\n const construct = ERROR_CONSTRUCTOR[node.s];\n const result = this.assignIndexedValue(\n node.i,\n new construct(deserializeString(node.m)),\n );\n return this.deserializeDictionary(node, result);\n }\n\n private deserializePromise(node: SerovalPromiseNode): Promise {\n const deferred = createDeferred();\n const result = this.assignIndexedValue(node.i, deferred);\n const deserialized = this.deserialize(node.f);\n if (node.s) {\n deferred.resolve(deserialized);\n } else {\n deferred.reject(deserialized);\n }\n return result.promise;\n }\n\n private deserializeBoxed(node: SerovalBoxedNode): unknown {\n return this.assignIndexedValue(node.i, Object(this.deserialize(node.f)));\n }\n\n private deserializePlugin(node: SerovalPluginNode): unknown {\n const currentPlugins = this.plugins;\n if (currentPlugins) {\n const tag = deserializeString(node.c);\n for (let i = 0, len = currentPlugins.length; i < len; i++) {\n const plugin = currentPlugins[i];\n if (plugin.tag === tag) {\n return this.assignIndexedValue(\n node.i,\n plugin.deserialize(node.s, this, {\n id: node.i,\n }),\n );\n }\n }\n }\n throw new SerovalMissingPluginError(node.c);\n }\n\n private deserializePromiseConstructor(\n node: SerovalPromiseConstructorNode,\n ): unknown {\n return this.assignIndexedValue(node.i, createDeferred()).promise;\n }\n\n private deserializePromiseResolve(node: SerovalPromiseResolveNode): unknown {\n const deferred = this.refs.get(node.i) as Deferred | undefined;\n assert(deferred, new SerovalMissingInstanceError('Promise'));\n deferred.resolve(this.deserialize(node.a[1]));\n return undefined;\n }\n\n private deserializePromiseReject(node: SerovalPromiseRejectNode): unknown {\n const deferred = this.refs.get(node.i) as Deferred | undefined;\n assert(deferred, new SerovalMissingInstanceError('Promise'));\n deferred.reject(this.deserialize(node.a[1]));\n return undefined;\n }\n\n private deserializeIteratorFactoryInstance(\n node: SerovalIteratorFactoryInstanceNode,\n ): unknown {\n this.deserialize(node.a[0]);\n const source = this.deserialize(node.a[1]);\n return sequenceToIterator(source as Sequence);\n }\n\n private deserializeAsyncIteratorFactoryInstance(\n node: SerovalAsyncIteratorFactoryInstanceNode,\n ): unknown {\n this.deserialize(node.a[0]);\n const source = this.deserialize(node.a[1]);\n return streamToAsyncIterable(source as Stream);\n }\n\n private deserializeStreamConstructor(\n node: SerovalStreamConstructorNode,\n ): unknown {\n const result = this.assignIndexedValue(node.i, createStream());\n const len = node.a.length;\n if (len) {\n for (let i = 0; i < len; i++) {\n this.deserialize(node.a[i]);\n }\n }\n return result;\n }\n\n private deserializeStreamNext(node: SerovalStreamNextNode): unknown {\n const deferred = this.refs.get(node.i) as Stream | undefined;\n assert(deferred, new SerovalMissingInstanceError('Stream'));\n deferred.next(this.deserialize(node.f));\n return undefined;\n }\n\n private deserializeStreamThrow(node: SerovalStreamThrowNode): unknown {\n const deferred = this.refs.get(node.i) as Stream | undefined;\n assert(deferred, new SerovalMissingInstanceError('Stream'));\n deferred.throw(this.deserialize(node.f));\n return undefined;\n }\n\n private deserializeStreamReturn(node: SerovalStreamReturnNode): unknown {\n const deferred = this.refs.get(node.i) as Stream | undefined;\n assert(deferred, new SerovalMissingInstanceError('Stream'));\n deferred.return(this.deserialize(node.f));\n return undefined;\n }\n\n private deserializeIteratorFactory(\n node: SerovalIteratorFactoryNode,\n ): unknown {\n this.deserialize(node.f);\n return undefined;\n }\n\n private deserializeAsyncIteratorFactory(\n node: SerovalAsyncIteratorFactoryNode,\n ): unknown {\n this.deserialize(node.a[1]);\n return undefined;\n }\n\n deserialize(node: SerovalNode): unknown {\n try {\n switch (node.t) {\n case SerovalNodeType.Constant:\n return CONSTANT_VAL[node.s];\n case SerovalNodeType.Number:\n return node.s;\n case SerovalNodeType.String:\n return deserializeString(node.s);\n case SerovalNodeType.BigInt:\n return BigInt(node.s);\n case SerovalNodeType.IndexedValue:\n return this.refs.get(node.i);\n case SerovalNodeType.Reference:\n return this.deserializeReference(node);\n case SerovalNodeType.Array:\n return this.deserializeArray(node);\n case SerovalNodeType.Object:\n case SerovalNodeType.NullConstructor:\n return this.deserializeObject(node);\n case SerovalNodeType.Date:\n return this.deserializeDate(node);\n case SerovalNodeType.RegExp:\n return this.deserializeRegExp(node);\n case SerovalNodeType.Set:\n return this.deserializeSet(node);\n case SerovalNodeType.Map:\n return this.deserializeMap(node);\n case SerovalNodeType.ArrayBuffer:\n return this.deserializeArrayBuffer(node);\n case SerovalNodeType.BigIntTypedArray:\n case SerovalNodeType.TypedArray:\n return this.deserializeTypedArray(node);\n case SerovalNodeType.DataView:\n return this.deserializeDataView(node);\n case SerovalNodeType.AggregateError:\n return this.deserializeAggregateError(node);\n case SerovalNodeType.Error:\n return this.deserializeError(node);\n case SerovalNodeType.Promise:\n return this.deserializePromise(node);\n case SerovalNodeType.WKSymbol:\n return SYMBOL_REF[node.s];\n case SerovalNodeType.Boxed:\n return this.deserializeBoxed(node);\n case SerovalNodeType.Plugin:\n return this.deserializePlugin(node);\n case SerovalNodeType.PromiseConstructor:\n return this.deserializePromiseConstructor(node);\n case SerovalNodeType.PromiseResolve:\n return this.deserializePromiseResolve(node);\n case SerovalNodeType.PromiseReject:\n return this.deserializePromiseReject(node);\n case SerovalNodeType.IteratorFactoryInstance:\n return this.deserializeIteratorFactoryInstance(node);\n case SerovalNodeType.AsyncIteratorFactoryInstance:\n return this.deserializeAsyncIteratorFactoryInstance(node);\n case SerovalNodeType.StreamConstructor:\n return this.deserializeStreamConstructor(node);\n case SerovalNodeType.StreamNext:\n return this.deserializeStreamNext(node);\n case SerovalNodeType.StreamThrow:\n return this.deserializeStreamThrow(node);\n case SerovalNodeType.StreamReturn:\n return this.deserializeStreamReturn(node);\n case SerovalNodeType.IteratorFactory:\n return this.deserializeIteratorFactory(node);\n case SerovalNodeType.AsyncIteratorFactory:\n return this.deserializeAsyncIteratorFactory(node);\n // case SerovalNodeType.SpecialReference:\n default:\n throw new SerovalUnsupportedNodeError(node);\n }\n } catch (error) {\n throw new SerovalDeserializationError(error);\n }\n }\n}\n", "import type { BaseDeserializerOptions } from '../context/deserializer';\nimport BaseDeserializerContext from '../context/deserializer';\nimport type { SerovalMode } from '../plugin';\n\nexport interface VanillaDeserializerContextOptions\n extends Omit {\n markedRefs: number[] | Set;\n}\n\nexport default class VanillaDeserializerContext extends BaseDeserializerContext {\n readonly mode: SerovalMode = 'vanilla';\n\n marked: Set;\n\n constructor(options: VanillaDeserializerContextOptions) {\n super(options);\n this.marked = new Set(options.markedRefs);\n }\n\n assignIndexedValue(index: number, value: T): T {\n if (this.marked.has(index)) {\n this.refs.set(index, value);\n }\n return value;\n }\n}\n", "const IDENTIFIER_CHECK = /^[$A-Z_][0-9A-Z_$]*$/i;\n\nexport function isValidIdentifier(name: string): boolean {\n const char = name[0];\n return (\n (char === '$' ||\n char === '_' ||\n (char >= 'A' && char <= 'Z') ||\n (char >= 'a' && char <= 'z')) &&\n IDENTIFIER_CHECK.test(name)\n );\n}\n", "import { Feature } from '../compat';\nimport {\n CONSTANT_STRING,\n ERROR_CONSTRUCTOR_STRING,\n SYMBOL_STRING,\n SerovalNodeType,\n SerovalObjectFlags,\n} from '../constants';\nimport {\n SerovalMissingPluginError,\n SerovalSerializationError,\n SerovalUnsupportedNodeError,\n} from '../errors';\nimport { REFERENCES_KEY } from '../keys';\nimport type { Plugin, PluginAccessOptions, SerovalMode } from '../plugin';\nimport { SpecialReference } from '../special-reference';\nimport type {\n SerovalAggregateErrorNode,\n SerovalArrayBufferNode,\n SerovalArrayNode,\n SerovalAsyncIteratorFactoryInstanceNode,\n SerovalAsyncIteratorFactoryNode,\n SerovalBigIntTypedArrayNode,\n SerovalBoxedNode,\n SerovalDataViewNode,\n SerovalDateNode,\n SerovalErrorNode,\n SerovalIndexedValueNode,\n SerovalIteratorFactoryInstanceNode,\n SerovalIteratorFactoryNode,\n SerovalMapNode,\n SerovalNode,\n SerovalNodeWithID,\n SerovalNullConstructorNode,\n SerovalObjectNode,\n SerovalObjectRecordKey,\n SerovalObjectRecordNode,\n SerovalPluginNode,\n SerovalPromiseConstructorNode,\n SerovalPromiseNode,\n SerovalPromiseRejectNode,\n SerovalPromiseResolveNode,\n SerovalReferenceNode,\n SerovalRegExpNode,\n SerovalSetNode,\n SerovalSpecialReferenceNode,\n SerovalStreamConstructorNode,\n SerovalStreamNextNode,\n SerovalStreamReturnNode,\n SerovalStreamThrowNode,\n SerovalTypedArrayNode,\n SerovalWKSymbolNode,\n} from '../types';\nimport { isValidIdentifier } from '../utils/is-valid-identifier';\n\nconst enum AssignmentType {\n Index = 0,\n Add = 1,\n Set = 2,\n Delete = 3,\n}\n\ninterface IndexAssignment {\n t: AssignmentType.Index;\n s: string;\n k: undefined;\n v: string;\n}\n\ninterface SetAssignment {\n t: AssignmentType.Set;\n s: string;\n k: string;\n v: string;\n}\n\ninterface AddAssignment {\n t: AssignmentType.Add;\n s: string;\n k: undefined;\n v: string;\n}\n\ninterface DeleteAssignment {\n t: AssignmentType.Delete;\n s: string;\n k: string;\n v: undefined;\n}\n\n// Array of assignments to be done (used for recursion)\ntype Assignment =\n | IndexAssignment\n | AddAssignment\n | SetAssignment\n | DeleteAssignment;\n\nexport interface FlaggedObject {\n type: SerovalObjectFlags;\n value: string;\n}\n\nfunction getAssignmentExpression(assignment: Assignment): string {\n switch (assignment.t) {\n case AssignmentType.Index:\n return assignment.s + '=' + assignment.v;\n case AssignmentType.Set:\n return assignment.s + '.set(' + assignment.k + ',' + assignment.v + ')';\n case AssignmentType.Add:\n return assignment.s + '.add(' + assignment.v + ')';\n case AssignmentType.Delete:\n return assignment.s + '.delete(' + assignment.k + ')';\n }\n}\n\nfunction mergeAssignments(assignments: Assignment[]): Assignment[] {\n const newAssignments: Assignment[] = [];\n let current = assignments[0];\n for (\n let i = 1, len = assignments.length, item: Assignment, prev = current;\n i < len;\n i++\n ) {\n item = assignments[i];\n if (item.t === AssignmentType.Index && item.v === prev.v) {\n // Merge if the right-hand value is the same\n // saves at least 2 chars\n current = {\n t: AssignmentType.Index,\n s: item.s,\n k: undefined,\n v: getAssignmentExpression(current),\n } as IndexAssignment;\n } else if (item.t === AssignmentType.Set && item.s === prev.s) {\n // Maps has chaining methods, merge if source is the same\n current = {\n t: AssignmentType.Set,\n s: getAssignmentExpression(current),\n k: item.k,\n v: item.v,\n } as SetAssignment;\n } else if (item.t === AssignmentType.Add && item.s === prev.s) {\n // Sets has chaining methods too\n current = {\n t: AssignmentType.Add,\n s: getAssignmentExpression(current),\n k: undefined,\n v: item.v,\n } as AddAssignment;\n } else if (item.t === AssignmentType.Delete && item.s === prev.s) {\n // Maps has chaining methods, merge if source is the same\n current = {\n t: AssignmentType.Delete,\n s: getAssignmentExpression(current),\n k: item.k,\n v: undefined,\n } as DeleteAssignment;\n } else {\n // Different assignment, push current\n newAssignments.push(current);\n current = item;\n }\n prev = item;\n }\n\n newAssignments.push(current);\n\n return newAssignments;\n}\n\nfunction resolveAssignments(assignments: Assignment[]): string | undefined {\n if (assignments.length) {\n let result = '';\n const merged = mergeAssignments(assignments);\n for (let i = 0, len = merged.length; i < len; i++) {\n result += getAssignmentExpression(merged[i]) + ',';\n }\n return result;\n }\n return undefined;\n}\n\nconst NULL_CONSTRUCTOR = 'Object.create(null)';\nconst SET_CONSTRUCTOR = 'new Set';\nconst MAP_CONSTRUCTOR = 'new Map';\n\nconst PROMISE_RESOLVE = 'Promise.resolve';\nconst PROMISE_REJECT = 'Promise.reject';\n\nconst OBJECT_FLAG_CONSTRUCTOR: Record =\n {\n [SerovalObjectFlags.Frozen]: 'Object.freeze',\n [SerovalObjectFlags.Sealed]: 'Object.seal',\n [SerovalObjectFlags.NonExtensible]: 'Object.preventExtensions',\n [SerovalObjectFlags.None]: undefined,\n };\n\ntype SerovalNodeWithProperties =\n | SerovalObjectNode\n | SerovalNullConstructorNode\n | SerovalAggregateErrorNode\n | SerovalErrorNode;\n\nexport interface BaseSerializerContextOptions extends PluginAccessOptions {\n features: number;\n markedRefs: number[] | Set;\n}\n\nexport default abstract class BaseSerializerContext\n implements PluginAccessOptions\n{\n /**\n * @private\n */\n features: number;\n\n /**\n * To check if an object is synchronously referencing itself\n * @private\n */\n stack: number[] = [];\n\n /**\n * Array of object mutations\n * @private\n */\n flags: FlaggedObject[] = [];\n\n /**\n * Array of assignments to be done (used for recursion)\n * @private\n */\n assignments: Assignment[] = [];\n\n plugins?: Plugin[] | undefined;\n\n /**\n * Refs that are...referenced\n * @private\n */\n marked: Set;\n\n constructor(options: BaseSerializerContextOptions) {\n this.plugins = options.plugins;\n this.features = options.features;\n this.marked = new Set(options.markedRefs);\n }\n\n abstract readonly mode: SerovalMode;\n\n createFunction(parameters: string[], body: string): string {\n if (this.features & Feature.ArrowFunction) {\n const joined =\n parameters.length === 1\n ? parameters[0]\n : '(' + parameters.join(',') + ')';\n return joined + '=>' + body;\n }\n return 'function(' + parameters.join(',') + '){return ' + body + '}';\n }\n\n createEffectfulFunction(parameters: string[], body: string): string {\n if (this.features & Feature.ArrowFunction) {\n const joined =\n parameters.length === 1\n ? parameters[0]\n : '(' + parameters.join(',') + ')';\n return joined + '=>{' + body + '}';\n }\n return 'function(' + parameters.join(',') + '){' + body + '}';\n }\n\n /**\n * A tiny function that tells if a reference\n * is to be accessed. This is a requirement for\n * deciding whether or not we should generate\n * an identifier for the object\n */\n protected markRef(id: number): void {\n this.marked.add(id);\n }\n\n protected isMarked(id: number): boolean {\n return this.marked.has(id);\n }\n\n /**\n * Converts the ID of a reference into a identifier string\n * that is used to refer to the object instance in the\n * generated script.\n */\n abstract getRefParam(id: number): string;\n\n protected pushObjectFlag(flag: SerovalObjectFlags, id: number): void {\n if (flag !== SerovalObjectFlags.None) {\n this.markRef(id);\n this.flags.push({\n type: flag,\n value: this.getRefParam(id),\n });\n }\n }\n\n private resolveFlags(): string | undefined {\n let result = '';\n for (let i = 0, current = this.flags, len = current.length; i < len; i++) {\n const flag = current[i];\n result += OBJECT_FLAG_CONSTRUCTOR[flag.type] + '(' + flag.value + '),';\n }\n return result;\n }\n\n protected resolvePatches(): string | undefined {\n const assignments = resolveAssignments(this.assignments);\n const flags = this.resolveFlags();\n if (assignments) {\n if (flags) {\n return assignments + flags;\n }\n return assignments;\n }\n return flags;\n }\n\n /**\n * Generates the inlined assignment for the reference\n * This is different from the assignments array as this one\n * signifies creation rather than mutation\n */\n protected createAssignment(source: string, value: string): void {\n this.assignments.push({\n t: AssignmentType.Index,\n s: source,\n k: undefined,\n v: value,\n });\n }\n\n protected createAddAssignment(ref: number, value: string): void {\n this.assignments.push({\n t: AssignmentType.Add,\n s: this.getRefParam(ref),\n k: undefined,\n v: value,\n });\n }\n\n protected createSetAssignment(ref: number, key: string, value: string): void {\n this.assignments.push({\n t: AssignmentType.Set,\n s: this.getRefParam(ref),\n k: key,\n v: value,\n });\n }\n\n protected createDeleteAssignment(ref: number, key: string): void {\n this.assignments.push({\n t: AssignmentType.Delete,\n s: this.getRefParam(ref),\n k: key,\n v: undefined,\n });\n }\n\n protected createArrayAssign(\n ref: number,\n index: number | string,\n value: string,\n ): void {\n this.createAssignment(this.getRefParam(ref) + '[' + index + ']', value);\n }\n\n protected createObjectAssign(ref: number, key: string, value: string): void {\n this.createAssignment(this.getRefParam(ref) + '.' + key, value);\n }\n\n /**\n * Checks if the value is in the stack. Stack here is a reference\n * structure to know if a object is to be accessed in a TDZ.\n */\n isIndexedValueInStack(node: SerovalNode): boolean {\n return (\n node.t === SerovalNodeType.IndexedValue && this.stack.includes(node.i)\n );\n }\n\n /**\n * Produces an assignment expression. `id` generates a reference\n * parameter (through `getRefParam`) and has the option to\n * return the reference parameter directly or assign a value to\n * it.\n */\n protected abstract assignIndexedValue(id: number, value: string): string;\n\n protected serializeReference(node: SerovalReferenceNode): string {\n return this.assignIndexedValue(\n node.i,\n REFERENCES_KEY + '.get(\"' + node.s + '\")',\n );\n }\n\n protected serializeArrayItem(\n id: number,\n item: SerovalNode | undefined,\n index: number,\n ): string {\n // Check if index is a hole\n if (item) {\n // Check if item is a parent\n if (this.isIndexedValueInStack(item)) {\n this.markRef(id);\n this.createArrayAssign(\n id,\n index,\n this.getRefParam((item as SerovalIndexedValueNode).i),\n );\n return '';\n }\n return this.serialize(item);\n }\n return '';\n }\n\n protected serializeArray(node: SerovalArrayNode): string {\n const id = node.i;\n if (node.l) {\n this.stack.push(id);\n const list = node.a;\n let values = this.serializeArrayItem(id, list[0], 0);\n // This is different than Map and Set\n // because we also need to serialize\n // the holes of the Array\n let isHoley = values === '';\n for (let i = 1, len = node.l, item: string; i < len; i++) {\n item = this.serializeArrayItem(id, list[i], i);\n values += ',' + item;\n isHoley = item === '';\n }\n this.stack.pop();\n this.pushObjectFlag(node.o, node.i);\n return this.assignIndexedValue(id, '[' + values + (isHoley ? ',]' : ']'));\n }\n return this.assignIndexedValue(id, '[]');\n }\n\n protected serializeProperty(\n source: SerovalNodeWithProperties,\n key: SerovalObjectRecordKey,\n val: SerovalNode,\n ): string {\n if (typeof key === 'string') {\n const check = Number(key);\n const isIdentifier =\n // Test if key is a valid positive number or JS identifier\n // so that we don't have to serialize the key and wrap with brackets\n (check >= 0 &&\n // It's also important to consider that if the key is\n // indeed numeric, we need to make sure that when\n // converted back into a string, it's still the same\n // to the original key. This allows us to differentiate\n // keys that has numeric formats but in a different\n // format, which can cause unintentional key declaration\n // Example: { 0x1: 1 } vs { '0x1': 1 }\n check.toString() === key) ||\n isValidIdentifier(key);\n if (this.isIndexedValueInStack(val)) {\n const refParam = this.getRefParam((val as SerovalIndexedValueNode).i);\n this.markRef(source.i);\n // Strict identifier check, make sure\n // that it isn't numeric (except NaN)\n if (isIdentifier && check !== check) {\n this.createObjectAssign(source.i, key, refParam);\n } else {\n this.createArrayAssign(\n source.i,\n isIdentifier ? key : '\"' + key + '\"',\n refParam,\n );\n }\n return '';\n }\n return (isIdentifier ? key : '\"' + key + '\"') + ':' + this.serialize(val);\n }\n return '[' + this.serialize(key) + ']:' + this.serialize(val);\n }\n\n protected serializeProperties(\n source: SerovalNodeWithProperties,\n record: SerovalObjectRecordNode,\n ): string {\n const len = record.s;\n if (len) {\n const keys = record.k;\n const values = record.v;\n this.stack.push(source.i);\n let result = this.serializeProperty(source, keys[0], values[0]);\n for (let i = 1, item = result; i < len; i++) {\n item = this.serializeProperty(source, keys[i], values[i]);\n result += (item && result && ',') + item;\n }\n this.stack.pop();\n return '{' + result + '}';\n }\n return '{}';\n }\n\n protected serializeObject(node: SerovalObjectNode): string {\n this.pushObjectFlag(node.o, node.i);\n return this.assignIndexedValue(\n node.i,\n this.serializeProperties(node, node.p),\n );\n }\n\n protected serializeWithObjectAssign(\n source: SerovalNodeWithProperties,\n value: SerovalObjectRecordNode,\n serialized: string,\n ): string {\n const fields = this.serializeProperties(source, value);\n if (fields !== '{}') {\n return 'Object.assign(' + serialized + ',' + fields + ')';\n }\n return serialized;\n }\n\n private serializeStringKeyAssignment(\n source: SerovalNodeWithProperties,\n mainAssignments: Assignment[],\n key: string,\n value: SerovalNode,\n ): void {\n const serialized = this.serialize(value);\n const check = Number(key);\n const isIdentifier =\n // Test if key is a valid positive number or JS identifier\n // so that we don't have to serialize the key and wrap with brackets\n (check >= 0 &&\n // It's also important to consider that if the key is\n // indeed numeric, we need to make sure that when\n // converted back into a string, it's still the same\n // to the original key. This allows us to differentiate\n // keys that has numeric formats but in a different\n // format, which can cause unintentional key declaration\n // Example: { 0x1: 1 } vs { '0x1': 1 }\n check.toString() === key) ||\n isValidIdentifier(key);\n if (this.isIndexedValueInStack(value)) {\n // Strict identifier check, make sure\n // that it isn't numeric (except NaN)\n if (isIdentifier && check !== check) {\n this.createObjectAssign(source.i, key, serialized);\n } else {\n this.createArrayAssign(\n source.i,\n isIdentifier ? key : '\"' + key + '\"',\n serialized,\n );\n }\n } else {\n const parentAssignment = this.assignments;\n this.assignments = mainAssignments;\n if (isIdentifier && check !== check) {\n this.createObjectAssign(source.i, key, serialized);\n } else {\n this.createArrayAssign(\n source.i,\n isIdentifier ? key : '\"' + key + '\"',\n serialized,\n );\n }\n this.assignments = parentAssignment;\n }\n }\n\n protected serializeAssignment(\n source: SerovalNodeWithProperties,\n mainAssignments: Assignment[],\n key: SerovalObjectRecordKey,\n value: SerovalNode,\n ): void {\n if (typeof key === 'string') {\n this.serializeStringKeyAssignment(source, mainAssignments, key, value);\n } else {\n const parent = this.stack;\n this.stack = [];\n const serialized = this.serialize(value);\n this.stack = parent;\n const parentAssignment = this.assignments;\n this.assignments = mainAssignments;\n this.createArrayAssign(source.i, this.serialize(key), serialized);\n this.assignments = parentAssignment;\n }\n }\n\n protected serializeAssignments(\n source: SerovalNodeWithProperties,\n node: SerovalObjectRecordNode,\n ): string | undefined {\n const len = node.s;\n if (len) {\n const mainAssignments: Assignment[] = [];\n const keys = node.k;\n const values = node.v;\n this.stack.push(source.i);\n for (let i = 0; i < len; i++) {\n this.serializeAssignment(source, mainAssignments, keys[i], values[i]);\n }\n this.stack.pop();\n return resolveAssignments(mainAssignments);\n }\n return undefined;\n }\n\n protected serializeDictionary(\n node: SerovalNodeWithProperties,\n init: string,\n ): string {\n if (node.p) {\n if (this.features & Feature.ObjectAssign) {\n init = this.serializeWithObjectAssign(node, node.p, init);\n } else {\n this.markRef(node.i);\n const assignments = this.serializeAssignments(node, node.p);\n if (assignments) {\n return (\n '(' +\n this.assignIndexedValue(node.i, init) +\n ',' +\n assignments +\n this.getRefParam(node.i) +\n ')'\n );\n }\n }\n }\n return this.assignIndexedValue(node.i, init);\n }\n\n protected serializeNullConstructor(node: SerovalNullConstructorNode): string {\n this.pushObjectFlag(node.o, node.i);\n return this.serializeDictionary(node, NULL_CONSTRUCTOR);\n }\n\n protected serializeDate(node: SerovalDateNode): string {\n return this.assignIndexedValue(node.i, 'new Date(\"' + node.s + '\")');\n }\n\n protected serializeRegExp(node: SerovalRegExpNode): string {\n return this.assignIndexedValue(node.i, '/' + node.c + '/' + node.m);\n }\n\n protected serializeSetItem(id: number, item: SerovalNode): string {\n if (this.isIndexedValueInStack(item)) {\n this.markRef(id);\n this.createAddAssignment(\n id,\n this.getRefParam((item as SerovalIndexedValueNode).i),\n );\n return '';\n }\n return this.serialize(item);\n }\n\n protected serializeSet(node: SerovalSetNode): string {\n let serialized = SET_CONSTRUCTOR;\n const size = node.l;\n const id = node.i;\n if (size) {\n const items = node.a;\n this.stack.push(id);\n let result = this.serializeSetItem(id, items[0]);\n for (let i = 1, item = result; i < size; i++) {\n item = this.serializeSetItem(id, items[i]);\n result += (item && result && ',') + item;\n }\n this.stack.pop();\n if (result) {\n serialized += '([' + result + '])';\n }\n }\n return this.assignIndexedValue(id, serialized);\n }\n\n protected serializeMapEntry(\n id: number,\n key: SerovalNode,\n val: SerovalNode,\n sentinel: string,\n ): string {\n if (this.isIndexedValueInStack(key)) {\n // Create reference for the map instance\n const keyRef = this.getRefParam((key as SerovalIndexedValueNode).i);\n this.markRef(id);\n // Check if value is a parent\n if (this.isIndexedValueInStack(val)) {\n const valueRef = this.getRefParam((val as SerovalIndexedValueNode).i);\n // Register an assignment since\n // both key and value are a parent of this\n // Map instance\n this.createSetAssignment(id, keyRef, valueRef);\n return '';\n }\n // Reset the stack\n // This is required because the serialized\n // value is no longer part of the expression\n // tree and has been moved to the deferred\n // assignment\n if (\n val.t !== SerovalNodeType.IndexedValue &&\n val.i != null &&\n this.isMarked(val.i)\n ) {\n // We use a trick here using sequence (or comma) expressions\n // basically we serialize the intended object in place WITHOUT\n // actually returning it, this is by returning a placeholder\n // value that we will remove sometime after.\n const serialized =\n '(' + this.serialize(val) + ',[' + sentinel + ',' + sentinel + '])';\n this.createSetAssignment(id, keyRef, this.getRefParam(val.i));\n this.createDeleteAssignment(id, sentinel);\n return serialized;\n }\n const parent = this.stack;\n this.stack = [];\n this.createSetAssignment(id, keyRef, this.serialize(val));\n this.stack = parent;\n return '';\n }\n if (this.isIndexedValueInStack(val)) {\n // Create ref for the Map instance\n const valueRef = this.getRefParam((val as SerovalIndexedValueNode).i);\n this.markRef(id);\n if (\n key.t !== SerovalNodeType.IndexedValue &&\n key.i != null &&\n this.isMarked(key.i)\n ) {\n const serialized =\n '(' + this.serialize(key) + ',[' + sentinel + ',' + sentinel + '])';\n this.createSetAssignment(id, this.getRefParam(key.i), valueRef);\n this.createDeleteAssignment(id, sentinel);\n return serialized;\n }\n // Reset stack for the key serialization\n const parent = this.stack;\n this.stack = [];\n this.createSetAssignment(id, this.serialize(key), valueRef);\n this.stack = parent;\n return '';\n }\n\n return '[' + this.serialize(key) + ',' + this.serialize(val) + ']';\n }\n\n protected serializeMap(node: SerovalMapNode): string {\n let serialized = MAP_CONSTRUCTOR;\n const size = node.e.s;\n const id = node.i;\n const sentinel = node.f;\n const sentinelId = this.getRefParam(sentinel.i);\n if (size) {\n const keys = node.e.k;\n const vals = node.e.v;\n this.stack.push(id);\n let result = this.serializeMapEntry(id, keys[0], vals[0], sentinelId);\n for (let i = 1, item = result; i < size; i++) {\n item = this.serializeMapEntry(id, keys[i], vals[i], sentinelId);\n result += (item && result && ',') + item;\n }\n this.stack.pop();\n // Check if there are any values\n // so that the empty Map constructor\n // can be used instead\n if (result) {\n serialized += '([' + result + '])';\n }\n }\n if (sentinel.t === SerovalNodeType.SpecialReference) {\n this.markRef(sentinel.i);\n serialized = '(' + this.serialize(sentinel) + ',' + serialized + ')';\n }\n return this.assignIndexedValue(id, serialized);\n }\n\n protected serializeArrayBuffer(node: SerovalArrayBufferNode): string {\n let result = 'new Uint8Array(';\n const buffer = node.s;\n const len = buffer.length;\n if (len) {\n result += '[' + buffer[0];\n for (let i = 1; i < len; i++) {\n result += ',' + buffer[i];\n }\n result += ']';\n }\n return this.assignIndexedValue(node.i, result + ').buffer');\n }\n\n protected serializeTypedArray(\n node: SerovalTypedArrayNode | SerovalBigIntTypedArrayNode,\n ): string {\n return this.assignIndexedValue(\n node.i,\n 'new ' +\n node.c +\n '(' +\n this.serialize(node.f) +\n ',' +\n node.b +\n ',' +\n node.l +\n ')',\n );\n }\n\n protected serializeDataView(node: SerovalDataViewNode): string {\n return this.assignIndexedValue(\n node.i,\n 'new DataView(' +\n this.serialize(node.f) +\n ',' +\n node.b +\n ',' +\n node.l +\n ')',\n );\n }\n\n protected serializeAggregateError(node: SerovalAggregateErrorNode): string {\n const id = node.i;\n // `AggregateError` might've been extended\n // either through class or custom properties\n // Make sure to assign extra properties\n this.stack.push(id);\n const serialized = this.serializeDictionary(\n node,\n 'new AggregateError([],\"' + node.m + '\")',\n );\n this.stack.pop();\n return serialized;\n }\n\n protected serializeError(node: SerovalErrorNode): string {\n return this.serializeDictionary(\n node,\n 'new ' + ERROR_CONSTRUCTOR_STRING[node.s] + '(\"' + node.m + '\")',\n );\n }\n\n protected serializePromise(node: SerovalPromiseNode): string {\n let serialized: string;\n // Check if resolved value is a parent expression\n const fulfilled = node.f;\n const id = node.i;\n const promiseConstructor = node.s ? PROMISE_RESOLVE : PROMISE_REJECT;\n if (this.isIndexedValueInStack(fulfilled)) {\n // A Promise trick, reference the value\n // inside the `then` expression so that\n // the Promise evaluates after the parent\n // has initialized\n const ref = this.getRefParam((fulfilled as SerovalIndexedValueNode).i);\n serialized =\n promiseConstructor +\n (node.s\n ? '().then(' + this.createFunction([], ref) + ')'\n : '().catch(' +\n this.createEffectfulFunction([], 'throw ' + ref) +\n ')');\n } else {\n this.stack.push(id);\n const result = this.serialize(fulfilled);\n this.stack.pop();\n // just inline the value/reference here\n serialized = promiseConstructor + '(' + result + ')';\n }\n return this.assignIndexedValue(id, serialized);\n }\n\n protected serializeWellKnownSymbol(node: SerovalWKSymbolNode): string {\n return this.assignIndexedValue(node.i, SYMBOL_STRING[node.s]);\n }\n\n protected serializeBoxed(node: SerovalBoxedNode): string {\n return this.assignIndexedValue(\n node.i,\n 'Object(' + this.serialize(node.f) + ')',\n );\n }\n\n protected serializePlugin(node: SerovalPluginNode): string {\n const currentPlugins = this.plugins;\n if (currentPlugins) {\n for (let i = 0, len = currentPlugins.length; i < len; i++) {\n const plugin = currentPlugins[i];\n if (plugin.tag === node.c) {\n return this.assignIndexedValue(\n node.i,\n plugin.serialize(node.s, this, {\n id: node.i,\n }),\n );\n }\n }\n }\n throw new SerovalMissingPluginError(node.c);\n }\n\n private getConstructor(node: SerovalNodeWithID): string {\n const current = this.serialize(node);\n return current === this.getRefParam(node.i) ? current : '(' + current + ')';\n }\n\n protected serializePromiseConstructor(\n node: SerovalPromiseConstructorNode,\n ): string {\n return this.assignIndexedValue(node.i, this.getConstructor(node.f) + '()');\n }\n\n protected serializePromiseResolve(node: SerovalPromiseResolveNode): string {\n return (\n this.getConstructor(node.a[0]) +\n '(' +\n this.getRefParam(node.i) +\n ',' +\n this.serialize(node.a[1]) +\n ')'\n );\n }\n\n protected serializePromiseReject(node: SerovalPromiseRejectNode): string {\n return (\n this.getConstructor(node.a[0]) +\n '(' +\n this.getRefParam(node.i) +\n ',' +\n this.serialize(node.a[1]) +\n ')'\n );\n }\n\n private serializeSpecialReferenceValue(ref: SpecialReference): string {\n switch (ref) {\n case SpecialReference.MapSentinel:\n return '[]';\n case SpecialReference.PromiseConstructor:\n return this.createFunction(\n ['s', 'f', 'p'],\n '((p=new Promise(' +\n this.createEffectfulFunction(['a', 'b'], 's=a,f=b') +\n ')).s=s,p.f=f,p)',\n );\n case SpecialReference.PromiseResolve:\n return this.createEffectfulFunction(\n ['p', 'd'],\n 'p.s(d),p.status=\"success\",p.value=d;delete p.s;delete p.f',\n );\n case SpecialReference.PromiseReject:\n return this.createEffectfulFunction(\n ['p', 'd'],\n 'p.f(d),p.status=\"failure\",p.value=d;delete p.s;delete p.f',\n );\n case SpecialReference.StreamConstructor:\n return this.createFunction(\n ['b', 'a', 's', 'l', 'p', 'f', 'e', 'n'],\n '(b=[],a=!0,s=!1,l=[],p=0,f=' +\n this.createEffectfulFunction(\n ['v', 'm', 'x'],\n 'for(x=0;xs.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}',\n ) +\n '})',\n ),\n ),\n );\n if (initialized) {\n result += ')';\n }\n return result;\n }\n\n protected serializeIteratorFactoryInstance(\n node: SerovalIteratorFactoryInstanceNode,\n ): string {\n return (\n this.getConstructor(node.a[0]) + '(' + this.serialize(node.a[1]) + ')'\n );\n }\n\n protected serializeAsyncIteratorFactory(\n node: SerovalAsyncIteratorFactoryNode,\n ): string {\n const promise = node.a[0];\n const symbol = node.a[1];\n\n let result = '';\n\n if (promise.t !== SerovalNodeType.IndexedValue) {\n this.markRef(promise.i);\n result += '(' + this.serialize(promise);\n }\n if (symbol.t !== SerovalNodeType.IndexedValue) {\n this.markRef(symbol.i);\n result += (result ? ',' : '(') + this.serialize(symbol);\n }\n if (result) {\n result += ',';\n }\n\n const iterator = this.assignIndexedValue(\n node.i,\n this.createFunction(\n ['s'],\n this.createFunction(\n ['b', 'c', 'p', 'd', 'e', 't', 'f'],\n '(b=[],c=0,p=[],d=-1,e=!1,f=' +\n this.createEffectfulFunction(\n ['i', 'l'],\n 'for(i=0,l=p.length;i=b.length)?(p.push(t=' +\n this.getRefParam(promise.i) +\n '()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}',\n ) +\n '})',\n ),\n ),\n );\n\n if (result) {\n return result + iterator + ')';\n }\n\n return iterator;\n }\n\n protected serializeAsyncIteratorFactoryInstance(\n node: SerovalAsyncIteratorFactoryInstanceNode,\n ): string {\n return (\n this.getConstructor(node.a[0]) + '(' + this.serialize(node.a[1]) + ')'\n );\n }\n\n protected serializeStreamConstructor(\n node: SerovalStreamConstructorNode,\n ): string {\n const result = this.assignIndexedValue(\n node.i,\n this.getConstructor(node.f) + '()',\n );\n const len = node.a.length;\n if (len) {\n let values = this.serialize(node.a[0]);\n for (let i = 1; i < len; i++) {\n values += ',' + this.serialize(node.a[i]);\n }\n return '(' + result + ',' + values + ',' + this.getRefParam(node.i) + ')';\n }\n return result;\n }\n\n protected serializeStreamNext(node: SerovalStreamNextNode): string {\n return this.getRefParam(node.i) + '.next(' + this.serialize(node.f) + ')';\n }\n\n protected serializeStreamThrow(node: SerovalStreamThrowNode): string {\n return this.getRefParam(node.i) + '.throw(' + this.serialize(node.f) + ')';\n }\n\n protected serializeStreamReturn(node: SerovalStreamReturnNode): string {\n return this.getRefParam(node.i) + '.return(' + this.serialize(node.f) + ')';\n }\n\n serialize(node: SerovalNode): string {\n try {\n switch (node.t) {\n case SerovalNodeType.Constant:\n return CONSTANT_STRING[node.s];\n case SerovalNodeType.Number:\n return '' + node.s;\n case SerovalNodeType.String:\n return '\"' + node.s + '\"';\n case SerovalNodeType.BigInt:\n return node.s + 'n';\n case SerovalNodeType.IndexedValue:\n return this.getRefParam(node.i);\n case SerovalNodeType.Reference:\n return this.serializeReference(node);\n case SerovalNodeType.Array:\n return this.serializeArray(node);\n case SerovalNodeType.Object:\n return this.serializeObject(node);\n case SerovalNodeType.NullConstructor:\n return this.serializeNullConstructor(node);\n case SerovalNodeType.Date:\n return this.serializeDate(node);\n case SerovalNodeType.RegExp:\n return this.serializeRegExp(node);\n case SerovalNodeType.Set:\n return this.serializeSet(node);\n case SerovalNodeType.Map:\n return this.serializeMap(node);\n case SerovalNodeType.ArrayBuffer:\n return this.serializeArrayBuffer(node);\n case SerovalNodeType.BigIntTypedArray:\n case SerovalNodeType.TypedArray:\n return this.serializeTypedArray(node);\n case SerovalNodeType.DataView:\n return this.serializeDataView(node);\n case SerovalNodeType.AggregateError:\n return this.serializeAggregateError(node);\n case SerovalNodeType.Error:\n return this.serializeError(node);\n case SerovalNodeType.Promise:\n return this.serializePromise(node);\n case SerovalNodeType.WKSymbol:\n return this.serializeWellKnownSymbol(node);\n case SerovalNodeType.Boxed:\n return this.serializeBoxed(node);\n case SerovalNodeType.PromiseConstructor:\n return this.serializePromiseConstructor(node);\n case SerovalNodeType.PromiseResolve:\n return this.serializePromiseResolve(node);\n case SerovalNodeType.PromiseReject:\n return this.serializePromiseReject(node);\n case SerovalNodeType.Plugin:\n return this.serializePlugin(node);\n case SerovalNodeType.SpecialReference:\n return this.serializeSpecialReference(node);\n case SerovalNodeType.IteratorFactory:\n return this.serializeIteratorFactory(node);\n case SerovalNodeType.IteratorFactoryInstance:\n return this.serializeIteratorFactoryInstance(node);\n case SerovalNodeType.AsyncIteratorFactory:\n return this.serializeAsyncIteratorFactory(node);\n case SerovalNodeType.AsyncIteratorFactoryInstance:\n return this.serializeAsyncIteratorFactoryInstance(node);\n case SerovalNodeType.StreamConstructor:\n return this.serializeStreamConstructor(node);\n case SerovalNodeType.StreamNext:\n return this.serializeStreamNext(node);\n case SerovalNodeType.StreamThrow:\n return this.serializeStreamThrow(node);\n case SerovalNodeType.StreamReturn:\n return this.serializeStreamReturn(node);\n default:\n throw new SerovalUnsupportedNodeError(node);\n }\n } catch (error) {\n throw new SerovalSerializationError(error);\n }\n }\n}\n", "// Written by https://github.com/DylanPiercey and is distributed under the MIT license.\nconst REF_START_CHARS = /* @__PURE__ */ 'hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_'; // Avoids chars that could evaluate to a reserved word.\nconst REF_START_CHARS_LEN = /* @__PURE__ */ REF_START_CHARS.length;\nconst REF_CHARS =\n /* @__PURE__ */ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_';\nconst REF_CHARS_LEN = /* @__PURE__ */ REF_CHARS.length;\n\nexport default function getIdentifier(index: number): string {\n let mod = index % REF_START_CHARS_LEN;\n let ref = REF_START_CHARS[mod];\n index = (index - mod) / REF_START_CHARS_LEN;\n while (index > 0) {\n mod = index % REF_CHARS_LEN;\n ref += REF_CHARS[mod];\n index = (index - mod) / REF_CHARS_LEN;\n }\n return ref;\n}\n", "import { SerovalNodeType } from '../constants';\nimport type { BaseSerializerContextOptions } from '../context/serializer';\nimport BaseSerializerContext from '../context/serializer';\nimport { SerovalUnsupportedNodeError } from '../errors';\nimport type { SerovalMode } from '../plugin';\nimport type {\n SerovalNode,\n SerovalPromiseConstructorNode,\n SerovalPromiseRejectNode,\n SerovalPromiseResolveNode,\n} from '../types';\nimport getIdentifier from '../utils/get-identifier';\n\nexport type VanillaSerializerContextOptions = BaseSerializerContextOptions;\n\nexport default class VanillaSerializerContext extends BaseSerializerContext {\n readonly mode: SerovalMode = 'vanilla';\n\n /**\n * Map tree refs to actual refs\n * @private\n */\n valid = new Map();\n\n /**\n * Variables\n * @private\n */\n vars: string[] = [];\n\n /**\n * Creates the reference param (identifier) from the given reference ID\n * Calling this function means the value has been referenced somewhere\n */\n getRefParam(index: number): string {\n /**\n * Creates a new reference ID from a given reference ID\n * This new reference ID means that the reference itself\n * has been referenced at least once, and is used to generate\n * the variables\n */\n let actualIndex = this.valid.get(index);\n if (actualIndex == null) {\n actualIndex = this.valid.size;\n this.valid.set(index, actualIndex);\n }\n let identifier = this.vars[actualIndex];\n if (identifier == null) {\n identifier = getIdentifier(actualIndex);\n this.vars[actualIndex] = identifier;\n }\n return identifier;\n }\n\n protected assignIndexedValue(index: number, value: string): string {\n if (this.isMarked(index)) {\n return this.getRefParam(index) + '=' + value;\n }\n return value;\n }\n\n protected serializePromiseConstructor(\n node: SerovalPromiseConstructorNode,\n ): string {\n throw new SerovalUnsupportedNodeError(node);\n }\n\n protected serializePromiseResolve(node: SerovalPromiseResolveNode): string {\n throw new SerovalUnsupportedNodeError(node);\n }\n\n protected serializePromiseReject(node: SerovalPromiseRejectNode): string {\n throw new SerovalUnsupportedNodeError(node);\n }\n\n serializeTop(tree: SerovalNode): string {\n const result = this.serialize(tree);\n // Shared references detected\n if (tree.i != null && this.vars.length) {\n const patches = this.resolvePatches();\n let body = result;\n if (patches) {\n // Get (or create) a ref from the source\n const index = this.getRefParam(tree.i);\n body = result + ',' + patches + index;\n if (!result.startsWith(index + '=')) {\n body = index + '=' + body;\n }\n }\n return '(' + this.createFunction(this.vars, '(' + body + ')') + ')()';\n }\n if (tree.t === SerovalNodeType.Object) {\n return '(' + result + ')';\n }\n return result;\n }\n}\n", "import {\n createAggregateErrorNode,\n createArrayBufferNode,\n createArrayNode,\n createAsyncIteratorFactoryInstanceNode,\n createBigIntNode,\n createBigIntTypedArrayNode,\n createBoxedNode,\n createDataViewNode,\n createDateNode,\n createErrorNode,\n createIteratorFactoryInstanceNode,\n createNumberNode,\n createPluginNode,\n createRegExpNode,\n createSetNode,\n createStreamConstructorNode,\n createStringNode,\n createTypedArrayNode,\n} from '../../base-primitives';\nimport { Feature } from '../../compat';\nimport { SerovalParserError, SerovalUnsupportedTypeError } from '../../errors';\nimport {\n FALSE_NODE,\n NULL_NODE,\n TRUE_NODE,\n UNDEFINED_NODE,\n} from '../../literals';\nimport { SpecialReference } from '../../special-reference';\nimport type { Stream } from '../../stream';\nimport { createStream, isStream } from '../../stream';\nimport { serializeString } from '../../string';\nimport type {\n SerovalAggregateErrorNode,\n SerovalArrayNode,\n SerovalBigIntTypedArrayNode,\n SerovalBoxedNode,\n SerovalDataViewNode,\n SerovalErrorNode,\n SerovalMapNode,\n SerovalNode,\n SerovalNullConstructorNode,\n SerovalObjectNode,\n SerovalObjectRecordKey,\n SerovalObjectRecordNode,\n SerovalPluginNode,\n SerovalPromiseConstructorNode,\n SerovalSetNode,\n SerovalTypedArrayNode,\n} from '../../types';\nimport { getErrorOptions } from '../../utils/error';\nimport { iteratorToSequence } from '../../utils/iterator-to-sequence';\nimport type {\n BigIntTypedArrayValue,\n TypedArrayValue,\n} from '../../utils/typed-array';\nimport type { BaseParserContextOptions } from '../parser';\nimport { BaseParserContext } from '../parser';\n\ntype ObjectLikeNode = SerovalObjectNode | SerovalNullConstructorNode;\n\nexport type BaseSyncParserContextOptions = BaseParserContextOptions;\n\nexport default abstract class BaseSyncParserContext extends BaseParserContext {\n protected parseItems(current: unknown[]): SerovalNode[] {\n const nodes = [];\n for (let i = 0, len = current.length; i < len; i++) {\n if (i in current) {\n nodes[i] = this.parse(current[i]);\n }\n }\n return nodes;\n }\n\n protected parseArray(id: number, current: unknown[]): SerovalArrayNode {\n return createArrayNode(id, current, this.parseItems(current));\n }\n\n protected parseProperties(\n properties: Record,\n ): SerovalObjectRecordNode {\n const entries = Object.entries(properties);\n const keyNodes: SerovalObjectRecordKey[] = [];\n const valueNodes: SerovalNode[] = [];\n for (let i = 0, len = entries.length; i < len; i++) {\n keyNodes.push(serializeString(entries[i][0]));\n valueNodes.push(this.parse(entries[i][1]));\n }\n // Check special properties, symbols in this case\n let symbol = Symbol.iterator;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(\n createIteratorFactoryInstanceNode(\n this.parseIteratorFactory(),\n this.parse(\n iteratorToSequence(properties as unknown as Iterable),\n ),\n ),\n );\n }\n symbol = Symbol.asyncIterator;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(\n createAsyncIteratorFactoryInstanceNode(\n this.parseAsyncIteratorFactory(),\n this.parse(createStream()),\n ),\n );\n }\n symbol = Symbol.toStringTag;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(createStringNode(properties[symbol] as string));\n }\n symbol = Symbol.isConcatSpreadable;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(properties[symbol] ? TRUE_NODE : FALSE_NODE);\n }\n return {\n k: keyNodes,\n v: valueNodes,\n s: keyNodes.length,\n };\n }\n\n protected parsePlainObject(\n id: number,\n current: Record,\n empty: boolean,\n ): ObjectLikeNode {\n return this.createObjectNode(\n id,\n current,\n empty,\n this.parseProperties(current),\n );\n }\n\n protected parseBoxed(id: number, current: object): SerovalBoxedNode {\n return createBoxedNode(id, this.parse(current.valueOf()));\n }\n\n protected parseTypedArray(\n id: number,\n current: TypedArrayValue,\n ): SerovalTypedArrayNode {\n return createTypedArrayNode(id, current, this.parse(current.buffer));\n }\n\n protected parseBigIntTypedArray(\n id: number,\n current: BigIntTypedArrayValue,\n ): SerovalBigIntTypedArrayNode {\n return createBigIntTypedArrayNode(id, current, this.parse(current.buffer));\n }\n\n protected parseDataView(id: number, current: DataView): SerovalDataViewNode {\n return createDataViewNode(id, current, this.parse(current.buffer));\n }\n\n protected parseError(id: number, current: Error): SerovalErrorNode {\n const options = getErrorOptions(current, this.features);\n return createErrorNode(\n id,\n current,\n options ? this.parseProperties(options) : undefined,\n );\n }\n\n protected parseAggregateError(\n id: number,\n current: AggregateError,\n ): SerovalAggregateErrorNode {\n const options = getErrorOptions(current, this.features);\n return createAggregateErrorNode(\n id,\n current,\n options ? this.parseProperties(options) : undefined,\n );\n }\n\n protected parseMap(\n id: number,\n current: Map,\n ): SerovalMapNode {\n const keyNodes: SerovalNode[] = [];\n const valueNodes: SerovalNode[] = [];\n for (const [key, value] of current.entries()) {\n keyNodes.push(this.parse(key));\n valueNodes.push(this.parse(value));\n }\n return this.createMapNode(id, keyNodes, valueNodes, current.size);\n }\n\n protected parseSet(id: number, current: Set): SerovalSetNode {\n const items: SerovalNode[] = [];\n for (const item of current.keys()) {\n items.push(this.parse(item));\n }\n return createSetNode(id, current.size, items);\n }\n\n protected parsePlugin(\n id: number,\n current: unknown,\n ): SerovalPluginNode | undefined {\n const currentPlugins = this.plugins;\n if (currentPlugins) {\n for (let i = 0, len = currentPlugins.length; i < len; i++) {\n const plugin = currentPlugins[i];\n if (plugin.parse.sync && plugin.test(current)) {\n return createPluginNode(\n id,\n plugin.tag,\n plugin.parse.sync(current, this, {\n id,\n }),\n );\n }\n }\n }\n return undefined;\n }\n\n protected parseStream(id: number, _current: Stream): SerovalNode {\n return createStreamConstructorNode(\n id,\n this.parseSpecialReference(SpecialReference.StreamConstructor),\n [],\n );\n }\n\n protected parsePromise(\n id: number,\n _current: Promise,\n ): SerovalPromiseConstructorNode {\n return this.createPromiseConstructorNode(id);\n }\n\n protected parseObject(id: number, current: object): SerovalNode {\n if (Array.isArray(current)) {\n return this.parseArray(id, current);\n }\n if (isStream(current)) {\n return this.parseStream(id, current);\n }\n const parsed = this.parsePlugin(id, current);\n if (parsed) {\n return parsed;\n }\n const currentClass = current.constructor;\n switch (currentClass) {\n case Object:\n return this.parsePlainObject(\n id,\n current as Record,\n false,\n );\n case undefined:\n return this.parsePlainObject(\n id,\n current as Record,\n true,\n );\n case Date:\n return createDateNode(id, current as unknown as Date);\n case RegExp:\n return createRegExpNode(id, current as unknown as RegExp);\n case Error:\n case EvalError:\n case RangeError:\n case ReferenceError:\n case SyntaxError:\n case TypeError:\n case URIError:\n return this.parseError(id, current as unknown as Error);\n case Number:\n case Boolean:\n case String:\n case BigInt:\n return this.parseBoxed(id, current);\n case ArrayBuffer:\n return createArrayBufferNode(id, current as unknown as ArrayBuffer);\n case Int8Array:\n case Int16Array:\n case Int32Array:\n case Uint8Array:\n case Uint16Array:\n case Uint32Array:\n case Uint8ClampedArray:\n case Float32Array:\n case Float64Array:\n return this.parseTypedArray(id, current as unknown as TypedArrayValue);\n case DataView:\n return this.parseDataView(id, current as unknown as DataView);\n case Map:\n return this.parseMap(id, current as unknown as Map);\n case Set:\n return this.parseSet(id, current as unknown as Set);\n default:\n break;\n }\n // Promises\n if (currentClass === Promise || current instanceof Promise) {\n return this.parsePromise(id, current as unknown as Promise);\n }\n const currentFeatures = this.features;\n // BigInt Typed Arrays\n if (currentFeatures & Feature.BigIntTypedArray) {\n switch (currentClass) {\n case BigInt64Array:\n case BigUint64Array:\n return this.parseBigIntTypedArray(\n id,\n current as unknown as BigIntTypedArrayValue,\n );\n default:\n break;\n }\n }\n if (\n currentFeatures & Feature.AggregateError &&\n typeof AggregateError !== 'undefined' &&\n (currentClass === AggregateError || current instanceof AggregateError)\n ) {\n return this.parseAggregateError(id, current as unknown as AggregateError);\n }\n // Slow path. We only need to handle Errors and Iterators\n // since they have very broad implementations.\n if (current instanceof Error) {\n return this.parseError(id, current);\n }\n // Generator functions don't have a global constructor\n // despite existing\n if (Symbol.iterator in current || Symbol.asyncIterator in current) {\n return this.parsePlainObject(id, current, !!currentClass);\n }\n throw new SerovalUnsupportedTypeError(current);\n }\n\n parse(current: T): SerovalNode {\n try {\n switch (typeof current) {\n case 'boolean':\n return current ? TRUE_NODE : FALSE_NODE;\n case 'undefined':\n return UNDEFINED_NODE;\n case 'string':\n return createStringNode(current as string);\n case 'number':\n return createNumberNode(current as number);\n case 'bigint':\n return createBigIntNode(current as bigint);\n case 'object': {\n if (current) {\n const ref = this.getReference(current);\n return ref.type === 0\n ? this.parseObject(ref.value, current as object)\n : ref.value;\n }\n return NULL_NODE;\n }\n case 'symbol':\n return this.parseWellKnownSymbol(current);\n case 'function':\n return this.parseFunction(current as (...args: unknown[]) => unknown);\n default:\n throw new SerovalUnsupportedTypeError(current);\n }\n } catch (error) {\n throw new SerovalParserError(error);\n }\n }\n}\n", "import BaseSyncParserContext from '../context/parser/sync';\nimport type { BaseParserContextOptions } from '../context/parser';\nimport type { SerovalMode } from '../plugin';\n\nexport type SyncParserContextOptions = Omit;\n\nexport default class SyncParserContext extends BaseSyncParserContext {\n readonly mode: SerovalMode = 'vanilla';\n}\n", "import { resolvePlugins, type PluginAccessOptions } from '../plugin';\nimport type { SerovalNode } from '../types';\nimport type { AsyncParserContextOptions } from './async';\nimport AsyncParserContext from './async';\nimport VanillaDeserializerContext from './deserializer';\nimport VanillaSerializerContext from './serializer';\nimport type { SyncParserContextOptions } from './sync';\nimport SyncParserContext from './sync';\n\nexport function serialize(\n source: T,\n options: SyncParserContextOptions = {},\n): string {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new SyncParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n });\n const tree = ctx.parse(source);\n const serial = new VanillaSerializerContext({\n plugins,\n features: ctx.features,\n markedRefs: ctx.marked,\n });\n return serial.serializeTop(tree);\n}\n\nexport async function serializeAsync(\n source: T,\n options: AsyncParserContextOptions = {},\n): Promise {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new AsyncParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n });\n const tree = await ctx.parse(source);\n const serial = new VanillaSerializerContext({\n plugins,\n features: ctx.features,\n markedRefs: ctx.marked,\n });\n return serial.serializeTop(tree);\n}\n\nexport function deserialize(source: string): T {\n return (0, eval)(source) as T;\n}\n\nexport interface SerovalJSON {\n t: SerovalNode;\n f: number;\n m: number[];\n}\n\nexport function toJSON(\n source: T,\n options: SyncParserContextOptions = {},\n): SerovalJSON {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new SyncParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n });\n return {\n t: ctx.parse(source),\n f: ctx.features,\n m: Array.from(ctx.marked),\n };\n}\n\nexport async function toJSONAsync(\n source: T,\n options: AsyncParserContextOptions = {},\n): Promise {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new AsyncParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n });\n return {\n t: await ctx.parse(source),\n f: ctx.features,\n m: Array.from(ctx.marked),\n };\n}\n\nexport function compileJSON(\n source: SerovalJSON,\n options: PluginAccessOptions = {},\n): string {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new VanillaSerializerContext({\n plugins,\n features: source.f,\n markedRefs: source.m,\n });\n return ctx.serializeTop(source.t);\n}\n\nexport function fromJSON(\n source: SerovalJSON,\n options: PluginAccessOptions = {},\n): T {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new VanillaDeserializerContext({\n plugins,\n markedRefs: source.m,\n });\n return ctx.deserialize(source.t) as T;\n}\n", "import BaseAsyncParserContext from '../context/parser/async';\nimport type { SerovalMode } from '../plugin';\nimport type { CrossParserContextOptions } from './parser';\n\nexport type CrossAsyncParserContextOptions = CrossParserContextOptions;\n\nexport default class CrossAsyncParserContext extends BaseAsyncParserContext {\n readonly mode: SerovalMode = 'cross';\n}\n", "import type { BaseDeserializerOptions } from '../context/deserializer';\nimport BaseDeserializerContext from '../context/deserializer';\nimport type { SerovalMode } from '../plugin';\n\nexport type CrossDeserializerContextOptions = BaseDeserializerOptions;\n\nexport default class CrossDeserializerContext extends BaseDeserializerContext {\n readonly mode: SerovalMode = 'cross';\n\n assignIndexedValue(index: number, value: T): T {\n if (!this.refs.has(index)) {\n this.refs.set(index, value);\n }\n return value;\n }\n}\n", "import type { BaseSerializerContextOptions } from '../context/serializer';\nimport BaseSerializerContext from '../context/serializer';\nimport { GLOBAL_CONTEXT_REFERENCES } from '../keys';\nimport type { SerovalMode } from '../plugin';\nimport { serializeString } from '../string';\nimport type { SerovalNode } from '../types';\nimport type { CrossContextOptions } from './parser';\n\nexport interface CrossSerializerContextOptions\n extends BaseSerializerContextOptions,\n CrossContextOptions {}\n\nexport default class CrossSerializerContext extends BaseSerializerContext {\n readonly mode: SerovalMode = 'cross';\n\n scopeId?: string;\n\n constructor(options: CrossSerializerContextOptions) {\n super(options);\n this.scopeId = options.scopeId;\n }\n\n getRefParam(id: number): string {\n return GLOBAL_CONTEXT_REFERENCES + '[' + id + ']';\n }\n\n protected assignIndexedValue(index: number, value: string): string {\n // In cross-reference, we have to assume that\n // every reference are going to be referenced\n // in the future, and so we need to store\n // all of it into the reference array.\n return this.getRefParam(index) + '=' + value;\n }\n\n serializeTop(tree: SerovalNode): string {\n // Get the serialized result\n const result = this.serialize(tree);\n // If the node is a non-reference, return\n // the result immediately\n const id = tree.i;\n if (id == null) {\n return result;\n }\n // Get the patches\n const patches = this.resolvePatches();\n // Get the variable that represents the root\n const ref = this.getRefParam(id);\n // Parameters needed for scoping\n const params = this.scopeId == null ? '' : GLOBAL_CONTEXT_REFERENCES;\n // If there are patches, append it after the result\n const body = patches ? result + ',' + patches + ref : result;\n // If there are no params, there's no need to generate a function\n if (params === '') {\n return patches ? '(' + body + ')' : body;\n }\n // Get the arguments for the IIFE\n const args =\n this.scopeId == null\n ? '()'\n : '(' +\n GLOBAL_CONTEXT_REFERENCES +\n '[\"' +\n serializeString(this.scopeId) +\n '\"])';\n // Create the IIFE\n return '(' + this.createFunction([params], body) + ')' + args;\n }\n}\n", "import {\n createAsyncIteratorFactoryInstanceNode,\n createIteratorFactoryInstanceNode,\n createPluginNode,\n createStreamConstructorNode,\n createStreamNextNode,\n createStreamReturnNode,\n createStreamThrowNode,\n createStringNode,\n} from '../../base-primitives';\nimport { SerovalNodeType } from '../../constants';\nimport { FALSE_NODE, TRUE_NODE } from '../../literals';\nimport { SpecialReference } from '../../special-reference';\nimport type { Stream } from '../../stream';\nimport { createStreamFromAsyncIterable } from '../../stream';\nimport { serializeString } from '../../string';\nimport type {\n SerovalNode,\n SerovalObjectRecordKey,\n SerovalObjectRecordNode,\n SerovalPluginNode,\n SerovalPromiseConstructorNode,\n} from '../../types';\nimport { iteratorToSequence } from '../../utils/iterator-to-sequence';\nimport type { BaseSyncParserContextOptions } from './sync';\nimport BaseSyncParserContext from './sync';\n\nexport interface BaseStreamParserContextOptions\n extends BaseSyncParserContextOptions {\n onParse: (node: SerovalNode, initial: boolean) => void;\n onError?: (error: unknown) => void;\n onDone?: () => void;\n}\n\nexport default abstract class BaseStreamParserContext extends BaseSyncParserContext {\n // Life\n private alive = true;\n\n // Amount of pending promises/streams\n private pending = 0;\n\n private onParseCallback: (node: SerovalNode, initial: boolean) => void;\n\n private onErrorCallback?: (error: unknown) => void;\n\n private onDoneCallback?: () => void;\n\n constructor(options: BaseStreamParserContextOptions) {\n super(options);\n this.onParseCallback = options.onParse;\n this.onErrorCallback = options.onError;\n this.onDoneCallback = options.onDone;\n }\n\n private initial = true;\n\n private buffer: SerovalNode[] = [];\n\n private onParseInternal(node: SerovalNode, initial: boolean): void {\n try {\n this.onParseCallback(node, initial);\n } catch (error) {\n this.onError(error);\n }\n }\n\n private flush(): void {\n for (let i = 0, len = this.buffer.length; i < len; i++) {\n this.onParseInternal(this.buffer[i], false);\n }\n }\n\n private onParse(node: SerovalNode): void {\n if (this.initial) {\n this.buffer.push(node);\n } else {\n this.onParseInternal(node, false);\n }\n }\n\n private onError(error: unknown): void {\n if (this.onErrorCallback) {\n this.onErrorCallback(error);\n } else {\n throw error;\n }\n }\n\n private onDone(): void {\n if (this.onDoneCallback) {\n this.onDoneCallback();\n }\n }\n\n private pushPendingState(): void {\n this.pending++;\n }\n\n private popPendingState(): void {\n if (--this.pending <= 0) {\n this.onDone();\n }\n }\n\n protected parseProperties(\n properties: Record,\n ): SerovalObjectRecordNode {\n const entries = Object.entries(properties);\n const keyNodes: SerovalObjectRecordKey[] = [];\n const valueNodes: SerovalNode[] = [];\n for (let i = 0, len = entries.length; i < len; i++) {\n keyNodes.push(serializeString(entries[i][0]));\n valueNodes.push(this.parse(entries[i][1]));\n }\n // Check special properties, symbols in this case\n let symbol = Symbol.iterator;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(\n createIteratorFactoryInstanceNode(\n this.parseIteratorFactory(),\n this.parse(\n iteratorToSequence(properties as unknown as Iterable),\n ),\n ),\n );\n }\n symbol = Symbol.asyncIterator;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(\n createAsyncIteratorFactoryInstanceNode(\n this.parseAsyncIteratorFactory(),\n this.parse(\n createStreamFromAsyncIterable(\n properties as unknown as AsyncIterable,\n ),\n ),\n ),\n );\n }\n symbol = Symbol.toStringTag;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(createStringNode(properties[symbol] as string));\n }\n symbol = Symbol.isConcatSpreadable;\n if (symbol in properties) {\n keyNodes.push(this.parseWellKnownSymbol(symbol));\n valueNodes.push(properties[symbol] ? TRUE_NODE : FALSE_NODE);\n }\n return {\n k: keyNodes,\n v: valueNodes,\n s: keyNodes.length,\n };\n }\n\n protected parsePromise(\n id: number,\n current: Promise,\n ): SerovalPromiseConstructorNode {\n current.then(\n data => {\n const parsed = this.parseWithError(data);\n if (parsed) {\n this.onParse({\n t: SerovalNodeType.PromiseResolve,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: [\n this.parseSpecialReference(SpecialReference.PromiseResolve),\n parsed,\n ],\n f: undefined,\n b: undefined,\n o: undefined,\n });\n }\n this.popPendingState();\n },\n data => {\n if (this.alive) {\n const parsed = this.parseWithError(data);\n if (parsed) {\n this.onParse({\n t: SerovalNodeType.PromiseReject,\n i: id,\n s: undefined,\n l: undefined,\n c: undefined,\n m: undefined,\n p: undefined,\n e: undefined,\n a: [\n this.parseSpecialReference(SpecialReference.PromiseReject),\n parsed,\n ],\n f: undefined,\n b: undefined,\n o: undefined,\n });\n }\n }\n this.popPendingState();\n },\n );\n this.pushPendingState();\n return this.createPromiseConstructorNode(id);\n }\n\n protected parsePlugin(\n id: number,\n current: unknown,\n ): SerovalPluginNode | undefined {\n const currentPlugins = this.plugins;\n if (currentPlugins) {\n for (let i = 0, len = currentPlugins.length; i < len; i++) {\n const plugin = currentPlugins[i];\n if (plugin.parse.stream && plugin.test(current)) {\n return createPluginNode(\n id,\n plugin.tag,\n plugin.parse.stream(current, this, {\n id,\n }),\n );\n }\n }\n }\n return undefined;\n }\n\n protected parseStream(id: number, current: Stream): SerovalNode {\n const result = createStreamConstructorNode(\n id,\n this.parseSpecialReference(SpecialReference.StreamConstructor),\n [],\n );\n this.pushPendingState();\n current.on({\n next: value => {\n if (this.alive) {\n const parsed = this.parseWithError(value);\n if (parsed) {\n this.onParse(createStreamNextNode(id, parsed));\n }\n }\n },\n throw: value => {\n if (this.alive) {\n const parsed = this.parseWithError(value);\n if (parsed) {\n this.onParse(createStreamThrowNode(id, parsed));\n }\n }\n this.popPendingState();\n },\n return: value => {\n if (this.alive) {\n const parsed = this.parseWithError(value);\n if (parsed) {\n this.onParse(createStreamReturnNode(id, parsed));\n }\n }\n this.popPendingState();\n },\n });\n return result;\n }\n\n private parseWithError(current: T): SerovalNode | undefined {\n try {\n return this.parse(current);\n } catch (err) {\n this.onError(err);\n return undefined;\n }\n }\n\n /**\n * @private\n */\n start(current: T): void {\n const parsed = this.parseWithError(current);\n if (parsed) {\n this.onParseInternal(parsed, true);\n this.initial = false;\n this.flush();\n\n // Check if there's any pending pushes\n if (this.pending <= 0) {\n this.destroy();\n }\n }\n }\n\n /**\n * @private\n */\n destroy(): void {\n if (this.alive) {\n this.onDone();\n this.alive = false;\n }\n }\n\n isAlive(): boolean {\n return this.alive;\n }\n}\n", "import type { BaseStreamParserContextOptions } from '../context/parser/stream';\nimport BaseStreamParserContext from '../context/parser/stream';\nimport type { SerovalMode } from '../plugin';\n\nexport type CrossStreamParserContextOptions = BaseStreamParserContextOptions;\n\nexport default class CrossStreamParserContext extends BaseStreamParserContext {\n readonly mode: SerovalMode = 'cross';\n}\n", "import BaseSyncParserContext from '../context/parser/sync';\nimport type { SerovalMode } from '../plugin';\nimport type { CrossParserContextOptions } from './parser';\n\nexport type CrossSyncParserContextOptions = CrossParserContextOptions;\n\nexport default class CrossSyncParserContext extends BaseSyncParserContext {\n readonly mode: SerovalMode = 'cross';\n}\n", "import { resolvePlugins } from '../plugin';\nimport type { SerovalNode } from '../types';\nimport type { CrossAsyncParserContextOptions } from './async';\nimport AsyncCrossParserContext from './async';\nimport type { CrossDeserializerContextOptions } from './deserializer';\nimport CrossDeserializerContext from './deserializer';\nimport type { CrossContextOptions, CrossParserContextOptions } from './parser';\nimport CrossSerializerContext from './serializer';\nimport type { CrossStreamParserContextOptions } from './stream';\nimport StreamCrossParserContext from './stream';\nimport type { CrossSyncParserContextOptions } from './sync';\nimport SyncCrossParserContext from './sync';\n\nexport interface CrossSerializeOptions\n extends CrossSyncParserContextOptions,\n CrossContextOptions {}\n\nexport function crossSerialize(\n source: T,\n options: CrossSerializeOptions = {},\n): string {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new SyncCrossParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n refs: options.refs,\n });\n const tree = ctx.parse(source);\n const serial = new CrossSerializerContext({\n plugins,\n features: ctx.features,\n scopeId: options.scopeId,\n markedRefs: ctx.marked,\n });\n return serial.serializeTop(tree);\n}\n\nexport interface CrossSerializeAsyncOptions\n extends CrossAsyncParserContextOptions,\n CrossContextOptions {}\n\nexport async function crossSerializeAsync(\n source: T,\n options: CrossSerializeAsyncOptions = {},\n): Promise {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new AsyncCrossParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n refs: options.refs,\n });\n const tree = await ctx.parse(source);\n const serial = new CrossSerializerContext({\n plugins,\n features: ctx.features,\n scopeId: options.scopeId,\n markedRefs: ctx.marked,\n });\n return serial.serializeTop(tree);\n}\n\nexport type ToCrossJSONOptions = CrossParserContextOptions;\n\nexport function toCrossJSON(\n source: T,\n options: CrossParserContextOptions = {},\n): SerovalNode {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new SyncCrossParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n refs: options.refs,\n });\n return ctx.parse(source);\n}\n\nexport type ToCrossJSONAsyncOptions = CrossParserContextOptions;\n\nexport async function toCrossJSONAsync(\n source: T,\n options: CrossParserContextOptions = {},\n): Promise {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new AsyncCrossParserContext({\n plugins,\n disabledFeatures: options.disabledFeatures,\n refs: options.refs,\n });\n return await ctx.parse(source);\n}\n\nexport interface CrossSerializeStreamOptions\n extends Omit,\n CrossContextOptions {\n onSerialize: (data: string, initial: boolean) => void;\n}\n\nexport function crossSerializeStream(\n source: T,\n options: CrossSerializeStreamOptions,\n): () => void {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new StreamCrossParserContext({\n plugins,\n refs: options.refs,\n disabledFeatures: options.disabledFeatures,\n onParse(node, initial): void {\n const serial = new CrossSerializerContext({\n plugins,\n features: ctx.features,\n scopeId: options.scopeId,\n markedRefs: ctx.marked,\n });\n\n let serialized: string;\n\n try {\n serialized = serial.serializeTop(node);\n } catch (err) {\n if (options.onError) {\n options.onError(err);\n }\n return;\n }\n\n options.onSerialize(serialized, initial);\n },\n onError: options.onError,\n onDone: options.onDone,\n });\n\n ctx.start(source);\n\n return () => {\n ctx.destroy();\n };\n}\n\nexport type ToCrossJSONStreamOptions = CrossStreamParserContextOptions;\n\nexport function toCrossJSONStream(\n source: T,\n options: ToCrossJSONStreamOptions,\n): () => void {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new StreamCrossParserContext({\n plugins,\n refs: options.refs,\n disabledFeatures: options.disabledFeatures,\n onParse: options.onParse,\n onError: options.onError,\n onDone: options.onDone,\n });\n\n ctx.start(source);\n\n return () => {\n ctx.destroy();\n };\n}\n\nexport type FromCrossJSONOptions = CrossDeserializerContextOptions;\n\nexport function fromCrossJSON(\n source: SerovalNode,\n options: FromCrossJSONOptions,\n): T {\n const plugins = resolvePlugins(options.plugins);\n const ctx = new CrossDeserializerContext({\n plugins,\n refs: options.refs,\n });\n return ctx.deserialize(source) as T;\n}\n", "import { crossSerializeStream } from './cross';\nimport {\n resolvePlugins,\n type Plugin,\n type PluginAccessOptions,\n} from './plugin';\nimport { serializeString } from './string';\n\nexport interface SerializerOptions extends PluginAccessOptions {\n globalIdentifier: string;\n scopeId?: string;\n disabledFeatures?: number;\n onData: (result: string) => void;\n onError: (error: unknown) => void;\n onDone?: () => void;\n}\n\nexport default class Serializer {\n private alive = true;\n\n private flushed = false;\n\n private done = false;\n\n private pending = 0;\n\n private cleanups: (() => void)[] = [];\n\n private refs = new Map();\n\n private plugins?: Plugin[];\n\n constructor(private options: SerializerOptions) {\n this.plugins = resolvePlugins(options.plugins);\n }\n\n keys = new Set();\n\n write(key: string, value: unknown): void {\n if (this.alive && !this.flushed) {\n this.pending++;\n this.keys.add(key);\n this.cleanups.push(\n crossSerializeStream(value, {\n plugins: this.plugins,\n scopeId: this.options.scopeId,\n refs: this.refs,\n disabledFeatures: this.options.disabledFeatures,\n onError: this.options.onError,\n onSerialize: (data, initial) => {\n if (this.alive) {\n this.options.onData(\n initial\n ? this.options.globalIdentifier +\n '[\"' +\n serializeString(key) +\n '\"]=' +\n data\n : data,\n );\n }\n },\n onDone: () => {\n if (this.alive) {\n this.pending--;\n if (\n this.pending <= 0 &&\n this.flushed &&\n !this.done &&\n this.options.onDone\n ) {\n this.options.onDone();\n this.done = true;\n }\n }\n },\n }),\n );\n }\n }\n\n ids = 0;\n\n private getNextID(): string {\n while (this.keys.has('' + this.ids)) {\n this.ids++;\n }\n return '' + this.ids;\n }\n\n push(value: unknown): string {\n const newID = this.getNextID();\n this.write(newID, value);\n return newID;\n }\n\n flush(): void {\n if (this.alive) {\n this.flushed = true;\n if (this.pending <= 0 && !this.done && this.options.onDone) {\n this.options.onDone();\n this.done = true;\n }\n }\n }\n\n close(): void {\n if (this.alive) {\n for (let i = 0, len = this.cleanups.length; i < len; i++) {\n this.cleanups[i]();\n }\n if (!this.done && this.options.onDone) {\n this.options.onDone();\n this.done = true;\n }\n this.alive = false;\n }\n }\n}\n"],
"mappings": ";AAMO,IAAW,UAAX,kBAAWA,aAAX;AACL,EAAAA,kBAAA,oBAAiB,KAAjB;AACA,EAAAA,kBAAA,mBAAgB,KAAhB;AACA,EAAAA,kBAAA,yBAAsB,KAAtB;AACA,EAAAA,kBAAA,kBAAe,KAAf;AACA,EAAAA,kBAAA,sBAAmB,MAAnB;AALgB,SAAAA;AAAA,GAAA;AAQX,IAAM,cAAc;;;ACdpB,SAAS,cAAc,KAAiC;AAC7D,UAAQ,KAAK;AAAA,IACX,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,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