diff --git a/benchmark/package.json b/benchmark/package.json index c837f530..982f87c7 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -21,7 +21,7 @@ "next-json": "^0.2.2", "o-son": "^1.0.1", "serialize-javascript": "^6.0.1", - "seroval": "workspace:^0.13.1", + "seroval": "workspace:^0.13.2", "superjson": "^1.13.3", "tosource": "2.0.0-alpha.3", "warp10": "^2.1.0" @@ -43,5 +43,5 @@ "typesVersions": { "*": {} }, - "version": "0.13.1" + "version": "0.13.2" } diff --git a/lerna.json b/lerna.json index 4a85d4d1..452c2259 100644 --- a/lerna.json +++ b/lerna.json @@ -15,5 +15,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "0.13.1" + "version": "0.13.2" } diff --git a/packages/seroval/package.json b/packages/seroval/package.json index 28aa8e18..0af6651d 100644 --- a/packages/seroval/package.json +++ b/packages/seroval/package.json @@ -1,7 +1,7 @@ { "name": "seroval", "type": "module", - "version": "0.13.1", + "version": "0.13.2", "files": [ "dist", "src" diff --git a/packages/seroval/src/core/base-primitives.ts b/packages/seroval/src/core/base-primitives.ts index 8e63c2a7..f1caa4c8 100644 --- a/packages/seroval/src/core/base-primitives.ts +++ b/packages/seroval/src/core/base-primitives.ts @@ -26,6 +26,7 @@ import type { SerovalIndexedValueNode, SerovalIteratorFactoryInstanceNode, SerovalNode, + SerovalNodeWithID, SerovalNumberNode, SerovalObjectRecordNode, SerovalPluginNode, @@ -412,7 +413,7 @@ export function createSetNode( } export function createIteratorFactoryInstanceNode( - factory: SerovalNode, + factory: SerovalNodeWithID, items: SerovalNode, ): SerovalIteratorFactoryInstanceNode { return { @@ -435,7 +436,7 @@ export function createIteratorFactoryInstanceNode( } export function createAsyncIteratorFactoryInstanceNode( - factory: SerovalNode, + factory: SerovalNodeWithID, items: SerovalNode, ): SerovalAsyncIteratorFactoryInstanceNode { return { diff --git a/packages/seroval/src/core/constants.ts b/packages/seroval/src/core/constants.ts index 17c2e10d..a261419c 100644 --- a/packages/seroval/src/core/constants.ts +++ b/packages/seroval/src/core/constants.ts @@ -51,13 +51,12 @@ export const enum SerovalNodeType { CustomEvent = 38, DOMException = 39, Plugin = 40, - MapSentinel = 41, + SpecialReference = 41, IteratorFactory = 42, IteratorFactoryInstance = 43, AsyncIteratorFactory = 44, AsyncIteratorFactoryInstance = 45, ReadableStream = 46, - ReadableStreamFactory = 47, } export const enum SerovalObjectFlags { diff --git a/packages/seroval/src/core/context/deserializer.ts b/packages/seroval/src/core/context/deserializer.ts index 9ee6d506..5429544e 100644 --- a/packages/seroval/src/core/context/deserializer.ts +++ b/packages/seroval/src/core/context/deserializer.ts @@ -449,7 +449,7 @@ export default abstract class BaseDeserializerContext implements PluginAccessOpt const deferred = this.refs.get(node.i) as Deferred | undefined; assert(deferred, new Error('Missing Promise instance.')); deferred.resolve( - this.deserialize(node.f), + this.deserialize(node.a[1]), ); return undefined; } @@ -458,7 +458,7 @@ export default abstract class BaseDeserializerContext implements PluginAccessOpt const deferred = this.refs.get(node.i) as Deferred | undefined; assert(deferred, new Error('Missing Promise instance.')); deferred.reject( - this.deserialize(node.f), + this.deserialize(node.a[1]), ); return undefined; } @@ -476,7 +476,7 @@ export default abstract class BaseDeserializerContext implements PluginAccessOpt const deferred = this.refs.get(node.i) as DeferredStream | undefined; assert(deferred, new Error('Missing ReadableStream instance.')); deferred.enqueue( - this.deserialize(node.f), + this.deserialize(node.a[1]), ); return undefined; } @@ -485,7 +485,7 @@ export default abstract class BaseDeserializerContext implements PluginAccessOpt const deferred = this.refs.get(node.i) as DeferredStream | undefined; assert(deferred, new Error('Missing Promise instance.')); deferred.error( - this.deserialize(node.f), + this.deserialize(node.a[1]), ); return undefined; } @@ -508,7 +508,7 @@ export default abstract class BaseDeserializerContext implements PluginAccessOpt node: SerovalAsyncIteratorFactoryInstanceNode, ): unknown { const source = this.deserialize(node.a[1]); - if ((source as object).constructor === ReadableStream) { + if (node.s) { return readableStreamToAsyncIterator( source as ReadableStream>, ); @@ -615,10 +615,9 @@ export default abstract class BaseDeserializerContext implements PluginAccessOpt return this.deserializeAsyncIteratorFactoryInstance(node); case SerovalNodeType.ReadableStream: return this.deserializeReadableStream(node); - case SerovalNodeType.MapSentinel: + case SerovalNodeType.SpecialReference: case SerovalNodeType.IteratorFactory: case SerovalNodeType.AsyncIteratorFactory: - case SerovalNodeType.ReadableStreamFactory: default: throw new Error('invariant'); } diff --git a/packages/seroval/src/core/context/parser.ts b/packages/seroval/src/core/context/parser.ts index 41a48457..4be40bf9 100644 --- a/packages/seroval/src/core/context/parser.ts +++ b/packages/seroval/src/core/context/parser.ts @@ -14,23 +14,22 @@ import { import type { Plugin, PluginAccessOptions, SerovalMode } from '../plugin'; import { hasReferenceID } from '../reference'; import { + SpecialReference, ASYNC_ITERATOR, ITERATOR, - MAP_SENTINEL, - READABLE_STREAM, + SPECIAL_REFS, } from '../special-reference'; import type { SerovalAsyncIteratorFactoryNode, SerovalIndexedValueNode, SerovalIteratorFactoryNode, SerovalMapNode, - SerovalMapSentinelNode, SerovalNode, SerovalNullConstructorNode, SerovalObjectNode, SerovalObjectRecordNode, - SerovalReadableStreamFactoryNode, SerovalReferenceNode, + SerovalSpecialReferenceNode, SerovalWKSymbolNode, } from '../types'; import { getObjectFlag } from '../utils/get-object-flag'; @@ -115,18 +114,21 @@ export abstract class BaseParserContext implements PluginAccessOptions { return createReferenceNode(id, current); } - protected parseMapSentinel(): SerovalIndexedValueNode | SerovalMapSentinelNode { - const registeredID = this.refs.get(MAP_SENTINEL); + protected parseSpecialReference( + ref: SpecialReference, + ): SerovalIndexedValueNode | SerovalSpecialReferenceNode { + const specialRef = SPECIAL_REFS[ref]; + const registeredID = this.refs.get(specialRef); if (registeredID != null) { this.markRef(registeredID); return createIndexedValueNode(registeredID); } const id = this.refs.size; - this.refs.set(MAP_SENTINEL, id); + this.refs.set(specialRef, id); return { - t: SerovalNodeType.MapSentinel, + t: SerovalNodeType.SpecialReference, i: id, - s: undefined, + s: ref, l: undefined, c: undefined, m: undefined, @@ -163,7 +165,9 @@ export abstract class BaseParserContext implements PluginAccessOptions { }; } - protected parseAsyncIteratorFactory(): SerovalIndexedValueNode | SerovalAsyncIteratorFactoryNode { + protected parseAsyncIteratorFactory( + streaming: 0 | 1, + ): SerovalIndexedValueNode | SerovalAsyncIteratorFactoryNode { const registeredID = this.refs.get(ASYNC_ITERATOR); if (registeredID != null) { this.markRef(registeredID); @@ -174,7 +178,7 @@ export abstract class BaseParserContext implements PluginAccessOptions { return { t: SerovalNodeType.AsyncIteratorFactory, i: id, - s: undefined, + s: streaming, l: undefined, c: undefined, m: undefined, @@ -225,33 +229,7 @@ export abstract class BaseParserContext implements PluginAccessOptions { p: undefined, e: { k, v, s }, a: undefined, - f: this.parseMapSentinel(), - b: undefined, - o: undefined, - }; - } - - protected parseReadableStreamFactory(): ( - SerovalIndexedValueNode | SerovalReadableStreamFactoryNode - ) { - const registeredID = this.refs.get(READABLE_STREAM); - if (registeredID != null) { - this.markRef(registeredID); - return createIndexedValueNode(registeredID); - } - const id = this.refs.size; - this.refs.set(READABLE_STREAM, id); - return { - t: SerovalNodeType.ReadableStreamFactory, - i: id, - s: undefined, - l: undefined, - c: undefined, - m: undefined, - p: undefined, - e: undefined, - a: undefined, - f: undefined, + f: this.parseSpecialReference(SpecialReference.MapSentinel), b: undefined, o: undefined, }; diff --git a/packages/seroval/src/core/context/parser/async.ts b/packages/seroval/src/core/context/parser/async.ts index a642d9a5..87e56e14 100644 --- a/packages/seroval/src/core/context/parser/async.ts +++ b/packages/seroval/src/core/context/parser/async.ts @@ -79,7 +79,7 @@ import { createCustomEventNode, createReadableStreamNode, } from '../../web-api'; -import { UNIVERSAL_SENTINEL } from '../../special-reference'; +import { SpecialReference, UNIVERSAL_SENTINEL } from '../../special-reference'; type ObjectLikeNode = | SerovalObjectNode @@ -147,7 +147,7 @@ export default abstract class BaseAsyncParserContext extends BaseParserContext { ); valueNodes.push( createAsyncIteratorFactoryInstanceNode( - this.parseAsyncIteratorFactory(), + this.parseAsyncIteratorFactory(0), await this.parse( await asyncIteratorToSequence(properties as unknown as AsyncIterable), ), @@ -489,7 +489,7 @@ export default abstract class BaseAsyncParserContext extends BaseParserContext { ): Promise { return createReadableStreamNode( id, - this.parseReadableStreamFactory(), + this.parseSpecialReference(SpecialReference.ReadableStream), await this.parse( await readableStreamToSequence(current), ), diff --git a/packages/seroval/src/core/context/parser/stream.ts b/packages/seroval/src/core/context/parser/stream.ts index e7054196..e070c21c 100644 --- a/packages/seroval/src/core/context/parser/stream.ts +++ b/packages/seroval/src/core/context/parser/stream.ts @@ -28,7 +28,7 @@ import type { } from '../../types'; import { createDOMExceptionNode, createURLNode, createURLSearchParamsNode } from '../../web-api'; import { asyncIteratorToReadableStream, iteratorToSequence } from '../../utils/iterator-to-sequence'; -import { UNIVERSAL_SENTINEL } from '../../special-reference'; +import { SpecialReference, UNIVERSAL_SENTINEL } from '../../special-reference'; export interface BaseStreamParserContextOptions extends BaseSyncParserContextOptions { onParse: (node: SerovalNode, initial: boolean) => void; @@ -57,7 +57,11 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont } private onParse(node: SerovalNode, initial: boolean): void { - this.onParseCallback(node, initial); + try { + this.onParseCallback(node, initial); + } catch (error) { + this.onError(error); + } } private onError(error: unknown): void { @@ -128,7 +132,7 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont ); valueNodes.push( createAsyncIteratorFactoryInstanceNode( - this.parseAsyncIteratorFactory(), + this.parseAsyncIteratorFactory(1), this.parse( asyncIteratorToReadableStream( properties as unknown as AsyncIterable, @@ -174,7 +178,7 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont p: undefined, e: undefined, a: undefined, - f: undefined, + f: this.parseSpecialReference(SpecialReference.ReadableStreamClose), b: undefined, o: undefined, }, false); @@ -191,8 +195,11 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont m: undefined, p: undefined, e: undefined, - a: undefined, - f: parsed, + a: [ + this.parseSpecialReference(SpecialReference.ReadableStreamEnqueue), + parsed, + ], + f: undefined, b: undefined, o: undefined, }, false); @@ -214,8 +221,11 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont m: undefined, p: undefined, e: undefined, - a: undefined, - f: parsed, + a: [ + this.parseSpecialReference(SpecialReference.ReadableStreamError), + parsed, + ], + f: undefined, b: undefined, o: undefined, }, false); @@ -244,7 +254,7 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont p: undefined, e: undefined, a: undefined, - f: undefined, + f: this.parseSpecialReference(SpecialReference.ReadableStreamConstructor), b: undefined, o: undefined, }; @@ -314,8 +324,11 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont m: undefined, p: undefined, e: undefined, - a: undefined, - f: parsed, + a: [ + this.parseSpecialReference(SpecialReference.PromiseResolve), + parsed, + ], + f: undefined, b: undefined, o: undefined, }, false); @@ -335,8 +348,11 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont m: undefined, p: undefined, e: undefined, - a: undefined, - f: parsed, + a: [ + this.parseSpecialReference(SpecialReference.PromiseReject), + parsed, + ], + f: undefined, b: undefined, o: undefined, }, false); @@ -356,7 +372,7 @@ export default abstract class BaseStreamParserContext extends BaseSyncParserCont p: undefined, e: undefined, a: undefined, - f: undefined, + f: this.parseSpecialReference(SpecialReference.PromiseConstructor), b: undefined, o: undefined, }; diff --git a/packages/seroval/src/core/context/serializer.ts b/packages/seroval/src/core/context/serializer.ts index 0c14f0c5..3cebed81 100644 --- a/packages/seroval/src/core/context/serializer.ts +++ b/packages/seroval/src/core/context/serializer.ts @@ -8,6 +8,7 @@ import { } from '../constants'; import { REFERENCES_KEY } from '../keys'; import type { Plugin, PluginAccessOptions, SerovalMode } from '../plugin'; +import { SpecialReference } from '../special-reference'; import type { SerovalArrayNode, SerovalIndexedValueNode, @@ -49,13 +50,13 @@ import type { SerovalReadableStreamEnqueueNode, SerovalReadableStreamErrorNode, SerovalReadableStreamCloseNode, - SerovalMapSentinelNode, SerovalIteratorFactoryInstanceNode, SerovalIteratorFactoryNode, SerovalAsyncIteratorFactoryInstanceNode, SerovalAsyncIteratorFactoryNode, SerovalReadableStreamNode, - SerovalReadableStreamFactoryNode, + SerovalSpecialReferenceNode, + SerovalNodeWithID, } from '../types'; import { isValidIdentifier } from '../utils/is-valid-identifier'; @@ -746,7 +747,7 @@ export default abstract class BaseSerializerContext implements PluginAccessOptio serialized += '([' + result + '])'; } } - if (sentinel.t === SerovalNodeType.MapSentinel) { + if (sentinel.t === SerovalNodeType.SpecialReference) { this.markRef(sentinel.i); serialized = '(' + this.serialize(sentinel) + ',' + serialized + ')'; } @@ -986,38 +987,118 @@ export default abstract class BaseSerializerContext implements PluginAccessOptio throw new Error('Missing plugin for tag "' + node.c + '".'); } - protected abstract serializePromiseConstructor( + private getConstructor(node: SerovalNodeWithID): string { + const constructor = this.serialize(node); + return (constructor === this.getRefParam(node.i)) ? constructor : ('(' + constructor + ')'); + } + + protected serializePromiseConstructor( node: SerovalPromiseConstructorNode, - ): string; + ): string { + return this.assignIndexedValue( + node.i, + this.getConstructor(node.f) + '()', + ); + } - protected abstract serializePromiseResolve( + protected serializePromiseResolve( node: SerovalPromiseResolveNode, - ): string; + ): string { + return this.getConstructor(node.a[0]) + '(' + this.getRefParam(node.i) + ',' + this.serialize(node.a[1]) + ')'; + } - protected abstract serializePromiseReject( + protected serializePromiseReject( node: SerovalPromiseRejectNode, - ): string; + ): string { + return this.getConstructor(node.a[0]) + '(' + this.getRefParam(node.i) + ',' + this.serialize(node.a[1]) + ')'; + } - protected abstract serializeReadableStreamConstructor( + protected serializeReadableStreamConstructor( node: SerovalReadableStreamConstructorNode, - ): string; + ): string { + return this.assignIndexedValue( + node.i, + this.getConstructor(node.f) + '()', + ); + } - protected abstract serializeReadableStreamEnqueue( + protected serializeReadableStreamEnqueue( node: SerovalReadableStreamEnqueueNode, - ): string; + ): string { + return this.getConstructor(node.a[0]) + '(' + this.getRefParam(node.i) + ',' + this.serialize(node.a[1]) + ')'; + } - protected abstract serializeReadableStreamError( + protected serializeReadableStreamError( node: SerovalReadableStreamErrorNode, - ): string; + ): string { + return this.getConstructor(node.a[0]) + '(' + this.getRefParam(node.i) + ',' + this.serialize(node.a[1]) + ')'; + } - protected abstract serializeReadableStreamClose( + protected serializeReadableStreamClose( node: SerovalReadableStreamCloseNode, - ): string; + ): string { + return this.getConstructor(node.f) + '(' + this.getRefParam(node.i) + ')'; + } + + private serializeSpecialReferenceValue(ref: SpecialReference): string { + switch (ref) { + case SpecialReference.MapSentinel: + return '[]'; + case SpecialReference.ReadableStream: + return this.createFunction( + ['s'], + 'new ReadableStream({start:' + this.createFunction( + ['c'], + 'Promise.resolve().then(' + this.createEffectfulFunction( + ['i', 'v'], + 'for(i=0;is.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}', + ) + ')', + ) + '})', + ), + ); } protected serializeAsyncIteratorFactory(node: SerovalAsyncIteratorFactoryNode): string { return this.assignIndexedValue( node.i, - this.createFunction( - ['s'], - this.createFunction( - ['i', 't'], - '(i=0,t={[' + this.serialize(node.f) + ']:' + this.createFunction([], 't') + ',' - + 'next:' + this.createFunction( - [], - 'Promise.resolve().then(' + this.createEffectfulFunction( - ['c', 'd'], - 'if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}', - ) + ')', - ) + '})', - ), - ), + node.s + ? this.getStreamingAsyncIteratorFactory(node) + : this.getBlockingAsyncIteratorFactory(node), ); } protected serializeAsyncIteratorFactoryInstance( node: SerovalAsyncIteratorFactoryInstanceNode, ): string { - return '(' + this.serialize(node.a[0]) + ')(' + this.serialize(node.a[1]) + ')'; + return this.getConstructor(node.a[0]) + '(' + this.serialize(node.a[1]) + ')'; } protected serializeReadableStream( node: SerovalReadableStreamNode, ): string { this.stack.push(node.i); - const result = '(' + this.serialize(node.a[0]) + ')(' + this.serialize(node.a[1]) + ')'; + const result = this.getConstructor(node.a[0]) + '(' + this.serialize(node.a[1]) + ')'; this.stack.pop(); return this.assignIndexedValue( node.i, @@ -1079,24 +1183,6 @@ export default abstract class BaseSerializerContext implements PluginAccessOptio ); } - protected serializeReadableStreamFactory( - node: SerovalReadableStreamFactoryNode, - ): string { - return this.assignIndexedValue( - node.i, - this.createFunction( - ['s'], - 'new ReadableStream({start:' + this.createFunction( - ['c'], - 'Promise.resolve().then(' + this.createEffectfulFunction( - ['i', 'v'], - 'for(i=0;i = { + [SpecialReference.MapSentinel]: {}, + [SpecialReference.ReadableStream]: {}, + [SpecialReference.PromiseConstructor]: {}, + [SpecialReference.PromiseResolve]: {}, + [SpecialReference.PromiseReject]: {}, + [SpecialReference.ReadableStreamConstructor]: {}, + [SpecialReference.ReadableStreamEnqueue]: {}, + [SpecialReference.ReadableStreamError]: {}, + [SpecialReference.ReadableStreamClose]: {}, +}; diff --git a/packages/seroval/src/core/types.ts b/packages/seroval/src/core/types.ts index 26e83e3b..775086e8 100644 --- a/packages/seroval/src/core/types.ts +++ b/packages/seroval/src/core/types.ts @@ -5,6 +5,7 @@ import type { Symbols, ErrorConstructorTag, } from './constants'; +import type { SpecialReference } from './special-reference'; export interface SerovalBaseNode { // Type of the node @@ -162,7 +163,7 @@ export interface SerovalMapNode extends SerovalBaseNode { i: number; // key/value pairs e: SerovalMapRecordNode; - f: SerovalMapSentinelNode | SerovalIndexedValueNode; + f: SerovalNodeWithID; } export interface SerovalArrayNode extends SerovalBaseNode { @@ -300,42 +301,55 @@ export interface SerovalBoxedNode extends SerovalBaseNode { export interface SerovalPromiseConstructorNode extends SerovalBaseNode { t: SerovalNodeType.PromiseConstructor; i: number; + f: SerovalNodeWithID; } export interface SerovalPromiseResolveNode extends SerovalBaseNode { t: SerovalNodeType.PromiseResolve; - // reference to the resolver i: number; - f: SerovalNode; + a: [ + resolver: SerovalNodeWithID, + resolved: SerovalNode, + ]; } export interface SerovalPromiseRejectNode extends SerovalBaseNode { t: SerovalNodeType.PromiseReject; - // reference to the resolver i: number; - f: SerovalNode; + a: [ + resolver: SerovalNodeWithID, + resolved: SerovalNode, + ]; } export interface SerovalReadableStreamConstructorNode extends SerovalBaseNode { t: SerovalNodeType.ReadableStreamConstructor; i: number; + f: SerovalNodeWithID; } export interface SerovalReadableStreamEnqueueNode extends SerovalBaseNode { t: SerovalNodeType.ReadableStreamEnqueue; i: number; - f: SerovalNode; + a: [ + resolver: SerovalNodeWithID, + resolved: SerovalNode, + ]; } -export interface SerovalReadableStreamCloseNode extends SerovalBaseNode { - t: SerovalNodeType.ReadableStreamClose; +export interface SerovalReadableStreamErrorNode extends SerovalBaseNode { + t: SerovalNodeType.ReadableStreamError; i: number; + a: [ + resolver: SerovalNodeWithID, + resolved: SerovalNode, + ]; } -export interface SerovalReadableStreamErrorNode extends SerovalBaseNode { - t: SerovalNodeType.ReadableStreamError; +export interface SerovalReadableStreamCloseNode extends SerovalBaseNode { + t: SerovalNodeType.ReadableStreamClose; i: number; - f: SerovalNode; + f: SerovalNodeWithID; } export interface SerovalRequestNode extends SerovalBaseNode { @@ -389,9 +403,10 @@ export interface SerovalPluginNode extends SerovalBaseNode { c: string; } -export interface SerovalMapSentinelNode extends SerovalBaseNode { - t: SerovalNodeType.MapSentinel; +export interface SerovalSpecialReferenceNode extends SerovalBaseNode { + t: SerovalNodeType.SpecialReference; i: number; + s: SpecialReference; } export interface SerovalIteratorFactoryNode extends SerovalBaseNode { @@ -403,7 +418,7 @@ export interface SerovalIteratorFactoryNode extends SerovalBaseNode { export interface SerovalIteratorFactoryInstanceNode extends SerovalBaseNode { t: SerovalNodeType.IteratorFactoryInstance; a: [ - instance: SerovalNode, + instance: SerovalNodeWithID, sequence: SerovalNode, ]; } @@ -411,13 +426,14 @@ export interface SerovalIteratorFactoryInstanceNode extends SerovalBaseNode { export interface SerovalAsyncIteratorFactoryNode extends SerovalBaseNode { t: SerovalNodeType.AsyncIteratorFactory; i: number; + s: 0 | 1; f: SerovalNode; } export interface SerovalAsyncIteratorFactoryInstanceNode extends SerovalBaseNode { t: SerovalNodeType.AsyncIteratorFactoryInstance; a: [ - instance: SerovalNode, + instance: SerovalNodeWithID, sequence: SerovalNode, ]; } @@ -426,16 +442,11 @@ export interface SerovalReadableStreamNode extends SerovalBaseNode { t: SerovalNodeType.ReadableStream; i: number; a: [ - instance: SerovalNode, + instance: SerovalNodeWithID, sequence: SerovalNode, ]; } -export interface SerovalReadableStreamFactoryNode extends SerovalBaseNode { - t: SerovalNodeType.ReadableStreamFactory; - i: number; -} - export type SerovalSyncNode = | SerovalPrimitiveNode | SerovalIndexedValueNode @@ -463,7 +474,7 @@ export type SerovalSyncNode = | SerovalCustomEventNode | SerovalDOMExceptionNode | SerovalPluginNode - | SerovalMapSentinelNode + | SerovalSpecialReferenceNode | SerovalIteratorFactoryNode | SerovalIteratorFactoryInstanceNode | SerovalAsyncIteratorFactoryNode @@ -482,8 +493,7 @@ export type SerovalAsyncNode = | SerovalReadableStreamErrorNode | SerovalRequestNode | SerovalResponseNode - | SerovalReadableStreamNode - | SerovalReadableStreamFactoryNode; + | SerovalReadableStreamNode; export type SerovalNode = | SerovalSyncNode diff --git a/packages/seroval/src/core/web-api.ts b/packages/seroval/src/core/web-api.ts index ff093a03..34581c68 100644 --- a/packages/seroval/src/core/web-api.ts +++ b/packages/seroval/src/core/web-api.ts @@ -5,6 +5,7 @@ import type { SerovalDOMExceptionNode, SerovalEventNode, SerovalNode, + SerovalNodeWithID, SerovalReadableStreamNode, SerovalURLNode, SerovalURLSearchParamsNode, @@ -114,7 +115,7 @@ export function createCustomEventNode( export function createReadableStreamNode( id: number, - factory: SerovalNode, + factory: SerovalNodeWithID, items: SerovalNode, ): SerovalReadableStreamNode { return { diff --git a/packages/seroval/src/index.ts b/packages/seroval/src/index.ts index 30af6364..5774d64a 100644 --- a/packages/seroval/src/index.ts +++ b/packages/seroval/src/index.ts @@ -14,7 +14,7 @@ export { createReference } from './core/reference'; export * from './core/tree'; export * from './core/cross'; -export { GLOBAL_CONTEXT_API_SCRIPT, getCrossReferenceHeader } from './core/keys'; +export { getCrossReferenceHeader } from './core/keys'; export { default as Serializer } from './core/Serializer'; export * from './core/plugin'; diff --git a/packages/seroval/test/__snapshots__/array.test.ts.snap b/packages/seroval/test/__snapshots__/array.test.ts.snap index 128ec4d6..6c76cd56 100644 --- a/packages/seroval/test/__snapshots__/array.test.ts.snap +++ b/packages/seroval/test/__snapshots__/array.test.ts.snap @@ -16,25 +16,25 @@ exports[`arrays > crossSerializeAsync > supports Arrays 1`] = `"$R[0]=Promise.re exports[`arrays > crossSerializeAsync > supports self recursion 1`] = `"$R[0]=[$R[1]=Promise.resolve().then(()=>$R[0]),$R[2]=Promise.resolve().then(()=>$R[0])]"`; -exports[`arrays > crossSerializeStream > scoped > supports Arrays 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`arrays > crossSerializeStream > scoped > supports Arrays 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`arrays > crossSerializeStream > scoped > supports Arrays 2`] = `"($R=>_$.Ps($R[0],$R[1]=[1,2,3]))($R[\\"example\\"])"`; +exports[`arrays > crossSerializeStream > scoped > supports Arrays 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=[1,2,3]))($R[\\"example\\"])"`; -exports[`arrays > crossSerializeStream > scoped > supports self recursion 1`] = `"($R=>$R[0]=[$R[1]=_$.P(),$R[2]=_$.P()])($R[\\"example\\"])"`; +exports[`arrays > crossSerializeStream > scoped > supports self recursion 1`] = `"($R=>$R[0]=[$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),$R[3]=$R[2]()])($R[\\"example\\"])"`; -exports[`arrays > crossSerializeStream > scoped > supports self recursion 2`] = `"($R=>_$.Ps($R[1],$R[0]))($R[\\"example\\"])"`; +exports[`arrays > crossSerializeStream > scoped > supports self recursion 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0]))($R[\\"example\\"])"`; -exports[`arrays > crossSerializeStream > scoped > supports self recursion 3`] = `"($R=>_$.Ps($R[2],$R[0]))($R[\\"example\\"])"`; +exports[`arrays > crossSerializeStream > scoped > supports self recursion 3`] = `"($R=>$R[4]($R[3],$R[0]))($R[\\"example\\"])"`; -exports[`arrays > crossSerializeStream > supports Arrays 1`] = `"$R[0]=_$.P()"`; +exports[`arrays > crossSerializeStream > supports Arrays 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`arrays > crossSerializeStream > supports Arrays 2`] = `"_$.Ps($R[0],$R[1]=[1,2,3])"`; +exports[`arrays > crossSerializeStream > supports Arrays 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=[1,2,3])"`; -exports[`arrays > crossSerializeStream > supports self recursion 1`] = `"$R[0]=[$R[1]=_$.P(),$R[2]=_$.P()]"`; +exports[`arrays > crossSerializeStream > supports self recursion 1`] = `"$R[0]=[$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),$R[3]=$R[2]()]"`; -exports[`arrays > crossSerializeStream > supports self recursion 2`] = `"_$.Ps($R[1],$R[0])"`; +exports[`arrays > crossSerializeStream > supports self recursion 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0])"`; -exports[`arrays > crossSerializeStream > supports self recursion 3`] = `"_$.Ps($R[2],$R[0])"`; +exports[`arrays > crossSerializeStream > supports self recursion 3`] = `"$R[4]($R[3],$R[0])"`; exports[`arrays > serialize > supports Arrays 1`] = `"[1,2,3]"`; @@ -52,15 +52,15 @@ exports[`arrays > toCrossJSONAsync > supports Arrays 1`] = `"{\\"t\\":12,\\"i\\" exports[`arrays > toCrossJSONAsync > supports self recursion 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}},{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"o\\":0}"`; -exports[`arrays > toCrossJSONStream > supports Arrays 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`arrays > toCrossJSONStream > supports Arrays 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`arrays > toCrossJSONStream > supports Arrays 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":9,\\"i\\":1,\\"l\\":3,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}}"`; +exports[`arrays > toCrossJSONStream > supports Arrays 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":9,\\"i\\":2,\\"l\\":3,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}]}"`; -exports[`arrays > toCrossJSONStream > supports self recursion 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":28,\\"i\\":1},{\\"t\\":28,\\"i\\":2}],\\"o\\":0}"`; +exports[`arrays > toCrossJSONStream > supports self recursion 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":28,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":2}},{\\"t\\":28,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}}],\\"o\\":0}"`; -exports[`arrays > toCrossJSONStream > supports self recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`arrays > toCrossJSONStream > supports self recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":4,\\"i\\":0}]}"`; -exports[`arrays > toCrossJSONStream > supports self recursion 3`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`arrays > toCrossJSONStream > supports self recursion 3`] = `"{\\"t\\":29,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":4},{\\"t\\":4,\\"i\\":0}]}"`; exports[`arrays > toJSON > supports Arrays 1`] = `"{\\"t\\":{\\"t\\":9,\\"i\\":0,\\"l\\":3,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3}],\\"o\\":0},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/async-iterable.test.ts.snap b/packages/seroval/test/__snapshots__/async-iterable.test.ts.snap index 690dcd96..e8f198c1 100644 --- a/packages/seroval/test/__snapshots__/async-iterable.test.ts.snap +++ b/packages/seroval/test/__snapshots__/async-iterable.test.ts.snap @@ -1,53 +1,53 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`AsyncIterable > compat > should use function expressions instead of arrow functions. 1`] = `"(function(h){return ({title:\\"Hello World\\",[h=Symbol.asyncIterator]:(function(s){return function(i,t){return (i=0,t={[h]:function(){return t},next:function(){return Promise.resolve().then(function(c,d){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; +exports[`AsyncIterable > compat > should use function expressions instead of arrow functions. 1`] = `"(function(h,j){return ({title:\\"Hello World\\",[h=Symbol.asyncIterator]:(function(s){return function(i,t){return (i=0,t={[h]:function(){return t},next:function(){return Promise.resolve().then(function(c,d){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; -exports[`AsyncIterable > compat#toJSONAsync > should use function expression instead of arrow functions. 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0},\\"f\\":16379,\\"m\\":[1]}"`; +exports[`AsyncIterable > compat#toJSONAsync > should use function expression instead of arrow functions. 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0},\\"f\\":16379,\\"m\\":[1]}"`; -exports[`AsyncIterable > compat#toJSONAsync > should use function expression instead of arrow functions. 2`] = `"(function(h){return ({title:\\"Hello World\\",[h=Symbol.asyncIterator]:(function(s){return function(i,t){return (i=0,t={[h]:function(){return t},next:function(){return Promise.resolve().then(function(c,d){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; +exports[`AsyncIterable > compat#toJSONAsync > should use function expression instead of arrow functions. 2`] = `"(function(h,j){return ({title:\\"Hello World\\",[h=Symbol.asyncIterator]:(function(s){return function(i,t){return (i=0,t={[h]:function(){return t},next:function(){return Promise.resolve().then(function(c,d){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; -exports[`AsyncIterable > crossSerializeAsync > scoped > supports AsyncIterables 1`] = `"($R=>$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})})($R[\\"example\\"])"`; +exports[`AsyncIterable > crossSerializeAsync > scoped > supports AsyncIterables 1`] = `"($R=>$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})})($R[\\"example\\"])"`; -exports[`AsyncIterable > crossSerializeAsync > supports AsyncIterables 1`] = `"$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})}"`; +exports[`AsyncIterable > crossSerializeAsync > supports AsyncIterables 1`] = `"$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})}"`; -exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 1`] = `"($R=>$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())})($R[\\"example\\"])"`; +exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 1`] = `"($R=>$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())})($R[\\"example\\"])"`; -exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 2`] = `"($R=>_$.Se($R[3],$R[4]=[0,1]))($R[\\"example\\"])"`; +exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 2`] = `"($R=>($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1]))($R[\\"example\\"])"`; -exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 3`] = `"($R=>_$.Se($R[3],$R[5]=[0,2]))($R[\\"example\\"])"`; +exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 3`] = `"($R=>$R[6]($R[3],$R[7]=[0,2]))($R[\\"example\\"])"`; -exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 4`] = `"($R=>_$.Se($R[3],$R[6]=[0,3]))($R[\\"example\\"])"`; +exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 4`] = `"($R=>$R[6]($R[3],$R[8]=[0,3]))($R[\\"example\\"])"`; -exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 5`] = `"($R=>_$.Se($R[3],$R[7]=[2,void 0]))($R[\\"example\\"])"`; +exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 5`] = `"($R=>$R[6]($R[3],$R[9]=[2,void 0]))($R[\\"example\\"])"`; -exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 6`] = `"($R=>_$.Sc($R[3]))($R[\\"example\\"])"`; +exports[`AsyncIterable > crossSerializeStream > scoped > supports AsyncIterables 6`] = `"($R=>($R[10]=s=>{s.c.close();delete s.c})($R[3]))($R[\\"example\\"])"`; -exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 1`] = `"$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())}"`; +exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 1`] = `"$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())}"`; -exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 2`] = `"_$.Se($R[3],$R[4]=[0,1])"`; +exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 2`] = `"($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1])"`; -exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 3`] = `"_$.Se($R[3],$R[5]=[0,2])"`; +exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 3`] = `"$R[6]($R[3],$R[7]=[0,2])"`; -exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 4`] = `"_$.Se($R[3],$R[6]=[0,3])"`; +exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 4`] = `"$R[6]($R[3],$R[8]=[0,3])"`; -exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 5`] = `"_$.Se($R[3],$R[7]=[2,void 0])"`; +exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 5`] = `"$R[6]($R[3],$R[9]=[2,void 0])"`; -exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 6`] = `"_$.Sc($R[3])"`; +exports[`AsyncIterable > crossSerializeStream > supports AsyncIterables 6`] = `"($R[10]=s=>{s.c.close();delete s.c})($R[3])"`; -exports[`AsyncIterable > serializeAsync > supports AsyncIterables 1`] = `"(h=>({title:\\"Hello World\\",[h=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[h]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; +exports[`AsyncIterable > serializeAsync > supports AsyncIterables 1`] = `"((h,j)=>({title:\\"Hello World\\",[h=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[h]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; -exports[`AsyncIterable > toCrossJSONAsync > supports AsyncIterables 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0}"`; +exports[`AsyncIterable > toCrossJSONAsync > supports AsyncIterables 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0}"`; -exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3}]}],\\"s\\":2},\\"o\\":0}"`; +exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":4,\\"s\\":5}}]}],\\"s\\":2},\\"o\\":0}"`; -exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 2`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":4,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}}"`; +exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 2`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":6},{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 3`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}}"`; +exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 3`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}]}"`; -exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 4`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":6,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}}"`; +exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 4`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":8,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}]}"`; -exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 5`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}}"`; +exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 5`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":9,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 6`] = `"{\\"t\\":33,\\"i\\":3}"`; +exports[`AsyncIterable > toCrossJSONStream > supports AsyncIterables 6`] = `"{\\"t\\":33,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":10,\\"s\\":8}}"`; -exports[`AsyncIterable > toJSONAsync > supports AsyncIterables 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0},\\"f\\":16383,\\"m\\":[1]}"`; +exports[`AsyncIterable > toJSONAsync > supports AsyncIterables 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0},\\"f\\":16383,\\"m\\":[1]}"`; diff --git a/packages/seroval/test/__snapshots__/bigint.test.ts.snap b/packages/seroval/test/__snapshots__/bigint.test.ts.snap index a0862f46..b9c13d21 100644 --- a/packages/seroval/test/__snapshots__/bigint.test.ts.snap +++ b/packages/seroval/test/__snapshots__/bigint.test.ts.snap @@ -8,9 +8,9 @@ exports[`bigint > crossSerialize > supports bigint 1`] = `"9007199254740991n"`; exports[`bigint > crossSerializeAsync > supports bigint 1`] = `"$R[0]=Promise.resolve(9007199254740991n)"`; -exports[`bigint > crossSerializeStream > supports bigint 1`] = `"$R[0]=_$.P()"`; +exports[`bigint > crossSerializeStream > supports bigint 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`bigint > crossSerializeStream > supports bigint 2`] = `"_$.Ps($R[0],9007199254740991n)"`; +exports[`bigint > crossSerializeStream > supports bigint 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],9007199254740991n)"`; exports[`bigint > serialize > supports bigint 1`] = `"9007199254740991n"`; @@ -20,9 +20,9 @@ exports[`bigint > toCrossJSON > supports bigint 1`] = `"{\\"t\\":3,\\"s\\":\\"90 exports[`bigint > toCrossJSONAsync > supports bigint 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":3,\\"s\\":\\"9007199254740991\\"}}"`; -exports[`bigint > toCrossJSONStream > supports bigint 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`bigint > toCrossJSONStream > supports bigint 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`bigint > toCrossJSONStream > supports bigint 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":3,\\"s\\":\\"9007199254740991\\"}}"`; +exports[`bigint > toCrossJSONStream > supports bigint 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":3,\\"s\\":\\"9007199254740991\\"}]}"`; exports[`bigint > toJSON > supports bigint 1`] = `"{\\"t\\":{\\"t\\":3,\\"s\\":\\"9007199254740991\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/boolean.test.ts.snap b/packages/seroval/test/__snapshots__/boolean.test.ts.snap index f360003e..42ded919 100644 --- a/packages/seroval/test/__snapshots__/boolean.test.ts.snap +++ b/packages/seroval/test/__snapshots__/boolean.test.ts.snap @@ -8,13 +8,13 @@ exports[`boolean > crossSerializeAsync > supports boolean 1`] = `"$R[0]=Promise. exports[`boolean > crossSerializeAsync > supports boolean 2`] = `"$R[0]=Promise.resolve(!1)"`; -exports[`boolean > crossSerializeStream > supports false value 1`] = `"$R[0]=_$.P()"`; +exports[`boolean > crossSerializeStream > supports false value 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boolean > crossSerializeStream > supports false value 2`] = `"_$.Ps($R[0],!1)"`; +exports[`boolean > crossSerializeStream > supports false value 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],!1)"`; -exports[`boolean > crossSerializeStream > supports true value 1`] = `"$R[0]=_$.P()"`; +exports[`boolean > crossSerializeStream > supports true value 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boolean > crossSerializeStream > supports true value 2`] = `"_$.Ps($R[0],!0)"`; +exports[`boolean > crossSerializeStream > supports true value 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],!0)"`; exports[`boolean > toCrossJSON > supports boolean 1`] = `"{\\"t\\":2,\\"s\\":2}"`; @@ -24,13 +24,13 @@ exports[`boolean > toCrossJSONAsync > supports boolean 1`] = `"{\\"t\\":12,\\"i\ exports[`boolean > toCrossJSONAsync > supports boolean 2`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":2,\\"s\\":3}}"`; -exports[`boolean > toCrossJSONStream > supports false value 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boolean > toCrossJSONStream > supports false value 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boolean > toCrossJSONStream > supports false value 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":3}}"`; +exports[`boolean > toCrossJSONStream > supports false value 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}]}"`; -exports[`boolean > toCrossJSONStream > supports true value 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boolean > toCrossJSONStream > supports true value 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boolean > toCrossJSONStream > supports true value 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":2}}"`; +exports[`boolean > toCrossJSONStream > supports true value 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":2}]}"`; exports[`boolean > toJSON > supports boolean 1`] = `"{\\"t\\":{\\"t\\":2,\\"s\\":2},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/boxed-bigint.test.ts.snap b/packages/seroval/test/__snapshots__/boxed-bigint.test.ts.snap index 827dcdd7..671336b6 100644 --- a/packages/seroval/test/__snapshots__/boxed-bigint.test.ts.snap +++ b/packages/seroval/test/__snapshots__/boxed-bigint.test.ts.snap @@ -12,13 +12,13 @@ exports[`boxed bigint > crossSerializeAsync > scoped > supports boxed bigint 1`] exports[`boxed bigint > crossSerializeAsync > supports boxed bigint 1`] = `"$R[0]=Promise.resolve($R[1]=Object(9007199254740991n))"`; -exports[`boxed bigint > crossSerializeStream > scoped > supports boxed bigint 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed bigint > crossSerializeStream > scoped > supports boxed bigint 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed bigint > crossSerializeStream > scoped > supports boxed bigint 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(9007199254740991n)))($R[\\"example\\"])"`; +exports[`boxed bigint > crossSerializeStream > scoped > supports boxed bigint 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(9007199254740991n)))($R[\\"example\\"])"`; -exports[`boxed bigint > crossSerializeStream > supports boxed bigint 1`] = `"$R[0]=_$.P()"`; +exports[`boxed bigint > crossSerializeStream > supports boxed bigint 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed bigint > crossSerializeStream > supports boxed bigint 2`] = `"_$.Ps($R[0],$R[1]=Object(9007199254740991n))"`; +exports[`boxed bigint > crossSerializeStream > supports boxed bigint 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(9007199254740991n))"`; exports[`boxed bigint > serialize > supports boxed bigint 1`] = `"Object(9007199254740991n)"`; @@ -28,9 +28,9 @@ exports[`boxed bigint > toCrossJSON > supports boxed bigint 1`] = `"{\\"t\\":27, exports[`boxed bigint > toCrossJSONAsync > supports boxed bigint 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":3,\\"s\\":\\"9007199254740991\\"}}}"`; -exports[`boxed bigint > toCrossJSONStream > supports boxed bigint 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed bigint > toCrossJSONStream > supports boxed bigint 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed bigint > toCrossJSONStream > supports boxed bigint 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":3,\\"s\\":\\"9007199254740991\\"}}}"`; +exports[`boxed bigint > toCrossJSONStream > supports boxed bigint 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":3,\\"s\\":\\"9007199254740991\\"}}]}"`; exports[`boxed bigint > toJSON > supports boxed bigint 1`] = `"{\\"t\\":{\\"t\\":27,\\"i\\":0,\\"f\\":{\\"t\\":3,\\"s\\":\\"9007199254740991\\"}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/boxed-boolean.test.ts.snap b/packages/seroval/test/__snapshots__/boxed-boolean.test.ts.snap index 227bd127..7e6e6f7d 100644 --- a/packages/seroval/test/__snapshots__/boxed-boolean.test.ts.snap +++ b/packages/seroval/test/__snapshots__/boxed-boolean.test.ts.snap @@ -16,21 +16,21 @@ exports[`boxed boolean > crossSerializeAsync > supports boolean 1`] = `"$R[0]=Ob exports[`boxed boolean > crossSerializeAsync > supports boolean 2`] = `"$R[0]=Object(!1)"`; -exports[`boxed boolean > crossSerializeStream > scoped > supports boxed false 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed boolean > crossSerializeStream > scoped > supports boxed false 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed boolean > crossSerializeStream > scoped > supports boxed false 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(!1)))($R[\\"example\\"])"`; +exports[`boxed boolean > crossSerializeStream > scoped > supports boxed false 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(!1)))($R[\\"example\\"])"`; -exports[`boxed boolean > crossSerializeStream > scoped > supports boxed true 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed boolean > crossSerializeStream > scoped > supports boxed true 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed boolean > crossSerializeStream > scoped > supports boxed true 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(!0)))($R[\\"example\\"])"`; +exports[`boxed boolean > crossSerializeStream > scoped > supports boxed true 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(!0)))($R[\\"example\\"])"`; -exports[`boxed boolean > crossSerializeStream > supports boxed false 1`] = `"$R[0]=_$.P()"`; +exports[`boxed boolean > crossSerializeStream > supports boxed false 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed boolean > crossSerializeStream > supports boxed false 2`] = `"_$.Ps($R[0],$R[1]=Object(!1))"`; +exports[`boxed boolean > crossSerializeStream > supports boxed false 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(!1))"`; -exports[`boxed boolean > crossSerializeStream > supports boxed true 1`] = `"$R[0]=_$.P()"`; +exports[`boxed boolean > crossSerializeStream > supports boxed true 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed boolean > crossSerializeStream > supports boxed true 2`] = `"_$.Ps($R[0],$R[1]=Object(!0))"`; +exports[`boxed boolean > crossSerializeStream > supports boxed true 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(!0))"`; exports[`boxed boolean > toCrossJSON > supports boolean 1`] = `"{\\"t\\":27,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":2}}"`; @@ -40,13 +40,13 @@ exports[`boxed boolean > toCrossJSONAsync > supports boolean 1`] = `"{\\"t\\":12 exports[`boxed boolean > toCrossJSONAsync > supports boolean 2`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":3}}}"`; -exports[`boxed boolean > toCrossJSONStream > supports boxed false 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed boolean > toCrossJSONStream > supports boxed false 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed boolean > toCrossJSONStream > supports boxed false 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":3}}}"`; +exports[`boxed boolean > toCrossJSONStream > supports boxed false 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":2,\\"s\\":3}}]}"`; -exports[`boxed boolean > toCrossJSONStream > supports boxed true 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed boolean > toCrossJSONStream > supports boxed true 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed boolean > toCrossJSONStream > supports boxed true 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":2}}}"`; +exports[`boxed boolean > toCrossJSONStream > supports boxed true 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":2,\\"s\\":2}}]}"`; exports[`boxed boolean > toJSON > supports boolean 1`] = `"{\\"t\\":{\\"t\\":27,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":2}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/boxed-number.test.ts.snap b/packages/seroval/test/__snapshots__/boxed-number.test.ts.snap index 52c539bb..8e1bad49 100644 --- a/packages/seroval/test/__snapshots__/boxed-number.test.ts.snap +++ b/packages/seroval/test/__snapshots__/boxed-number.test.ts.snap @@ -40,45 +40,45 @@ exports[`boxed number > crossSerializeAsync > supports boxed numbers 4`] = `"$R[ exports[`boxed number > crossSerializeAsync > supports boxed numbers 5`] = `"$R[0]=Promise.resolve($R[1]=Object(-0))"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed -0 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed -0 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed -0 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(-0)))($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed -0 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(-0)))($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed -Infinity 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed -Infinity 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed -Infinity 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(-1/0)))($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed -Infinity 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(-1/0)))($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed Infinity 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed Infinity 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed Infinity 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(1/0)))($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed Infinity 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(1/0)))($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed NaN 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed NaN 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed NaN 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(0/0)))($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed NaN 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(0/0)))($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed numbers 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed numbers 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > scoped > supports boxed numbers 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(3735928559)))($R[\\"example\\"])"`; +exports[`boxed number > crossSerializeStream > scoped > supports boxed numbers 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(3735928559)))($R[\\"example\\"])"`; -exports[`boxed number > crossSerializeStream > supports boxed -0 1`] = `"$R[0]=_$.P()"`; +exports[`boxed number > crossSerializeStream > supports boxed -0 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed number > crossSerializeStream > supports boxed -0 2`] = `"_$.Ps($R[0],$R[1]=Object(-0))"`; +exports[`boxed number > crossSerializeStream > supports boxed -0 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(-0))"`; -exports[`boxed number > crossSerializeStream > supports boxed -Infinity 1`] = `"$R[0]=_$.P()"`; +exports[`boxed number > crossSerializeStream > supports boxed -Infinity 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed number > crossSerializeStream > supports boxed -Infinity 2`] = `"_$.Ps($R[0],$R[1]=Object(-1/0))"`; +exports[`boxed number > crossSerializeStream > supports boxed -Infinity 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(-1/0))"`; -exports[`boxed number > crossSerializeStream > supports boxed Infinity 1`] = `"$R[0]=_$.P()"`; +exports[`boxed number > crossSerializeStream > supports boxed Infinity 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed number > crossSerializeStream > supports boxed Infinity 2`] = `"_$.Ps($R[0],$R[1]=Object(1/0))"`; +exports[`boxed number > crossSerializeStream > supports boxed Infinity 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(1/0))"`; -exports[`boxed number > crossSerializeStream > supports boxed NaN 1`] = `"$R[0]=_$.P()"`; +exports[`boxed number > crossSerializeStream > supports boxed NaN 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed number > crossSerializeStream > supports boxed NaN 2`] = `"_$.Ps($R[0],$R[1]=Object(0/0))"`; +exports[`boxed number > crossSerializeStream > supports boxed NaN 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(0/0))"`; -exports[`boxed number > crossSerializeStream > supports boxed numbers 1`] = `"$R[0]=_$.P()"`; +exports[`boxed number > crossSerializeStream > supports boxed numbers 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed number > crossSerializeStream > supports boxed numbers 2`] = `"_$.Ps($R[0],$R[1]=Object(3735928559))"`; +exports[`boxed number > crossSerializeStream > supports boxed numbers 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(3735928559))"`; exports[`boxed number > toCrossJSON > supports boxed numbers 1`] = `"{\\"t\\":27,\\"i\\":0,\\"f\\":{\\"t\\":0,\\"s\\":3735928559}}"`; @@ -100,25 +100,25 @@ exports[`boxed number > toCrossJSONAsync > supports boxed numbers 4`] = `"{\\"t\ exports[`boxed number > toCrossJSONAsync > supports boxed numbers 5`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":4}}}"`; -exports[`boxed number > toCrossJSONStream > supports boxed -0 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed number > toCrossJSONStream > supports boxed -0 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed number > toCrossJSONStream > supports boxed -0 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":4}}}"`; +exports[`boxed number > toCrossJSONStream > supports boxed -0 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":2,\\"s\\":4}}]}"`; -exports[`boxed number > toCrossJSONStream > supports boxed -Infinity 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed number > toCrossJSONStream > supports boxed -Infinity 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed number > toCrossJSONStream > supports boxed -Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":6}}}"`; +exports[`boxed number > toCrossJSONStream > supports boxed -Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":2,\\"s\\":6}}]}"`; -exports[`boxed number > toCrossJSONStream > supports boxed Infinity 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed number > toCrossJSONStream > supports boxed Infinity 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed number > toCrossJSONStream > supports boxed Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":5}}}"`; +exports[`boxed number > toCrossJSONStream > supports boxed Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":2,\\"s\\":5}}]}"`; -exports[`boxed number > toCrossJSONStream > supports boxed NaN 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed number > toCrossJSONStream > supports boxed NaN 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed number > toCrossJSONStream > supports boxed NaN 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":2,\\"s\\":7}}}"`; +exports[`boxed number > toCrossJSONStream > supports boxed NaN 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":2,\\"s\\":7}}]}"`; -exports[`boxed number > toCrossJSONStream > supports boxed numbers 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed number > toCrossJSONStream > supports boxed numbers 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed number > toCrossJSONStream > supports boxed numbers 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":0,\\"s\\":3735928559}}}"`; +exports[`boxed number > toCrossJSONStream > supports boxed numbers 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":0,\\"s\\":3735928559}}]}"`; exports[`boxed number > toJSON > supports boxed numbers 1`] = `"{\\"t\\":{\\"t\\":27,\\"i\\":0,\\"f\\":{\\"t\\":0,\\"s\\":3735928559}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/boxed-string.test.ts.snap b/packages/seroval/test/__snapshots__/boxed-string.test.ts.snap index d09ed0e0..f720e4b7 100644 --- a/packages/seroval/test/__snapshots__/boxed-string.test.ts.snap +++ b/packages/seroval/test/__snapshots__/boxed-string.test.ts.snap @@ -16,21 +16,21 @@ exports[`boxed string > crossSerializeAsync > supports boxed strings 1`] = `"$R[ exports[`boxed string > crossSerializeAsync > supports boxed strings 2`] = `"$R[0]=Promise.resolve($R[1]=Object(\\"\\\\x3Cscript>\\\\x3C/script>\\"))"`; -exports[`boxed string > crossSerializeStream > scoped > supports boxed sanitized strings 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed string > crossSerializeStream > scoped > supports boxed sanitized strings 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed string > crossSerializeStream > scoped > supports boxed sanitized strings 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(\\"\\\\x3Cscript>\\\\x3C/script>\\")))($R[\\"example\\"])"`; +exports[`boxed string > crossSerializeStream > scoped > supports boxed sanitized strings 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(\\"\\\\x3Cscript>\\\\x3C/script>\\")))($R[\\"example\\"])"`; -exports[`boxed string > crossSerializeStream > scoped > supports boxed strings 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`boxed string > crossSerializeStream > scoped > supports boxed strings 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`boxed string > crossSerializeStream > scoped > supports boxed strings 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object(\\"\\\\\\"hello\\\\\\"\\")))($R[\\"example\\"])"`; +exports[`boxed string > crossSerializeStream > scoped > supports boxed strings 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(\\"\\\\\\"hello\\\\\\"\\")))($R[\\"example\\"])"`; -exports[`boxed string > crossSerializeStream > supports boxed sanitized strings 1`] = `"$R[0]=_$.P()"`; +exports[`boxed string > crossSerializeStream > supports boxed sanitized strings 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed string > crossSerializeStream > supports boxed sanitized strings 2`] = `"_$.Ps($R[0],$R[1]=Object(\\"\\\\x3Cscript>\\\\x3C/script>\\"))"`; +exports[`boxed string > crossSerializeStream > supports boxed sanitized strings 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(\\"\\\\x3Cscript>\\\\x3C/script>\\"))"`; -exports[`boxed string > crossSerializeStream > supports boxed strings 1`] = `"$R[0]=_$.P()"`; +exports[`boxed string > crossSerializeStream > supports boxed strings 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`boxed string > crossSerializeStream > supports boxed strings 2`] = `"_$.Ps($R[0],$R[1]=Object(\\"\\\\\\"hello\\\\\\"\\"))"`; +exports[`boxed string > crossSerializeStream > supports boxed strings 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object(\\"\\\\\\"hello\\\\\\"\\"))"`; exports[`boxed string > serialize > supports boxed strings 1`] = `"Object(\\"\\\\\\"hello\\\\\\"\\")"`; @@ -48,13 +48,13 @@ exports[`boxed string > toCrossJSONAsync > supports boxed strings 1`] = `"{\\"t\ exports[`boxed string > toCrossJSONAsync > supports boxed strings 2`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\x3Cscript>\\\\\\\\x3C/script>\\"}}}"`; -exports[`boxed string > toCrossJSONStream > supports boxed sanitized strings 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed string > toCrossJSONStream > supports boxed sanitized strings 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed string > toCrossJSONStream > supports boxed sanitized strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\x3Cscript>\\\\\\\\x3C/script>\\"}}}"`; +exports[`boxed string > toCrossJSONStream > supports boxed sanitized strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\x3Cscript>\\\\\\\\x3C/script>\\"}}]}"`; -exports[`boxed string > toCrossJSONStream > supports boxed strings 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`boxed string > toCrossJSONStream > supports boxed strings 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`boxed string > toCrossJSONStream > supports boxed strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":27,\\"i\\":1,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\\\\\\\"hello\\\\\\\\\\\\\\"\\"}}}"`; +exports[`boxed string > toCrossJSONStream > supports boxed strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":27,\\"i\\":2,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\\\\\\\"hello\\\\\\\\\\\\\\"\\"}}]}"`; exports[`boxed string > toJSON > supports boxed strings 1`] = `"{\\"t\\":{\\"t\\":27,\\"i\\":0,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\\\\\\\"hello\\\\\\\\\\\\\\"\\"}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/data-view.test.ts.snap b/packages/seroval/test/__snapshots__/data-view.test.ts.snap index 0840cc69..0f1416d0 100644 --- a/packages/seroval/test/__snapshots__/data-view.test.ts.snap +++ b/packages/seroval/test/__snapshots__/data-view.test.ts.snap @@ -8,13 +8,13 @@ exports[`DataView > crossSerializeAsync > scoped > supports DataView 1`] = `"($R exports[`DataView > crossSerializeAsync > supports DataView 1`] = `"$R[0]=Promise.resolve($R[1]=new DataView($R[2]=new Uint8Array([0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer,0,16))"`; -exports[`DataView > crossSerializeStream > scoped > supports DataView 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`DataView > crossSerializeStream > scoped > supports DataView 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`DataView > crossSerializeStream > scoped > supports DataView 2`] = `"($R=>_$.Ps($R[0],$R[1]=new DataView($R[2]=new Uint8Array([0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer,0,16)))($R[\\"example\\"])"`; +exports[`DataView > crossSerializeStream > scoped > supports DataView 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new DataView($R[3]=new Uint8Array([0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer,0,16)))($R[\\"example\\"])"`; -exports[`DataView > crossSerializeStream > supports DataView 1`] = `"$R[0]=_$.P()"`; +exports[`DataView > crossSerializeStream > supports DataView 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`DataView > crossSerializeStream > supports DataView 2`] = `"_$.Ps($R[0],$R[1]=new DataView($R[2]=new Uint8Array([0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer,0,16))"`; +exports[`DataView > crossSerializeStream > supports DataView 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new DataView($R[3]=new Uint8Array([0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer,0,16))"`; exports[`DataView > serialize > supports DataView 1`] = `"new DataView(new Uint8Array([0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer,0,16)"`; @@ -24,9 +24,9 @@ exports[`DataView > toCrossJSON > supports DataView 1`] = `"{\\"t\\":22,\\"i\\": exports[`DataView > toCrossJSONAsync > supports DataView 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":22,\\"i\\":1,\\"l\\":16,\\"f\\":{\\"t\\":21,\\"i\\":2,\\"s\\":[0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]},\\"b\\":0}}"`; -exports[`DataView > toCrossJSONStream > supports DataView 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`DataView > toCrossJSONStream > supports DataView 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`DataView > toCrossJSONStream > supports DataView 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":22,\\"i\\":1,\\"l\\":16,\\"f\\":{\\"t\\":21,\\"i\\":2,\\"s\\":[0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]},\\"b\\":0}}"`; +exports[`DataView > toCrossJSONStream > supports DataView 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":22,\\"i\\":2,\\"l\\":16,\\"f\\":{\\"t\\":21,\\"i\\":3,\\"s\\":[0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]},\\"b\\":0}]}"`; exports[`DataView > toJSON > supports DataView 1`] = `"{\\"t\\":{\\"t\\":22,\\"i\\":0,\\"l\\":16,\\"f\\":{\\"t\\":21,\\"i\\":1,\\"s\\":[0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0]},\\"b\\":0},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/date.test.ts.snap b/packages/seroval/test/__snapshots__/date.test.ts.snap index 94cbcc9f..610c37bd 100644 --- a/packages/seroval/test/__snapshots__/date.test.ts.snap +++ b/packages/seroval/test/__snapshots__/date.test.ts.snap @@ -8,13 +8,13 @@ exports[`Date > crossSerializeAsync > scoped > supports Date 1`] = `"($R=>$R[0]= exports[`Date > crossSerializeAsync > supports Date 1`] = `"$R[0]=Promise.resolve($R[1]=new Date(\\"2023-03-14T11:16:24.879Z\\"))"`; -exports[`Date > crossSerializeStream > scoped > supports Date 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Date > crossSerializeStream > scoped > supports Date 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Date > crossSerializeStream > scoped > supports Date 2`] = `"($R=>_$.Ps($R[0],$R[1]=new Date(\\"2023-03-14T11:16:24.879Z\\")))($R[\\"example\\"])"`; +exports[`Date > crossSerializeStream > scoped > supports Date 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Date(\\"2023-03-14T11:16:24.879Z\\")))($R[\\"example\\"])"`; -exports[`Date > crossSerializeStream > supports Date 1`] = `"$R[0]=_$.P()"`; +exports[`Date > crossSerializeStream > supports Date 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Date > crossSerializeStream > supports Date 2`] = `"_$.Ps($R[0],$R[1]=new Date(\\"2023-03-14T11:16:24.879Z\\"))"`; +exports[`Date > crossSerializeStream > supports Date 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Date(\\"2023-03-14T11:16:24.879Z\\"))"`; exports[`Date > serialize > supports Date 1`] = `"new Date(\\"2023-03-14T11:16:24.879Z\\")"`; @@ -24,9 +24,9 @@ exports[`Date > toCrossJSON > supports Date 1`] = `"{\\"t\\":5,\\"i\\":0,\\"s\\" exports[`Date > toCrossJSONAsync > supports Date 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":5,\\"i\\":1,\\"s\\":\\"2023-03-14T11:16:24.879Z\\"}}"`; -exports[`Date > toCrossJSONStream > supports Date 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Date > toCrossJSONStream > supports Date 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Date > toCrossJSONStream > supports Date 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":5,\\"i\\":1,\\"s\\":\\"2023-03-14T11:16:24.879Z\\"}}"`; +exports[`Date > toCrossJSONStream > supports Date 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":5,\\"i\\":2,\\"s\\":\\"2023-03-14T11:16:24.879Z\\"}]}"`; exports[`Date > toJSON > supports Date 1`] = `"{\\"t\\":{\\"t\\":5,\\"i\\":0,\\"s\\":\\"2023-03-14T11:16:24.879Z\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/error.test.ts.snap b/packages/seroval/test/__snapshots__/error.test.ts.snap index 9bcd70d2..83e483a3 100644 --- a/packages/seroval/test/__snapshots__/error.test.ts.snap +++ b/packages/seroval/test/__snapshots__/error.test.ts.snap @@ -24,33 +24,33 @@ exports[`Error > crossSerializeAsync > supports Error.prototype.name 1`] = `"$R[ exports[`Error > crossSerializeAsync > supports other Error classes 1`] = `"$R[0]=Promise.resolve($R[1]=Object.assign(new ReferenceError(\\"A\\"),{stack:\\"\\"}))"`; -exports[`Error > crossSerializeStream > scoped > supports Error.prototype.cause 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Error > crossSerializeStream > scoped > supports Error.prototype.cause 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Error > crossSerializeStream > scoped > supports Error.prototype.cause 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object.assign(new Error(\\"B\\"),{stack:\\"\\",cause:$R[2]=_$.P()})))($R[\\"example\\"])"`; +exports[`Error > crossSerializeStream > scoped > supports Error.prototype.cause 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(new Error(\\"B\\"),{stack:\\"\\",cause:$R[3]=$R[1]()})))($R[\\"example\\"])"`; -exports[`Error > crossSerializeStream > scoped > supports Error.prototype.cause 3`] = `"($R=>_$.Ps($R[2],$R[3]=Object.assign(new Error(\\"A\\"),{stack:\\"\\"})))($R[\\"example\\"])"`; +exports[`Error > crossSerializeStream > scoped > supports Error.prototype.cause 3`] = `"($R=>$R[4]($R[3],$R[5]=Object.assign(new Error(\\"A\\"),{stack:\\"\\"})))($R[\\"example\\"])"`; -exports[`Error > crossSerializeStream > scoped > supports Error.prototype.name 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Error > crossSerializeStream > scoped > supports Error.prototype.name 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Error > crossSerializeStream > scoped > supports Error.prototype.name 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object.assign(new Error(\\"A\\"),{name:\\"ExampleError\\",stack:\\"\\"})))($R[\\"example\\"])"`; +exports[`Error > crossSerializeStream > scoped > supports Error.prototype.name 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(new Error(\\"A\\"),{name:\\"ExampleError\\",stack:\\"\\"})))($R[\\"example\\"])"`; -exports[`Error > crossSerializeStream > scoped > supports other Error classes 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Error > crossSerializeStream > scoped > supports other Error classes 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Error > crossSerializeStream > scoped > supports other Error classes 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object.assign(new ReferenceError(\\"A\\"),{stack:\\"\\"})))($R[\\"example\\"])"`; +exports[`Error > crossSerializeStream > scoped > supports other Error classes 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(new ReferenceError(\\"A\\"),{stack:\\"\\"})))($R[\\"example\\"])"`; -exports[`Error > crossSerializeStream > supports Error.prototype.cause 1`] = `"$R[0]=_$.P()"`; +exports[`Error > crossSerializeStream > supports Error.prototype.cause 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Error > crossSerializeStream > supports Error.prototype.cause 2`] = `"_$.Ps($R[0],$R[1]=Object.assign(new Error(\\"B\\"),{stack:\\"\\",cause:$R[2]=_$.P()}))"`; +exports[`Error > crossSerializeStream > supports Error.prototype.cause 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(new Error(\\"B\\"),{stack:\\"\\",cause:$R[3]=$R[1]()}))"`; -exports[`Error > crossSerializeStream > supports Error.prototype.cause 3`] = `"_$.Ps($R[2],$R[3]=Object.assign(new Error(\\"A\\"),{stack:\\"\\"}))"`; +exports[`Error > crossSerializeStream > supports Error.prototype.cause 3`] = `"$R[4]($R[3],$R[5]=Object.assign(new Error(\\"A\\"),{stack:\\"\\"}))"`; -exports[`Error > crossSerializeStream > supports Error.prototype.name 1`] = `"$R[0]=_$.P()"`; +exports[`Error > crossSerializeStream > supports Error.prototype.name 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Error > crossSerializeStream > supports Error.prototype.name 2`] = `"_$.Ps($R[0],$R[1]=Object.assign(new Error(\\"A\\"),{name:\\"ExampleError\\",stack:\\"\\"}))"`; +exports[`Error > crossSerializeStream > supports Error.prototype.name 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(new Error(\\"A\\"),{name:\\"ExampleError\\",stack:\\"\\"}))"`; -exports[`Error > crossSerializeStream > supports other Error classes 1`] = `"$R[0]=_$.P()"`; +exports[`Error > crossSerializeStream > supports other Error classes 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Error > crossSerializeStream > supports other Error classes 2`] = `"_$.Ps($R[0],$R[1]=Object.assign(new ReferenceError(\\"A\\"),{stack:\\"\\"}))"`; +exports[`Error > crossSerializeStream > supports other Error classes 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(new ReferenceError(\\"A\\"),{stack:\\"\\"}))"`; exports[`Error > serialize > supports Error.prototype.cause 1`] = `"Object.assign(new Error(\\"B\\"),{stack:\\"\\",cause:Object.assign(new Error(\\"A\\"),{stack:\\"\\"})})"`; @@ -76,19 +76,19 @@ exports[`Error > toCrossJSONAsync > supports Error.prototype.name 1`] = `"{\\"t\ exports[`Error > toCrossJSONAsync > supports other Error classes 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":13,\\"i\\":1,\\"s\\":3,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}}"`; -exports[`Error > toCrossJSONStream > supports Error.prototype.cause 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Error > toCrossJSONStream > supports Error.prototype.cause 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Error > toCrossJSONStream > supports Error.prototype.cause 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":13,\\"i\\":1,\\"s\\":0,\\"m\\":\\"B\\",\\"p\\":{\\"k\\":[\\"stack\\",\\"cause\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"},{\\"t\\":28,\\"i\\":2}],\\"s\\":2}}}"`; +exports[`Error > toCrossJSONStream > supports Error.prototype.cause 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":13,\\"i\\":2,\\"s\\":0,\\"m\\":\\"B\\",\\"p\\":{\\"k\\":[\\"stack\\",\\"cause\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"},{\\"t\\":28,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":1}}],\\"s\\":2}}]}"`; -exports[`Error > toCrossJSONStream > supports Error.prototype.cause 3`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":13,\\"i\\":3,\\"s\\":0,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}}"`; +exports[`Error > toCrossJSONStream > supports Error.prototype.cause 3`] = `"{\\"t\\":29,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":4},{\\"t\\":13,\\"i\\":5,\\"s\\":0,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}]}"`; -exports[`Error > toCrossJSONStream > supports Error.prototype.name 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Error > toCrossJSONStream > supports Error.prototype.name 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Error > toCrossJSONStream > supports Error.prototype.name 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":13,\\"i\\":1,\\"s\\":0,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"name\\",\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"ExampleError\\"},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":2}}}"`; +exports[`Error > toCrossJSONStream > supports Error.prototype.name 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":13,\\"i\\":2,\\"s\\":0,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"name\\",\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"ExampleError\\"},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":2}}]}"`; -exports[`Error > toCrossJSONStream > supports other Error classes 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Error > toCrossJSONStream > supports other Error classes 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Error > toCrossJSONStream > supports other Error classes 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":13,\\"i\\":1,\\"s\\":3,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}}"`; +exports[`Error > toCrossJSONStream > supports other Error classes 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":13,\\"i\\":2,\\"s\\":3,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}]}"`; exports[`Error > toJSON > supports Error.prototype.cause 1`] = `"{\\"t\\":{\\"t\\":13,\\"i\\":0,\\"s\\":0,\\"m\\":\\"B\\",\\"p\\":{\\"k\\":[\\"stack\\",\\"cause\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"},{\\"t\\":13,\\"i\\":1,\\"s\\":0,\\"m\\":\\"A\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}],\\"s\\":2}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/frozen-object.test.ts.snap b/packages/seroval/test/__snapshots__/frozen-object.test.ts.snap index ddc246fc..9839f54f 100644 --- a/packages/seroval/test/__snapshots__/frozen-object.test.ts.snap +++ b/packages/seroval/test/__snapshots__/frozen-object.test.ts.snap @@ -14,7 +14,7 @@ exports[`frozen object > crossSerialize > supports self-recursion 1`] = `"($R[0] exports[`frozen object > crossSerializeAsync > scoped > supports Objects 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={hello:\\"world\\"}),Object.freeze($R[1]),$R[0])($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.freeze($R[0]),$R[0])($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.freeze($R[0]),$R[0])($R[\\"example\\"])"`; exports[`frozen object > crossSerializeAsync > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[1]),$R[0])($R[\\"example\\"])"`; @@ -22,75 +22,75 @@ exports[`frozen object > crossSerializeAsync > scoped > supports self-recursion exports[`frozen object > crossSerializeAsync > supports Objects 1`] = `"($R[0]=Promise.resolve($R[1]={hello:\\"world\\"}),Object.freeze($R[1]),$R[0])"`; -exports[`frozen object > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.freeze($R[0]),$R[0])"`; +exports[`frozen object > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.freeze($R[0]),$R[0])"`; exports[`frozen object > crossSerializeAsync > supports Symbol.iterator 1`] = `"($R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[1]),$R[0])"`; exports[`frozen object > crossSerializeAsync > supports self-recursion 1`] = `"($R[0]={a:$R[1]=Promise.resolve().then(()=>$R[0]),b:$R[2]=Promise.resolve().then(()=>$R[0])},Object.freeze($R[0]),$R[0])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Objects 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Objects 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Objects 2`] = `"($R=>_$.Ps($R[0],$R[1]={hello:\\"world\\"}),Object.freeze($R[1]),$R[0])($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Objects 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:\\"world\\"}),Object.freeze($R[2]),$R[0])($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())},Object.freeze($R[0]),$R[0])($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())},Object.freeze($R[0]),$R[0])($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>_$.Se($R[3],$R[4]=[0,1]))($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1]))($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>_$.Se($R[3],$R[5]=[0,2]))($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>$R[6]($R[3],$R[7]=[0,2]))($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>_$.Se($R[3],$R[6]=[0,3]))($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>$R[6]($R[3],$R[8]=[0,3]))($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>_$.Se($R[3],$R[7]=[2,void 0]))($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>$R[6]($R[3],$R[9]=[2,void 0]))($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>_$.Sc($R[3]))($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>($R[10]=s=>{s.c.close();delete s.c})($R[3]))($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>_$.Ps($R[0],$R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[1]),$R[0])($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[2]),$R[0])($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]={a:$R[1]=_$.P(),b:$R[2]=_$.P()},Object.freeze($R[0]),$R[0])($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]={a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()},Object.freeze($R[0]),$R[0])($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>_$.Ps($R[1],$R[0]))($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0]))($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>_$.Ps($R[2],$R[0]))($R[\\"example\\"])"`; +exports[`frozen object > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>$R[4]($R[3],$R[0]))($R[\\"example\\"])"`; -exports[`frozen object > crossSerializeStream > supports Objects 1`] = `"$R[0]=_$.P()"`; +exports[`frozen object > crossSerializeStream > supports Objects 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`frozen object > crossSerializeStream > supports Objects 2`] = `"(_$.Ps($R[0],$R[1]={hello:\\"world\\"}),Object.freeze($R[1]),$R[0])"`; +exports[`frozen object > crossSerializeStream > supports Objects 2`] = `"(($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:\\"world\\"}),Object.freeze($R[2]),$R[0])"`; -exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())},Object.freeze($R[0]),$R[0])"`; +exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())},Object.freeze($R[0]),$R[0])"`; -exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"_$.Se($R[3],$R[4]=[0,1])"`; +exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1])"`; -exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"_$.Se($R[3],$R[5]=[0,2])"`; +exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"$R[6]($R[3],$R[7]=[0,2])"`; -exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"_$.Se($R[3],$R[6]=[0,3])"`; +exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"$R[6]($R[3],$R[8]=[0,3])"`; -exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"_$.Se($R[3],$R[7]=[2,void 0])"`; +exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"$R[6]($R[3],$R[9]=[2,void 0])"`; -exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"_$.Sc($R[3])"`; +exports[`frozen object > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"($R[10]=s=>{s.c.close();delete s.c})($R[3])"`; -exports[`frozen object > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=_$.P()"`; +exports[`frozen object > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`frozen object > crossSerializeStream > supports Symbol.iterator 2`] = `"(_$.Ps($R[0],$R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[1]),$R[0])"`; +exports[`frozen object > crossSerializeStream > supports Symbol.iterator 2`] = `"(($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})}),Object.freeze($R[2]),$R[0])"`; -exports[`frozen object > crossSerializeStream > supports self-recursion 1`] = `"($R[0]={a:$R[1]=_$.P(),b:$R[2]=_$.P()},Object.freeze($R[0]),$R[0])"`; +exports[`frozen object > crossSerializeStream > supports self-recursion 1`] = `"($R[0]={a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()},Object.freeze($R[0]),$R[0])"`; -exports[`frozen object > crossSerializeStream > supports self-recursion 2`] = `"_$.Ps($R[1],$R[0])"`; +exports[`frozen object > crossSerializeStream > supports self-recursion 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0])"`; -exports[`frozen object > crossSerializeStream > supports self-recursion 3`] = `"_$.Ps($R[2],$R[0])"`; +exports[`frozen object > crossSerializeStream > supports self-recursion 3`] = `"$R[4]($R[3],$R[0])"`; exports[`frozen object > serialize > supports Objects 1`] = `"(h=>(h={hello:\\"world\\"},Object.freeze(h),h))()"`; -exports[`frozen object > serialize > supports Symbol.iterator 1`] = `"((h,j)=>(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})},Object.freeze(h),h))()"`; +exports[`frozen object > serialize > supports Symbol.iterator 1`] = `"((h,j,k)=>(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})},Object.freeze(h),h))()"`; exports[`frozen object > serialize > supports self-recursion 1`] = `"(h=>(h={},h.b=h.a=h,Object.freeze(h),h))()"`; exports[`frozen object > serializeAsync > supports Objects 1`] = `"((h,j)=>(j=Promise.resolve(h={hello:\\"world\\"}),Object.freeze(h),j))()"`; -exports[`frozen object > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j)=>(h={[j=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[j]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})},Object.freeze(h),h))()"`; +exports[`frozen object > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j,k)=>(h={[j=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[j]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})},Object.freeze(h),h))()"`; -exports[`frozen object > serializeAsync > supports Symbol.iterator 1`] = `"((h,j,k)=>(k=Promise.resolve(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}),Object.freeze(h),k))()"`; +exports[`frozen object > serializeAsync > supports Symbol.iterator 1`] = `"((h,j,k,m)=>(m=Promise.resolve(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}),Object.freeze(h),m))()"`; exports[`frozen object > serializeAsync > supports self-recursion 1`] = `"(h=>(h={a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)},Object.freeze(h),h))()"`; @@ -102,37 +102,37 @@ exports[`frozen object > toCrossJSON > supports self-recursion 1`] = `"{\\"t\\": exports[`frozen object > toCrossJSONAsync > supports Objects 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":3}}"`; -exports[`frozen object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3}"`; +exports[`frozen object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3}"`; exports[`frozen object > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3}}"`; exports[`frozen object > toCrossJSONAsync > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}},{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":2},\\"o\\":3}"`; -exports[`frozen object > toCrossJSONStream > supports Objects 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`frozen object > toCrossJSONStream > supports Objects 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`frozen object > toCrossJSONStream > supports Objects 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":3}}"`; +exports[`frozen object > toCrossJSONStream > supports Objects 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":3}]}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3}]}],\\"s\\":1},\\"o\\":3}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":4,\\"s\\":5}}]}],\\"s\\":1},\\"o\\":3}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":4,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":6},{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}]}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":6,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":8,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}]}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":9,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":10,\\"s\\":8}}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`frozen object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3}}"`; +exports[`frozen object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":7,\\"s\\":3},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":3,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":3}},{\\"t\\":10,\\"i\\":5,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":6,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3}]}"`; -exports[`frozen object > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1},{\\"t\\":28,\\"i\\":2}],\\"s\\":2},\\"o\\":3}"`; +exports[`frozen object > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":2}},{\\"t\\":28,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}}],\\"s\\":2},\\"o\\":3}"`; -exports[`frozen object > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`frozen object > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":4,\\"i\\":0}]}"`; -exports[`frozen object > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`frozen object > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":4},{\\"t\\":4,\\"i\\":0}]}"`; exports[`frozen object > toJSON > supports Objects 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":3},\\"f\\":16383,\\"m\\":[]}"`; @@ -142,7 +142,7 @@ exports[`frozen object > toJSON > supports self-recursion 1`] = `"{\\"t\\":{\\"t exports[`frozen object > toJSONAsync > supports Objects 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":3}},\\"f\\":16383,\\"m\\":[]}"`; -exports[`frozen object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3},\\"f\\":16383,\\"m\\":[1]}"`; +exports[`frozen object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3},\\"f\\":16383,\\"m\\":[1]}"`; exports[`frozen object > toJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":3}},\\"f\\":16383,\\"m\\":[2]}"`; diff --git a/packages/seroval/test/__snapshots__/iterable.test.ts.snap b/packages/seroval/test/__snapshots__/iterable.test.ts.snap index 31a3cdb0..8111fb14 100644 --- a/packages/seroval/test/__snapshots__/iterable.test.ts.snap +++ b/packages/seroval/test/__snapshots__/iterable.test.ts.snap @@ -1,10 +1,10 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Iterable > compat > should use function expression instead of arrow functions. 1`] = `"(function(h){return ({title:\\"Hello World\\",[h=Symbol.iterator]:(function(s){return function(i,c,d,t){return (i=0,t={[h]:function(){return t},next:function(){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; +exports[`Iterable > compat > should use function expression instead of arrow functions. 1`] = `"(function(h,j){return ({title:\\"Hello World\\",[h=Symbol.iterator]:(function(s){return function(i,c,d,t){return (i=0,t={[h]:function(){return t},next:function(){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; exports[`Iterable > compat#toJSON > should use function expression instead of arrow functions. 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":3}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0},\\"f\\":16379,\\"m\\":[1]}"`; -exports[`Iterable > compat#toJSON > should use function expression instead of arrow functions. 2`] = `"(function(h){return ({title:\\"Hello World\\",[h=Symbol.iterator]:(function(s){return function(i,c,d,t){return (i=0,t={[h]:function(){return t},next:function(){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; +exports[`Iterable > compat#toJSON > should use function expression instead of arrow functions. 2`] = `"(function(h,j){return ({title:\\"Hello World\\",[h=Symbol.iterator]:(function(s){return function(i,c,d,t){return (i=0,t={[h]:function(){return t},next:function(){if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}})}})({v:[1,2,3,void 0],t:-1,d:3})})})()"`; exports[`Iterable > crossSerialize > scoped > supports Iterables 1`] = `"($R=>$R[0]={title:\\"Hello World\\",[$R[1]=Symbol.iterator]:($R[2]=s=>(i,c,d,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})})($R[\\"example\\"])"`; @@ -14,25 +14,25 @@ exports[`Iterable > crossSerializeAsync > scoped > supports Iterables 1`] = `"($ exports[`Iterable > crossSerializeAsync > supports Iterables 1`] = `"$R[0]=Promise.resolve($R[1]={title:\\"Hello World\\",[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})})"`; -exports[`Iterable > crossSerializeStream > scoped > supports Iterables 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Iterable > crossSerializeStream > scoped > supports Iterables 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Iterable > crossSerializeStream > scoped > supports Iterables 2`] = `"($R=>_$.Ps($R[0],$R[1]={title:\\"Hello World\\",[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}))($R[\\"example\\"])"`; +exports[`Iterable > crossSerializeStream > scoped > supports Iterables 2`] = `"($R=>($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={title:\\"Hello World\\",[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})}))($R[\\"example\\"])"`; -exports[`Iterable > crossSerializeStream > supports Iterables 1`] = `"$R[0]=_$.P()"`; +exports[`Iterable > crossSerializeStream > supports Iterables 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Iterable > crossSerializeStream > supports Iterables 2`] = `"_$.Ps($R[0],$R[1]={title:\\"Hello World\\",[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})})"`; +exports[`Iterable > crossSerializeStream > supports Iterables 2`] = `"($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={title:\\"Hello World\\",[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})})"`; -exports[`Iterable > serialize > supports Iterables 1`] = `"(h=>({title:\\"Hello World\\",[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; +exports[`Iterable > serialize > supports Iterables 1`] = `"((h,j)=>({title:\\"Hello World\\",[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; -exports[`Iterable > serializeAsync > supports Iterables 1`] = `"(h=>(Promise.resolve({title:\\"Hello World\\",[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; +exports[`Iterable > serializeAsync > supports Iterables 1`] = `"((h,j)=>(Promise.resolve({title:\\"Hello World\\",[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; exports[`Iterable > toCrossJSON > supports Iterables 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":3}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0}"`; exports[`Iterable > toCrossJSONAsync > supports Iterables 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0}}"`; -exports[`Iterable > toCrossJSONStream > supports Iterables 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Iterable > toCrossJSONStream > supports Iterables 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Iterable > toCrossJSONStream > supports Iterables 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0}}"`; +exports[`Iterable > toCrossJSONStream > supports Iterables 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":7,\\"s\\":3},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":3,\\"s\\":3}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":3}},{\\"t\\":10,\\"i\\":5,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":6,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0}]}"`; exports[`Iterable > toJSON > supports Iterables 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"title\\",{\\"t\\":17,\\"i\\":1,\\"s\\":3}],\\"v\\":[{\\"t\\":1,\\"s\\":\\"Hello World\\"},{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":2},\\"o\\":0},\\"f\\":16383,\\"m\\":[1]}"`; diff --git a/packages/seroval/test/__snapshots__/map.test.ts.snap b/packages/seroval/test/__snapshots__/map.test.ts.snap index a86eab8a..5fe8ce6a 100644 --- a/packages/seroval/test/__snapshots__/map.test.ts.snap +++ b/packages/seroval/test/__snapshots__/map.test.ts.snap @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Map > compat > should fallback to Symbol.iterator 1`] = `"(h=>(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[[1,2],[3,4],void 0],t:-1,d:2}),[Symbol.toStringTag]:\\"Map\\"})))()"`; +exports[`Map > compat > should fallback to Symbol.iterator 1`] = `"((h,j)=>(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[[1,2],[3,4],void 0],t:-1,d:2}),[Symbol.toStringTag]:\\"Map\\"})))()"`; exports[`Map > compat > should throw an error for unsupported target 1`] = `"Unsupported type \\"[object Map]\\""`; @@ -24,35 +24,35 @@ exports[`Map > crossSerializeAsync > supports Map 1`] = `"$R[0]=Promise.resolve( exports[`Map > crossSerializeAsync > supports self-recursion 1`] = `"$R[0]=($R[3]=[],new Map([[$R[1]=Promise.resolve().then(()=>$R[0]),$R[2]=Promise.resolve().then(()=>$R[0])]]))"`; -exports[`Map > crossSerializeStream > scoped > supports Map 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Map > crossSerializeStream > scoped > supports Map 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Map > crossSerializeStream > scoped > supports Map 2`] = `"($R=>_$.Ps($R[0],$R[1]=($R[2]=[],new Map([[1,2],[3,4]]))))($R[\\"example\\"])"`; +exports[`Map > crossSerializeStream > scoped > supports Map 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=($R[3]=[],new Map([[1,2],[3,4]]))))($R[\\"example\\"])"`; -exports[`Map > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]=($R[3]=[],new Map([[$R[1]=_$.P(),$R[2]=_$.P()]])))($R[\\"example\\"])"`; +exports[`Map > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]=($R[4]=[],new Map([[$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),$R[3]=$R[2]()]])))($R[\\"example\\"])"`; -exports[`Map > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>_$.Ps($R[1],$R[0]))($R[\\"example\\"])"`; +exports[`Map > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>($R[5]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0]))($R[\\"example\\"])"`; -exports[`Map > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>_$.Ps($R[2],$R[0]))($R[\\"example\\"])"`; +exports[`Map > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>$R[5]($R[3],$R[0]))($R[\\"example\\"])"`; -exports[`Map > crossSerializeStream > supports Map 1`] = `"$R[0]=_$.P()"`; +exports[`Map > crossSerializeStream > supports Map 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Map > crossSerializeStream > supports Map 2`] = `"_$.Ps($R[0],$R[1]=($R[2]=[],new Map([[1,2],[3,4]])))"`; +exports[`Map > crossSerializeStream > supports Map 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=($R[3]=[],new Map([[1,2],[3,4]])))"`; -exports[`Map > crossSerializeStream > supports Map 3`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Map > crossSerializeStream > supports Map 3`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Map > crossSerializeStream > supports Map 4`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":8,\\"i\\":1,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":2}}}"`; +exports[`Map > crossSerializeStream > supports Map 4`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":8,\\"i\\":2,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":0}}]}"`; -exports[`Map > crossSerializeStream > supports self-recursion 1`] = `"$R[0]=($R[3]=[],new Map([[$R[1]=_$.P(),$R[2]=_$.P()]]))"`; +exports[`Map > crossSerializeStream > supports self-recursion 1`] = `"$R[0]=($R[4]=[],new Map([[$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),$R[3]=$R[2]()]]))"`; -exports[`Map > crossSerializeStream > supports self-recursion 2`] = `"_$.Ps($R[1],$R[0])"`; +exports[`Map > crossSerializeStream > supports self-recursion 2`] = `"($R[5]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0])"`; -exports[`Map > crossSerializeStream > supports self-recursion 3`] = `"_$.Ps($R[2],$R[0])"`; +exports[`Map > crossSerializeStream > supports self-recursion 3`] = `"$R[5]($R[3],$R[0])"`; -exports[`Map > crossSerializeStream > supports self-recursion 4`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":28,\\"i\\":1}],\\"v\\":[{\\"t\\":28,\\"i\\":2}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":3}}"`; +exports[`Map > crossSerializeStream > supports self-recursion 4`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":28,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":2}}],\\"v\\":[{\\"t\\":28,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":4,\\"s\\":0}}"`; -exports[`Map > crossSerializeStream > supports self-recursion 5`] = `"{\\"t\\":29,\\"i\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`Map > crossSerializeStream > supports self-recursion 5`] = `"{\\"t\\":29,\\"i\\":1,\\"a\\":[{\\"t\\":41,\\"i\\":5,\\"s\\":3},{\\"t\\":4,\\"i\\":0}]}"`; -exports[`Map > crossSerializeStream > supports self-recursion 6`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`Map > crossSerializeStream > supports self-recursion 6`] = `"{\\"t\\":29,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":5},{\\"t\\":4,\\"i\\":0}]}"`; exports[`Map > serialize > supports Map 1`] = `"(h=>((h=[],new Map([[1,2],[3,4]]))))()"`; @@ -62,18 +62,18 @@ exports[`Map > serializeAsync > supports Map 1`] = `"(h=>(Promise.resolve((h=[], exports[`Map > serializeAsync > supports self-recursion 1`] = `"((h,j)=>(j=(h=[],new Map([[Promise.resolve().then(()=>j),Promise.resolve().then(()=>j)]]))))()"`; -exports[`Map > toCrossJSON > supports Map 1`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":1}}"`; +exports[`Map > toCrossJSON > supports Map 1`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":0}}"`; -exports[`Map > toCrossJSON > supports self-recursion 1`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":4,\\"i\\":0}],\\"v\\":[{\\"t\\":4,\\"i\\":0}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":1}}"`; +exports[`Map > toCrossJSON > supports self-recursion 1`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":4,\\"i\\":0}],\\"v\\":[{\\"t\\":4,\\"i\\":0}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":0}}"`; -exports[`Map > toCrossJSONAsync > supports Map 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":8,\\"i\\":1,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":2}}}"`; +exports[`Map > toCrossJSONAsync > supports Map 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":8,\\"i\\":1,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":0}}}"`; -exports[`Map > toCrossJSONAsync > supports self-recursion 1`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"v\\":[{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":3}}"`; +exports[`Map > toCrossJSONAsync > supports self-recursion 1`] = `"{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"v\\":[{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":0}}"`; -exports[`Map > toJSON > supports Map 1`] = `"{\\"t\\":{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":1}},\\"f\\":16383,\\"m\\":[]}"`; +exports[`Map > toJSON > supports Map 1`] = `"{\\"t\\":{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":0}},\\"f\\":16383,\\"m\\":[]}"`; -exports[`Map > toJSON > supports self-recursion 1`] = `"{\\"t\\":{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":4,\\"i\\":0}],\\"v\\":[{\\"t\\":4,\\"i\\":0}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":1}},\\"f\\":16383,\\"m\\":[0]}"`; +exports[`Map > toJSON > supports self-recursion 1`] = `"{\\"t\\":{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":4,\\"i\\":0}],\\"v\\":[{\\"t\\":4,\\"i\\":0}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":0}},\\"f\\":16383,\\"m\\":[0]}"`; -exports[`Map > toJSONAsync > supports Map 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":8,\\"i\\":1,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":2}}},\\"f\\":16383,\\"m\\":[]}"`; +exports[`Map > toJSONAsync > supports Map 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":8,\\"i\\":1,\\"e\\":{\\"k\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":3}],\\"v\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":4}],\\"s\\":2},\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":0}}},\\"f\\":16383,\\"m\\":[]}"`; -exports[`Map > toJSONAsync > supports self-recursion 1`] = `"{\\"t\\":{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"v\\":[{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":3}},\\"f\\":16383,\\"m\\":[0]}"`; +exports[`Map > toJSONAsync > supports self-recursion 1`] = `"{\\"t\\":{\\"t\\":8,\\"i\\":0,\\"e\\":{\\"k\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"v\\":[{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":1},\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":0}},\\"f\\":16383,\\"m\\":[0]}"`; diff --git a/packages/seroval/test/__snapshots__/mutual-cycle.test.ts.snap b/packages/seroval/test/__snapshots__/mutual-cycle.test.ts.snap index f646e150..319bfd44 100644 --- a/packages/seroval/test/__snapshots__/mutual-cycle.test.ts.snap +++ b/packages/seroval/test/__snapshots__/mutual-cycle.test.ts.snap @@ -24,41 +24,41 @@ exports[`mutual cyclic references > crossSerializeAsync > supports Arrays and Ob exports[`mutual cyclic references > crossSerializeAsync > supports Objects and Objects 1`] = `"$R[0]=[$R[1]={0:$R[2]=Promise.resolve($R[3]={0:$R[4]=Promise.resolve().then(()=>$R[1])})},$R[3]]"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Arrays 1`] = `"($R=>$R[0]=[$R[1]=[$R[2]=_$.P()],$R[3]=[$R[4]=_$.P()]])($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Arrays 1`] = `"($R=>$R[0]=[$R[1]=[$R[2]=($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()],$R[4]=[$R[5]=$R[3]()]])($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Arrays 2`] = `"($R=>_$.Ps($R[2],$R[3]))($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Arrays 2`] = `"($R=>($R[6]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[2],$R[4]))($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Arrays 3`] = `"($R=>_$.Ps($R[4],$R[1]))($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Arrays 3`] = `"($R=>$R[6]($R[5],$R[1]))($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Objects 1`] = `"($R=>$R[0]=[$R[1]=[$R[2]=_$.P()],$R[3]={0:$R[4]=_$.P()}])($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Objects 1`] = `"($R=>$R[0]=[$R[1]=[$R[2]=($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()],$R[4]={0:$R[5]=$R[3]()}])($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Objects 2`] = `"($R=>_$.Ps($R[2],$R[3]))($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Objects 2`] = `"($R=>($R[6]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[2],$R[4]))($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Objects 3`] = `"($R=>_$.Ps($R[4],$R[1]))($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Arrays and Objects 3`] = `"($R=>$R[6]($R[5],$R[1]))($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Objects and Objects 1`] = `"($R=>$R[0]=[$R[1]={0:$R[2]=_$.P()},$R[3]={0:$R[4]=_$.P()}])($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Objects and Objects 1`] = `"($R=>$R[0]=[$R[1]={0:$R[2]=($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()},$R[4]={0:$R[5]=$R[3]()}])($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Objects and Objects 2`] = `"($R=>_$.Ps($R[2],$R[3]))($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Objects and Objects 2`] = `"($R=>($R[6]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[2],$R[4]))($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > scoped > supports Objects and Objects 3`] = `"($R=>_$.Ps($R[4],$R[1]))($R[\\"example\\"])"`; +exports[`mutual cyclic references > crossSerializeStream > scoped > supports Objects and Objects 3`] = `"($R=>$R[6]($R[5],$R[1]))($R[\\"example\\"])"`; -exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Arrays 1`] = `"$R[0]=[$R[1]=[$R[2]=_$.P()],$R[3]=[$R[4]=_$.P()]]"`; +exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Arrays 1`] = `"$R[0]=[$R[1]=[$R[2]=($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()],$R[4]=[$R[5]=$R[3]()]]"`; -exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Arrays 2`] = `"_$.Ps($R[2],$R[3])"`; +exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Arrays 2`] = `"($R[6]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[2],$R[4])"`; -exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Arrays 3`] = `"_$.Ps($R[4],$R[1])"`; +exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Arrays 3`] = `"$R[6]($R[5],$R[1])"`; -exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Objects 1`] = `"$R[0]=[$R[1]=[$R[2]=_$.P()],$R[3]={0:$R[4]=_$.P()}]"`; +exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Objects 1`] = `"$R[0]=[$R[1]=[$R[2]=($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()],$R[4]={0:$R[5]=$R[3]()}]"`; -exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Objects 2`] = `"_$.Ps($R[2],$R[3])"`; +exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Objects 2`] = `"($R[6]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[2],$R[4])"`; -exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Objects 3`] = `"_$.Ps($R[4],$R[1])"`; +exports[`mutual cyclic references > crossSerializeStream > supports Arrays and Objects 3`] = `"$R[6]($R[5],$R[1])"`; -exports[`mutual cyclic references > crossSerializeStream > supports Objects and Objects 1`] = `"$R[0]=[$R[1]={0:$R[2]=_$.P()},$R[3]={0:$R[4]=_$.P()}]"`; +exports[`mutual cyclic references > crossSerializeStream > supports Objects and Objects 1`] = `"$R[0]=[$R[1]={0:$R[2]=($R[3]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()},$R[4]={0:$R[5]=$R[3]()}]"`; -exports[`mutual cyclic references > crossSerializeStream > supports Objects and Objects 2`] = `"_$.Ps($R[2],$R[3])"`; +exports[`mutual cyclic references > crossSerializeStream > supports Objects and Objects 2`] = `"($R[6]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[2],$R[4])"`; -exports[`mutual cyclic references > crossSerializeStream > supports Objects and Objects 3`] = `"_$.Ps($R[4],$R[1])"`; +exports[`mutual cyclic references > crossSerializeStream > supports Objects and Objects 3`] = `"$R[6]($R[5],$R[1])"`; exports[`mutual cyclic references > serialize > supports Arrays and Arrays 1`] = `"((h,j,k)=>(k=[h=[j=[,]],j],j[0]=h,k))()"`; @@ -84,23 +84,23 @@ exports[`mutual cyclic references > toCrossJSONAsync > supports Arrays and Objec exports[`mutual cyclic references > toCrossJSONAsync > supports Objects and Objects 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":12,\\"i\\":4,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":1}}],\\"s\\":1},\\"o\\":0}}],\\"s\\":1},\\"o\\":0},{\\"t\\":4,\\"i\\":3}],\\"o\\":0}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":9,\\"i\\":1,\\"l\\":1,\\"a\\":[{\\"t\\":28,\\"i\\":2}],\\"o\\":0},{\\"t\\":9,\\"i\\":3,\\"l\\":1,\\"a\\":[{\\"t\\":28,\\"i\\":4}],\\"o\\":0}],\\"o\\":0}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":9,\\"i\\":1,\\"l\\":1,\\"a\\":[{\\"t\\":28,\\"i\\":2,\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":2}}],\\"o\\":0},{\\"t\\":9,\\"i\\":4,\\"l\\":1,\\"a\\":[{\\"t\\":28,\\"i\\":5,\\"f\\":{\\"t\\":4,\\"i\\":3}}],\\"o\\":0}],\\"o\\":0}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 2`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":3}}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 2`] = `"{\\"t\\":29,\\"i\\":2,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":3},{\\"t\\":4,\\"i\\":4}]}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 3`] = `"{\\"t\\":29,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":1}}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Arrays 3`] = `"{\\"t\\":29,\\"i\\":5,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":4,\\"i\\":1}]}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":9,\\"i\\":1,\\"l\\":1,\\"a\\":[{\\"t\\":28,\\"i\\":2}],\\"o\\":0},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":28,\\"i\\":4}],\\"s\\":1},\\"o\\":0}],\\"o\\":0}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":9,\\"i\\":1,\\"l\\":1,\\"a\\":[{\\"t\\":28,\\"i\\":2,\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":2}}],\\"o\\":0},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":28,\\"i\\":5,\\"f\\":{\\"t\\":4,\\"i\\":3}}],\\"s\\":1},\\"o\\":0}],\\"o\\":0}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 2`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":3}}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 2`] = `"{\\"t\\":29,\\"i\\":2,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":3},{\\"t\\":4,\\"i\\":4}]}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 3`] = `"{\\"t\\":29,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":1}}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Arrays and Objects 3`] = `"{\\"t\\":29,\\"i\\":5,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":4,\\"i\\":1}]}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":28,\\"i\\":2}],\\"s\\":1},\\"o\\":0},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":28,\\"i\\":4}],\\"s\\":1},\\"o\\":0}],\\"o\\":0}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 1`] = `"{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":28,\\"i\\":2,\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":2}}],\\"s\\":1},\\"o\\":0},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"0\\"],\\"v\\":[{\\"t\\":28,\\"i\\":5,\\"f\\":{\\"t\\":4,\\"i\\":3}}],\\"s\\":1},\\"o\\":0}],\\"o\\":0}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 2`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":3}}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 2`] = `"{\\"t\\":29,\\"i\\":2,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":3},{\\"t\\":4,\\"i\\":4}]}"`; -exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 3`] = `"{\\"t\\":29,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":1}}"`; +exports[`mutual cyclic references > toCrossJSONStream > supports Objects and Objects 3`] = `"{\\"t\\":29,\\"i\\":5,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":4,\\"i\\":1}]}"`; exports[`mutual cyclic references > toJSON > supports Arrays and Arrays 1`] = `"{\\"t\\":{\\"t\\":9,\\"i\\":0,\\"l\\":2,\\"a\\":[{\\"t\\":9,\\"i\\":1,\\"l\\":1,\\"a\\":[{\\"t\\":9,\\"i\\":2,\\"l\\":1,\\"a\\":[{\\"t\\":4,\\"i\\":1}],\\"o\\":0}],\\"o\\":0},{\\"t\\":4,\\"i\\":2}],\\"o\\":0},\\"f\\":16383,\\"m\\":[1,2]}"`; diff --git a/packages/seroval/test/__snapshots__/null-constructor.test.ts.snap b/packages/seroval/test/__snapshots__/null-constructor.test.ts.snap index f99bd98d..5f31e9dc 100644 --- a/packages/seroval/test/__snapshots__/null-constructor.test.ts.snap +++ b/packages/seroval/test/__snapshots__/null-constructor.test.ts.snap @@ -20,7 +20,7 @@ exports[`null-constructor > crossSerialize > supports self-recursion 1`] = `"($R exports[`null-constructor > crossSerializeAsync > scoped > supports Object.create(null) 1`] = `"($R=>$R[0]=Promise.resolve($R[1]=Object.assign(Object.create(null),{hello:\\"world\\"})))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})}))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})}))($R[\\"example\\"])"`; exports[`null-constructor > crossSerializeAsync > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=Promise.resolve($R[1]=Object.assign(Object.create(null),{[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})})))($R[\\"example\\"])"`; @@ -28,75 +28,75 @@ exports[`null-constructor > crossSerializeAsync > scoped > supports self-recursi exports[`null-constructor > crossSerializeAsync > supports Object.create(null) 1`] = `"$R[0]=Promise.resolve($R[1]=Object.assign(Object.create(null),{hello:\\"world\\"}))"`; -exports[`null-constructor > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})})"`; +exports[`null-constructor > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})})"`; exports[`null-constructor > crossSerializeAsync > supports Symbol.iterator 1`] = `"$R[0]=Promise.resolve($R[1]=Object.assign(Object.create(null),{[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}))"`; exports[`null-constructor > crossSerializeAsync > supports self-recursion 1`] = `"$R[0]=Object.assign(Object.create(null),{a:$R[1]=Promise.resolve().then(()=>$R[0]),b:$R[2]=Promise.resolve().then(()=>$R[0])})"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Object.create(null) 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Object.create(null) 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Object.create(null) 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object.assign(Object.create(null),{hello:\\"world\\"})))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Object.create(null) 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(Object.create(null),{hello:\\"world\\"})))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())}))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())}))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>_$.Se($R[3],$R[4]=[0,1]))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1]))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>_$.Se($R[3],$R[5]=[0,2]))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>$R[6]($R[3],$R[7]=[0,2]))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>_$.Se($R[3],$R[6]=[0,3]))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>$R[6]($R[3],$R[8]=[0,3]))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>_$.Se($R[3],$R[7]=[2,void 0]))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>$R[6]($R[3],$R[9]=[2,void 0]))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>_$.Sc($R[3]))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>($R[10]=s=>{s.c.close();delete s.c})($R[3]))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>_$.Ps($R[0],$R[1]=Object.assign(Object.create(null),{[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})})))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(Object.create(null),{[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})})))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]=Object.assign(Object.create(null),{a:$R[1]=_$.P(),b:$R[2]=_$.P()}))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]=Object.assign(Object.create(null),{a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()}))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>_$.Ps($R[1],$R[0]))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0]))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>_$.Ps($R[2],$R[0]))($R[\\"example\\"])"`; +exports[`null-constructor > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>$R[4]($R[3],$R[0]))($R[\\"example\\"])"`; -exports[`null-constructor > crossSerializeStream > supports Object.create(null) 1`] = `"$R[0]=_$.P()"`; +exports[`null-constructor > crossSerializeStream > supports Object.create(null) 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`null-constructor > crossSerializeStream > supports Object.create(null) 2`] = `"_$.Ps($R[0],$R[1]=Object.assign(Object.create(null),{hello:\\"world\\"}))"`; +exports[`null-constructor > crossSerializeStream > supports Object.create(null) 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(Object.create(null),{hello:\\"world\\"}))"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())})"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"$R[0]=Object.assign(Object.create(null),{[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())})"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"_$.Se($R[3],$R[4]=[0,1])"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1])"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"_$.Se($R[3],$R[5]=[0,2])"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"$R[6]($R[3],$R[7]=[0,2])"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"_$.Se($R[3],$R[6]=[0,3])"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"$R[6]($R[3],$R[8]=[0,3])"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"_$.Se($R[3],$R[7]=[2,void 0])"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"$R[6]($R[3],$R[9]=[2,void 0])"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"_$.Sc($R[3])"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"($R[10]=s=>{s.c.close();delete s.c})($R[3])"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=_$.P()"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`null-constructor > crossSerializeStream > supports Symbol.iterator 2`] = `"_$.Ps($R[0],$R[1]=Object.assign(Object.create(null),{[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}))"`; +exports[`null-constructor > crossSerializeStream > supports Symbol.iterator 2`] = `"($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Object.assign(Object.create(null),{[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})}))"`; -exports[`null-constructor > crossSerializeStream > supports self-recursion 1`] = `"$R[0]=Object.assign(Object.create(null),{a:$R[1]=_$.P(),b:$R[2]=_$.P()})"`; +exports[`null-constructor > crossSerializeStream > supports self-recursion 1`] = `"$R[0]=Object.assign(Object.create(null),{a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()})"`; -exports[`null-constructor > crossSerializeStream > supports self-recursion 2`] = `"_$.Ps($R[1],$R[0])"`; +exports[`null-constructor > crossSerializeStream > supports self-recursion 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0])"`; -exports[`null-constructor > crossSerializeStream > supports self-recursion 3`] = `"_$.Ps($R[2],$R[0])"`; +exports[`null-constructor > crossSerializeStream > supports self-recursion 3`] = `"$R[4]($R[3],$R[0])"`; exports[`null-constructor > serialize > supports Object.create(null) 1`] = `"Object.assign(Object.create(null),{hello:\\"world\\"})"`; -exports[`null-constructor > serialize > supports Symbol.iterator 1`] = `"(h=>(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; +exports[`null-constructor > serialize > supports Symbol.iterator 1`] = `"((h,j)=>(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; exports[`null-constructor > serialize > supports self-recursion 1`] = `"(h=>(h=Object.create(null),h.b=h.a=h,h))()"`; exports[`null-constructor > serializeAsync > supports Object.create(null) 1`] = `"Promise.resolve(Object.assign(Object.create(null),{hello:\\"world\\"}))"`; -exports[`null-constructor > serializeAsync > supports Symbol.asyncIterator 1`] = `"(h=>(Object.assign(Object.create(null),{[h=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[h]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; +exports[`null-constructor > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j)=>(Object.assign(Object.create(null),{[h=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[h]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; -exports[`null-constructor > serializeAsync > supports Symbol.iterator 1`] = `"(h=>(Promise.resolve(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}))))()"`; +exports[`null-constructor > serializeAsync > supports Symbol.iterator 1`] = `"((h,j)=>(Promise.resolve(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}))))()"`; exports[`null-constructor > serializeAsync > supports self-recursion 1`] = `"(h=>(h=Object.assign(Object.create(null),{a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)})))()"`; @@ -108,37 +108,37 @@ exports[`null-constructor > toCrossJSON > supports self-recursion 1`] = `"{\\"t\ exports[`null-constructor > toCrossJSONAsync > supports Object.create(null) 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":11,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}}"`; -exports[`null-constructor > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}"`; +exports[`null-constructor > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}"`; exports[`null-constructor > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":11,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}}"`; exports[`null-constructor > toCrossJSONAsync > supports self-recursion 1`] = `"{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}},{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":2},\\"o\\":0}"`; -exports[`null-constructor > toCrossJSONStream > supports Object.create(null) 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`null-constructor > toCrossJSONStream > supports Object.create(null) 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`null-constructor > toCrossJSONStream > supports Object.create(null) 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":11,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports Object.create(null) 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":11,\\"i\\":2,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}]}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3}]}],\\"s\\":1},\\"o\\":0}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":4,\\"s\\":5}}]}],\\"s\\":1},\\"o\\":0}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":4,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":6},{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}]}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":6,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":8,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}]}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":9,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":10,\\"s\\":8}}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`null-constructor > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":11,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":7,\\"s\\":3},{\\"t\\":11,\\"i\\":2,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":3,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":3}},{\\"t\\":10,\\"i\\":5,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":6,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}]}"`; -exports[`null-constructor > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1},{\\"t\\":28,\\"i\\":2}],\\"s\\":2},\\"o\\":0}"`; +exports[`null-constructor > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":2}},{\\"t\\":28,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}}],\\"s\\":2},\\"o\\":0}"`; -exports[`null-constructor > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":4,\\"i\\":0}]}"`; -exports[`null-constructor > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`null-constructor > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":4},{\\"t\\":4,\\"i\\":0}]}"`; exports[`null-constructor > toJSON > supports Object.create(null) 1`] = `"{\\"t\\":{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0},\\"f\\":16383,\\"m\\":[]}"`; @@ -148,7 +148,7 @@ exports[`null-constructor > toJSON > supports self-recursion 1`] = `"{\\"t\\":{\ exports[`null-constructor > toJSONAsync > supports Object.create(null) 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":11,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}},\\"f\\":16383,\\"m\\":[]}"`; -exports[`null-constructor > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0},\\"f\\":16383,\\"m\\":[1]}"`; +exports[`null-constructor > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":11,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0},\\"f\\":16383,\\"m\\":[1]}"`; exports[`null-constructor > toJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":11,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}},\\"f\\":16383,\\"m\\":[2]}"`; diff --git a/packages/seroval/test/__snapshots__/number.test.ts.snap b/packages/seroval/test/__snapshots__/number.test.ts.snap index 2c80c176..beb96c27 100644 --- a/packages/seroval/test/__snapshots__/number.test.ts.snap +++ b/packages/seroval/test/__snapshots__/number.test.ts.snap @@ -20,25 +20,25 @@ exports[`number > crossSerializeAsync > supports numbers 4`] = `"$R[0]=Promise.r exports[`number > crossSerializeAsync > supports numbers 5`] = `"$R[0]=Promise.resolve(-0)"`; -exports[`number > crossSerializeStream > supports -0 1`] = `"$R[0]=_$.P()"`; +exports[`number > crossSerializeStream > supports -0 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`number > crossSerializeStream > supports -0 2`] = `"_$.Ps($R[0],-0)"`; +exports[`number > crossSerializeStream > supports -0 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],-0)"`; -exports[`number > crossSerializeStream > supports -Infinity 1`] = `"$R[0]=_$.P()"`; +exports[`number > crossSerializeStream > supports -Infinity 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`number > crossSerializeStream > supports -Infinity 2`] = `"_$.Ps($R[0],-1/0)"`; +exports[`number > crossSerializeStream > supports -Infinity 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],-1/0)"`; -exports[`number > crossSerializeStream > supports Infinity 1`] = `"$R[0]=_$.P()"`; +exports[`number > crossSerializeStream > supports Infinity 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`number > crossSerializeStream > supports Infinity 2`] = `"_$.Ps($R[0],1/0)"`; +exports[`number > crossSerializeStream > supports Infinity 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],1/0)"`; -exports[`number > crossSerializeStream > supports NaN 1`] = `"$R[0]=_$.P()"`; +exports[`number > crossSerializeStream > supports NaN 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`number > crossSerializeStream > supports NaN 2`] = `"_$.Ps($R[0],0/0)"`; +exports[`number > crossSerializeStream > supports NaN 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],0/0)"`; -exports[`number > crossSerializeStream > supports numbers 1`] = `"$R[0]=_$.P()"`; +exports[`number > crossSerializeStream > supports numbers 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`number > crossSerializeStream > supports numbers 2`] = `"_$.Ps($R[0],3735928559)"`; +exports[`number > crossSerializeStream > supports numbers 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],3735928559)"`; exports[`number > toCrossJSON > supports numbers 1`] = `"{\\"t\\":0,\\"s\\":3735928559}"`; @@ -60,25 +60,25 @@ exports[`number > toCrossJSONAsync > supports numbers 4`] = `"{\\"t\\":12,\\"i\\ exports[`number > toCrossJSONAsync > supports numbers 5`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":2,\\"s\\":4}}"`; -exports[`number > toCrossJSONStream > supports -0 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`number > toCrossJSONStream > supports -0 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`number > toCrossJSONStream > supports -0 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":4}}"`; +exports[`number > toCrossJSONStream > supports -0 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":4}]}"`; -exports[`number > toCrossJSONStream > supports -Infinity 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`number > toCrossJSONStream > supports -Infinity 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`number > toCrossJSONStream > supports -Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":6}}"`; +exports[`number > toCrossJSONStream > supports -Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":6}]}"`; -exports[`number > toCrossJSONStream > supports Infinity 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`number > toCrossJSONStream > supports Infinity 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`number > toCrossJSONStream > supports Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":5}}"`; +exports[`number > toCrossJSONStream > supports Infinity 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":5}]}"`; -exports[`number > toCrossJSONStream > supports NaN 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`number > toCrossJSONStream > supports NaN 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`number > toCrossJSONStream > supports NaN 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":2,\\"s\\":7}}"`; +exports[`number > toCrossJSONStream > supports NaN 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":7}]}"`; -exports[`number > toCrossJSONStream > supports numbers 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`number > toCrossJSONStream > supports numbers 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`number > toCrossJSONStream > supports numbers 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":0,\\"s\\":3735928559}}"`; +exports[`number > toCrossJSONStream > supports numbers 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":0,\\"s\\":3735928559}]}"`; exports[`number > toJSON > supports numbers 1`] = `"{\\"t\\":{\\"t\\":0,\\"s\\":3735928559},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/object.test.ts.snap b/packages/seroval/test/__snapshots__/object.test.ts.snap index 7e7c357f..5946479f 100644 --- a/packages/seroval/test/__snapshots__/object.test.ts.snap +++ b/packages/seroval/test/__snapshots__/object.test.ts.snap @@ -20,7 +20,7 @@ exports[`objects > crossSerialize > supports self-recursion 1`] = `"($R[0]={},$R exports[`objects > crossSerializeAsync > scoped > supports Objects 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={hello:\\"world\\"}))($R[\\"example\\"])"`; -exports[`objects > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})})($R[\\"example\\"])"`; +exports[`objects > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})})($R[\\"example\\"])"`; exports[`objects > crossSerializeAsync > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}))($R[\\"example\\"])"`; @@ -28,75 +28,75 @@ exports[`objects > crossSerializeAsync > scoped > supports self-recursion 1`] = exports[`objects > crossSerializeAsync > supports Objects 1`] = `"$R[0]=Promise.resolve($R[1]={hello:\\"world\\"})"`; -exports[`objects > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})}"`; +exports[`objects > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})}"`; exports[`objects > crossSerializeAsync > supports Symbol.iterator 1`] = `"$R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})})"`; exports[`objects > crossSerializeAsync > supports self-recursion 1`] = `"$R[0]={a:$R[1]=Promise.resolve().then(()=>$R[0]),b:$R[2]=Promise.resolve().then(()=>$R[0])}"`; -exports[`objects > crossSerializeStream > scoped > supports Objects 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Objects 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Objects 2`] = `"($R=>_$.Ps($R[0],$R[1]={hello:\\"world\\"}))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Objects 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:\\"world\\"}))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())})($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())})($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>_$.Se($R[3],$R[4]=[0,1]))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1]))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>_$.Se($R[3],$R[5]=[0,2]))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>$R[6]($R[3],$R[7]=[0,2]))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>_$.Se($R[3],$R[6]=[0,3]))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>$R[6]($R[3],$R[8]=[0,3]))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>_$.Se($R[3],$R[7]=[2,void 0]))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>$R[6]($R[3],$R[9]=[2,void 0]))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>_$.Sc($R[3]))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>($R[10]=s=>{s.c.close();delete s.c})($R[3]))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>_$.Ps($R[0],$R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})}))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]={a:$R[1]=_$.P(),b:$R[2]=_$.P()})($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]={a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()})($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>_$.Ps($R[1],$R[0]))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0]))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>_$.Ps($R[2],$R[0]))($R[\\"example\\"])"`; +exports[`objects > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>$R[4]($R[3],$R[0]))($R[\\"example\\"])"`; -exports[`objects > crossSerializeStream > supports Objects 1`] = `"$R[0]=_$.P()"`; +exports[`objects > crossSerializeStream > supports Objects 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`objects > crossSerializeStream > supports Objects 2`] = `"_$.Ps($R[0],$R[1]={hello:\\"world\\"})"`; +exports[`objects > crossSerializeStream > supports Objects 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:\\"world\\"})"`; -exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())}"`; +exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())}"`; -exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"_$.Se($R[3],$R[4]=[0,1])"`; +exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1])"`; -exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"_$.Se($R[3],$R[5]=[0,2])"`; +exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"$R[6]($R[3],$R[7]=[0,2])"`; -exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"_$.Se($R[3],$R[6]=[0,3])"`; +exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"$R[6]($R[3],$R[8]=[0,3])"`; -exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"_$.Se($R[3],$R[7]=[2,void 0])"`; +exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"$R[6]($R[3],$R[9]=[2,void 0])"`; -exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"_$.Sc($R[3])"`; +exports[`objects > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"($R[10]=s=>{s.c.close();delete s.c})($R[3])"`; -exports[`objects > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=_$.P()"`; +exports[`objects > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`objects > crossSerializeStream > supports Symbol.iterator 2`] = `"_$.Ps($R[0],$R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})})"`; +exports[`objects > crossSerializeStream > supports Symbol.iterator 2`] = `"($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})})"`; -exports[`objects > crossSerializeStream > supports self-recursion 1`] = `"$R[0]={a:$R[1]=_$.P(),b:$R[2]=_$.P()}"`; +exports[`objects > crossSerializeStream > supports self-recursion 1`] = `"$R[0]={a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()}"`; -exports[`objects > crossSerializeStream > supports self-recursion 2`] = `"_$.Ps($R[1],$R[0])"`; +exports[`objects > crossSerializeStream > supports self-recursion 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0])"`; -exports[`objects > crossSerializeStream > supports self-recursion 3`] = `"_$.Ps($R[2],$R[0])"`; +exports[`objects > crossSerializeStream > supports self-recursion 3`] = `"$R[4]($R[3],$R[0])"`; exports[`objects > serialize > supports Objects 1`] = `"({hello:\\"world\\"})"`; -exports[`objects > serialize > supports Symbol.iterator 1`] = `"(h=>({[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; +exports[`objects > serialize > supports Symbol.iterator 1`] = `"((h,j)=>({[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; exports[`objects > serialize > supports self-recursion 1`] = `"(h=>(h={},h.b=h.a=h,h))()"`; exports[`objects > serializeAsync > supports Objects 1`] = `"Promise.resolve({hello:\\"world\\"})"`; -exports[`objects > serializeAsync > supports Symbol.asyncIterator 1`] = `"(h=>({[h=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[h]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; +exports[`objects > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j)=>({[h=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[h]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})}))()"`; -exports[`objects > serializeAsync > supports Symbol.iterator 1`] = `"(h=>(Promise.resolve({[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; +exports[`objects > serializeAsync > supports Symbol.iterator 1`] = `"((h,j)=>(Promise.resolve({[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})})))()"`; exports[`objects > serializeAsync > supports self-recursion 1`] = `"(h=>(h={a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)}))()"`; @@ -108,37 +108,37 @@ exports[`objects > toCrossJSON > supports self-recursion 1`] = `"{\\"t\\":10,\\" exports[`objects > toCrossJSONAsync > supports Objects 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}}"`; -exports[`objects > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}"`; +exports[`objects > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}"`; exports[`objects > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}}"`; exports[`objects > toCrossJSONAsync > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}},{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":2},\\"o\\":0}"`; -exports[`objects > toCrossJSONStream > supports Objects 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`objects > toCrossJSONStream > supports Objects 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`objects > toCrossJSONStream > supports Objects 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}}"`; +exports[`objects > toCrossJSONStream > supports Objects 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}]}"`; -exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3}]}],\\"s\\":1},\\"o\\":0}"`; +exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":4,\\"s\\":5}}]}],\\"s\\":1},\\"o\\":0}"`; -exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":4,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}}"`; +exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":6},{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}}"`; +exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}]}"`; -exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":6,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}}"`; +exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":8,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}]}"`; -exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}}"`; +exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":9,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3}"`; +exports[`objects > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":10,\\"s\\":8}}"`; -exports[`objects > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`objects > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`objects > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}}"`; +exports[`objects > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":7,\\"s\\":3},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":3,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":3}},{\\"t\\":10,\\"i\\":5,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":6,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}]}"`; -exports[`objects > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1},{\\"t\\":28,\\"i\\":2}],\\"s\\":2},\\"o\\":0}"`; +exports[`objects > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":2}},{\\"t\\":28,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}}],\\"s\\":2},\\"o\\":0}"`; -exports[`objects > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`objects > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":4,\\"i\\":0}]}"`; -exports[`objects > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`objects > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":4},{\\"t\\":4,\\"i\\":0}]}"`; exports[`objects > toJSON > supports Objects 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0},\\"f\\":16383,\\"m\\":[]}"`; @@ -148,7 +148,7 @@ exports[`objects > toJSON > supports self-recursion 1`] = `"{\\"t\\":{\\"t\\":10 exports[`objects > toJSONAsync > supports Objects 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":0}},\\"f\\":16383,\\"m\\":[]}"`; -exports[`objects > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0},\\"f\\":16383,\\"m\\":[1]}"`; +exports[`objects > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0},\\"f\\":16383,\\"m\\":[1]}"`; exports[`objects > toJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":0}},\\"f\\":16383,\\"m\\":[2]}"`; diff --git a/packages/seroval/test/__snapshots__/reference.test.ts.snap b/packages/seroval/test/__snapshots__/reference.test.ts.snap index 3ea70d29..0d490ee7 100644 --- a/packages/seroval/test/__snapshots__/reference.test.ts.snap +++ b/packages/seroval/test/__snapshots__/reference.test.ts.snap @@ -8,13 +8,13 @@ exports[`Reference > crossSerializeAsync > scoped > supports Reference 1`] = `"( exports[`Reference > crossSerializeAsync > supports Reference 1`] = `"$R[0]=Promise.resolve($R[1]=__SEROVAL_REFS__.get(\\"example\\"))"`; -exports[`Reference > crossSerializeStream > scoped > supports Reference 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Reference > crossSerializeStream > scoped > supports Reference 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Reference > crossSerializeStream > scoped > supports Reference 2`] = `"($R=>_$.Ps($R[0],$R[1]=__SEROVAL_REFS__.get(\\"example\\")))($R[\\"example\\"])"`; +exports[`Reference > crossSerializeStream > scoped > supports Reference 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=__SEROVAL_REFS__.get(\\"example\\")))($R[\\"example\\"])"`; -exports[`Reference > crossSerializeStream > supports Reference 1`] = `"$R[0]=_$.P()"`; +exports[`Reference > crossSerializeStream > supports Reference 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Reference > crossSerializeStream > supports Reference 2`] = `"_$.Ps($R[0],$R[1]=__SEROVAL_REFS__.get(\\"example\\"))"`; +exports[`Reference > crossSerializeStream > supports Reference 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=__SEROVAL_REFS__.get(\\"example\\"))"`; exports[`Reference > serialize > supports Reference 1`] = `"__SEROVAL_REFS__.get(\\"example\\")"`; @@ -24,9 +24,9 @@ exports[`Reference > toCrossJSON > supports Reference 1`] = `"{\\"t\\":20,\\"i\\ exports[`Reference > toCrossJSONAsync > supports Reference 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":20,\\"i\\":1,\\"s\\":\\"example\\"}}"`; -exports[`Reference > toCrossJSONStream > supports Reference 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Reference > toCrossJSONStream > supports Reference 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Reference > toCrossJSONStream > supports Reference 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":20,\\"i\\":1,\\"s\\":\\"example\\"}}"`; +exports[`Reference > toCrossJSONStream > supports Reference 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":20,\\"i\\":2,\\"s\\":\\"example\\"}]}"`; exports[`Reference > toJSON > supports Reference 1`] = `"{\\"t\\":{\\"t\\":20,\\"i\\":0,\\"s\\":\\"example\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/regexp.test.ts.snap b/packages/seroval/test/__snapshots__/regexp.test.ts.snap index 78ed5573..8597e4d4 100644 --- a/packages/seroval/test/__snapshots__/regexp.test.ts.snap +++ b/packages/seroval/test/__snapshots__/regexp.test.ts.snap @@ -8,13 +8,13 @@ exports[`RegExp > crossSerializeAsync > scoped > supports RegExp 1`] = `"($R=>$R exports[`RegExp > crossSerializeAsync > supports RegExp 1`] = `"$R[0]=Promise.resolve($R[1]=/[a-z0-9]+/i)"`; -exports[`RegExp > crossSerializeStream > scoped > supports RegExp 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`RegExp > crossSerializeStream > scoped > supports RegExp 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`RegExp > crossSerializeStream > scoped > supports RegExp 2`] = `"($R=>_$.Ps($R[0],$R[1]=/[a-z0-9]+/i))($R[\\"example\\"])"`; +exports[`RegExp > crossSerializeStream > scoped > supports RegExp 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=/[a-z0-9]+/i))($R[\\"example\\"])"`; -exports[`RegExp > crossSerializeStream > supports RegExp 1`] = `"$R[0]=_$.P()"`; +exports[`RegExp > crossSerializeStream > supports RegExp 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`RegExp > crossSerializeStream > supports RegExp 2`] = `"_$.Ps($R[0],$R[1]=/[a-z0-9]+/i)"`; +exports[`RegExp > crossSerializeStream > supports RegExp 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=/[a-z0-9]+/i)"`; exports[`RegExp > serialize > supports RegExp 1`] = `"/[a-z0-9]+/i"`; @@ -24,9 +24,9 @@ exports[`RegExp > toCrossJSON > supports RegExp 1`] = `"{\\"t\\":6,\\"i\\":0,\\" exports[`RegExp > toCrossJSONAsync > supports RegExp 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":6,\\"i\\":1,\\"c\\":\\"[a-z0-9]+\\",\\"m\\":\\"i\\"}}"`; -exports[`RegExp > toCrossJSONStream > supports RegExp 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`RegExp > toCrossJSONStream > supports RegExp 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`RegExp > toCrossJSONStream > supports RegExp 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":6,\\"i\\":1,\\"c\\":\\"[a-z0-9]+\\",\\"m\\":\\"i\\"}}"`; +exports[`RegExp > toCrossJSONStream > supports RegExp 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":6,\\"i\\":2,\\"c\\":\\"[a-z0-9]+\\",\\"m\\":\\"i\\"}]}"`; exports[`RegExp > toJSON > supports RegExp 1`] = `"{\\"t\\":{\\"t\\":6,\\"i\\":0,\\"c\\":\\"[a-z0-9]+\\",\\"m\\":\\"i\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/sealed-object.test.ts.snap b/packages/seroval/test/__snapshots__/sealed-object.test.ts.snap index 0dda1782..11679d82 100644 --- a/packages/seroval/test/__snapshots__/sealed-object.test.ts.snap +++ b/packages/seroval/test/__snapshots__/sealed-object.test.ts.snap @@ -14,7 +14,7 @@ exports[`sealed object > crossSerialize > supports self-recursion 1`] = `"($R[0] exports[`sealed object > crossSerializeAsync > scoped > supports Objects 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={hello:\\"world\\"}),Object.seal($R[1]),$R[0])($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.seal($R[0]),$R[0])($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeAsync > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.seal($R[0]),$R[0])($R[\\"example\\"])"`; exports[`sealed object > crossSerializeAsync > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.seal($R[1]),$R[0])($R[\\"example\\"])"`; @@ -22,75 +22,75 @@ exports[`sealed object > crossSerializeAsync > scoped > supports self-recursion exports[`sealed object > crossSerializeAsync > supports Objects 1`] = `"($R[0]=Promise.resolve($R[1]={hello:\\"world\\"}),Object.seal($R[1]),$R[0])"`; -exports[`sealed object > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.seal($R[0]),$R[0])"`; +exports[`sealed object > crossSerializeAsync > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(i,t)=>(i=0,t={[$R[1]]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))($R[3]={v:$R[4]=[1,2,3,void 0],t:-1,d:3})},Object.seal($R[0]),$R[0])"`; exports[`sealed object > crossSerializeAsync > supports Symbol.iterator 1`] = `"($R[0]=Promise.resolve($R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.seal($R[1]),$R[0])"`; exports[`sealed object > crossSerializeAsync > supports self-recursion 1`] = `"($R[0]={a:$R[1]=Promise.resolve().then(()=>$R[0]),b:$R[2]=Promise.resolve().then(()=>$R[0])},Object.seal($R[0]),$R[0])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Objects 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Objects 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Objects 2`] = `"($R=>_$.Ps($R[0],$R[1]={hello:\\"world\\"}),Object.seal($R[1]),$R[0])($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Objects 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:\\"world\\"}),Object.seal($R[2]),$R[0])($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())},Object.seal($R[0]),$R[0])($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())},Object.seal($R[0]),$R[0])($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>_$.Se($R[3],$R[4]=[0,1]))($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1]))($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>_$.Se($R[3],$R[5]=[0,2]))($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 3`] = `"($R=>$R[6]($R[3],$R[7]=[0,2]))($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>_$.Se($R[3],$R[6]=[0,3]))($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 4`] = `"($R=>$R[6]($R[3],$R[8]=[0,3]))($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>_$.Se($R[3],$R[7]=[2,void 0]))($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 5`] = `"($R=>$R[6]($R[3],$R[9]=[2,void 0]))($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>_$.Sc($R[3]))($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.asyncIterator 6`] = `"($R=>($R[10]=s=>{s.c.close();delete s.c})($R[3]))($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>_$.Ps($R[0],$R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.seal($R[1]),$R[0])($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})}),Object.seal($R[2]),$R[0])($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]={a:$R[1]=_$.P(),b:$R[2]=_$.P()},Object.seal($R[0]),$R[0])($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]={a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()},Object.seal($R[0]),$R[0])($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>_$.Ps($R[1],$R[0]))($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0]))($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>_$.Ps($R[2],$R[0]))($R[\\"example\\"])"`; +exports[`sealed object > crossSerializeStream > scoped > supports self-recursion 3`] = `"($R=>$R[4]($R[3],$R[0]))($R[\\"example\\"])"`; -exports[`sealed object > crossSerializeStream > supports Objects 1`] = `"$R[0]=_$.P()"`; +exports[`sealed object > crossSerializeStream > supports Objects 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`sealed object > crossSerializeStream > supports Objects 2`] = `"(_$.Ps($R[0],$R[1]={hello:\\"world\\"}),Object.seal($R[1]),$R[0])"`; +exports[`sealed object > crossSerializeStream > supports Objects 2`] = `"(($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={hello:\\"world\\"}),Object.seal($R[2]),$R[0])"`; -exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=_$.S())},Object.seal($R[0]),$R[0])"`; +exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"($R[0]={[$R[1]=Symbol.asyncIterator]:($R[2]=s=>(b,t)=>(b=s.tee(),s=b[0],b=b[1].getReader(),t={[$R[1]]:()=>t,next:()=>b.read().then(d=>{if(d.done)return{done:!0,value:void 0};d=d.value;if(d[0]===1)throw d[1];return{done:d[0]===2,value:d[1]}})}))($R[3]=($R[4]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())},Object.seal($R[0]),$R[0])"`; -exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"_$.Se($R[3],$R[4]=[0,1])"`; +exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"($R[6]=(s,d)=>{s.c.enqueue(d)})($R[3],$R[5]=[0,1])"`; -exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"_$.Se($R[3],$R[5]=[0,2])"`; +exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 3`] = `"$R[6]($R[3],$R[7]=[0,2])"`; -exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"_$.Se($R[3],$R[6]=[0,3])"`; +exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 4`] = `"$R[6]($R[3],$R[8]=[0,3])"`; -exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"_$.Se($R[3],$R[7]=[2,void 0])"`; +exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 5`] = `"$R[6]($R[3],$R[9]=[2,void 0])"`; -exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"_$.Sc($R[3])"`; +exports[`sealed object > crossSerializeStream > supports Symbol.asyncIterator 6`] = `"($R[10]=s=>{s.c.close();delete s.c})($R[3])"`; -exports[`sealed object > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=_$.P()"`; +exports[`sealed object > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`sealed object > crossSerializeStream > supports Symbol.iterator 2`] = `"(_$.Ps($R[0],$R[1]={[$R[2]=Symbol.iterator]:($R[3]=s=>(i,c,d,t)=>(i=0,t={[$R[2]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[4]={v:$R[5]=[1,2,3,void 0],t:-1,d:3})}),Object.seal($R[1]),$R[0])"`; +exports[`sealed object > crossSerializeStream > supports Symbol.iterator 2`] = `"(($R[7]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]={[$R[3]=Symbol.iterator]:($R[4]=s=>(i,c,d,t)=>(i=0,t={[$R[3]]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))($R[5]={v:$R[6]=[1,2,3,void 0],t:-1,d:3})}),Object.seal($R[2]),$R[0])"`; -exports[`sealed object > crossSerializeStream > supports self-recursion 1`] = `"($R[0]={a:$R[1]=_$.P(),b:$R[2]=_$.P()},Object.seal($R[0]),$R[0])"`; +exports[`sealed object > crossSerializeStream > supports self-recursion 1`] = `"($R[0]={a:$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))(),b:$R[3]=$R[2]()},Object.seal($R[0]),$R[0])"`; -exports[`sealed object > crossSerializeStream > supports self-recursion 2`] = `"_$.Ps($R[1],$R[0])"`; +exports[`sealed object > crossSerializeStream > supports self-recursion 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0])"`; -exports[`sealed object > crossSerializeStream > supports self-recursion 3`] = `"_$.Ps($R[2],$R[0])"`; +exports[`sealed object > crossSerializeStream > supports self-recursion 3`] = `"$R[4]($R[3],$R[0])"`; exports[`sealed object > serialize > supports Objects 1`] = `"(h=>(h={hello:\\"world\\"},Object.seal(h),h))()"`; -exports[`sealed object > serialize > supports Symbol.iterator 1`] = `"((h,j)=>(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})},Object.seal(h),h))()"`; +exports[`sealed object > serialize > supports Symbol.iterator 1`] = `"((h,j,k)=>(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})},Object.seal(h),h))()"`; exports[`sealed object > serialize > supports self-recursion 1`] = `"(h=>(h={},h.b=h.a=h,Object.seal(h),h))()"`; exports[`sealed object > serializeAsync > supports Objects 1`] = `"((h,j)=>(j=Promise.resolve(h={hello:\\"world\\"}),Object.seal(h),j))()"`; -exports[`sealed object > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j)=>(h={[j=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[j]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})},Object.seal(h),h))()"`; +exports[`sealed object > serializeAsync > supports Symbol.asyncIterator 1`] = `"((h,j,k)=>(h={[j=Symbol.asyncIterator]:(s=>(i,t)=>(i=0,t={[j]:()=>t,next:()=>Promise.resolve().then((c,d)=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}})}))({v:[1,2,3,void 0],t:-1,d:3})},Object.seal(h),h))()"`; -exports[`sealed object > serializeAsync > supports Symbol.iterator 1`] = `"((h,j,k)=>(k=Promise.resolve(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}),Object.seal(h),k))()"`; +exports[`sealed object > serializeAsync > supports Symbol.iterator 1`] = `"((h,j,k,m)=>(m=Promise.resolve(h={[j=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[j]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3})}),Object.seal(h),m))()"`; exports[`sealed object > serializeAsync > supports self-recursion 1`] = `"(h=>(h={a:Promise.resolve().then(()=>h),b:Promise.resolve().then(()=>h)},Object.seal(h),h))()"`; @@ -102,37 +102,37 @@ exports[`sealed object > toCrossJSON > supports self-recursion 1`] = `"{\\"t\\": exports[`sealed object > toCrossJSONAsync > supports Objects 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":2}}"`; -exports[`sealed object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2}"`; +exports[`sealed object > toCrossJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2}"`; exports[`sealed object > toCrossJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2}}"`; exports[`sealed object > toCrossJSONAsync > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":12,\\"i\\":1,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}},{\\"t\\":12,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}],\\"s\\":2},\\"o\\":2}"`; -exports[`sealed object > toCrossJSONStream > supports Objects 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`sealed object > toCrossJSONStream > supports Objects 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`sealed object > toCrossJSONStream > supports Objects 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":2}}"`; +exports[`sealed object > toCrossJSONStream > supports Objects 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":2}]}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3}]}],\\"s\\":1},\\"o\\":2}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":1,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":31,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":4,\\"s\\":5}}]}],\\"s\\":1},\\"o\\":2}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":4,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":41,\\"i\\":6,\\"s\\":6},{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":5,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 3`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":2}],\\"o\\":0}]}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":6,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 4`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":8,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":3}],\\"o\\":0}]}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"f\\":{\\"t\\":9,\\"i\\":7,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 5`] = `"{\\"t\\":32,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":6},{\\"t\\":9,\\"i\\":9,\\"l\\":2,\\"a\\":[{\\"t\\":0,\\"s\\":2},{\\"t\\":2,\\"s\\":1}],\\"o\\":0}]}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.asyncIterator 6`] = `"{\\"t\\":33,\\"i\\":3,\\"f\\":{\\"t\\":41,\\"i\\":10,\\"s\\":8}}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`sealed object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2}}"`; +exports[`sealed object > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":7,\\"s\\":3},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":3,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":4,\\"f\\":{\\"t\\":4,\\"i\\":3}},{\\"t\\":10,\\"i\\":5,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":6,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2}]}"`; -exports[`sealed object > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1},{\\"t\\":28,\\"i\\":2}],\\"s\\":2},\\"o\\":2}"`; +exports[`sealed object > toCrossJSONStream > supports self-recursion 1`] = `"{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"a\\",\\"b\\"],\\"v\\":[{\\"t\\":28,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":2}},{\\"t\\":28,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}}],\\"s\\":2},\\"o\\":2}"`; -exports[`sealed object > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`sealed object > toCrossJSONStream > supports self-recursion 2`] = `"{\\"t\\":29,\\"i\\":1,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":4,\\"i\\":0}]}"`; -exports[`sealed object > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":0}}"`; +exports[`sealed object > toCrossJSONStream > supports self-recursion 3`] = `"{\\"t\\":29,\\"i\\":3,\\"a\\":[{\\"t\\":4,\\"i\\":4},{\\"t\\":4,\\"i\\":0}]}"`; exports[`sealed object > toJSON > supports Objects 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":2},\\"f\\":16383,\\"m\\":[]}"`; @@ -142,7 +142,7 @@ exports[`sealed object > toJSON > supports self-recursion 1`] = `"{\\"t\\":{\\"t exports[`sealed object > toJSONAsync > supports Objects 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"hello\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"}],\\"s\\":1},\\"o\\":2}},\\"f\\":16383,\\"m\\":[]}"`; -exports[`sealed object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2},\\"f\\":16383,\\"m\\":[1]}"`; +exports[`sealed object > toJSONAsync > supports Symbol.asyncIterator 1`] = `"{\\"t\\":{\\"t\\":10,\\"i\\":0,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":1,\\"s\\":0}],\\"v\\":[{\\"t\\":45,\\"a\\":[{\\"t\\":44,\\"i\\":2,\\"s\\":0,\\"f\\":{\\"t\\":4,\\"i\\":1}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":4,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2},\\"f\\":16383,\\"m\\":[1]}"`; exports[`sealed object > toJSONAsync > supports Symbol.iterator 1`] = `"{\\"t\\":{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[{\\"t\\":17,\\"i\\":2,\\"s\\":3}],\\"v\\":[{\\"t\\":43,\\"a\\":[{\\"t\\":42,\\"i\\":3,\\"f\\":{\\"t\\":4,\\"i\\":2}},{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":5,\\"l\\":4,\\"a\\":[{\\"t\\":0,\\"s\\":1},{\\"t\\":0,\\"s\\":2},{\\"t\\":0,\\"s\\":3},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}],\\"s\\":1},\\"o\\":2}},\\"f\\":16383,\\"m\\":[2]}"`; diff --git a/packages/seroval/test/__snapshots__/set.test.ts.snap b/packages/seroval/test/__snapshots__/set.test.ts.snap index c2b7a976..f25e72ec 100644 --- a/packages/seroval/test/__snapshots__/set.test.ts.snap +++ b/packages/seroval/test/__snapshots__/set.test.ts.snap @@ -1,6 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Set > compat > should fallback to Symbol.iterator 1`] = `"(h=>(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3}),[Symbol.toStringTag]:\\"Set\\"})))()"`; +exports[`Set > compat > should fallback to Symbol.iterator 1`] = `"((h,j)=>(Object.assign(Object.create(null),{[h=Symbol.iterator]:(s=>(i,c,d,t)=>(i=0,t={[h]:()=>t,next:()=>{if(i>s.d)return{done:!0,value:void 0};c=i++,d=s.v[c];if(c===s.t)throw d;return{done:c===s.d,value:d}}}))({v:[1,2,3,void 0],t:-1,d:3}),[Symbol.toStringTag]:\\"Set\\"})))()"`; exports[`Set > compat > should throw an error for unsupported target 1`] = `"Unsupported type \\"[object Set]\\""`; @@ -24,21 +24,21 @@ exports[`Set > crossSerializeAsync > supports Set 1`] = `"$R[0]=Promise.resolve( exports[`Set > crossSerializeAsync > supports self-recursion 1`] = `"$R[0]=new Set([$R[1]=Promise.resolve().then(()=>$R[0])])"`; -exports[`Set > crossSerializeStream > scoped > supports Set 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Set > crossSerializeStream > scoped > supports Set 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Set > crossSerializeStream > scoped > supports Set 2`] = `"($R=>_$.Ps($R[0],$R[1]=new Set([1,2,3])))($R[\\"example\\"])"`; +exports[`Set > crossSerializeStream > scoped > supports Set 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Set([1,2,3])))($R[\\"example\\"])"`; -exports[`Set > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]=new Set([$R[1]=_$.P()]))($R[\\"example\\"])"`; +exports[`Set > crossSerializeStream > scoped > supports self-recursion 1`] = `"($R=>$R[0]=new Set([$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()]))($R[\\"example\\"])"`; -exports[`Set > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>_$.Ps($R[1],$R[0]))($R[\\"example\\"])"`; +exports[`Set > crossSerializeStream > scoped > supports self-recursion 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0]))($R[\\"example\\"])"`; -exports[`Set > crossSerializeStream > supports Set 1`] = `"$R[0]=_$.P()"`; +exports[`Set > crossSerializeStream > supports Set 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Set > crossSerializeStream > supports Set 2`] = `"_$.Ps($R[0],$R[1]=new Set([1,2,3]))"`; +exports[`Set > crossSerializeStream > supports Set 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Set([1,2,3]))"`; -exports[`Set > crossSerializeStream > supports self-recursion 1`] = `"$R[0]=new Set([$R[1]=_$.P()])"`; +exports[`Set > crossSerializeStream > supports self-recursion 1`] = `"$R[0]=new Set([$R[1]=($R[2]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()])"`; -exports[`Set > crossSerializeStream > supports self-recursion 2`] = `"_$.Ps($R[1],$R[0])"`; +exports[`Set > crossSerializeStream > supports self-recursion 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[1],$R[0])"`; exports[`Set > serialize > supports Set 1`] = `"new Set([1,2,3])"`; diff --git a/packages/seroval/test/__snapshots__/sparse-array.test.ts.snap b/packages/seroval/test/__snapshots__/sparse-array.test.ts.snap index f8981059..fa68b4cf 100644 --- a/packages/seroval/test/__snapshots__/sparse-array.test.ts.snap +++ b/packages/seroval/test/__snapshots__/sparse-array.test.ts.snap @@ -8,13 +8,13 @@ exports[`sparse arrays > crossSerializeAsync > scoped > supports sparse arrays 1 exports[`sparse arrays > crossSerializeAsync > supports sparse arrays 1`] = `"$R[0]=Promise.resolve($R[1]=[,,,,,,,,,,])"`; -exports[`sparse arrays > crossSerializeStream > scoped > supports sparse arrays 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`sparse arrays > crossSerializeStream > scoped > supports sparse arrays 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`sparse arrays > crossSerializeStream > scoped > supports sparse arrays 2`] = `"($R=>_$.Ps($R[0],$R[1]=[,,,,,,,,,,]))($R[\\"example\\"])"`; +exports[`sparse arrays > crossSerializeStream > scoped > supports sparse arrays 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=[,,,,,,,,,,]))($R[\\"example\\"])"`; -exports[`sparse arrays > crossSerializeStream > supports sparse arrays 1`] = `"$R[0]=_$.P()"`; +exports[`sparse arrays > crossSerializeStream > supports sparse arrays 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`sparse arrays > crossSerializeStream > supports sparse arrays 2`] = `"_$.Ps($R[0],$R[1]=[,,,,,,,,,,])"`; +exports[`sparse arrays > crossSerializeStream > supports sparse arrays 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=[,,,,,,,,,,])"`; exports[`sparse arrays > serialize > supports sparse arrays 1`] = `"[,,,,,,,,,,]"`; @@ -24,9 +24,9 @@ exports[`sparse arrays > toCrossJSON > supports sparse arrays 1`] = `"{\\"t\\":9 exports[`sparse arrays > toCrossJSONAsync > supports sparse arrays 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":9,\\"i\\":1,\\"l\\":10,\\"a\\":[],\\"o\\":0}}"`; -exports[`sparse arrays > toCrossJSONStream > supports sparse arrays 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`sparse arrays > toCrossJSONStream > supports sparse arrays 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`sparse arrays > toCrossJSONStream > supports sparse arrays 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":9,\\"i\\":1,\\"l\\":10,\\"a\\":[],\\"o\\":0}}"`; +exports[`sparse arrays > toCrossJSONStream > supports sparse arrays 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":9,\\"i\\":2,\\"l\\":10,\\"a\\":[],\\"o\\":0}]}"`; exports[`sparse arrays > toJSON > supports sparse arrays 1`] = `"{\\"t\\":{\\"t\\":9,\\"i\\":0,\\"l\\":10,\\"a\\":[],\\"o\\":0},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/string.test.ts.snap b/packages/seroval/test/__snapshots__/string.test.ts.snap index cacea9d1..36a3152a 100644 --- a/packages/seroval/test/__snapshots__/string.test.ts.snap +++ b/packages/seroval/test/__snapshots__/string.test.ts.snap @@ -8,13 +8,13 @@ exports[`string > crossSerializeAsync > supports strings 1`] = `"$R[0]=Promise.r exports[`string > crossSerializeAsync > supports strings 2`] = `"$R[0]=Promise.resolve(\\"\\\\x3Cscript>\\\\x3C/script>\\")"`; -exports[`string > crossSerializeStream > supports sanitized strings 1`] = `"$R[0]=_$.P()"`; +exports[`string > crossSerializeStream > supports sanitized strings 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`string > crossSerializeStream > supports sanitized strings 2`] = `"_$.Ps($R[0],\\"\\\\x3Cscript>\\\\x3C/script>\\")"`; +exports[`string > crossSerializeStream > supports sanitized strings 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],\\"\\\\x3Cscript>\\\\x3C/script>\\")"`; -exports[`string > crossSerializeStream > supports strings 1`] = `"$R[0]=_$.P()"`; +exports[`string > crossSerializeStream > supports strings 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`string > crossSerializeStream > supports strings 2`] = `"_$.Ps($R[0],\\"\\\\\\"hello\\\\\\"\\")"`; +exports[`string > crossSerializeStream > supports strings 2`] = `"($R[2]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],\\"\\\\\\"hello\\\\\\"\\")"`; exports[`string > serialize > supports strings 1`] = `"\\"\\\\\\"hello\\\\\\"\\""`; @@ -32,13 +32,13 @@ exports[`string > toCrossJSONAsync > supports strings 1`] = `"{\\"t\\":12,\\"i\\ exports[`string > toCrossJSONAsync > supports strings 2`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\x3Cscript>\\\\\\\\x3C/script>\\"}}"`; -exports[`string > toCrossJSONStream > supports sanitized strings 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`string > toCrossJSONStream > supports sanitized strings 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`string > toCrossJSONStream > supports sanitized strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\x3Cscript>\\\\\\\\x3C/script>\\"}}"`; +exports[`string > toCrossJSONStream > supports sanitized strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":1,\\"s\\":\\"\\\\\\\\x3Cscript>\\\\\\\\x3C/script>\\"}]}"`; -exports[`string > toCrossJSONStream > supports strings 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`string > toCrossJSONStream > supports strings 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`string > toCrossJSONStream > supports strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\\\\\\\"hello\\\\\\\\\\\\\\"\\"}}"`; +exports[`string > toCrossJSONStream > supports strings 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":3},{\\"t\\":1,\\"s\\":\\"\\\\\\\\\\\\\\"hello\\\\\\\\\\\\\\"\\"}]}"`; exports[`string > toJSON > supports strings 1`] = `"{\\"t\\":{\\"t\\":1,\\"s\\":\\"\\\\\\\\\\\\\\"hello\\\\\\\\\\\\\\"\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/typed-array.test.ts.snap b/packages/seroval/test/__snapshots__/typed-array.test.ts.snap index a2121cf9..333f97b3 100644 --- a/packages/seroval/test/__snapshots__/typed-array.test.ts.snap +++ b/packages/seroval/test/__snapshots__/typed-array.test.ts.snap @@ -8,13 +8,13 @@ exports[`typed arrays > crossSerializeAsync > scoped > supports typed arrays 1`] exports[`typed arrays > crossSerializeAsync > supports typed arrays 1`] = `"$R[0]=Promise.resolve($R[1]=new Uint32Array($R[2]=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]).buffer,0,4))"`; -exports[`typed arrays > crossSerializeStream > scoped > supports typed arrays 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`typed arrays > crossSerializeStream > scoped > supports typed arrays 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`typed arrays > crossSerializeStream > scoped > supports typed arrays 2`] = `"($R=>_$.Ps($R[0],$R[1]=new Uint32Array($R[2]=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]).buffer,0,4)))($R[\\"example\\"])"`; +exports[`typed arrays > crossSerializeStream > scoped > supports typed arrays 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Uint32Array($R[3]=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]).buffer,0,4)))($R[\\"example\\"])"`; -exports[`typed arrays > crossSerializeStream > supports typed arrays 1`] = `"$R[0]=_$.P()"`; +exports[`typed arrays > crossSerializeStream > supports typed arrays 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`typed arrays > crossSerializeStream > supports typed arrays 2`] = `"_$.Ps($R[0],$R[1]=new Uint32Array($R[2]=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]).buffer,0,4))"`; +exports[`typed arrays > crossSerializeStream > supports typed arrays 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Uint32Array($R[3]=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]).buffer,0,4))"`; exports[`typed arrays > serialize > supports typed arrays 1`] = `"new Uint32Array(new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]).buffer,0,4)"`; @@ -24,9 +24,9 @@ exports[`typed arrays > toCrossJSON > supports typed arrays 1`] = `"{\\"t\\":15, exports[`typed arrays > toCrossJSONAsync > supports typed arrays 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":15,\\"i\\":1,\\"l\\":4,\\"c\\":\\"Uint32Array\\",\\"f\\":{\\"t\\":21,\\"i\\":2,\\"s\\":[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},\\"b\\":0}}"`; -exports[`typed arrays > toCrossJSONStream > supports typed arrays 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`typed arrays > toCrossJSONStream > supports typed arrays 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`typed arrays > toCrossJSONStream > supports typed arrays 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":15,\\"i\\":1,\\"l\\":4,\\"c\\":\\"Uint32Array\\",\\"f\\":{\\"t\\":21,\\"i\\":2,\\"s\\":[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},\\"b\\":0}}"`; +exports[`typed arrays > toCrossJSONStream > supports typed arrays 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":15,\\"i\\":2,\\"l\\":4,\\"c\\":\\"Uint32Array\\",\\"f\\":{\\"t\\":21,\\"i\\":3,\\"s\\":[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},\\"b\\":0}]}"`; exports[`typed arrays > toJSON > supports typed arrays 1`] = `"{\\"t\\":{\\"t\\":15,\\"i\\":0,\\"l\\":4,\\"c\\":\\"Uint32Array\\",\\"f\\":{\\"t\\":21,\\"i\\":1,\\"s\\":[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},\\"b\\":0},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/__snapshots__/wk-symbols.test.ts.snap b/packages/seroval/test/__snapshots__/wk-symbols.test.ts.snap index 62ac7ec8..a1562b02 100644 --- a/packages/seroval/test/__snapshots__/wk-symbols.test.ts.snap +++ b/packages/seroval/test/__snapshots__/wk-symbols.test.ts.snap @@ -104,109 +104,109 @@ exports[`well-known symbols > crossSerializeAsync > supports well-known symbols exports[`well-known symbols > crossSerializeAsync > supports well-known symbols 13`] = `"$R[0]=Promise.resolve($R[1]=Symbol.unscopables)"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.asyncIterator 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.asyncIterator))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.asyncIterator 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.asyncIterator))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.hasInstance 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.hasInstance 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.hasInstance 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.hasInstance))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.hasInstance 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.hasInstance))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.isConcatSpreadable 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.isConcatSpreadable 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.isConcatSpreadable 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.isConcatSpreadable))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.isConcatSpreadable 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.isConcatSpreadable))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.iterator 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.iterator))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.iterator 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.iterator))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.match 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.match 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.match 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.match))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.match 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.match))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.matchAll 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.matchAll 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.matchAll 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.matchAll))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.matchAll 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.matchAll))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.replace 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.replace 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.replace 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.replace))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.replace 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.replace))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.search 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.search 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.search 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.search))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.search 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.search))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.species 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.species 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.species 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.species))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.species 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.species))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.split 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.split 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.split 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.split))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.split 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.split))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toPrimitive 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toPrimitive 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toPrimitive 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.toPrimitive))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toPrimitive 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.toPrimitive))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toStringTag 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toStringTag 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toStringTag 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.toStringTag))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.toStringTag 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.toStringTag))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.unscopables 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.unscopables 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.unscopables 2`] = `"($R=>_$.Ps($R[0],$R[1]=Symbol.unscopables))($R[\\"example\\"])"`; +exports[`well-known symbols > crossSerializeStream > scoped > supports Symbol.unscopables 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.unscopables))($R[\\"example\\"])"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.asyncIterator 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"_$.Ps($R[0],$R[1]=Symbol.asyncIterator)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.asyncIterator 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.asyncIterator)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.hasInstance 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.hasInstance 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.hasInstance 2`] = `"_$.Ps($R[0],$R[1]=Symbol.hasInstance)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.hasInstance 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.hasInstance)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.isConcatSpreadable 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.isConcatSpreadable 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.isConcatSpreadable 2`] = `"_$.Ps($R[0],$R[1]=Symbol.isConcatSpreadable)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.isConcatSpreadable 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.isConcatSpreadable)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.iterator 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.iterator 2`] = `"_$.Ps($R[0],$R[1]=Symbol.iterator)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.iterator 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.iterator)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.match 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.match 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.match 2`] = `"_$.Ps($R[0],$R[1]=Symbol.match)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.match 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.match)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.matchAll 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.matchAll 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.matchAll 2`] = `"_$.Ps($R[0],$R[1]=Symbol.matchAll)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.matchAll 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.matchAll)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.replace 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.replace 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.replace 2`] = `"_$.Ps($R[0],$R[1]=Symbol.replace)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.replace 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.replace)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.search 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.search 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.search 2`] = `"_$.Ps($R[0],$R[1]=Symbol.search)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.search 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.search)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.species 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.species 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.species 2`] = `"_$.Ps($R[0],$R[1]=Symbol.species)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.species 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.species)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.split 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.split 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.split 2`] = `"_$.Ps($R[0],$R[1]=Symbol.split)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.split 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.split)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.toPrimitive 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.toPrimitive 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.toPrimitive 2`] = `"_$.Ps($R[0],$R[1]=Symbol.toPrimitive)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.toPrimitive 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.toPrimitive)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.toStringTag 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.toStringTag 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.toStringTag 2`] = `"_$.Ps($R[0],$R[1]=Symbol.toStringTag)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.toStringTag 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.toStringTag)"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.unscopables 1`] = `"$R[0]=_$.P()"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.unscopables 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`well-known symbols > crossSerializeStream > supports Symbol.unscopables 2`] = `"_$.Ps($R[0],$R[1]=Symbol.unscopables)"`; +exports[`well-known symbols > crossSerializeStream > supports Symbol.unscopables 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=Symbol.unscopables)"`; exports[`well-known symbols > serialize > supports well-known symbols 1`] = `"Symbol.asyncIterator"`; @@ -312,57 +312,57 @@ exports[`well-known symbols > toCrossJSONAsync > supports well-known symbols 12` exports[`well-known symbols > toCrossJSONAsync > supports well-known symbols 13`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":12}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.asyncIterator 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":0}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.asyncIterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":0}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.hasInstance 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.hasInstance 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.hasInstance 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":1}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.hasInstance 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":1}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.isConcatSpreadable 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.isConcatSpreadable 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.isConcatSpreadable 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":2}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.isConcatSpreadable 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":2}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.iterator 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":3}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.iterator 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":3}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.match 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.match 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.match 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":4}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.match 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":4}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.matchAll 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.matchAll 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.matchAll 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":5}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.matchAll 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":5}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.replace 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.replace 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.replace 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":6}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.replace 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":6}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.search 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.search 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.search 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":7}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.search 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":7}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.species 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.species 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.species 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":8}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.species 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":8}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.split 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.split 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.split 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":9}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.split 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":9}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.toPrimitive 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.toPrimitive 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.toPrimitive 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":10}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.toPrimitive 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":10}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.toStringTag 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.toStringTag 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.toStringTag 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":11}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.toStringTag 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":11}]}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.unscopables 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.unscopables 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`well-known symbols > toCrossJSONStream > supports Symbol.unscopables 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":17,\\"i\\":1,\\"s\\":12}}"`; +exports[`well-known symbols > toCrossJSONStream > supports Symbol.unscopables 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":17,\\"i\\":2,\\"s\\":12}]}"`; exports[`well-known symbols > toJSON > supports well-known symbols 1`] = `"{\\"t\\":{\\"t\\":17,\\"i\\":0,\\"s\\":0},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/custom-event.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/custom-event.test.ts.snap index fe6c5447..5d649bcc 100644 --- a/packages/seroval/test/web-api/__snapshots__/custom-event.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/custom-event.test.ts.snap @@ -8,13 +8,13 @@ exports[`CustomEvent > crossSerializeAsync > scoped > supports CustomEvent 1`] = exports[`CustomEvent > crossSerializeAsync > supports CustomEvent 1`] = `"($R[0]=Promise.resolve($R[1]=new CustomEvent(\\"example\\",$R[2]={detail:$R[3]={},bubbles:!1,cancelable:!1,composed:!1})),$R[3].self=$R[3],$R[0])"`; -exports[`CustomEvent > crossSerializeStream > scoped > supports CustomEvent 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`CustomEvent > crossSerializeStream > scoped > supports CustomEvent 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`CustomEvent > crossSerializeStream > scoped > supports CustomEvent 2`] = `"($R=>_$.Ps($R[0],$R[1]=new CustomEvent(\\"example\\",$R[2]={detail:$R[3]={},bubbles:!1,cancelable:!1,composed:!1})),$R[3].self=$R[3],$R[0])($R[\\"example\\"])"`; +exports[`CustomEvent > crossSerializeStream > scoped > supports CustomEvent 2`] = `"($R=>($R[5]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new CustomEvent(\\"example\\",$R[3]={detail:$R[4]={},bubbles:!1,cancelable:!1,composed:!1})),$R[4].self=$R[4],$R[0])($R[\\"example\\"])"`; -exports[`CustomEvent > crossSerializeStream > supports CustomEvent 1`] = `"$R[0]=_$.P()"`; +exports[`CustomEvent > crossSerializeStream > supports CustomEvent 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`CustomEvent > crossSerializeStream > supports CustomEvent 2`] = `"(_$.Ps($R[0],$R[1]=new CustomEvent(\\"example\\",$R[2]={detail:$R[3]={},bubbles:!1,cancelable:!1,composed:!1})),$R[3].self=$R[3],$R[0])"`; +exports[`CustomEvent > crossSerializeStream > supports CustomEvent 2`] = `"(($R[5]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new CustomEvent(\\"example\\",$R[3]={detail:$R[4]={},bubbles:!1,cancelable:!1,composed:!1})),$R[4].self=$R[4],$R[0])"`; exports[`CustomEvent > serialize > supports CustomEvent 1`] = `"((h,j)=>(j=new CustomEvent(\\"example\\",{detail:h={},bubbles:!1,cancelable:!1,composed:!1}),h.self=h,j))()"`; @@ -24,9 +24,9 @@ exports[`CustomEvent > toCrossJSON > supports CustomEvent 1`] = `"{\\"t\\":38,\\ exports[`CustomEvent > toCrossJSONAsync > supports CustomEvent 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":38,\\"i\\":1,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"detail\\",\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"self\\"],\\"v\\":[{\\"t\\":4,\\"i\\":3}],\\"s\\":1},\\"o\\":0},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":4},\\"o\\":0}}}"`; -exports[`CustomEvent > toCrossJSONStream > supports CustomEvent 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`CustomEvent > toCrossJSONStream > supports CustomEvent 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`CustomEvent > toCrossJSONStream > supports CustomEvent 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":38,\\"i\\":1,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"detail\\",\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"self\\"],\\"v\\":[{\\"t\\":4,\\"i\\":3}],\\"s\\":1},\\"o\\":0},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":4},\\"o\\":0}}}"`; +exports[`CustomEvent > toCrossJSONStream > supports CustomEvent 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":5,\\"s\\":3},{\\"t\\":38,\\"i\\":2,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"detail\\",\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":10,\\"i\\":4,\\"p\\":{\\"k\\":[\\"self\\"],\\"v\\":[{\\"t\\":4,\\"i\\":4}],\\"s\\":1},\\"o\\":0},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":4},\\"o\\":0}}]}"`; exports[`CustomEvent > toJSON > supports CustomEvent 1`] = `"{\\"t\\":{\\"t\\":38,\\"i\\":0,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"detail\\",\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"self\\"],\\"v\\":[{\\"t\\":4,\\"i\\":2}],\\"s\\":1},\\"o\\":0},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":4},\\"o\\":0}},\\"f\\":16383,\\"m\\":[2]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/dom-exception.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/dom-exception.test.ts.snap index 3f8b61a3..f408f178 100644 --- a/packages/seroval/test/web-api/__snapshots__/dom-exception.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/dom-exception.test.ts.snap @@ -8,13 +8,13 @@ exports[`DOMException > crossSerializeAsync > scoped > supports DOMException 1`] exports[`DOMException > crossSerializeAsync > supports DOMException 1`] = `"$R[0]=Promise.resolve($R[1]=new DOMException(\\"This is an example message.\\",\\"Example\\"))"`; -exports[`DOMException > crossSerializeStream > scoped > supports DOMException 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`DOMException > crossSerializeStream > scoped > supports DOMException 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`DOMException > crossSerializeStream > scoped > supports DOMException 2`] = `"($R=>_$.Ps($R[0],$R[1]=new DOMException(\\"This is an example message.\\",\\"Example\\")))($R[\\"example\\"])"`; +exports[`DOMException > crossSerializeStream > scoped > supports DOMException 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new DOMException(\\"This is an example message.\\",\\"Example\\")))($R[\\"example\\"])"`; -exports[`DOMException > crossSerializeStream > supports DOMException 1`] = `"$R[0]=_$.P()"`; +exports[`DOMException > crossSerializeStream > supports DOMException 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`DOMException > crossSerializeStream > supports DOMException 2`] = `"_$.Ps($R[0],$R[1]=new DOMException(\\"This is an example message.\\",\\"Example\\"))"`; +exports[`DOMException > crossSerializeStream > supports DOMException 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new DOMException(\\"This is an example message.\\",\\"Example\\"))"`; exports[`DOMException > serialize > supports DOMException 1`] = `"new DOMException(\\"This is an example message.\\",\\"Example\\")"`; @@ -24,9 +24,9 @@ exports[`DOMException > toCrossJSON > supports DOMException 1`] = `"{\\"t\\":39, exports[`DOMException > toCrossJSONAsync > supports DOMException 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":39,\\"i\\":1,\\"s\\":\\"This is an example message.\\",\\"c\\":\\"Example\\"}}"`; -exports[`DOMException > toCrossJSONStream > supports DOMException 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`DOMException > toCrossJSONStream > supports DOMException 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`DOMException > toCrossJSONStream > supports DOMException 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":39,\\"i\\":1,\\"s\\":\\"This is an example message.\\",\\"c\\":\\"Example\\"}}"`; +exports[`DOMException > toCrossJSONStream > supports DOMException 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":39,\\"i\\":2,\\"s\\":\\"This is an example message.\\",\\"c\\":\\"Example\\"}]}"`; exports[`DOMException > toJSON > supports DOMException 1`] = `"{\\"t\\":{\\"t\\":39,\\"i\\":0,\\"s\\":\\"This is an example message.\\",\\"c\\":\\"Example\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/event.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/event.test.ts.snap index 40c4f8bc..fa4b4918 100644 --- a/packages/seroval/test/web-api/__snapshots__/event.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/event.test.ts.snap @@ -8,13 +8,13 @@ exports[`Event > crossSerializeAsync > scoped > supports Event 1`] = `"($R=>$R[0 exports[`Event > crossSerializeAsync > supports Event 1`] = `"$R[0]=Promise.resolve($R[1]=new Event(\\"example\\",$R[2]={bubbles:!1,cancelable:!1,composed:!1}))"`; -exports[`Event > crossSerializeStream > scoped > supports Event 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Event > crossSerializeStream > scoped > supports Event 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Event > crossSerializeStream > scoped > supports Event 2`] = `"($R=>_$.Ps($R[0],$R[1]=new Event(\\"example\\",$R[2]={bubbles:!1,cancelable:!1,composed:!1})))($R[\\"example\\"])"`; +exports[`Event > crossSerializeStream > scoped > supports Event 2`] = `"($R=>($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Event(\\"example\\",$R[3]={bubbles:!1,cancelable:!1,composed:!1})))($R[\\"example\\"])"`; -exports[`Event > crossSerializeStream > supports Event 1`] = `"$R[0]=_$.P()"`; +exports[`Event > crossSerializeStream > supports Event 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Event > crossSerializeStream > supports Event 2`] = `"_$.Ps($R[0],$R[1]=new Event(\\"example\\",$R[2]={bubbles:!1,cancelable:!1,composed:!1}))"`; +exports[`Event > crossSerializeStream > supports Event 2`] = `"($R[4]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Event(\\"example\\",$R[3]={bubbles:!1,cancelable:!1,composed:!1}))"`; exports[`Event > serialize > supports Event 1`] = `"new Event(\\"example\\",{bubbles:!1,cancelable:!1,composed:!1})"`; @@ -24,9 +24,9 @@ exports[`Event > toCrossJSON > supports Event 1`] = `"{\\"t\\":37,\\"i\\":0,\\"s exports[`Event > toCrossJSONAsync > supports Event 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":37,\\"i\\":1,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":3},\\"o\\":0}}}"`; -exports[`Event > toCrossJSONStream > supports Event 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Event > toCrossJSONStream > supports Event 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Event > toCrossJSONStream > supports Event 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":37,\\"i\\":1,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":3},\\"o\\":0}}}"`; +exports[`Event > toCrossJSONStream > supports Event 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":4,\\"s\\":3},{\\"t\\":37,\\"i\\":2,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":3},\\"o\\":0}}]}"`; exports[`Event > toJSON > supports Event 1`] = `"{\\"t\\":{\\"t\\":37,\\"i\\":0,\\"s\\":\\"example\\",\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"bubbles\\",\\"cancelable\\",\\"composed\\"],\\"v\\":[{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3},{\\"t\\":2,\\"s\\":3}],\\"s\\":3},\\"o\\":0}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/form-data.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/form-data.test.ts.snap index 08697eab..973488b5 100644 --- a/packages/seroval/test/web-api/__snapshots__/form-data.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/form-data.test.ts.snap @@ -8,13 +8,13 @@ exports[`FormData > crossSerializeAsync > scoped > supports FormData 1`] = `"($R exports[`FormData > crossSerializeAsync > supports FormData 1`] = `"($R[0]=new FormData(),$R[0].append(\\"hello-world\\",$R[1]=new File([$R[2]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100]).buffer],\\"hello.txt\\",{type:\\"text/plain\\",lastModified:1681027542680})),$R[0].append(\\"foo-bar\\",$R[3]=new File([$R[4]=new Uint8Array([70,111,111,32,66,97,114]).buffer],\\"foo-bar.txt\\",{type:\\"text/plain\\",lastModified:1681027542680})),$R[0])"`; -exports[`FormData > crossSerializeStream > scoped > supports FormData 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`FormData > crossSerializeStream > scoped > supports FormData 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`FormData > crossSerializeStream > scoped > supports FormData 2`] = `"($R=>_$.Ps($R[0],($R[1]=new FormData(),$R[1].append(\\"hello\\",\\"world\\"),$R[1].append(\\"foo\\",\\"bar\\"),$R[1])))($R[\\"example\\"])"`; +exports[`FormData > crossSerializeStream > scoped > supports FormData 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],($R[2]=new FormData(),$R[2].append(\\"hello\\",\\"world\\"),$R[2].append(\\"foo\\",\\"bar\\"),$R[2])))($R[\\"example\\"])"`; -exports[`FormData > crossSerializeStream > supports FormData 1`] = `"$R[0]=_$.P()"`; +exports[`FormData > crossSerializeStream > supports FormData 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`FormData > crossSerializeStream > supports FormData 2`] = `"_$.Ps($R[0],($R[1]=new FormData(),$R[1].append(\\"hello\\",\\"world\\"),$R[1].append(\\"foo\\",\\"bar\\"),$R[1]))"`; +exports[`FormData > crossSerializeStream > supports FormData 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],($R[2]=new FormData(),$R[2].append(\\"hello\\",\\"world\\"),$R[2].append(\\"foo\\",\\"bar\\"),$R[2]))"`; exports[`FormData > serialize > supports FormData 1`] = `"(h=>((h=new FormData(),h.append(\\"hello\\",\\"world\\"),h.append(\\"foo\\",\\"bar\\"),h)))()"`; @@ -24,9 +24,9 @@ exports[`FormData > toCrossJSON > supports FormData 1`] = `"{\\"t\\":26,\\"i\\": exports[`FormData > toCrossJSONAsync > supports FormData 1`] = `"{\\"t\\":26,\\"i\\":0,\\"e\\":{\\"k\\":[\\"hello-world\\",\\"foo-bar\\"],\\"v\\":[{\\"t\\":24,\\"i\\":1,\\"c\\":\\"text/plain\\",\\"m\\":\\"hello.txt\\",\\"f\\":{\\"t\\":21,\\"i\\":2,\\"s\\":[72,101,108,108,111,32,87,111,114,108,100]},\\"b\\":1681027542680},{\\"t\\":24,\\"i\\":3,\\"c\\":\\"text/plain\\",\\"m\\":\\"foo-bar.txt\\",\\"f\\":{\\"t\\":21,\\"i\\":4,\\"s\\":[70,111,111,32,66,97,114]},\\"b\\":1681027542680}],\\"s\\":2}}"`; -exports[`FormData > toCrossJSONStream > supports FormData 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`FormData > toCrossJSONStream > supports FormData 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`FormData > toCrossJSONStream > supports FormData 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":26,\\"i\\":1,\\"e\\":{\\"k\\":[\\"hello\\",\\"foo\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"},{\\"t\\":1,\\"s\\":\\"bar\\"}],\\"s\\":2}}}"`; +exports[`FormData > toCrossJSONStream > supports FormData 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":26,\\"i\\":2,\\"e\\":{\\"k\\":[\\"hello\\",\\"foo\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"},{\\"t\\":1,\\"s\\":\\"bar\\"}],\\"s\\":2}}]}"`; exports[`FormData > toJSON > supports FormData 1`] = `"{\\"t\\":{\\"t\\":26,\\"i\\":0,\\"e\\":{\\"k\\":[\\"hello\\",\\"foo\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"world\\"},{\\"t\\":1,\\"s\\":\\"bar\\"}],\\"s\\":2}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/headers.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/headers.test.ts.snap index d2d66cd0..cb394f17 100644 --- a/packages/seroval/test/web-api/__snapshots__/headers.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/headers.test.ts.snap @@ -8,13 +8,13 @@ exports[`Headers > crossSerializeAsync > scoped > supports Headers 1`] = `"($R=> exports[`Headers > crossSerializeAsync > supports Headers 1`] = `"$R[0]=Promise.resolve($R[1]=new Headers({\\"content-encoding\\":\\"gzip\\",\\"content-type\\":\\"text/plain\\"}))"`; -exports[`Headers > crossSerializeStream > scoped > supports Headers 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`Headers > crossSerializeStream > scoped > supports Headers 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`Headers > crossSerializeStream > scoped > supports Headers 2`] = `"($R=>_$.Ps($R[0],$R[1]=new Headers({\\"content-encoding\\":\\"gzip\\",\\"content-type\\":\\"text/plain\\"})))($R[\\"example\\"])"`; +exports[`Headers > crossSerializeStream > scoped > supports Headers 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Headers({\\"content-encoding\\":\\"gzip\\",\\"content-type\\":\\"text/plain\\"})))($R[\\"example\\"])"`; -exports[`Headers > crossSerializeStream > supports Headers 1`] = `"$R[0]=_$.P()"`; +exports[`Headers > crossSerializeStream > supports Headers 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`Headers > crossSerializeStream > supports Headers 2`] = `"_$.Ps($R[0],$R[1]=new Headers({\\"content-encoding\\":\\"gzip\\",\\"content-type\\":\\"text/plain\\"}))"`; +exports[`Headers > crossSerializeStream > supports Headers 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new Headers({\\"content-encoding\\":\\"gzip\\",\\"content-type\\":\\"text/plain\\"}))"`; exports[`Headers > serialize > supports Headers 1`] = `"new Headers({\\"content-encoding\\":\\"gzip\\",\\"content-type\\":\\"text/plain\\"})"`; @@ -24,9 +24,9 @@ exports[`Headers > toCrossJSON > supports Headers 1`] = `"{\\"t\\":25,\\"i\\":0, exports[`Headers > toCrossJSONAsync > supports Headers 1`] = `"{\\"t\\":12,\\"i\\":0,\\"s\\":1,\\"f\\":{\\"t\\":25,\\"i\\":1,\\"e\\":{\\"k\\":[\\"content-encoding\\",\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"gzip\\"},{\\"t\\":1,\\"s\\":\\"text/plain\\"}],\\"s\\":2}}}"`; -exports[`Headers > toCrossJSONStream > supports Headers 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`Headers > toCrossJSONStream > supports Headers 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`Headers > toCrossJSONStream > supports Headers 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":25,\\"i\\":1,\\"e\\":{\\"k\\":[\\"content-encoding\\",\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"gzip\\"},{\\"t\\":1,\\"s\\":\\"text/plain\\"}],\\"s\\":2}}}"`; +exports[`Headers > toCrossJSONStream > supports Headers 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":25,\\"i\\":2,\\"e\\":{\\"k\\":[\\"content-encoding\\",\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"gzip\\"},{\\"t\\":1,\\"s\\":\\"text/plain\\"}],\\"s\\":2}}]}"`; exports[`Headers > toJSON > supports Headers 1`] = `"{\\"t\\":{\\"t\\":25,\\"i\\":0,\\"e\\":{\\"k\\":[\\"content-encoding\\",\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"gzip\\"},{\\"t\\":1,\\"s\\":\\"text/plain\\"}],\\"s\\":2}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/readable-stream.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/readable-stream.test.ts.snap index 1f74f37b..607fe67d 100644 --- a/packages/seroval/test/web-api/__snapshots__/readable-stream.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/readable-stream.test.ts.snap @@ -8,62 +8,62 @@ exports[`ReadableStream > crossSerializeAsync > supports ReadableStream 1`] = `" exports[`ReadableStream > crossSerializeAsync > supports ReadableStream errors 1`] = `"$R[0]=($R[1]=s=>new ReadableStream({start:c=>Promise.resolve().then((i,v)=>{for(i=0;i crossSerializeStream > scoped > supports ReadableStream 1`] = `"($R=>$R[0]=_$.S())($R[\\"example\\"])"`; +exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 1`] = `"($R=>$R[0]=($R[1]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())($R[\\"example\\"])"`; -exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 2`] = `"($R=>_$.Se($R[0],\\"foo\\"))($R[\\"example\\"])"`; +exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 2`] = `"($R=>($R[2]=(s,d)=>{s.c.enqueue(d)})($R[0],\\"foo\\"))($R[\\"example\\"])"`; -exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 3`] = `"($R=>_$.Se($R[0],\\"bar\\"))($R[\\"example\\"])"`; +exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 3`] = `"($R=>$R[2]($R[0],\\"bar\\"))($R[\\"example\\"])"`; -exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 4`] = `"($R=>_$.Se($R[0],\\"baz\\"))($R[\\"example\\"])"`; +exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 4`] = `"($R=>$R[2]($R[0],\\"baz\\"))($R[\\"example\\"])"`; -exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 5`] = `"($R=>_$.Sc($R[0]))($R[\\"example\\"])"`; +exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 5`] = `"($R=>($R[3]=s=>{s.c.close();delete s.c})($R[0]))($R[\\"example\\"])"`; -exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream errors 1`] = `"($R=>$R[0]=_$.S())($R[\\"example\\"])"`; +exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream errors 1`] = `"($R=>$R[0]=($R[1]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))())($R[\\"example\\"])"`; -exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream errors 2`] = `"($R=>_$.St($R[0],$R[1]=Object.assign(new Error(\\"Oops!\\"),{stack:\\"\\"})))($R[\\"example\\"])"`; +exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream errors 2`] = `"($R=>($R[3]=(s,d)=>{s.c.error(d);delete s.c})($R[0],$R[2]=Object.assign(new Error(\\"Oops!\\"),{stack:\\"\\"})))($R[\\"example\\"])"`; -exports[`ReadableStream > crossSerializeStream > supports ReadableStream 1`] = `"$R[0]=_$.S()"`; +exports[`ReadableStream > crossSerializeStream > supports ReadableStream 1`] = `"$R[0]=($R[1]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))()"`; -exports[`ReadableStream > crossSerializeStream > supports ReadableStream 2`] = `"_$.Se($R[0],\\"foo\\")"`; +exports[`ReadableStream > crossSerializeStream > supports ReadableStream 2`] = `"($R[2]=(s,d)=>{s.c.enqueue(d)})($R[0],\\"foo\\")"`; -exports[`ReadableStream > crossSerializeStream > supports ReadableStream 3`] = `"_$.Se($R[0],\\"bar\\")"`; +exports[`ReadableStream > crossSerializeStream > supports ReadableStream 3`] = `"$R[2]($R[0],\\"bar\\")"`; -exports[`ReadableStream > crossSerializeStream > supports ReadableStream 4`] = `"_$.Se($R[0],\\"baz\\")"`; +exports[`ReadableStream > crossSerializeStream > supports ReadableStream 4`] = `"$R[2]($R[0],\\"baz\\")"`; -exports[`ReadableStream > crossSerializeStream > supports ReadableStream 5`] = `"_$.Sc($R[0])"`; +exports[`ReadableStream > crossSerializeStream > supports ReadableStream 5`] = `"($R[3]=s=>{s.c.close();delete s.c})($R[0])"`; -exports[`ReadableStream > crossSerializeStream > supports ReadableStream errors 1`] = `"$R[0]=_$.S()"`; +exports[`ReadableStream > crossSerializeStream > supports ReadableStream errors 1`] = `"$R[0]=($R[1]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))()"`; -exports[`ReadableStream > crossSerializeStream > supports ReadableStream errors 2`] = `"_$.St($R[0],$R[1]=Object.assign(new Error(\\"Oops!\\"),{stack:\\"\\"}))"`; +exports[`ReadableStream > crossSerializeStream > supports ReadableStream errors 2`] = `"($R[3]=(s,d)=>{s.c.error(d);delete s.c})($R[0],$R[2]=Object.assign(new Error(\\"Oops!\\"),{stack:\\"\\"}))"`; -exports[`ReadableStream > serializeAsync > supports ReadableStream 1`] = `"(s=>new ReadableStream({start:c=>Promise.resolve().then((i,v)=>{for(i=0;i serializeAsync > supports ReadableStream 1`] = `"(h=>((s=>new ReadableStream({start:c=>Promise.resolve().then((i,v)=>{for(i=0;i serializeAsync > supports ReadableStream errors 1`] = `"(s=>new ReadableStream({start:c=>Promise.resolve().then((i,v)=>{for(i=0;i serializeAsync > supports ReadableStream errors 1`] = `"(h=>((s=>new ReadableStream({start:c=>Promise.resolve().then((i,v)=>{for(i=0;i serializeAsync > supports ReadableStream errors 2`] = `"Oops!"`; -exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream 1`] = `"{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":47,\\"i\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":4,\\"a\\":[{\\"t\\":1,\\"s\\":\\"foo\\"},{\\"t\\":1,\\"s\\":\\"bar\\"},{\\"t\\":1,\\"s\\":\\"baz\\"},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}"`; +exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream 1`] = `"{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":1,\\"s\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":4,\\"a\\":[{\\"t\\":1,\\"s\\":\\"foo\\"},{\\"t\\":1,\\"s\\":\\"bar\\"},{\\"t\\":1,\\"s\\":\\"baz\\"},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]}"`; -exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 1`] = `"{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":47,\\"i\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":1,\\"a\\":[{\\"t\\":13,\\"i\\":4,\\"s\\":0,\\"m\\":\\"Oops!\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}],\\"o\\":0},{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":0}],\\"s\\":3},\\"o\\":0}]}"`; +exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 1`] = `"{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":1,\\"s\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":1,\\"a\\":[{\\"t\\":13,\\"i\\":4,\\"s\\":0,\\"m\\":\\"Oops!\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}],\\"o\\":0},{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":0}],\\"s\\":3},\\"o\\":0}]}"`; exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 2`] = `"Oops!"`; -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 1`] = `"{\\"t\\":31,\\"i\\":0}"`; +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 1`] = `"{\\"t\\":31,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":5}}"`; -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 2`] = `"{\\"t\\":32,\\"i\\":0,\\"f\\":{\\"t\\":1,\\"s\\":\\"foo\\"}}"`; +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 2`] = `"{\\"t\\":32,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":2,\\"s\\":6},{\\"t\\":1,\\"s\\":\\"foo\\"}]}"`; -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 3`] = `"{\\"t\\":32,\\"i\\":0,\\"f\\":{\\"t\\":1,\\"s\\":\\"bar\\"}}"`; +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 3`] = `"{\\"t\\":32,\\"i\\":0,\\"a\\":[{\\"t\\":4,\\"i\\":2},{\\"t\\":1,\\"s\\":\\"bar\\"}]}"`; -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 4`] = `"{\\"t\\":32,\\"i\\":0,\\"f\\":{\\"t\\":1,\\"s\\":\\"baz\\"}}"`; +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 4`] = `"{\\"t\\":32,\\"i\\":0,\\"a\\":[{\\"t\\":4,\\"i\\":2},{\\"t\\":1,\\"s\\":\\"baz\\"}]}"`; -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 5`] = `"{\\"t\\":33,\\"i\\":0}"`; +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 5`] = `"{\\"t\\":33,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":8}}"`; -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 1`] = `"{\\"t\\":31,\\"i\\":0}"`; +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 1`] = `"{\\"t\\":31,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":5}}"`; -exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 2`] = `"{\\"t\\":34,\\"i\\":0,\\"f\\":{\\"t\\":13,\\"i\\":1,\\"s\\":0,\\"m\\":\\"Oops!\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}}"`; +exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 2`] = `"{\\"t\\":34,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":7},{\\"t\\":13,\\"i\\":2,\\"s\\":0,\\"m\\":\\"Oops!\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}]}"`; -exports[`ReadableStream > toJSONAsync > supports ReadableStream 1`] = `"{\\"t\\":{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":47,\\"i\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":4,\\"a\\":[{\\"t\\":1,\\"s\\":\\"foo\\"},{\\"t\\":1,\\"s\\":\\"bar\\"},{\\"t\\":1,\\"s\\":\\"baz\\"},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]},\\"f\\":16383,\\"m\\":[]}"`; +exports[`ReadableStream > toJSONAsync > supports ReadableStream 1`] = `"{\\"t\\":{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":1,\\"s\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":4,\\"a\\":[{\\"t\\":1,\\"s\\":\\"foo\\"},{\\"t\\":1,\\"s\\":\\"bar\\"},{\\"t\\":1,\\"s\\":\\"baz\\"},{\\"t\\":2,\\"s\\":1}],\\"o\\":0},{\\"t\\":0,\\"s\\":-1},{\\"t\\":0,\\"s\\":3}],\\"s\\":3},\\"o\\":0}]},\\"f\\":16383,\\"m\\":[]}"`; -exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 1`] = `"{\\"t\\":{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":47,\\"i\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":1,\\"a\\":[{\\"t\\":13,\\"i\\":4,\\"s\\":0,\\"m\\":\\"Oops!\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}],\\"o\\":0},{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":0}],\\"s\\":3},\\"o\\":0}]},\\"f\\":16383,\\"m\\":[]}"`; +exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 1`] = `"{\\"t\\":{\\"t\\":46,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":1,\\"s\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"v\\",\\"t\\",\\"d\\"],\\"v\\":[{\\"t\\":9,\\"i\\":3,\\"l\\":1,\\"a\\":[{\\"t\\":13,\\"i\\":4,\\"s\\":0,\\"m\\":\\"Oops!\\",\\"p\\":{\\"k\\":[\\"stack\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":1}}],\\"o\\":0},{\\"t\\":0,\\"s\\":0},{\\"t\\":0,\\"s\\":0}],\\"s\\":3},\\"o\\":0}]},\\"f\\":16383,\\"m\\":[]}"`; exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 2`] = `"Oops!"`; diff --git a/packages/seroval/test/web-api/__snapshots__/request.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/request.test.ts.snap index 6a1366cf..b99b01b3 100644 --- a/packages/seroval/test/web-api/__snapshots__/request.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/request.test.ts.snap @@ -4,25 +4,25 @@ exports[`Request > crossSerializeAsync > scoped > supports Blob 1`] = `"($R=>$R[ exports[`Request > crossSerializeAsync > supports Blob 1`] = `"$R[0]=new Request(\\"http://localhost:3000/\\",$R[1]={body:$R[2]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,cache:\\"default\\",credentials:\\"same-origin\\",headers:$R[3]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),integrity:\\"\\",keepalive:!1,method:\\"POST\\",mode:\\"cors\\",redirect:\\"follow\\",referrer:\\"about:client\\",referrerPolicy:\\"\\"})"`; -exports[`Request > crossSerializeStream > scoped > supports Request 1`] = `"($R=>$R[0]=new Request(\\"http://localhost:3000/\\",$R[1]={body:$R[2]=_$.S(),cache:\\"default\\",credentials:\\"same-origin\\",headers:$R[3]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),integrity:\\"\\",keepalive:!1,method:\\"POST\\",mode:\\"cors\\",redirect:\\"follow\\",referrer:\\"about:client\\",referrerPolicy:\\"\\"}))($R[\\"example\\"])"`; +exports[`Request > crossSerializeStream > scoped > supports Request 1`] = `"($R=>$R[0]=new Request(\\"http://localhost:3000/\\",$R[1]={body:$R[2]=($R[3]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))(),cache:\\"default\\",credentials:\\"same-origin\\",headers:$R[4]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),integrity:\\"\\",keepalive:!1,method:\\"POST\\",mode:\\"cors\\",redirect:\\"follow\\",referrer:\\"about:client\\",referrerPolicy:\\"\\"}))($R[\\"example\\"])"`; -exports[`Request > crossSerializeStream > scoped > supports Request 2`] = `"($R=>_$.Se($R[2],$R[4]=new Uint8Array($R[5]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12)))($R[\\"example\\"])"`; +exports[`Request > crossSerializeStream > scoped > supports Request 2`] = `"($R=>($R[7]=(s,d)=>{s.c.enqueue(d)})($R[2],$R[5]=new Uint8Array($R[6]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12)))($R[\\"example\\"])"`; -exports[`Request > crossSerializeStream > scoped > supports Request 3`] = `"($R=>_$.Sc($R[2]))($R[\\"example\\"])"`; +exports[`Request > crossSerializeStream > scoped > supports Request 3`] = `"($R=>($R[8]=s=>{s.c.close();delete s.c})($R[2]))($R[\\"example\\"])"`; -exports[`Request > crossSerializeStream > supports Request 1`] = `"$R[0]=new Request(\\"http://localhost:3000/\\",$R[1]={body:$R[2]=_$.S(),cache:\\"default\\",credentials:\\"same-origin\\",headers:$R[3]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),integrity:\\"\\",keepalive:!1,method:\\"POST\\",mode:\\"cors\\",redirect:\\"follow\\",referrer:\\"about:client\\",referrerPolicy:\\"\\"})"`; +exports[`Request > crossSerializeStream > supports Request 1`] = `"$R[0]=new Request(\\"http://localhost:3000/\\",$R[1]={body:$R[2]=($R[3]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))(),cache:\\"default\\",credentials:\\"same-origin\\",headers:$R[4]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),integrity:\\"\\",keepalive:!1,method:\\"POST\\",mode:\\"cors\\",redirect:\\"follow\\",referrer:\\"about:client\\",referrerPolicy:\\"\\"})"`; -exports[`Request > crossSerializeStream > supports Request 2`] = `"_$.Se($R[2],$R[4]=new Uint8Array($R[5]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12))"`; +exports[`Request > crossSerializeStream > supports Request 2`] = `"($R[7]=(s,d)=>{s.c.enqueue(d)})($R[2],$R[5]=new Uint8Array($R[6]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12))"`; -exports[`Request > crossSerializeStream > supports Request 3`] = `"_$.Sc($R[2])"`; +exports[`Request > crossSerializeStream > supports Request 3`] = `"($R[8]=s=>{s.c.close();delete s.c})($R[2])"`; exports[`Request > serializeAsync > supports Request 1`] = `"new Request(\\"http://localhost:3000/\\",{body:new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,cache:\\"default\\",credentials:\\"same-origin\\",headers:new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),integrity:\\"\\",keepalive:!1,method:\\"POST\\",mode:\\"cors\\",redirect:\\"follow\\",referrer:\\"about:client\\",referrerPolicy:\\"\\"})"`; -exports[`Request > toCrossJSONStream > supports Request 1`] = `"{\\"t\\":35,\\"i\\":0,\\"s\\":\\"http://localhost:3000/\\",\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"body\\",\\"cache\\",\\"credentials\\",\\"headers\\",\\"integrity\\",\\"keepalive\\",\\"method\\",\\"mode\\",\\"redirect\\",\\"referrer\\",\\"referrerPolicy\\"],\\"v\\":[{\\"t\\":31,\\"i\\":2},{\\"t\\":1,\\"s\\":\\"default\\"},{\\"t\\":1,\\"s\\":\\"same-origin\\"},{\\"t\\":25,\\"i\\":3,\\"e\\":{\\"k\\":[\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"text/plain;charset=UTF-8\\"}],\\"s\\":1}},{\\"t\\":1,\\"s\\":\\"\\"},{\\"t\\":2,\\"s\\":3},{\\"t\\":1,\\"s\\":\\"POST\\"},{\\"t\\":1,\\"s\\":\\"cors\\"},{\\"t\\":1,\\"s\\":\\"follow\\"},{\\"t\\":1,\\"s\\":\\"about:client\\"},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":11},\\"o\\":0}}"`; +exports[`Request > toCrossJSONStream > supports Request 1`] = `"{\\"t\\":35,\\"i\\":0,\\"s\\":\\"http://localhost:3000/\\",\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"body\\",\\"cache\\",\\"credentials\\",\\"headers\\",\\"integrity\\",\\"keepalive\\",\\"method\\",\\"mode\\",\\"redirect\\",\\"referrer\\",\\"referrerPolicy\\"],\\"v\\":[{\\"t\\":31,\\"i\\":2,\\"f\\":{\\"t\\":41,\\"i\\":3,\\"s\\":5}},{\\"t\\":1,\\"s\\":\\"default\\"},{\\"t\\":1,\\"s\\":\\"same-origin\\"},{\\"t\\":25,\\"i\\":4,\\"e\\":{\\"k\\":[\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"text/plain;charset=UTF-8\\"}],\\"s\\":1}},{\\"t\\":1,\\"s\\":\\"\\"},{\\"t\\":2,\\"s\\":3},{\\"t\\":1,\\"s\\":\\"POST\\"},{\\"t\\":1,\\"s\\":\\"cors\\"},{\\"t\\":1,\\"s\\":\\"follow\\"},{\\"t\\":1,\\"s\\":\\"about:client\\"},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":11},\\"o\\":0}}"`; -exports[`Request > toCrossJSONStream > supports Request 2`] = `"{\\"t\\":32,\\"i\\":2,\\"f\\":{\\"t\\":15,\\"i\\":4,\\"l\\":12,\\"c\\":\\"Uint8Array\\",\\"f\\":{\\"t\\":21,\\"i\\":5,\\"s\\":[72,101,108,108,111,32,87,111,114,108,100,33]},\\"b\\":0}}"`; +exports[`Request > toCrossJSONStream > supports Request 2`] = `"{\\"t\\":32,\\"i\\":2,\\"a\\":[{\\"t\\":41,\\"i\\":7,\\"s\\":6},{\\"t\\":15,\\"i\\":5,\\"l\\":12,\\"c\\":\\"Uint8Array\\",\\"f\\":{\\"t\\":21,\\"i\\":6,\\"s\\":[72,101,108,108,111,32,87,111,114,108,100,33]},\\"b\\":0}]}"`; -exports[`Request > toCrossJSONStream > supports Request 3`] = `"{\\"t\\":33,\\"i\\":2}"`; +exports[`Request > toCrossJSONStream > supports Request 3`] = `"{\\"t\\":33,\\"i\\":2,\\"f\\":{\\"t\\":41,\\"i\\":8,\\"s\\":8}}"`; exports[`Request > toJSONAsync > supports Request 1`] = `"{\\"t\\":{\\"t\\":35,\\"i\\":0,\\"s\\":\\"http://localhost:3000/\\",\\"f\\":{\\"t\\":10,\\"i\\":1,\\"p\\":{\\"k\\":[\\"body\\",\\"cache\\",\\"credentials\\",\\"headers\\",\\"integrity\\",\\"keepalive\\",\\"method\\",\\"mode\\",\\"redirect\\",\\"referrer\\",\\"referrerPolicy\\"],\\"v\\":[{\\"t\\":21,\\"i\\":2,\\"s\\":[72,101,108,108,111,32,87,111,114,108,100,33]},{\\"t\\":1,\\"s\\":\\"default\\"},{\\"t\\":1,\\"s\\":\\"same-origin\\"},{\\"t\\":25,\\"i\\":3,\\"e\\":{\\"k\\":[\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"text/plain;charset=UTF-8\\"}],\\"s\\":1}},{\\"t\\":1,\\"s\\":\\"\\"},{\\"t\\":2,\\"s\\":3},{\\"t\\":1,\\"s\\":\\"POST\\"},{\\"t\\":1,\\"s\\":\\"cors\\"},{\\"t\\":1,\\"s\\":\\"follow\\"},{\\"t\\":1,\\"s\\":\\"about:client\\"},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":11},\\"o\\":0}},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/response.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/response.test.ts.snap index bf081b31..9e350bb8 100644 --- a/packages/seroval/test/web-api/__snapshots__/response.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/response.test.ts.snap @@ -4,25 +4,25 @@ exports[`Response > crossSerializeAsync > scoped > supports Blob 1`] = `"($R=>$R exports[`Response > crossSerializeAsync > supports Blob 1`] = `"$R[0]=new Response($R[1]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,$R[2]={headers:$R[3]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),status:200,statusText:\\"\\"})"`; -exports[`Response > crossSerializeStream > scoped > supports Response 1`] = `"($R=>$R[0]=new Response($R[1]=_$.S(),$R[2]={headers:$R[3]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),status:200,statusText:\\"\\"}))($R[\\"example\\"])"`; +exports[`Response > crossSerializeStream > scoped > supports Response 1`] = `"($R=>$R[0]=new Response($R[1]=($R[2]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))(),$R[3]={headers:$R[4]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),status:200,statusText:\\"\\"}))($R[\\"example\\"])"`; -exports[`Response > crossSerializeStream > scoped > supports Response 2`] = `"($R=>_$.Se($R[1],$R[4]=new Uint8Array($R[5]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12)))($R[\\"example\\"])"`; +exports[`Response > crossSerializeStream > scoped > supports Response 2`] = `"($R=>($R[7]=(s,d)=>{s.c.enqueue(d)})($R[1],$R[5]=new Uint8Array($R[6]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12)))($R[\\"example\\"])"`; -exports[`Response > crossSerializeStream > scoped > supports Response 3`] = `"($R=>_$.Sc($R[1]))($R[\\"example\\"])"`; +exports[`Response > crossSerializeStream > scoped > supports Response 3`] = `"($R=>($R[8]=s=>{s.c.close();delete s.c})($R[1]))($R[\\"example\\"])"`; -exports[`Response > crossSerializeStream > supports Response 1`] = `"$R[0]=new Response($R[1]=_$.S(),$R[2]={headers:$R[3]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),status:200,statusText:\\"\\"})"`; +exports[`Response > crossSerializeStream > supports Response 1`] = `"$R[0]=new Response($R[1]=($R[2]=(s,c)=>((s=new ReadableStream({start:x=>{c=x}})).c=c,s))(),$R[3]={headers:$R[4]=new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),status:200,statusText:\\"\\"})"`; -exports[`Response > crossSerializeStream > supports Response 2`] = `"_$.Se($R[1],$R[4]=new Uint8Array($R[5]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12))"`; +exports[`Response > crossSerializeStream > supports Response 2`] = `"($R[7]=(s,d)=>{s.c.enqueue(d)})($R[1],$R[5]=new Uint8Array($R[6]=new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,0,12))"`; -exports[`Response > crossSerializeStream > supports Response 3`] = `"_$.Sc($R[1])"`; +exports[`Response > crossSerializeStream > supports Response 3`] = `"($R[8]=s=>{s.c.close();delete s.c})($R[1])"`; exports[`Response > serializeAsync > supports Response 1`] = `"new Response(new Uint8Array([72,101,108,108,111,32,87,111,114,108,100,33]).buffer,{headers:new Headers({\\"content-type\\":\\"text/plain;charset=UTF-8\\"}),status:200,statusText:\\"\\"})"`; -exports[`Response > toCrossJSONStream > supports Response 1`] = `"{\\"t\\":36,\\"i\\":0,\\"a\\":[{\\"t\\":31,\\"i\\":1},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"headers\\",\\"status\\",\\"statusText\\"],\\"v\\":[{\\"t\\":25,\\"i\\":3,\\"e\\":{\\"k\\":[\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"text/plain;charset=UTF-8\\"}],\\"s\\":1}},{\\"t\\":0,\\"s\\":200},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":3},\\"o\\":0}]}"`; +exports[`Response > toCrossJSONStream > supports Response 1`] = `"{\\"t\\":36,\\"i\\":0,\\"a\\":[{\\"t\\":31,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":2,\\"s\\":5}},{\\"t\\":10,\\"i\\":3,\\"p\\":{\\"k\\":[\\"headers\\",\\"status\\",\\"statusText\\"],\\"v\\":[{\\"t\\":25,\\"i\\":4,\\"e\\":{\\"k\\":[\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"text/plain;charset=UTF-8\\"}],\\"s\\":1}},{\\"t\\":0,\\"s\\":200},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":3},\\"o\\":0}]}"`; -exports[`Response > toCrossJSONStream > supports Response 2`] = `"{\\"t\\":32,\\"i\\":1,\\"f\\":{\\"t\\":15,\\"i\\":4,\\"l\\":12,\\"c\\":\\"Uint8Array\\",\\"f\\":{\\"t\\":21,\\"i\\":5,\\"s\\":[72,101,108,108,111,32,87,111,114,108,100,33]},\\"b\\":0}}"`; +exports[`Response > toCrossJSONStream > supports Response 2`] = `"{\\"t\\":32,\\"i\\":1,\\"a\\":[{\\"t\\":41,\\"i\\":7,\\"s\\":6},{\\"t\\":15,\\"i\\":5,\\"l\\":12,\\"c\\":\\"Uint8Array\\",\\"f\\":{\\"t\\":21,\\"i\\":6,\\"s\\":[72,101,108,108,111,32,87,111,114,108,100,33]},\\"b\\":0}]}"`; -exports[`Response > toCrossJSONStream > supports Response 3`] = `"{\\"t\\":33,\\"i\\":1}"`; +exports[`Response > toCrossJSONStream > supports Response 3`] = `"{\\"t\\":33,\\"i\\":1,\\"f\\":{\\"t\\":41,\\"i\\":8,\\"s\\":8}}"`; exports[`Response > toJSONAsync > supports Response 1`] = `"{\\"t\\":{\\"t\\":36,\\"i\\":0,\\"a\\":[{\\"t\\":21,\\"i\\":1,\\"s\\":[72,101,108,108,111,32,87,111,114,108,100,33]},{\\"t\\":10,\\"i\\":2,\\"p\\":{\\"k\\":[\\"headers\\",\\"status\\",\\"statusText\\"],\\"v\\":[{\\"t\\":25,\\"i\\":3,\\"e\\":{\\"k\\":[\\"content-type\\"],\\"v\\":[{\\"t\\":1,\\"s\\":\\"text/plain;charset=UTF-8\\"}],\\"s\\":1}},{\\"t\\":0,\\"s\\":200},{\\"t\\":1,\\"s\\":\\"\\"}],\\"s\\":3},\\"o\\":0}]},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/url-search-params.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/url-search-params.test.ts.snap index e3e91837..f6ced126 100644 --- a/packages/seroval/test/web-api/__snapshots__/url-search-params.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/url-search-params.test.ts.snap @@ -8,21 +8,21 @@ exports[`URLSearchParams > crossSerializeAsync > scoped > supports URLSearchPara exports[`URLSearchParams > crossSerializeAsync > supports URLSearchParams 1`] = `"$R[0]=Promise.resolve($R[1]=new URLSearchParams(\\"hello=world&foo=bar\\"))"`; -exports[`URLSearchParams > crossSerializeStream > scoped > supports URLSearchParams 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`URLSearchParams > crossSerializeStream > scoped > supports URLSearchParams 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`URLSearchParams > crossSerializeStream > scoped > supports URLSearchParams 2`] = `"($R=>_$.Ps($R[0],$R[1]=new URLSearchParams(\\"hello=world&foo=bar\\")))($R[\\"example\\"])"`; +exports[`URLSearchParams > crossSerializeStream > scoped > supports URLSearchParams 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new URLSearchParams(\\"hello=world&foo=bar\\")))($R[\\"example\\"])"`; -exports[`URLSearchParams > crossSerializeStream > supports URLSearchParams 1`] = `"$R[0]=_$.P()"`; +exports[`URLSearchParams > crossSerializeStream > supports URLSearchParams 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`URLSearchParams > crossSerializeStream > supports URLSearchParams 2`] = `"_$.Ps($R[0],$R[1]=new URLSearchParams(\\"hello=world&foo=bar\\"))"`; +exports[`URLSearchParams > crossSerializeStream > supports URLSearchParams 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new URLSearchParams(\\"hello=world&foo=bar\\"))"`; exports[`URLSearchParams > serialize > supports URLSearchParams 1`] = `"new URLSearchParams(\\"hello=world&foo=bar\\")"`; exports[`URLSearchParams > serializeAsync > supports URLSearchParams 1`] = `"Promise.resolve(new URLSearchParams(\\"hello=world&foo=bar\\"))"`; -exports[`URLSearchParams > toCrossJSONStream > supports URLSearchParams 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`URLSearchParams > toCrossJSONStream > supports URLSearchParams 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`URLSearchParams > toCrossJSONStream > supports URLSearchParams 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":19,\\"i\\":1,\\"s\\":\\"hello=world&foo=bar\\"}}"`; +exports[`URLSearchParams > toCrossJSONStream > supports URLSearchParams 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":19,\\"i\\":2,\\"s\\":\\"hello=world&foo=bar\\"}]}"`; exports[`URLSearchParams > toJSON > supports URLSearchParams 1`] = `"{\\"t\\":{\\"t\\":19,\\"i\\":0,\\"s\\":\\"hello=world&foo=bar\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/packages/seroval/test/web-api/__snapshots__/url.test.ts.snap b/packages/seroval/test/web-api/__snapshots__/url.test.ts.snap index f8147f3a..b189a1e4 100644 --- a/packages/seroval/test/web-api/__snapshots__/url.test.ts.snap +++ b/packages/seroval/test/web-api/__snapshots__/url.test.ts.snap @@ -8,21 +8,21 @@ exports[`URL > crossSerializeAsync > scoped > supports URL 1`] = `"($R=>$R[0]=Pr exports[`URL > crossSerializeAsync > supports URL 1`] = `"$R[0]=Promise.resolve($R[1]=new URL(\\"https://github.com/lxsmnsyc/seroval?hello=world\\"))"`; -exports[`URL > crossSerializeStream > scoped > supports URL 1`] = `"($R=>$R[0]=_$.P())($R[\\"example\\"])"`; +exports[`URL > crossSerializeStream > scoped > supports URL 1`] = `"($R=>$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))())($R[\\"example\\"])"`; -exports[`URL > crossSerializeStream > scoped > supports URL 2`] = `"($R=>_$.Ps($R[0],$R[1]=new URL(\\"https://github.com/lxsmnsyc/seroval?hello=world\\")))($R[\\"example\\"])"`; +exports[`URL > crossSerializeStream > scoped > supports URL 2`] = `"($R=>($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new URL(\\"https://github.com/lxsmnsyc/seroval?hello=world\\")))($R[\\"example\\"])"`; -exports[`URL > crossSerializeStream > supports URL 1`] = `"$R[0]=_$.P()"`; +exports[`URL > crossSerializeStream > supports URL 1`] = `"$R[0]=($R[1]=(s,f,p)=>((p=new Promise((a,b)=>{s=a,f=b})).s=s,p.f=f,p))()"`; -exports[`URL > crossSerializeStream > supports URL 2`] = `"_$.Ps($R[0],$R[1]=new URL(\\"https://github.com/lxsmnsyc/seroval?hello=world\\"))"`; +exports[`URL > crossSerializeStream > supports URL 2`] = `"($R[3]=(p,d)=>{p.s(d),p.status=\\"success\\",p.value=d;delete p.s;delete p.f})($R[0],$R[2]=new URL(\\"https://github.com/lxsmnsyc/seroval?hello=world\\"))"`; exports[`URL > serialize > supports URL 1`] = `"new URL(\\"https://github.com/lxsmnsyc/seroval?hello=world\\")"`; exports[`URL > serializeAsync > supports URL 1`] = `"Promise.resolve(new URL(\\"https://github.com/lxsmnsyc/seroval?hello=world\\"))"`; -exports[`URL > toCrossJSONStream > supports URL 1`] = `"{\\"t\\":28,\\"i\\":0}"`; +exports[`URL > toCrossJSONStream > supports URL 1`] = `"{\\"t\\":28,\\"i\\":0,\\"f\\":{\\"t\\":41,\\"i\\":1,\\"s\\":2}}"`; -exports[`URL > toCrossJSONStream > supports URL 2`] = `"{\\"t\\":29,\\"i\\":0,\\"f\\":{\\"t\\":18,\\"i\\":1,\\"s\\":\\"https://github.com/lxsmnsyc/seroval?hello=world\\"}}"`; +exports[`URL > toCrossJSONStream > supports URL 2`] = `"{\\"t\\":29,\\"i\\":0,\\"a\\":[{\\"t\\":41,\\"i\\":3,\\"s\\":3},{\\"t\\":18,\\"i\\":2,\\"s\\":\\"https://github.com/lxsmnsyc/seroval?hello=world\\"}]}"`; exports[`URL > toJSON > supports URL 1`] = `"{\\"t\\":{\\"t\\":18,\\"i\\":0,\\"s\\":\\"https://github.com/lxsmnsyc/seroval?hello=world\\"},\\"f\\":16383,\\"m\\":[]}"`; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3cc08c5b..ff8f6370 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,7 +42,7 @@ importers: specifier: ^6.0.1 version: 6.0.1 seroval: - specifier: workspace:^0.13.1 + specifier: workspace:^0.13.2 version: link:../packages/seroval superjson: specifier: ^1.13.3