seroval 1.3.1 → 1.4.0
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 +2637 -2682
- package/dist/cjs/development/index.cjs.map +4 -4
- package/dist/cjs/production/index.cjs +3 -17
- package/dist/esm/development/index.mjs +2637 -2682
- package/dist/esm/development/index.mjs.map +4 -4
- package/dist/esm/production/index.mjs +3 -17
- package/dist/types/core/base-primitives.d.ts +1 -2
- package/dist/types/core/base-primitives.d.ts.map +1 -1
- package/dist/types/core/compat.d.ts +1 -1
- package/dist/types/core/compat.d.ts.map +1 -1
- package/dist/types/core/constants.d.ts +1 -0
- package/dist/types/core/constants.d.ts.map +1 -1
- package/dist/types/core/constructors.d.ts +54 -0
- package/dist/types/core/constructors.d.ts.map +1 -0
- package/dist/types/core/context/async-parser.d.ts +19 -0
- package/dist/types/core/context/async-parser.d.ts.map +1 -0
- package/dist/types/core/context/deserializer.d.ts +35 -37
- package/dist/types/core/context/deserializer.d.ts.map +1 -1
- package/dist/types/core/context/parser.d.ts +32 -19
- package/dist/types/core/context/parser.d.ts.map +1 -1
- package/dist/types/core/context/serializer.d.ts +38 -99
- package/dist/types/core/context/serializer.d.ts.map +1 -1
- package/dist/types/core/context/sync-parser.d.ts +59 -0
- package/dist/types/core/context/sync-parser.d.ts.map +1 -0
- package/dist/types/core/cross/index.d.ts +12 -13
- package/dist/types/core/cross/index.d.ts.map +1 -1
- package/dist/types/core/errors.d.ts.map +1 -1
- package/dist/types/core/function-string.d.ts +2 -2
- package/dist/types/core/function-string.d.ts.map +1 -1
- package/dist/types/core/plugin.d.ts +13 -11
- package/dist/types/core/plugin.d.ts.map +1 -1
- package/dist/types/core/reference.d.ts.map +1 -1
- package/dist/types/core/special-reference.d.ts +3 -2
- package/dist/types/core/special-reference.d.ts.map +1 -1
- package/dist/types/core/stream.d.ts +1 -2
- package/dist/types/core/stream.d.ts.map +1 -1
- package/dist/types/core/symbols.d.ts +14 -0
- package/dist/types/core/symbols.d.ts.map +1 -0
- package/dist/types/core/tree/index.d.ts +3 -2
- package/dist/types/core/tree/index.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +3 -1
- package/dist/types/core/types.d.ts.map +1 -1
- package/dist/types/core/utils/iterator-to-sequence.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -5
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +17 -19
- package/src/core/base-primitives.ts +0 -27
- package/src/core/compat.ts +2 -1
- package/src/core/constants.ts +28 -26
- package/src/core/constructors.ts +269 -0
- package/src/core/context/async-parser.ts +586 -0
- package/src/core/context/deserializer.ts +504 -307
- package/src/core/context/parser.ts +243 -180
- package/src/core/context/serializer.ts +1058 -827
- package/src/core/context/sync-parser.ts +833 -0
- package/src/core/cross/index.ts +63 -47
- package/src/core/errors.ts +73 -12
- package/src/core/function-string.ts +11 -10
- package/src/core/plugin.ts +20 -11
- package/src/core/reference.ts +8 -5
- package/src/core/special-reference.ts +18 -90
- package/src/core/stream.ts +18 -152
- package/src/core/symbols.ts +18 -0
- package/src/core/tree/index.ts +45 -31
- package/src/core/types.ts +7 -2
- package/src/core/utils/iterator-to-sequence.ts +6 -28
- package/src/index.ts +29 -11
- package/dist/types/core/context/parser/async.d.ts +0 -24
- package/dist/types/core/context/parser/async.d.ts.map +0 -1
- package/dist/types/core/context/parser/stream.d.ts +0 -43
- package/dist/types/core/context/parser/stream.d.ts.map +0 -1
- package/dist/types/core/context/parser/sync.d.ts +0 -30
- package/dist/types/core/context/parser/sync.d.ts.map +0 -1
- package/dist/types/core/cross/async.d.ts +0 -8
- package/dist/types/core/cross/async.d.ts.map +0 -1
- package/dist/types/core/cross/deserializer.d.ts +0 -9
- package/dist/types/core/cross/deserializer.d.ts.map +0 -1
- package/dist/types/core/cross/parser.d.ts +0 -6
- package/dist/types/core/cross/parser.d.ts.map +0 -1
- package/dist/types/core/cross/serializer.d.ts +0 -16
- package/dist/types/core/cross/serializer.d.ts.map +0 -1
- package/dist/types/core/cross/stream.d.ts +0 -8
- package/dist/types/core/cross/stream.d.ts.map +0 -1
- package/dist/types/core/cross/sync.d.ts +0 -8
- package/dist/types/core/cross/sync.d.ts.map +0 -1
- package/dist/types/core/tree/async.d.ts +0 -8
- package/dist/types/core/tree/async.d.ts.map +0 -1
- package/dist/types/core/tree/deserializer.d.ts +0 -13
- package/dist/types/core/tree/deserializer.d.ts.map +0 -1
- package/dist/types/core/tree/serializer.d.ts +0 -29
- package/dist/types/core/tree/serializer.d.ts.map +0 -1
- package/dist/types/core/tree/sync.d.ts +0 -8
- package/dist/types/core/tree/sync.d.ts.map +0 -1
- package/dist/types/core/utils/assert.d.ts +0 -2
- package/dist/types/core/utils/assert.d.ts.map +0 -1
- package/dist/types/core/utils/deferred.d.ts +0 -7
- package/dist/types/core/utils/deferred.d.ts.map +0 -1
- package/src/core/context/parser/async.ts +0 -499
- package/src/core/context/parser/stream.ts +0 -323
- package/src/core/context/parser/sync.ts +0 -408
- package/src/core/cross/async.ts +0 -9
- package/src/core/cross/deserializer.ts +0 -16
- package/src/core/cross/parser.ts +0 -7
- package/src/core/cross/serializer.ts +0 -72
- package/src/core/cross/stream.ts +0 -9
- package/src/core/cross/sync.ts +0 -9
- package/src/core/tree/async.ts +0 -9
- package/src/core/tree/deserializer.ts +0 -26
- package/src/core/tree/serializer.ts +0 -98
- package/src/core/tree/sync.ts +0 -9
- package/src/core/utils/assert.ts +0 -5
- package/src/core/utils/deferred.ts +0 -22
package/src/core/stream.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
ASYNC_ITERATOR_CONSTRUCTOR,
|
|
3
|
+
PROMISE_CONSTRUCTOR,
|
|
4
|
+
STREAM_CONSTRUCTOR,
|
|
5
|
+
} from './constructors';
|
|
6
|
+
import { SYM_ASYNC_ITERATOR } from './symbols';
|
|
7
|
+
|
|
8
|
+
export interface StreamListener<T> {
|
|
5
9
|
next(value: T): void;
|
|
6
10
|
throw(value: unknown): void;
|
|
7
11
|
return(value: T): void;
|
|
@@ -22,78 +26,7 @@ export function isStream<T>(value: object): value is Stream<T> {
|
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
export function createStream<T>(): Stream<T> {
|
|
25
|
-
|
|
26
|
-
const buffer: unknown[] = [];
|
|
27
|
-
let alive = true;
|
|
28
|
-
let success = true;
|
|
29
|
-
|
|
30
|
-
function flushNext(value: T): void {
|
|
31
|
-
for (const listener of listeners.keys()) {
|
|
32
|
-
listener.next(value);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function flushThrow(value: unknown): void {
|
|
37
|
-
for (const listener of listeners.keys()) {
|
|
38
|
-
listener.throw(value);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function flushReturn(value: T): void {
|
|
43
|
-
for (const listener of listeners.keys()) {
|
|
44
|
-
listener.return(value);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
__SEROVAL_STREAM__: true,
|
|
50
|
-
on(listener: StreamListener<T>): () => void {
|
|
51
|
-
if (alive) {
|
|
52
|
-
listeners.add(listener);
|
|
53
|
-
}
|
|
54
|
-
for (let i = 0, len = buffer.length; i < len; i++) {
|
|
55
|
-
const value = buffer[i];
|
|
56
|
-
if (i === len - 1 && !alive) {
|
|
57
|
-
if (success) {
|
|
58
|
-
listener.return(value as T);
|
|
59
|
-
} else {
|
|
60
|
-
listener.throw(value);
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
listener.next(value as T);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return () => {
|
|
67
|
-
if (alive) {
|
|
68
|
-
listeners.delete(listener);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
next(value): void {
|
|
73
|
-
if (alive) {
|
|
74
|
-
buffer.push(value);
|
|
75
|
-
flushNext(value);
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
throw(value): void {
|
|
79
|
-
if (alive) {
|
|
80
|
-
buffer.push(value);
|
|
81
|
-
flushThrow(value);
|
|
82
|
-
alive = false;
|
|
83
|
-
success = false;
|
|
84
|
-
listeners.clear();
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
return(value): void {
|
|
88
|
-
if (alive) {
|
|
89
|
-
buffer.push(value);
|
|
90
|
-
flushReturn(value);
|
|
91
|
-
alive = false;
|
|
92
|
-
success = true;
|
|
93
|
-
listeners.clear();
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
};
|
|
29
|
+
return STREAM_CONSTRUCTOR() as unknown as Stream<T>;
|
|
97
30
|
}
|
|
98
31
|
|
|
99
32
|
export function createStreamFromAsyncIterable<T>(
|
|
@@ -101,7 +34,7 @@ export function createStreamFromAsyncIterable<T>(
|
|
|
101
34
|
): Stream<T> {
|
|
102
35
|
const stream = createStream<T>();
|
|
103
36
|
|
|
104
|
-
const iterator = iterable[
|
|
37
|
+
const iterator = iterable[SYM_ASYNC_ITERATOR]();
|
|
105
38
|
|
|
106
39
|
async function push(): Promise<void> {
|
|
107
40
|
try {
|
|
@@ -124,82 +57,15 @@ export function createStreamFromAsyncIterable<T>(
|
|
|
124
57
|
return stream;
|
|
125
58
|
}
|
|
126
59
|
|
|
60
|
+
const createAsyncIterable = ASYNC_ITERATOR_CONSTRUCTOR(
|
|
61
|
+
SYM_ASYNC_ITERATOR,
|
|
62
|
+
PROMISE_CONSTRUCTOR,
|
|
63
|
+
);
|
|
64
|
+
|
|
127
65
|
export function streamToAsyncIterable<T>(
|
|
128
66
|
stream: Stream<T>,
|
|
129
67
|
): () => AsyncIterableIterator<T> {
|
|
130
|
-
return (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
let count = 0;
|
|
134
|
-
let doneAt = -1;
|
|
135
|
-
let isThrow = false;
|
|
136
|
-
|
|
137
|
-
function resolveAll(): void {
|
|
138
|
-
for (let i = 0, len = pending.length; i < len; i++) {
|
|
139
|
-
pending[i].resolve({ done: true, value: undefined });
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
stream.on({
|
|
144
|
-
next(value) {
|
|
145
|
-
const current = pending.shift();
|
|
146
|
-
if (current) {
|
|
147
|
-
current.resolve({ done: false, value });
|
|
148
|
-
}
|
|
149
|
-
buffer.push(value);
|
|
150
|
-
},
|
|
151
|
-
throw(value) {
|
|
152
|
-
const current = pending.shift();
|
|
153
|
-
if (current) {
|
|
154
|
-
current.reject(value);
|
|
155
|
-
}
|
|
156
|
-
resolveAll();
|
|
157
|
-
doneAt = buffer.length;
|
|
158
|
-
buffer.push(value as T);
|
|
159
|
-
isThrow = true;
|
|
160
|
-
},
|
|
161
|
-
return(value) {
|
|
162
|
-
const current = pending.shift();
|
|
163
|
-
if (current) {
|
|
164
|
-
current.resolve({ done: true, value });
|
|
165
|
-
}
|
|
166
|
-
resolveAll();
|
|
167
|
-
doneAt = buffer.length;
|
|
168
|
-
buffer.push(value);
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
function finalize() {
|
|
173
|
-
const current = count++;
|
|
174
|
-
const value = buffer[current];
|
|
175
|
-
if (current !== doneAt) {
|
|
176
|
-
return { done: false, value };
|
|
177
|
-
}
|
|
178
|
-
if (isThrow) {
|
|
179
|
-
throw value;
|
|
180
|
-
}
|
|
181
|
-
return { done: true, value };
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return {
|
|
185
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<T> {
|
|
186
|
-
return this;
|
|
187
|
-
},
|
|
188
|
-
async next(): Promise<IteratorResult<T>> {
|
|
189
|
-
if (doneAt === -1) {
|
|
190
|
-
const current = count++;
|
|
191
|
-
if (current >= buffer.length) {
|
|
192
|
-
const deferred = createDeferred();
|
|
193
|
-
pending.push(deferred);
|
|
194
|
-
return (await deferred.promise) as Promise<IteratorResult<T>>;
|
|
195
|
-
}
|
|
196
|
-
return { done: false, value: buffer[current] };
|
|
197
|
-
}
|
|
198
|
-
if (count > doneAt) {
|
|
199
|
-
return { done: true, value: undefined };
|
|
200
|
-
}
|
|
201
|
-
return finalize();
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
};
|
|
68
|
+
return createAsyncIterable(
|
|
69
|
+
stream,
|
|
70
|
+
) as unknown as () => AsyncIterableIterator<T>;
|
|
205
71
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const SYM_ASYNC_ITERATOR: typeof Symbol.asyncIterator = Symbol.asyncIterator;
|
|
2
|
+
export const SYM_HAS_INSTANCE: typeof Symbol.hasInstance = Symbol.hasInstance;
|
|
3
|
+
export const SYM_IS_CONCAT_SPREADABLE: typeof Symbol.isConcatSpreadable = Symbol.isConcatSpreadable;
|
|
4
|
+
export const SYM_ITERATOR: typeof Symbol.iterator = Symbol.iterator;
|
|
5
|
+
export const SYM_MATCH: typeof Symbol.match = Symbol.match;
|
|
6
|
+
export const SYM_MATCH_ALL: typeof Symbol.matchAll = Symbol.matchAll;
|
|
7
|
+
export const SYM_REPLACE: typeof Symbol.replace = Symbol.replace;
|
|
8
|
+
export const SYM_SEARCH: typeof Symbol.search = Symbol.search;
|
|
9
|
+
export const SYM_SPECIES: typeof Symbol.species = Symbol.species;
|
|
10
|
+
export const SYM_SPLIT: typeof Symbol.split = Symbol.split;
|
|
11
|
+
export const SYM_TO_PRIMITIVE: typeof Symbol.toPrimitive = Symbol.toPrimitive;
|
|
12
|
+
export const SYM_TO_STRING_TAG: typeof Symbol.toStringTag = Symbol.toStringTag;
|
|
13
|
+
export const SYM_UNSCOPABLES: typeof Symbol.unscopables = Symbol.unscopables;
|
|
14
|
+
|
|
15
|
+
// For the future
|
|
16
|
+
|
|
17
|
+
// export const SYM_DISPOSE = Symbol.dispose;
|
|
18
|
+
// export const SYM_ASYNC_DISPOSE = Symbol.asyncDispose;
|
package/src/core/tree/index.ts
CHANGED
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createAsyncParserContext,
|
|
3
|
+
parseTopAsync,
|
|
4
|
+
} from '../context/async-parser';
|
|
5
|
+
import {
|
|
6
|
+
createVanillaDeserializerContext,
|
|
7
|
+
deserializeTop,
|
|
8
|
+
} from '../context/deserializer';
|
|
9
|
+
import type { BaseParserContextOptions } from '../context/parser';
|
|
10
|
+
import {
|
|
11
|
+
createVanillaSerializerContext,
|
|
12
|
+
serializeTopVanilla,
|
|
13
|
+
} from '../context/serializer';
|
|
14
|
+
import { createSyncParserContext, parseTop } from '../context/sync-parser';
|
|
15
|
+
import {
|
|
16
|
+
type PluginAccessOptions,
|
|
17
|
+
resolvePlugins,
|
|
18
|
+
SerovalMode,
|
|
19
|
+
} from '../plugin';
|
|
2
20
|
import type { SerovalNode } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import VanillaDeserializerContext from './deserializer';
|
|
6
|
-
import VanillaSerializerContext from './serializer';
|
|
7
|
-
import type { SyncParserContextOptions } from './sync';
|
|
8
|
-
import SyncParserContext from './sync';
|
|
21
|
+
export type SyncParserContextOptions = Omit<BaseParserContextOptions, 'refs'>;
|
|
22
|
+
export type AsyncParserContextOptions = Omit<BaseParserContextOptions, 'refs'>;
|
|
9
23
|
|
|
10
24
|
export function serialize<T>(
|
|
11
25
|
source: T,
|
|
12
26
|
options: SyncParserContextOptions = {},
|
|
13
27
|
): string {
|
|
14
28
|
const plugins = resolvePlugins(options.plugins);
|
|
15
|
-
const ctx =
|
|
29
|
+
const ctx = createSyncParserContext(SerovalMode.Vanilla, {
|
|
16
30
|
plugins,
|
|
17
31
|
disabledFeatures: options.disabledFeatures,
|
|
18
32
|
});
|
|
19
|
-
const tree = ctx
|
|
20
|
-
const serial =
|
|
33
|
+
const tree = parseTop(ctx, source);
|
|
34
|
+
const serial = createVanillaSerializerContext({
|
|
21
35
|
plugins,
|
|
22
|
-
features: ctx.features,
|
|
23
|
-
markedRefs: ctx.marked,
|
|
36
|
+
features: ctx.base.features,
|
|
37
|
+
markedRefs: ctx.base.marked,
|
|
24
38
|
});
|
|
25
|
-
return serial
|
|
39
|
+
return serializeTopVanilla(serial, tree);
|
|
26
40
|
}
|
|
27
41
|
|
|
28
42
|
export async function serializeAsync<T>(
|
|
@@ -30,17 +44,17 @@ export async function serializeAsync<T>(
|
|
|
30
44
|
options: AsyncParserContextOptions = {},
|
|
31
45
|
): Promise<string> {
|
|
32
46
|
const plugins = resolvePlugins(options.plugins);
|
|
33
|
-
const ctx =
|
|
47
|
+
const ctx = createAsyncParserContext(SerovalMode.Vanilla, {
|
|
34
48
|
plugins,
|
|
35
49
|
disabledFeatures: options.disabledFeatures,
|
|
36
50
|
});
|
|
37
|
-
const tree = await ctx
|
|
38
|
-
const serial =
|
|
51
|
+
const tree = await parseTopAsync(ctx, source);
|
|
52
|
+
const serial = createVanillaSerializerContext({
|
|
39
53
|
plugins,
|
|
40
|
-
features: ctx.features,
|
|
41
|
-
markedRefs: ctx.marked,
|
|
54
|
+
features: ctx.base.features,
|
|
55
|
+
markedRefs: ctx.base.marked,
|
|
42
56
|
});
|
|
43
|
-
return serial
|
|
57
|
+
return serializeTopVanilla(serial, tree);
|
|
44
58
|
}
|
|
45
59
|
|
|
46
60
|
export function deserialize<T>(source: string): T {
|
|
@@ -58,14 +72,14 @@ export function toJSON<T>(
|
|
|
58
72
|
options: SyncParserContextOptions = {},
|
|
59
73
|
): SerovalJSON {
|
|
60
74
|
const plugins = resolvePlugins(options.plugins);
|
|
61
|
-
const ctx =
|
|
75
|
+
const ctx = createSyncParserContext(SerovalMode.Vanilla, {
|
|
62
76
|
plugins,
|
|
63
77
|
disabledFeatures: options.disabledFeatures,
|
|
64
78
|
});
|
|
65
79
|
return {
|
|
66
|
-
t: ctx
|
|
67
|
-
f: ctx.features,
|
|
68
|
-
m: Array.from(ctx.marked),
|
|
80
|
+
t: parseTop(ctx, source),
|
|
81
|
+
f: ctx.base.features,
|
|
82
|
+
m: Array.from(ctx.base.marked),
|
|
69
83
|
};
|
|
70
84
|
}
|
|
71
85
|
|
|
@@ -74,14 +88,14 @@ export async function toJSONAsync<T>(
|
|
|
74
88
|
options: AsyncParserContextOptions = {},
|
|
75
89
|
): Promise<SerovalJSON> {
|
|
76
90
|
const plugins = resolvePlugins(options.plugins);
|
|
77
|
-
const ctx =
|
|
91
|
+
const ctx = createAsyncParserContext(SerovalMode.Vanilla, {
|
|
78
92
|
plugins,
|
|
79
93
|
disabledFeatures: options.disabledFeatures,
|
|
80
94
|
});
|
|
81
95
|
return {
|
|
82
|
-
t: await ctx
|
|
83
|
-
f: ctx.features,
|
|
84
|
-
m: Array.from(ctx.marked),
|
|
96
|
+
t: await parseTopAsync(ctx, source),
|
|
97
|
+
f: ctx.base.features,
|
|
98
|
+
m: Array.from(ctx.base.marked),
|
|
85
99
|
};
|
|
86
100
|
}
|
|
87
101
|
|
|
@@ -90,12 +104,12 @@ export function compileJSON(
|
|
|
90
104
|
options: PluginAccessOptions = {},
|
|
91
105
|
): string {
|
|
92
106
|
const plugins = resolvePlugins(options.plugins);
|
|
93
|
-
const ctx =
|
|
107
|
+
const ctx = createVanillaSerializerContext({
|
|
94
108
|
plugins,
|
|
95
109
|
features: source.f,
|
|
96
110
|
markedRefs: source.m,
|
|
97
111
|
});
|
|
98
|
-
return ctx
|
|
112
|
+
return serializeTopVanilla(ctx, source.t);
|
|
99
113
|
}
|
|
100
114
|
|
|
101
115
|
export function fromJSON<T>(
|
|
@@ -103,9 +117,9 @@ export function fromJSON<T>(
|
|
|
103
117
|
options: PluginAccessOptions = {},
|
|
104
118
|
): T {
|
|
105
119
|
const plugins = resolvePlugins(options.plugins);
|
|
106
|
-
const ctx =
|
|
120
|
+
const ctx = createVanillaDeserializerContext({
|
|
107
121
|
plugins,
|
|
108
122
|
markedRefs: source.m,
|
|
109
123
|
});
|
|
110
|
-
return ctx
|
|
124
|
+
return deserializeTop(ctx, source.t) as T;
|
|
111
125
|
}
|
package/src/core/types.ts
CHANGED
|
@@ -102,10 +102,15 @@ export interface SerovalArrayBufferNode extends SerovalBaseNode {
|
|
|
102
102
|
t: SerovalNodeType.ArrayBuffer;
|
|
103
103
|
// id
|
|
104
104
|
i: number;
|
|
105
|
-
//
|
|
106
|
-
s:
|
|
105
|
+
// byte string
|
|
106
|
+
s: string;
|
|
107
|
+
// length
|
|
108
|
+
l: number;
|
|
109
|
+
// array buffer constructor
|
|
110
|
+
f: SerovalNodeWithID;
|
|
107
111
|
}
|
|
108
112
|
|
|
113
|
+
|
|
109
114
|
export interface SerovalTypedArrayNode extends SerovalBaseNode {
|
|
110
115
|
t: SerovalNodeType.TypedArray;
|
|
111
116
|
// id
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITERATOR_CONSTRUCTOR } from '../constructors';
|
|
2
|
+
import { SYM_ITERATOR } from '../symbols';
|
|
2
3
|
|
|
3
4
|
export interface Sequence {
|
|
4
5
|
v: unknown[];
|
|
@@ -11,7 +12,7 @@ export function iteratorToSequence<T>(source: Iterable<T>): Sequence {
|
|
|
11
12
|
let throwsAt = -1;
|
|
12
13
|
let doneAt = -1;
|
|
13
14
|
|
|
14
|
-
const iterator = source[
|
|
15
|
+
const iterator = source[SYM_ITERATOR]();
|
|
15
16
|
|
|
16
17
|
while (true) {
|
|
17
18
|
try {
|
|
@@ -34,33 +35,10 @@ export function iteratorToSequence<T>(source: Iterable<T>): Sequence {
|
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
const createIterator = ITERATOR_CONSTRUCTOR(SYM_ITERATOR);
|
|
39
|
+
|
|
37
40
|
export function sequenceToIterator<T>(
|
|
38
41
|
sequence: Sequence,
|
|
39
42
|
): () => IterableIterator<T> {
|
|
40
|
-
return ()
|
|
41
|
-
let index = 0;
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
[Symbol.iterator](): IterableIterator<T> {
|
|
45
|
-
return this;
|
|
46
|
-
},
|
|
47
|
-
next(): IteratorResult<T> {
|
|
48
|
-
if (index > sequence.d) {
|
|
49
|
-
return {
|
|
50
|
-
done: true,
|
|
51
|
-
value: NIL,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const currentIndex = index++;
|
|
55
|
-
const currentItem = sequence.v[currentIndex];
|
|
56
|
-
if (currentIndex === sequence.t) {
|
|
57
|
-
throw currentItem;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
done: currentIndex === sequence.d,
|
|
61
|
-
value: currentItem as T,
|
|
62
|
-
};
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
};
|
|
43
|
+
return createIterator(sequence) as unknown as () => IterableIterator<T>;
|
|
66
44
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
export { Feature } from './core/compat';
|
|
2
|
-
export {
|
|
3
|
-
|
|
2
|
+
export type {
|
|
3
|
+
AsyncParsePluginContext,
|
|
4
|
+
AsyncParserContextOptions,
|
|
5
|
+
} from './core/context/async-parser';
|
|
6
|
+
export type {
|
|
7
|
+
BaseDeserializerContextOptions,
|
|
8
|
+
CrossDeserializerContextOptions,
|
|
9
|
+
DeserializePluginContext,
|
|
10
|
+
VanillaDeserializerContextOptions,
|
|
11
|
+
} from './core/context/deserializer';
|
|
12
|
+
export type { BaseParserContextOptions } from './core/context/parser';
|
|
13
|
+
export type {
|
|
14
|
+
BaseSerializerContextOptions,
|
|
15
|
+
CrossContextOptions,
|
|
16
|
+
CrossSerializerContextOptions,
|
|
17
|
+
SerializePluginContext,
|
|
18
|
+
VanillaSerializerContextOptions,
|
|
19
|
+
} from './core/context/serializer';
|
|
20
|
+
export type {
|
|
21
|
+
StreamParsePluginContext,
|
|
22
|
+
StreamParserContextOptions,
|
|
23
|
+
SyncParsePluginContext,
|
|
24
|
+
SyncParserContextOptions,
|
|
25
|
+
} from './core/context/sync-parser';
|
|
4
26
|
export * from './core/cross';
|
|
5
|
-
export * from './core/
|
|
6
|
-
|
|
27
|
+
export * from './core/errors';
|
|
7
28
|
export { getCrossReferenceHeader } from './core/keys';
|
|
8
|
-
|
|
29
|
+
export { OpaqueReference } from './core/opaque-reference';
|
|
9
30
|
export * from './core/plugin';
|
|
31
|
+
export { createReference } from './core/reference';
|
|
10
32
|
export { default as Serializer } from './core/Serializer';
|
|
11
|
-
|
|
12
33
|
export { createStream } from './core/stream';
|
|
13
|
-
export type { Stream } from './core/stream';
|
|
14
|
-
|
|
15
|
-
export * from './core/errors';
|
|
34
|
+
export type { Stream, StreamListener } from './core/stream';
|
|
35
|
+
export * from './core/tree';
|
|
16
36
|
export type { SerovalNode } from './core/types';
|
|
17
|
-
|
|
18
|
-
export { OpaqueReference } from './core/opaque-reference';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { SerovalNode } from '../../types';
|
|
2
|
-
import { BaseParserContext } from '../parser';
|
|
3
|
-
export default abstract class BaseAsyncParserContext extends BaseParserContext {
|
|
4
|
-
private parseItems;
|
|
5
|
-
private parseArray;
|
|
6
|
-
private parseProperties;
|
|
7
|
-
private parsePlainObject;
|
|
8
|
-
private parseBoxed;
|
|
9
|
-
private parseTypedArray;
|
|
10
|
-
private parseBigIntTypedArray;
|
|
11
|
-
private parseDataView;
|
|
12
|
-
private parseError;
|
|
13
|
-
private parseAggregateError;
|
|
14
|
-
private parseMap;
|
|
15
|
-
private parseSet;
|
|
16
|
-
private parsePromise;
|
|
17
|
-
private parsePlugin;
|
|
18
|
-
private parseStream;
|
|
19
|
-
private parseObject;
|
|
20
|
-
protected parseFunction(current: unknown): Promise<SerovalNode>;
|
|
21
|
-
parseTop<T>(current: T): Promise<SerovalNode>;
|
|
22
|
-
parse<T>(current: T): Promise<SerovalNode>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=async.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../../../src/core/context/parser/async.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAQV,WAAW,EAUZ,MAAM,aAAa,CAAC;AAQrB,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAC;AAO9D,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,sBAAuB,SAAQ,iBAAiB;YAC9D,UAAU;YAWV,UAAU;YAOV,eAAe;YAsDf,gBAAgB;YAahB,UAAU;YAOV,eAAe;YAWf,qBAAqB;YAWrB,aAAa;YAOb,UAAU;YAYV,mBAAmB;YAYnB,QAAQ;YAaR,QAAQ;YAWR,YAAY;YAsBZ,WAAW;YAsBX,WAAW;YAwDX,WAAW;cA0GT,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAY/D,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IA8B7C,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;CASjD"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Stream } from '../../stream';
|
|
2
|
-
import type { SerovalNode, SerovalObjectRecordNode, SerovalPluginNode, SerovalPromiseConstructorNode } from '../../types';
|
|
3
|
-
import type { BaseSyncParserContextOptions } from './sync';
|
|
4
|
-
import BaseSyncParserContext from './sync';
|
|
5
|
-
export interface BaseStreamParserContextOptions extends BaseSyncParserContextOptions {
|
|
6
|
-
onParse: (node: SerovalNode, initial: boolean) => void;
|
|
7
|
-
onError?: (error: unknown) => void;
|
|
8
|
-
onDone?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export default abstract class BaseStreamParserContext extends BaseSyncParserContext {
|
|
11
|
-
private alive;
|
|
12
|
-
private pending;
|
|
13
|
-
private onParseCallback;
|
|
14
|
-
private onErrorCallback?;
|
|
15
|
-
private onDoneCallback?;
|
|
16
|
-
constructor(options: BaseStreamParserContextOptions);
|
|
17
|
-
private initial;
|
|
18
|
-
private buffer;
|
|
19
|
-
private onParseInternal;
|
|
20
|
-
private flush;
|
|
21
|
-
onParse(node: SerovalNode): void;
|
|
22
|
-
onError(error: unknown): void;
|
|
23
|
-
private onDone;
|
|
24
|
-
pushPendingState(): void;
|
|
25
|
-
popPendingState(): void;
|
|
26
|
-
protected parseProperties(properties: Record<string | symbol, unknown>): SerovalObjectRecordNode;
|
|
27
|
-
protected handlePromiseSuccess(id: number, data: unknown): void;
|
|
28
|
-
protected handlePromiseFailure(id: number, data: unknown): void;
|
|
29
|
-
protected parsePromise(id: number, current: Promise<unknown>): SerovalPromiseConstructorNode;
|
|
30
|
-
protected parsePlugin(id: number, current: unknown): SerovalPluginNode | undefined;
|
|
31
|
-
protected parseStream(id: number, current: Stream<unknown>): SerovalNode;
|
|
32
|
-
parseWithError<T>(current: T): SerovalNode | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
start<T>(current: T): void;
|
|
37
|
-
/**
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
destroy(): void;
|
|
41
|
-
isAlive(): boolean;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../src/core/context/parser/stream.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EACV,WAAW,EAEX,uBAAuB,EACvB,iBAAiB,EACjB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,qBAAqB,MAAM,QAAQ,CAAC;AAE3C,MAAM,WAAW,8BACf,SAAQ,4BAA4B;IACpC,OAAO,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,uBAAwB,SAAQ,qBAAqB;IAEjF,OAAO,CAAC,KAAK,CAAQ;IAGrB,OAAO,CAAC,OAAO,CAAK;IAEpB,OAAO,CAAC,eAAe,CAAgD;IAEvE,OAAO,CAAC,eAAe,CAAC,CAA2B;IAEnD,OAAO,CAAC,cAAc,CAAC,CAAa;gBAExB,OAAO,EAAE,8BAA8B;IAOnD,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,MAAM,CAAqB;IAEnC,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAQhC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAQ7B,OAAO,CAAC,MAAM;IAMd,gBAAgB,IAAI,IAAI;IAIxB,eAAe,IAAI,IAAI;IAMvB,SAAS,CAAC,eAAe,CACvB,UAAU,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAC3C,uBAAuB;IAoD1B,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IAuB/D,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IA4B/D,SAAS,CAAC,YAAY,CACpB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GACxB,6BAA6B;IAUhC,SAAS,CAAC,WAAW,CACnB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,GACf,iBAAiB,GAAG,SAAS;IAmBhC,SAAS,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW;IAsCxE,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,WAAW,GAAG,SAAS;IAStD;;OAEG;IACH,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI;IAc1B;;OAEG;IACH,OAAO,IAAI,IAAI;IAOf,OAAO,IAAI,OAAO;CAGnB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Stream } from '../../stream';
|
|
2
|
-
import type { SerovalAggregateErrorNode, SerovalArrayNode, SerovalBigIntTypedArrayNode, SerovalBoxedNode, SerovalDataViewNode, SerovalErrorNode, SerovalMapNode, SerovalNode, SerovalNullConstructorNode, SerovalObjectNode, SerovalObjectRecordNode, SerovalPluginNode, SerovalPromiseConstructorNode, SerovalSetNode, SerovalTypedArrayNode } from '../../types';
|
|
3
|
-
import type { BigIntTypedArrayValue, TypedArrayValue } from '../../utils/typed-array';
|
|
4
|
-
import type { BaseParserContextOptions } from '../parser';
|
|
5
|
-
import { BaseParserContext } from '../parser';
|
|
6
|
-
type ObjectLikeNode = SerovalObjectNode | SerovalNullConstructorNode;
|
|
7
|
-
export type BaseSyncParserContextOptions = BaseParserContextOptions;
|
|
8
|
-
export default abstract class BaseSyncParserContext extends BaseParserContext {
|
|
9
|
-
protected parseItems(current: unknown[]): SerovalNode[];
|
|
10
|
-
protected parseArray(id: number, current: unknown[]): SerovalArrayNode;
|
|
11
|
-
protected parseProperties(properties: Record<string | symbol, unknown>): SerovalObjectRecordNode;
|
|
12
|
-
protected parsePlainObject(id: number, current: Record<string, unknown>, empty: boolean): ObjectLikeNode;
|
|
13
|
-
protected parseBoxed(id: number, current: object): SerovalBoxedNode;
|
|
14
|
-
protected parseTypedArray(id: number, current: TypedArrayValue): SerovalTypedArrayNode;
|
|
15
|
-
protected parseBigIntTypedArray(id: number, current: BigIntTypedArrayValue): SerovalBigIntTypedArrayNode;
|
|
16
|
-
protected parseDataView(id: number, current: DataView): SerovalDataViewNode;
|
|
17
|
-
protected parseError(id: number, current: Error): SerovalErrorNode;
|
|
18
|
-
protected parseAggregateError(id: number, current: AggregateError): SerovalAggregateErrorNode;
|
|
19
|
-
protected parseMap(id: number, current: Map<unknown, unknown>): SerovalMapNode;
|
|
20
|
-
protected parseSet(id: number, current: Set<unknown>): SerovalSetNode;
|
|
21
|
-
protected parsePlugin(id: number, current: unknown): SerovalPluginNode | undefined;
|
|
22
|
-
protected parseStream(id: number, _current: Stream<unknown>): SerovalNode;
|
|
23
|
-
protected parsePromise(id: number, _current: Promise<unknown>): SerovalPromiseConstructorNode;
|
|
24
|
-
protected parseObject(id: number, current: object): SerovalNode;
|
|
25
|
-
protected parseFunction(current: unknown): SerovalNode;
|
|
26
|
-
parseTop<T>(current: T): SerovalNode;
|
|
27
|
-
parse<T>(current: T): SerovalNode;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../../src/core/context/parser/sync.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,KAAK,EACV,yBAAyB,EACzB,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,0BAA0B,EAC1B,iBAAiB,EAEjB,uBAAuB,EACvB,iBAAiB,EACjB,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAC;AAE9D,KAAK,cAAc,GAAG,iBAAiB,GAAG,0BAA0B,CAAC;AAErE,MAAM,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AAEpE,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,qBAAsB,SAAQ,iBAAiB;IAC3E,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE;IAUvD,SAAS,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,gBAAgB;IAItE,SAAS,CAAC,eAAe,CACvB,UAAU,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAC3C,uBAAuB;IAgD1B,SAAS,CAAC,gBAAgB,CACxB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,KAAK,EAAE,OAAO,GACb,cAAc;IASjB,SAAS,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAInE,SAAS,CAAC,eAAe,CACvB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,eAAe,GACvB,qBAAqB;IAIxB,SAAS,CAAC,qBAAqB,CAC7B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,qBAAqB,GAC7B,2BAA2B;IAQ9B,SAAS,CAAC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,mBAAmB;IAI3E,SAAS,CAAC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,gBAAgB;IASlE,SAAS,CAAC,mBAAmB,CAC3B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,cAAc,GACtB,yBAAyB;IAS5B,SAAS,CAAC,QAAQ,CAChB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,GAC7B,cAAc;IAUjB,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,cAAc;IAQrE,SAAS,CAAC,WAAW,CACnB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,GACf,iBAAiB,GAAG,SAAS;IAmBhC,SAAS,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW;IAQzE,SAAS,CAAC,YAAY,CACpB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,GACzB,6BAA6B;IAKhC,SAAS,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW;IA0G/D,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW;IAYtD,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,WAAW;IA+BpC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,WAAW;CASlC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import BaseAsyncParserContext from '../context/parser/async';
|
|
2
|
-
import type { SerovalMode } from '../plugin';
|
|
3
|
-
import type { CrossParserContextOptions } from './parser';
|
|
4
|
-
export type CrossAsyncParserContextOptions = CrossParserContextOptions;
|
|
5
|
-
export default class CrossAsyncParserContext extends BaseAsyncParserContext {
|
|
6
|
-
readonly mode: SerovalMode;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=async.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../../src/core/cross/async.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;AAEvE,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,sBAAsB;IACzE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAW;CACtC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BaseDeserializerOptions } from '../context/deserializer';
|
|
2
|
-
import BaseDeserializerContext from '../context/deserializer';
|
|
3
|
-
import type { SerovalMode } from '../plugin';
|
|
4
|
-
export type CrossDeserializerContextOptions = BaseDeserializerOptions;
|
|
5
|
-
export default class CrossDeserializerContext extends BaseDeserializerContext {
|
|
6
|
-
readonly mode: SerovalMode;
|
|
7
|
-
assignIndexedValue<T>(index: number, value: T): T;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=deserializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deserializer.d.ts","sourceRoot":"","sources":["../../../../src/core/cross/deserializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,uBAAuB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,+BAA+B,GAAG,uBAAuB,CAAC;AAEtE,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,uBAAuB;IAC3E,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAW;IAErC,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;CAMlD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../src/core/cross/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAElE,MAAM,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { BaseSerializerContextOptions } from '../context/serializer';
|
|
2
|
-
import BaseSerializerContext from '../context/serializer';
|
|
3
|
-
import type { SerovalMode } from '../plugin';
|
|
4
|
-
import type { SerovalNode } from '../types';
|
|
5
|
-
import type { CrossContextOptions } from './parser';
|
|
6
|
-
export interface CrossSerializerContextOptions extends BaseSerializerContextOptions, CrossContextOptions {
|
|
7
|
-
}
|
|
8
|
-
export default class CrossSerializerContext extends BaseSerializerContext {
|
|
9
|
-
readonly mode: SerovalMode;
|
|
10
|
-
scopeId?: string;
|
|
11
|
-
constructor(options: CrossSerializerContextOptions);
|
|
12
|
-
getRefParam(id: number): string;
|
|
13
|
-
protected assignIndexedValue(index: number, value: string): string;
|
|
14
|
-
serializeTop(tree: SerovalNode): string;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../../../src/core/cross/serializer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,qBAAqB,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,6BACf,SAAQ,4BAA4B,EAClC,mBAAmB;CAAG;AAE1B,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,qBAAqB;IACvE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAW;IAErC,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEL,OAAO,EAAE,6BAA6B;IAKlD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAI/B,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAQlE,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM;CAoCxC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { BaseStreamParserContextOptions } from '../context/parser/stream';
|
|
2
|
-
import BaseStreamParserContext from '../context/parser/stream';
|
|
3
|
-
import type { SerovalMode } from '../plugin';
|
|
4
|
-
export type CrossStreamParserContextOptions = BaseStreamParserContextOptions;
|
|
5
|
-
export default class CrossStreamParserContext extends BaseStreamParserContext {
|
|
6
|
-
readonly mode: SerovalMode;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=stream.d.ts.map
|