Comparing version 0.10.1 to 0.10.2
@@ -5,2 +5,3 @@ import type { Assignment, FlaggedObject } from '../assignments'; | ||
export interface CrossParserContextOptions { | ||
scopeId?: string; | ||
refs?: Map<unknown, number>; | ||
@@ -10,2 +11,3 @@ disabledFeatures?: number; | ||
export interface CrossParserContext { | ||
scopeId?: string; | ||
refs: Map<unknown, number>; | ||
@@ -18,8 +20,13 @@ features: number; | ||
onParse: (node: SerovalNode, initial: boolean) => void; | ||
onDone?: () => void; | ||
} | ||
export interface StreamingCrossParserContext extends CrossParserContext { | ||
alive: boolean; | ||
pending: number; | ||
onParse(node: SerovalNode, initial: boolean): void; | ||
onDone(): void; | ||
} | ||
export declare function createStreamingCrossParserContext(options: StreamingCrossParserContextOptions): StreamingCrossParserContext; | ||
export declare function pushPendingState(ctx: StreamingCrossParserContext): void; | ||
export declare function popPendingState(ctx: StreamingCrossParserContext): void; | ||
export interface CrossSerializerContext extends BaseParserContext { | ||
@@ -26,0 +33,0 @@ stack: number[]; |
@@ -6,3 +6,4 @@ import type { CrossParserContextOptions } from './context'; | ||
onSerialize: (data: string, initial: boolean) => void; | ||
onDone?: () => void; | ||
} | ||
export declare function crossSerializeStream<T>(source: T, options: CrossSerializeStreamOptions): () => void; |
export declare const REFERENCES_KEY = "__SEROVAL_REFS__"; | ||
export declare const GLOBAL_CONTEXT_API = "_$"; | ||
export declare const GLOBAL_CONTEXT_REFERENCES = "$R"; | ||
export declare const LOCAL_CONTEXT_PROMISE_RESOLVE = "s"; | ||
export declare const LOCAL_CONTEXT_PROMISE_REJECT = "f"; | ||
export declare const GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR = "$P"; | ||
export declare const GLOBAL_CONTEXT_PROMISE_RESOLVE = "$Ps"; | ||
export declare const GLOBAL_CONTEXT_PROMISE_REJECT = "$Pf"; | ||
export declare const GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR = "P"; | ||
export declare const GLOBAL_CONTEXT_PROMISE_RESOLVE = "Ps"; | ||
export declare const GLOBAL_CONTEXT_PROMISE_REJECT = "Pf"; | ||
export declare const LOCAL_CONTEXT_STREAM_CONTROLLER = "c"; | ||
export declare const GLOBAL_CONTEXT_STREAM_CONSTRUCTOR = "$S"; | ||
export declare const GLOBAL_CONTEXT_STREAM_EMIT = "$Se"; | ||
export declare const ROOT_REFERENCE = "t"; | ||
export declare const CROSS_REFERENCE_HEADER: string; | ||
export declare const GLOBAL_CONTEXT_STREAM_CONSTRUCTOR = "S"; | ||
export declare const GLOBAL_CONTEXT_STREAM_EMIT = "Se"; | ||
export declare const GLOBAL_CONTEXT_API_SCRIPT: string; | ||
export declare function getCrossReferenceHeader(id?: string): string; |
export interface SerializerOptions { | ||
globalIdentifier: string; | ||
scopeId?: string; | ||
disabledFeatures?: number; | ||
@@ -4,0 +5,0 @@ onData: (result: string) => void; |
@@ -36,3 +36,2 @@ import type { BaseParserContext, BaseSerializerContext } from '../context'; | ||
export declare function getRefParam(ctx: SerializerContext, index: number): string; | ||
export declare function getRootID<T>(ctx: ParserContext, current: T): number; | ||
export declare function createIndexedValue<T>(ctx: ParserContext, current: T): number; | ||
@@ -39,0 +38,0 @@ export interface DeserializerContext { |
@@ -8,3 +8,2 @@ import type { SerovalNode } from '../types'; | ||
t: SerovalNode; | ||
r: number; | ||
f: number; | ||
@@ -11,0 +10,0 @@ m: number[]; |
@@ -7,4 +7,4 @@ import { serialize } from './core/tree'; | ||
export * from './core/cross'; | ||
export { CROSS_REFERENCE_HEADER } from './core/keys'; | ||
export { GLOBAL_CONTEXT_API_SCRIPT, getCrossReferenceHeader } from './core/keys'; | ||
export { default as Serializer } from './core/Serializer'; | ||
export default serialize; |
{ | ||
"name": "seroval", | ||
"type": "module", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"files": [ | ||
@@ -70,3 +70,3 @@ "dist", | ||
}, | ||
"gitHead": "aa589c20369bfbeb28d7a3d9ab0e86ed92205195" | ||
"gitHead": "a093a32769a5653f1598d409b404ecae95d2b2f5" | ||
} |
@@ -7,2 +7,3 @@ import type { Assignment, FlaggedObject } from '../assignments'; | ||
export interface CrossParserContextOptions { | ||
scopeId?: string; | ||
refs?: Map<unknown, number>; | ||
@@ -13,2 +14,3 @@ disabledFeatures?: number; | ||
export interface CrossParserContext { | ||
scopeId?: string; | ||
refs: Map<unknown, number>; | ||
@@ -22,2 +24,3 @@ features: number; | ||
return { | ||
scopeId: options.scopeId, | ||
refs: options.refs || new Map<unknown, number>(), | ||
@@ -43,2 +46,3 @@ features: ALL_ENABLED ^ (options.disabledFeatures || 0), | ||
onParse: (node: SerovalNode, initial: boolean) => void; | ||
onDone?: () => void; | ||
} | ||
@@ -48,3 +52,5 @@ | ||
alive: boolean; | ||
pending: number; | ||
onParse(node: SerovalNode, initial: boolean): void; | ||
onDone(): void; | ||
} | ||
@@ -57,8 +63,25 @@ | ||
alive: true, | ||
pending: 0, | ||
refs: options.refs || new Map<unknown, number>(), | ||
features: ALL_ENABLED ^ (options.disabledFeatures || 0), | ||
onParse: options.onParse, | ||
onDone(): void { | ||
if (options.onDone) { | ||
options.onDone(); | ||
} | ||
}, | ||
scopeId: options.scopeId, | ||
}; | ||
} | ||
export function pushPendingState(ctx: StreamingCrossParserContext): void { | ||
ctx.pending++; | ||
} | ||
export function popPendingState(ctx: StreamingCrossParserContext): void { | ||
if (--ctx.pending <= 0) { | ||
ctx.onDone(); | ||
} | ||
} | ||
export interface CrossSerializerContext extends BaseParserContext { | ||
@@ -65,0 +88,0 @@ stack: number[]; |
import { Feature } from '../compat'; | ||
import { | ||
ROOT_REFERENCE, | ||
} from '../keys'; | ||
import { GLOBAL_CONTEXT_REFERENCES } from '../keys'; | ||
import { serializeString } from '../string'; | ||
// import type { SerovalNode } from '../types'; | ||
@@ -22,20 +21,22 @@ import parseAsync from './async'; | ||
ctx: CrossSerializerContext, | ||
scopeId: string | undefined, | ||
id: number | undefined, | ||
result: string, | ||
): string { | ||
if (id == null) { | ||
return result; | ||
} | ||
const patches = resolvePatches(ctx); | ||
if (patches) { | ||
if (id == null) { | ||
if (ctx.features & Feature.ArrowFunction) { | ||
const params = '(' + ROOT_REFERENCE + ')'; | ||
const body = ROOT_REFERENCE + '=' + result + ',' + patches + ROOT_REFERENCE; | ||
return '(' + params + '=>(' + body + '))()'; | ||
} | ||
const params = '(' + ROOT_REFERENCE + ')'; | ||
const body = ROOT_REFERENCE + '=' + result + ',' + patches + ROOT_REFERENCE; | ||
return '(function' + params + '{return ' + body + '})()'; | ||
} | ||
return '(' + result + ',' + patches + getRefExpr(id) + ')'; | ||
const ref = getRefExpr(id); | ||
const params = scopeId == null ? '' : GLOBAL_CONTEXT_REFERENCES; | ||
const mainBody = patches ? result + ',' + patches : result; | ||
if (params === '') { | ||
return patches ? '(' + mainBody + ref + ')' : mainBody; | ||
} | ||
return result; | ||
const args = scopeId == null ? '()' : '(' + GLOBAL_CONTEXT_REFERENCES + '["' + serializeString(scopeId) + '"])'; | ||
const body = mainBody + (patches ? ref : ''); | ||
if (ctx.features & Feature.ArrowFunction) { | ||
return '(' + params + '=>(' + body + '))' + args; | ||
} | ||
return '(function(' + params + '){return ' + body + '})' + args; | ||
} | ||
@@ -55,2 +56,3 @@ | ||
serial, | ||
ctx.scopeId, | ||
tree.i, | ||
@@ -73,2 +75,3 @@ result, | ||
serial, | ||
ctx.scopeId, | ||
tree.i, | ||
@@ -127,2 +130,3 @@ result, | ||
onSerialize: (data: string, initial: boolean) => void; | ||
onDone?: () => void; | ||
} | ||
@@ -135,2 +139,3 @@ | ||
const ctx = createStreamingCrossParserContext({ | ||
scopeId: options.scopeId, | ||
refs: options.refs, | ||
@@ -146,2 +151,3 @@ disabledFeatures: options.disabledFeatures, | ||
serial, | ||
ctx.scopeId, | ||
node.i, | ||
@@ -153,2 +159,3 @@ crossSerializeTree(serial, node), | ||
}, | ||
onDone: options.onDone, | ||
}); | ||
@@ -158,5 +165,13 @@ | ||
if (ctx.pending <= 0) { | ||
ctx.onDone(); | ||
ctx.alive = false; | ||
} | ||
return () => { | ||
ctx.alive = false; | ||
if (ctx.alive) { | ||
ctx.alive = false; | ||
ctx.onDone(); | ||
} | ||
}; | ||
} |
@@ -62,2 +62,3 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ | ||
GLOBAL_CONTEXT_STREAM_EMIT, | ||
GLOBAL_CONTEXT_API, | ||
} from '../keys'; | ||
@@ -728,3 +729,3 @@ | ||
): string { | ||
return GLOBAL_CONTEXT_PROMISE_RESOLVE + '(' + node.i + ',' + crossSerializeTree(ctx, node.f) + ')'; | ||
return GLOBAL_CONTEXT_API + '.' + GLOBAL_CONTEXT_PROMISE_RESOLVE + '(' + getRefExpr(node.i) + ',' + crossSerializeTree(ctx, node.f) + ')'; | ||
} | ||
@@ -736,3 +737,3 @@ | ||
): string { | ||
return GLOBAL_CONTEXT_PROMISE_REJECT + '(' + node.i + ',' + crossSerializeTree(ctx, node.f) + ')'; | ||
return GLOBAL_CONTEXT_API + '.' + GLOBAL_CONTEXT_PROMISE_REJECT + '(' + getRefExpr(node.i) + ',' + crossSerializeTree(ctx, node.f) + ')'; | ||
} | ||
@@ -743,3 +744,3 @@ | ||
): string { | ||
return assignIndexedValue(node.i, GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR + '()'); | ||
return assignIndexedValue(node.i, GLOBAL_CONTEXT_API + '.' + GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR + '()'); | ||
} | ||
@@ -750,3 +751,3 @@ | ||
): string { | ||
return GLOBAL_CONTEXT_STREAM_EMIT + '(' + node.i + ',2)'; | ||
return GLOBAL_CONTEXT_API + '.' + GLOBAL_CONTEXT_STREAM_EMIT + '(' + getRefExpr(node.i) + ',2)'; | ||
} | ||
@@ -758,3 +759,3 @@ | ||
): string { | ||
return GLOBAL_CONTEXT_STREAM_EMIT + '(' + node.i + ',0,' + crossSerializeTree(ctx, node.f) + ')'; | ||
return GLOBAL_CONTEXT_API + '.' + GLOBAL_CONTEXT_STREAM_EMIT + '(' + getRefExpr(node.i) + ',0,' + crossSerializeTree(ctx, node.f) + ')'; | ||
} | ||
@@ -766,3 +767,3 @@ | ||
): string { | ||
return GLOBAL_CONTEXT_STREAM_EMIT + '(' + node.i + ',1,' + crossSerializeTree(ctx, node.f) + ')'; | ||
return GLOBAL_CONTEXT_API + '.' + GLOBAL_CONTEXT_STREAM_EMIT + '(' + getRefExpr(node.i) + ',1,' + crossSerializeTree(ctx, node.f) + ')'; | ||
} | ||
@@ -773,3 +774,3 @@ | ||
): string { | ||
return assignIndexedValue(node.i, GLOBAL_CONTEXT_STREAM_CONSTRUCTOR + '()'); | ||
return assignIndexedValue(node.i, GLOBAL_CONTEXT_API + '.' + GLOBAL_CONTEXT_STREAM_CONSTRUCTOR + '()'); | ||
} | ||
@@ -776,0 +777,0 @@ |
@@ -7,3 +7,3 @@ /* eslint-disable no-await-in-loop */ | ||
import { | ||
createCrossIndexedValue, | ||
createCrossIndexedValue, popPendingState, pushPendingState, | ||
} from './context'; | ||
@@ -322,2 +322,3 @@ import { serializeString } from '../string'; | ||
}, false); | ||
popPendingState(ctx); | ||
} | ||
@@ -341,5 +342,7 @@ }, | ||
}, false); | ||
popPendingState(ctx); | ||
} | ||
}, | ||
); | ||
pushPendingState(ctx); | ||
return { | ||
@@ -513,2 +516,3 @@ t: SerovalNodeType.PromiseConstructor, | ||
const reader = current.getReader(); | ||
pushPendingState(ctx); | ||
@@ -534,2 +538,3 @@ function push(): void { | ||
}, false); | ||
popPendingState(ctx); | ||
} else { | ||
@@ -570,3 +575,3 @@ ctx.onParse({ | ||
}, false); | ||
push(); | ||
popPendingState(ctx); | ||
} | ||
@@ -573,0 +578,0 @@ }, |
@@ -7,60 +7,56 @@ /** | ||
// Global references array. Global because we (ideally) want <script> elements to share it. | ||
var $R = []; | ||
// Promise constructor, used to construct deferred Promises | ||
function $P(success, failure, promise) { | ||
promise = new Promise(function (resolve, reject) { | ||
success = resolve; | ||
failure = reject; | ||
}); | ||
promise.s = success; | ||
promise.f = failure; | ||
return promise; | ||
} | ||
// This unsets the custom properties of the Promise instance | ||
function $uP(promise) { | ||
delete promise.s; | ||
delete promise.f; | ||
} | ||
function $Ps(referenceID, data) { | ||
$R[referenceID].s(data); | ||
} | ||
function $Pf(referenceID, data) { | ||
$R[referenceID].f(data); | ||
} | ||
// Unset stream | ||
function $uS(stream) { | ||
delete stream.c; | ||
} | ||
function $Se(referenceID, type, data, stream, controller) { | ||
stream = $R[referenceID]; | ||
controller = stream.c; | ||
switch (type) { | ||
case 0: return controller.enqueue(data); | ||
case 1: | ||
$uS(stream); | ||
return controller.error(data); | ||
case 2: | ||
$uS(stream); | ||
return controller.close(); | ||
} | ||
} | ||
// ReadableStream constructor | ||
function $S(stream, controller) { | ||
stream = new ReadableStream({ | ||
start: function (c) { | ||
controller = c; | ||
self._$ = self._$ || { | ||
// Promise constructor, used to construct deferred Promises | ||
P(success, failure, promise) { | ||
promise = new Promise(function (resolve, reject) { | ||
success = resolve; | ||
failure = reject; | ||
}); | ||
promise.s = success; | ||
promise.f = failure; | ||
return promise; | ||
}, | ||
// This unsets the custom properties of the Promise instance | ||
uP(promise) { | ||
delete promise.s; | ||
delete promise.f; | ||
}, | ||
// Promise resolution | ||
Ps(promise, data) { | ||
promise.s(data); | ||
promise.value = data; | ||
this.uP(promise); | ||
}, | ||
Pf(promise, data) { | ||
promise.f(data); | ||
this.uP(promise); | ||
}, | ||
// Unset stream | ||
uS(stream) { | ||
delete stream.c; | ||
}, | ||
Se(stream, type, data, controller) { | ||
controller = stream.c; | ||
switch (type) { | ||
case 0: return controller.enqueue(data); | ||
case 1: | ||
this.uS(stream); | ||
return controller.error(data); | ||
case 2: | ||
this.uS(stream); | ||
return controller.close(); | ||
} | ||
}); | ||
stream.c = controller; | ||
return stream; | ||
} | ||
}, | ||
// ReadableStream constructor | ||
S(stream, controller) { | ||
stream = new ReadableStream({ | ||
start: function (c) { | ||
controller = c; | ||
} | ||
}); | ||
stream.c = controller; | ||
return stream; | ||
}, | ||
}; |
@@ -0,4 +1,8 @@ | ||
import { serializeString } from './string'; | ||
// Used for mapping isomorphic references | ||
export const REFERENCES_KEY = '__SEROVAL_REFS__'; | ||
export const GLOBAL_CONTEXT_API = '_$'; | ||
export const GLOBAL_CONTEXT_REFERENCES = '$R'; | ||
@@ -10,25 +14,29 @@ | ||
export const GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR = '$P'; | ||
export const GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR = 'P'; | ||
export const GLOBAL_CONTEXT_PROMISE_RESOLVE = '$Ps'; | ||
export const GLOBAL_CONTEXT_PROMISE_RESOLVE = 'Ps'; | ||
export const GLOBAL_CONTEXT_PROMISE_REJECT = '$Pf'; | ||
export const GLOBAL_CONTEXT_PROMISE_REJECT = 'Pf'; | ||
export const LOCAL_CONTEXT_STREAM_CONTROLLER = 'c'; | ||
export const GLOBAL_CONTEXT_STREAM_CONSTRUCTOR = '$S'; | ||
export const GLOBAL_CONTEXT_STREAM_CONSTRUCTOR = 'S'; | ||
export const GLOBAL_CONTEXT_STREAM_EMIT = '$Se'; | ||
export const GLOBAL_CONTEXT_STREAM_EMIT = 'Se'; | ||
export const ROOT_REFERENCE = 't'; | ||
export const GLOBAL_CONTEXT_API_SCRIPT = `self.${GLOBAL_CONTEXT_API}=self.${GLOBAL_CONTEXT_API}||{` | ||
+ `${GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR}:function(s,f,p){return(p=new Promise(function(a,b){s=a,f=b})).${LOCAL_CONTEXT_PROMISE_RESOLVE}=s,p.${LOCAL_CONTEXT_PROMISE_REJECT}=f,p},` | ||
+ `uP:function(p){delete p.${LOCAL_CONTEXT_PROMISE_RESOLVE};delete p.${LOCAL_CONTEXT_PROMISE_REJECT}},` | ||
+ `${GLOBAL_CONTEXT_PROMISE_RESOLVE}:function(p,d){p.${LOCAL_CONTEXT_PROMISE_RESOLVE}(d),p.value=d,this.uP(p)},` | ||
+ `${GLOBAL_CONTEXT_PROMISE_REJECT}:function(p,d){p.${LOCAL_CONTEXT_PROMISE_REJECT}(d),this.uP(p)},` | ||
+ `uS:function(s){delete s.${LOCAL_CONTEXT_STREAM_CONTROLLER}},` | ||
+ `${GLOBAL_CONTEXT_STREAM_EMIT}:function(s,t,d,c){switch(c=s.${LOCAL_CONTEXT_STREAM_CONTROLLER},t){case 0:return c.enqueue(d);case 1:return(this.uS(s),c.error(d));case 2:return(this.uS(s),c.close())}},` | ||
+ `${GLOBAL_CONTEXT_STREAM_CONSTRUCTOR}:function(s,c){return(s=new ReadableStream({start:function(x){c=x}})).${LOCAL_CONTEXT_STREAM_CONTROLLER}=c,s},` | ||
+ '}'; | ||
export const CROSS_REFERENCE_HEADER = ` | ||
var ${GLOBAL_CONTEXT_REFERENCES}=[]; | ||
function ${GLOBAL_CONTEXT_PROMISE_CONSTRUCTOR}(s,f,p){return (p=new Promise(function(a,b){s=a,f=b})).${LOCAL_CONTEXT_PROMISE_RESOLVE}=s,p.${LOCAL_CONTEXT_PROMISE_REJECT}=f,p} | ||
function $uP(i,p){delete (p=${GLOBAL_CONTEXT_REFERENCES}[i]).${LOCAL_CONTEXT_PROMISE_RESOLVE};delete p.${LOCAL_CONTEXT_PROMISE_REJECT}} | ||
function ${GLOBAL_CONTEXT_PROMISE_RESOLVE}(i,d){${GLOBAL_CONTEXT_REFERENCES}[i].${LOCAL_CONTEXT_PROMISE_RESOLVE}(d),$uP(i)} | ||
function ${GLOBAL_CONTEXT_PROMISE_REJECT}(i,d){${GLOBAL_CONTEXT_REFERENCES}[i].${LOCAL_CONTEXT_PROMISE_REJECT}(d),$uP(i)} | ||
function $uS(s){delete s.${LOCAL_CONTEXT_STREAM_CONTROLLER}} | ||
function ${GLOBAL_CONTEXT_STREAM_EMIT}(i,t,d,s,c){switch(c=(s=${GLOBAL_CONTEXT_REFERENCES}[i]).${LOCAL_CONTEXT_STREAM_CONTROLLER},t){case 0:return c.enqueue(d);case 1:return c.error(d),$uS(s);case 2:return c.close(),$uS(s)}} | ||
function ${GLOBAL_CONTEXT_STREAM_CONSTRUCTOR}(s,c){return(s=new ReadableStream({start:function(t){c=t}})).c=c,s} | ||
`; | ||
export function getCrossReferenceHeader(id?: string): string { | ||
if (id == null) { | ||
return `self.${GLOBAL_CONTEXT_REFERENCES}=self.${GLOBAL_CONTEXT_REFERENCES}||[];`; | ||
} | ||
return `(self.${GLOBAL_CONTEXT_REFERENCES}=self.${GLOBAL_CONTEXT_REFERENCES}||{})["${serializeString(id)}"]=[]`; | ||
} |
@@ -6,2 +6,3 @@ import { crossSerializeStream } from './cross'; | ||
globalIdentifier: string; | ||
scopeId?: string; | ||
disabledFeatures?: number; | ||
@@ -26,2 +27,3 @@ onData: (result: string) => void; | ||
this.cleanups.push(crossSerializeStream(value, { | ||
scopeId: this.options.scopeId, | ||
refs: this.refs, | ||
@@ -28,0 +30,0 @@ disabledFeatures: this.options.disabledFeatures, |
@@ -95,13 +95,2 @@ import { ALL_ENABLED } from '../compat'; | ||
export function getRootID<T>( | ||
ctx: ParserContext, | ||
current: T, | ||
): number { | ||
const ref = ctx.reference.ids.get(current); | ||
if (ref == null) { | ||
return ctx.reference.ids.size; | ||
} | ||
return ref; | ||
} | ||
export function createIndexedValue<T>( | ||
@@ -108,0 +97,0 @@ ctx: ParserContext, |
@@ -14,3 +14,2 @@ import { Feature } from '../compat'; | ||
getRefParam, | ||
getRootID, | ||
} from './context'; | ||
@@ -23,3 +22,3 @@ import deserializeTree from './deserialize'; | ||
ctx: SerializerContext, | ||
rootID: number, | ||
rootID: number | undefined, | ||
isObject: boolean, | ||
@@ -29,3 +28,3 @@ result: string, | ||
// Shared references detected | ||
if (ctx.vars.length) { | ||
if (rootID != null && ctx.vars.length) { | ||
const patches = resolvePatches(ctx); | ||
@@ -72,3 +71,3 @@ let body = result; | ||
serial, | ||
getRootID(ctx, source), | ||
tree.i, | ||
tree.t === SerovalNodeType.Object, | ||
@@ -92,3 +91,3 @@ result, | ||
serial, | ||
getRootID(ctx, source), | ||
tree.i, | ||
tree.t === SerovalNodeType.Object, | ||
@@ -106,3 +105,2 @@ result, | ||
t: SerovalNode; | ||
r: number; | ||
f: number; | ||
@@ -119,3 +117,2 @@ m: number[]; | ||
t: parseSync(ctx, source), | ||
r: getRootID(ctx, source), | ||
f: ctx.features, | ||
@@ -133,3 +130,2 @@ m: Array.from(ctx.reference.marked), | ||
t: await parseAsync(ctx, source), | ||
r: getRootID(ctx, source), | ||
f: ctx.features, | ||
@@ -146,3 +142,3 @@ m: Array.from(ctx.reference.marked), | ||
const result = serializeTree(serial, source.t); | ||
return finalize(serial, source.r, source.t.i === SerovalNodeType.Object, result); | ||
return finalize(serial, source.t.i, source.t.i === SerovalNodeType.Object, result); | ||
} | ||
@@ -149,0 +145,0 @@ |
@@ -17,3 +17,3 @@ import { serialize } from './core/tree'; | ||
export { CROSS_REFERENCE_HEADER } from './core/keys'; | ||
export { GLOBAL_CONTEXT_API_SCRIPT, getCrossReferenceHeader } from './core/keys'; | ||
@@ -20,0 +20,0 @@ export { default as Serializer } from './core/Serializer'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1261312
18541
0