seroval 1.0.4 → 1.0.5
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 +267 -267
- package/dist/cjs/development/index.cjs.map +3 -3
- package/dist/cjs/production/index.cjs +4 -4
- package/dist/esm/development/index.mjs +267 -267
- package/dist/esm/development/index.mjs.map +3 -3
- package/dist/esm/production/index.mjs +5 -5
- package/dist/types/core/Serializer.d.ts.map +1 -1
- package/dist/types/core/base-primitives.d.ts.map +1 -1
- package/dist/types/core/constants.d.ts +4 -4
- package/dist/types/core/constants.d.ts.map +1 -1
- package/dist/types/core/context/deserializer.d.ts +1 -1
- package/dist/types/core/context/deserializer.d.ts.map +1 -1
- package/dist/types/core/context/parser/async.d.ts +1 -1
- package/dist/types/core/context/parser/async.d.ts.map +1 -1
- package/dist/types/core/context/parser/stream.d.ts +2 -2
- package/dist/types/core/context/parser/stream.d.ts.map +1 -1
- package/dist/types/core/context/parser/sync.d.ts +3 -3
- package/dist/types/core/context/parser/sync.d.ts.map +1 -1
- package/dist/types/core/context/parser.d.ts.map +1 -1
- package/dist/types/core/context/serializer.d.ts +1 -1
- package/dist/types/core/context/serializer.d.ts.map +1 -1
- package/dist/types/core/cross/async.d.ts +1 -1
- package/dist/types/core/cross/async.d.ts.map +1 -1
- package/dist/types/core/cross/deserializer.d.ts +1 -1
- package/dist/types/core/cross/deserializer.d.ts.map +1 -1
- package/dist/types/core/cross/serializer.d.ts +1 -1
- package/dist/types/core/cross/serializer.d.ts.map +1 -1
- package/dist/types/core/errors.d.ts +1 -1
- package/dist/types/core/errors.d.ts.map +1 -1
- package/dist/types/core/plugin.d.ts +1 -1
- package/dist/types/core/plugin.d.ts.map +1 -1
- package/dist/types/core/tree/async.d.ts +1 -1
- package/dist/types/core/tree/async.d.ts.map +1 -1
- package/dist/types/core/tree/deserializer.d.ts +1 -1
- package/dist/types/core/tree/deserializer.d.ts.map +1 -1
- package/dist/types/core/tree/index.d.ts.map +1 -1
- package/dist/types/core/tree/serializer.d.ts +1 -1
- package/dist/types/core/tree/serializer.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +1 -1
- package/dist/types/core/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/core/Serializer.ts +5 -5
- package/src/core/base-primitives.ts +4 -4
- package/src/core/constants.ts +12 -12
- package/src/core/context/deserializer.ts +20 -20
- package/src/core/context/parser/async.ts +27 -27
- package/src/core/context/parser/stream.ts +5 -5
- package/src/core/context/parser/sync.ts +16 -16
- package/src/core/context/parser.ts +3 -3
- package/src/core/context/serializer.ts +23 -23
- package/src/core/cross/async.ts +1 -1
- package/src/core/cross/deserializer.ts +1 -1
- package/src/core/cross/serializer.ts +2 -2
- package/src/core/errors.ts +5 -2
- package/src/core/literals.ts +4 -4
- package/src/core/plugin.ts +1 -1
- package/src/core/reference.ts +2 -2
- package/src/core/tree/async.ts +1 -1
- package/src/core/tree/deserializer.ts +1 -1
- package/src/core/tree/index.ts +8 -2
- package/src/core/tree/serializer.ts +5 -5
- package/src/core/types.ts +2 -2
package/src/core/tree/index.ts
CHANGED
|
@@ -85,7 +85,10 @@ export async function toJSONAsync<T>(
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
export function compileJSON(
|
|
88
|
+
export function compileJSON(
|
|
89
|
+
source: SerovalJSON,
|
|
90
|
+
options: PluginAccessOptions = {},
|
|
91
|
+
): string {
|
|
89
92
|
const plugins = resolvePlugins(options.plugins);
|
|
90
93
|
const ctx = new VanillaSerializerContext({
|
|
91
94
|
plugins,
|
|
@@ -95,7 +98,10 @@ export function compileJSON(source: SerovalJSON, options: PluginAccessOptions =
|
|
|
95
98
|
return ctx.serializeTop(source.t);
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
export function fromJSON<T>(
|
|
101
|
+
export function fromJSON<T>(
|
|
102
|
+
source: SerovalJSON,
|
|
103
|
+
options: PluginAccessOptions = {},
|
|
104
|
+
): T {
|
|
99
105
|
const plugins = resolvePlugins(options.plugins);
|
|
100
106
|
const ctx = new VanillaDeserializerContext({
|
|
101
107
|
plugins,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { SerovalNodeType } from '../constants';
|
|
2
|
+
import type { BaseSerializerContextOptions } from '../context/serializer';
|
|
3
|
+
import BaseSerializerContext from '../context/serializer';
|
|
4
|
+
import { SerovalUnsupportedNodeError } from '../errors';
|
|
5
|
+
import type { SerovalMode } from '../plugin';
|
|
1
6
|
import type {
|
|
2
7
|
SerovalNode,
|
|
3
8
|
SerovalPromiseConstructorNode,
|
|
4
9
|
SerovalPromiseRejectNode,
|
|
5
10
|
SerovalPromiseResolveNode,
|
|
6
11
|
} from '../types';
|
|
7
|
-
import type { BaseSerializerContextOptions } from '../context/serializer';
|
|
8
|
-
import BaseSerializerContext from '../context/serializer';
|
|
9
12
|
import getIdentifier from '../utils/get-identifier';
|
|
10
|
-
import type { SerovalMode } from '../plugin';
|
|
11
|
-
import { SerovalNodeType } from '../constants';
|
|
12
|
-
import { SerovalUnsupportedNodeError } from '../errors';
|
|
13
13
|
|
|
14
14
|
export type VanillaSerializerContextOptions = BaseSerializerContextOptions;
|
|
15
15
|
|
package/src/core/types.ts
CHANGED