seroval 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/development/index.cjs +14 -8
- package/dist/cjs/development/index.cjs.map +2 -2
- package/dist/cjs/production/index.cjs +1 -1
- package/dist/esm/development/index.mjs +14 -8
- package/dist/esm/development/index.mjs.map +2 -2
- package/dist/esm/production/index.mjs +1 -1
- package/dist/types/core/context/deserializer.d.ts +3 -2
- package/dist/types/core/context/deserializer.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/context/deserializer.ts +14 -9
|
@@ -1968,13 +1968,18 @@ function applyObjectFlag(obj, flag) {
|
|
|
1968
1968
|
var DEFAULT_DEPTH_LIMIT = 1e3;
|
|
1969
1969
|
function createBaseDeserializerContext(mode, options) {
|
|
1970
1970
|
var _a;
|
|
1971
|
+
const refs = options.refs || /* @__PURE__ */ new Map();
|
|
1972
|
+
if (!("types" in refs)) {
|
|
1973
|
+
Object.assign(refs, {
|
|
1974
|
+
types: /* @__PURE__ */ new Map()
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1971
1977
|
return {
|
|
1972
1978
|
mode,
|
|
1973
1979
|
plugins: options.plugins,
|
|
1974
|
-
refs
|
|
1980
|
+
refs,
|
|
1975
1981
|
features: (_a = options.features) != null ? _a : ALL_ENABLED ^ (options.disabledFeatures || 0),
|
|
1976
|
-
depthLimit: options.depthLimit || DEFAULT_DEPTH_LIMIT
|
|
1977
|
-
types: /* @__PURE__ */ new Map()
|
|
1982
|
+
depthLimit: options.depthLimit || DEFAULT_DEPTH_LIMIT
|
|
1978
1983
|
};
|
|
1979
1984
|
}
|
|
1980
1985
|
function createVanillaDeserializerContext(options) {
|
|
@@ -2120,10 +2125,10 @@ function assignProperty(ctx, depth, object, key, value) {
|
|
|
2120
2125
|
}
|
|
2121
2126
|
}
|
|
2122
2127
|
function assignNodeType(ctx, id, type) {
|
|
2123
|
-
ctx.base.types.set(id, type);
|
|
2128
|
+
ctx.base.refs.types.set(id, type);
|
|
2124
2129
|
}
|
|
2125
2130
|
function validateNodeType(ctx, node, id, type) {
|
|
2126
|
-
if (ctx.base.types.get(id) !== type) {
|
|
2131
|
+
if (ctx.base.refs.types.get(id) !== type) {
|
|
2127
2132
|
throw new SerovalMalformedNodeError(node);
|
|
2128
2133
|
}
|
|
2129
2134
|
}
|
|
@@ -2280,12 +2285,13 @@ function deserializePlugin(ctx, depth, node) {
|
|
|
2280
2285
|
throw new SerovalMissingPluginError(node.c);
|
|
2281
2286
|
}
|
|
2282
2287
|
function deserializePromiseConstructor(ctx, node) {
|
|
2283
|
-
|
|
2284
|
-
return assignIndexedValue(
|
|
2288
|
+
const value = assignIndexedValue(
|
|
2285
2289
|
ctx,
|
|
2286
2290
|
node.i,
|
|
2287
2291
|
assignIndexedValue(ctx, node.s, PROMISE_CONSTRUCTOR()).p
|
|
2288
2292
|
);
|
|
2293
|
+
assignNodeType(ctx, node.s, 22 /* PromiseConstructor */);
|
|
2294
|
+
return value;
|
|
2289
2295
|
}
|
|
2290
2296
|
function deserializePromiseResolve(ctx, depth, node) {
|
|
2291
2297
|
const deferred = ctx.base.refs.get(node.i);
|
|
@@ -2316,8 +2322,8 @@ function deserializeAsyncIteratorFactoryInstance(ctx, depth, node) {
|
|
|
2316
2322
|
return streamToAsyncIterable(source);
|
|
2317
2323
|
}
|
|
2318
2324
|
function deserializeStreamConstructor(ctx, depth, node) {
|
|
2319
|
-
assignNodeType(ctx, node.i, 31 /* StreamConstructor */);
|
|
2320
2325
|
const result = assignIndexedValue(ctx, node.i, createStream());
|
|
2326
|
+
assignNodeType(ctx, node.i, 31 /* StreamConstructor */);
|
|
2321
2327
|
const items = node.a;
|
|
2322
2328
|
const len = items.length;
|
|
2323
2329
|
if (len) {
|