Comparing version 0.14.1 to 0.15.0
@@ -7,3 +7,2 @@ import { serialize } from './core/tree'; | ||
export * from './core/cross'; | ||
export { getCrossReferenceHeader } from './core/keys'; | ||
export { default as Serializer } from './core/Serializer'; | ||
@@ -10,0 +9,0 @@ export * from './core/plugin'; |
{ | ||
"name": "seroval", | ||
"type": "module", | ||
"version": "0.14.1", | ||
"version": "0.15.0", | ||
"files": [ | ||
@@ -69,3 +69,3 @@ "dist", | ||
}, | ||
"gitHead": "6c22472b58ec0dc367bf91bde033da0e9d8706fa" | ||
"gitHead": "0f5b9e1e9fef04bf9a9e6f142950f1167e17a424" | ||
} |
@@ -0,1 +1,2 @@ | ||
import { getCrossReferenceHeader } from '../keys'; | ||
import type { SerovalNode } from '../types'; | ||
@@ -13,2 +14,6 @@ import type { CrossAsyncParserContextOptions } from './async'; | ||
function insertCrossReferenceHeader(scopeId: string | undefined, value: string): string { | ||
return '(' + getCrossReferenceHeader(scopeId) + ',' + value + ')'; | ||
} | ||
export interface CrossSerializeOptions | ||
@@ -34,3 +39,3 @@ extends CrossSyncParserContextOptions, CrossContextOptions { | ||
}); | ||
return serial.serializeTop(tree); | ||
return insertCrossReferenceHeader(options.scopeId, serial.serializeTop(tree)); | ||
} | ||
@@ -58,3 +63,3 @@ | ||
}); | ||
return serial.serializeTop(tree); | ||
return insertCrossReferenceHeader(options.scopeId, serial.serializeTop(tree)); | ||
} | ||
@@ -122,2 +127,6 @@ | ||
if (initial) { | ||
serialized = insertCrossReferenceHeader(options.scopeId, serialized); | ||
} | ||
options.onSerialize( | ||
@@ -124,0 +133,0 @@ serialized, |
@@ -12,5 +12,5 @@ import { serializeString } from './string'; | ||
if (id == null) { | ||
return `${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||[];`; | ||
return `${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||[]`; | ||
} | ||
return `(${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||{})["${serializeString(id)}"]=[];`; | ||
return `(${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||{})["${serializeString(id)}"]=[]`; | ||
} |
@@ -43,4 +43,2 @@ import type BaseAsyncParserContext from './context/parser/async'; | ||
): Value; | ||
// isIterable?: (value: Value) => boolean; | ||
// isSerializable?: (value: Value) => boolean; | ||
} | ||
@@ -47,0 +45,0 @@ |
@@ -17,4 +17,2 @@ import { serialize } from './core/tree'; | ||
export { getCrossReferenceHeader } from './core/keys'; | ||
export { default as Serializer } from './core/Serializer'; | ||
@@ -21,0 +19,0 @@ export * from './core/plugin'; |
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
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
1224282
140
16698