json-seq-stream 1.0.8 → 1.0.10
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/CHANGELOG.md +160 -0
- package/dist/index.d.ts +2 -0
- package/{index.js → dist/index.js} +92 -93
- package/dist/index.umd.cjs +4 -0
- package/{InputJsonLinesStream.d.ts → dist/input/InputJsonLinesStream.d.ts} +2 -2
- package/{InputJsonSequenceParseStream.d.ts → dist/input/InputJsonSequenceParseStream.d.ts} +2 -2
- package/{InputJsonSequenceStream.d.ts → dist/input/InputJsonSequenceStream.d.ts} +2 -2
- package/{InputLineFeedSeparattedSequenceStream.d.ts → dist/input/InputLineFeedSeparattedSequenceStream.d.ts} +2 -1
- package/{InputRecordSequenceStream.d.ts → dist/input/InputRecordSequenceStream.d.ts} +2 -2
- package/dist/input/index.d.ts +8 -0
- package/{OutputJsonLinesStream.d.ts → dist/output/OutputJsonLinesStream.d.ts} +2 -2
- package/{OutputJsonSequenceStream.d.ts → dist/output/OutputJsonSequenceStream.d.ts} +2 -2
- package/{OutputJsonSequenceStringifyStream.d.ts → dist/output/OutputJsonSequenceStringifyStream.d.ts} +2 -2
- package/{OutputRecordSequenceStream.d.ts → dist/output/OutputRecordSequenceStream.d.ts} +2 -2
- package/{OutputTextJoinLineFeedSequenceStream.d.ts → dist/output/OutputTextJoinLineFeedSequenceStream.d.ts} +2 -2
- package/dist/output/index.d.ts +8 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +27 -22
- package/index.d.ts +0 -16
- package/index.umd.cjs +0 -4
- /package/{ParseStream.d.ts → dist/input/ParseStream.d.ts} +0 -0
- /package/{RecordToSequenceStream.d.ts → dist/input/RecordToSequenceStream.d.ts} +0 -0
- /package/{TextSplitStream.d.ts → dist/input/TextSplitStream.d.ts} +0 -0
- /package/{jsonlines.d.ts → dist/jsonlines.d.ts} +0 -0
- /package/{SequenceToRecordStream.d.ts → dist/output/SequenceToRecordStream.d.ts} +0 -0
- /package/{StringifyStream.d.ts → dist/output/StringifyStream.d.ts} +0 -0
- /package/{TextJoinStream.d.ts → dist/output/TextJoinStream.d.ts} +0 -0
- /package/{rfc7464.d.ts → dist/rfc7464.d.ts} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## v1.0.10
|
|
4
|
+
|
|
5
|
+
- [npm:json-seq-stream@1.0.10](https://www.npmjs.com/package/json-seq-stream/v/1.0.10)
|
|
6
|
+
- [github:juner/json-seq/stream/release/tag/v1.0.10](https://github.com/juner/json-seq-stream/releases/tag/v1.0.10)
|
|
7
|
+
|
|
8
|
+
- release
|
|
9
|
+
- 2026/03/10
|
|
10
|
+
|
|
11
|
+
- refactor
|
|
12
|
+
- reorganize TypeScript types and project structure
|
|
13
|
+
- split sources into `input/` and `output/` directories
|
|
14
|
+
- remove `cpx` and replace with `fs-extra`
|
|
15
|
+
- add internal utilities `copy.ts` and `remove.ts`
|
|
16
|
+
|
|
17
|
+
- dev
|
|
18
|
+
- improve ESLint configuration
|
|
19
|
+
- fix lint rules not being properly applied
|
|
20
|
+
- add `.editorconfig`
|
|
21
|
+
- enable `verbatimModuleSyntax`
|
|
22
|
+
|
|
23
|
+
- build
|
|
24
|
+
- adjust npm publish workflow
|
|
25
|
+
- refine files included in npm package
|
|
26
|
+
|
|
27
|
+
- misc
|
|
28
|
+
- update `engines` version
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## v1.0.9
|
|
32
|
+
|
|
33
|
+
- [npm:json-seq-stream@1.0.9](https://www.npmjs.com/package/json-seq-stream/v/1.0.9)
|
|
34
|
+
- [github:juner/json-seq-stream/stream/release/tag/v1.0.9](https://github.com/juner/json-seq-stream/releases/tag/v1.0.9)
|
|
35
|
+
|
|
36
|
+
- release
|
|
37
|
+
- 2025/11/13
|
|
38
|
+
|
|
39
|
+
- fix
|
|
40
|
+
- fix: use modern esm type resolution for consumers with NodeNext [#9](https://github.com/juner/json-seq-stream/pull/9)
|
|
41
|
+
|
|
42
|
+
## v1.0.8
|
|
43
|
+
|
|
44
|
+
🐛 Bug fix for record separator (RS).
|
|
45
|
+
|
|
46
|
+
- [npm:json-seq-stream@1.0.8](https://www.npmjs.com/package/json-seq-stream/v/1.0.8)
|
|
47
|
+
- [github:juner/json-seq-stream/releases/tag/v1.0.8](https://github.com/juner/json-seq-stream/releases/tag/v1.0.8)
|
|
48
|
+
|
|
49
|
+
- release
|
|
50
|
+
- 2025/08/29
|
|
51
|
+
|
|
52
|
+
- fix
|
|
53
|
+
- Incorrectly used `\u00e1` instead of the correct `\u001e` for RS (Record Separator).
|
|
54
|
+
|
|
55
|
+
## v1.0.7
|
|
56
|
+
|
|
57
|
+
🚀 Supports `application/jsonl` (JSON Lines) and `application/x-ndjson` (NDJSON) and some generalization of functionality.
|
|
58
|
+
|
|
59
|
+
- [npm:json-seq-stream@1.0.7](https://www.npmjs.com/package/json-seq-stream/v/1.0.7)
|
|
60
|
+
- [github:juner/json-seq-stream/releases/tag/v1.0.7](https://github.com/juner/json-seq-stream/releases/tag/v1.0.7)
|
|
61
|
+
|
|
62
|
+
- release
|
|
63
|
+
- 2025/07/17
|
|
64
|
+
|
|
65
|
+
- design
|
|
66
|
+
- Generalized core transformation streams (`ParseStream`, `StringifyStream`, etc.)
|
|
67
|
+
- These now form the base of higher-level format-specific classes
|
|
68
|
+
- Options required for instantiation
|
|
69
|
+
- docs
|
|
70
|
+
- Updated `README.md` with JSON Lines usage examples
|
|
71
|
+
- rename
|
|
72
|
+
- `InputSequenceStream` -> `InputRecordSequenceStream`
|
|
73
|
+
- sequence -> record sequence
|
|
74
|
+
- `OutputJsonSequenceStfingifyStream<T>` -> `OutputJsonSequenceStringifyStream<T>`
|
|
75
|
+
- typo
|
|
76
|
+
- `OutputSequenceStream` -> `OutputRecordSequenceStream`
|
|
77
|
+
- sequence -> record sequence
|
|
78
|
+
- new feature
|
|
79
|
+
- `InputJsonLinesStream<T>`
|
|
80
|
+
- `application/jsonl` (JSON Lines) / `application/x-ndjson` (NDJSON) binary -> object `T` sequence
|
|
81
|
+
- `OutputJsonLinesStream<T>`
|
|
82
|
+
- object `T` sequence -> `application/jsonl` (JSON Lines) / `application/x-ndjson` (NDJSON) binary
|
|
83
|
+
- `InputLineFeedSeparattedSequenceStream`
|
|
84
|
+
- `LF` (or `CRLF`) seprated `<TEXT>` chunk -> `<TEXT>` sequence
|
|
85
|
+
- base of NDJSON / JSONL parsing logic
|
|
86
|
+
- `OutputRecordSequenceStream`
|
|
87
|
+
- `<TEXT>` sequence -> `RS` `<TEXT>` `LF` chunks
|
|
88
|
+
- `OutputTextJoinLineFeedSequenceStream`
|
|
89
|
+
- `<TEXT>` sequence -> `LF` separeted `<TEXT>` chunks
|
|
90
|
+
- base of NDJSON / JSONL parsing logic
|
|
91
|
+
- `ParseStream<T>`
|
|
92
|
+
- general: `<TEXT>` sequence -> object `T` sequence
|
|
93
|
+
- `RecordToSequenceStream`
|
|
94
|
+
- general: `BEGIN` `<TEXT>` `END` chunks -> `<TEXT>` sequence
|
|
95
|
+
- `SequenceToRecordStream`
|
|
96
|
+
- general: `<TEXT>` sequence -> `BEGIN` `<TEXT>` `END` chunks
|
|
97
|
+
- `StringifyStream<T>`
|
|
98
|
+
- general: object `T` sequence -> `<TEXT>` sequence
|
|
99
|
+
- `TextJoinStream`
|
|
100
|
+
- general: `<TEXT>` sequence -> `DELIMITER` separeted `<TEXT>` chunks
|
|
101
|
+
- useful for composing structured output (e.g., for logging or NDJSON)
|
|
102
|
+
- `TextSplitStream`
|
|
103
|
+
- general: `DELIMITER` separeted `<TEXT>` chunks -> `<TEXT>` sequence
|
|
104
|
+
- useful for parsing plain delimited logs, TSV/CSV-style streams
|
|
105
|
+
- deprecated (to be removed in v2.0.0)
|
|
106
|
+
- `InputSequenceStream`
|
|
107
|
+
- rename after `InputRecordSequenceStream`
|
|
108
|
+
- `OutputJsonSequenceStfingifyStream<T>`
|
|
109
|
+
- rename after `OutputJsonSequenceStringifyStream<T>`
|
|
110
|
+
- `OutputSequenceStream`
|
|
111
|
+
- rename after `OutputRecordSequenceStream`
|
|
112
|
+
|
|
113
|
+
## v1.0.6
|
|
114
|
+
|
|
115
|
+
🚀 Both input and output of application/json-seq are now supported.
|
|
116
|
+
|
|
117
|
+
- [npm:json-seq-stream@1.0.6](https://www.npmjs.com/package/json-seq-stream/v/1.0.6)
|
|
118
|
+
- [github:juner/json-seq-stream/releases/tag/v1.0.6](https://github.com/juner/json-seq-stream/releases/tag/v1.0.6)
|
|
119
|
+
|
|
120
|
+
- release
|
|
121
|
+
- 2025/07/15
|
|
122
|
+
|
|
123
|
+
- rename
|
|
124
|
+
- `JsonSequenceFormatStream<T>` -> `InputJsonSequenceParseStream<T>`
|
|
125
|
+
- add `Input` prefix
|
|
126
|
+
- `JsonSequenceStream<T>` -> `InputJsonSequenceStream<T>`
|
|
127
|
+
- add `Input` prefix
|
|
128
|
+
- `SequenceStream` -> `InputSequenceStream`
|
|
129
|
+
- add `Input` prefix
|
|
130
|
+
- new features
|
|
131
|
+
- `OutputJsonSequenceStfingifyStream<T>`
|
|
132
|
+
- object `T` Sequence -> `JSON Text <T>`
|
|
133
|
+
- `OutputJsonSequenceStream<T>`
|
|
134
|
+
- object `T` Sequence -> `application/json-seq` (json sequence) binary
|
|
135
|
+
- `OutputSequenceStream`
|
|
136
|
+
- `<TEXT>` sequence -> `RS` `<TEXT>` `LF` chunks
|
|
137
|
+
- deprecated (to be removed in v2.0.0)
|
|
138
|
+
- `JsonSequenceFormatStream<T>`
|
|
139
|
+
- rename after `InputJsonSequenceParseStream<T>`
|
|
140
|
+
- `JsonSequenceStream<T>`
|
|
141
|
+
- rename after `InputJsonSequenceStream<T>`
|
|
142
|
+
- `SequenceStream`
|
|
143
|
+
- rename after `InputSequenceStream`
|
|
144
|
+
|
|
145
|
+
## v1.0.5
|
|
146
|
+
|
|
147
|
+
🚀 First working release
|
|
148
|
+
|
|
149
|
+
- [npm:json-seq-stream@1.0.5](https://www.npmjs.com/package/json-seq-stream/v/1.0.5)
|
|
150
|
+
|
|
151
|
+
- release
|
|
152
|
+
- 2025/07/10
|
|
153
|
+
|
|
154
|
+
- new features
|
|
155
|
+
- `JsonSequenceFormatStream<T>`
|
|
156
|
+
- `JSON Text <T>` Sequence -> object `T` Sequence
|
|
157
|
+
- `JsonSequenceStream<T>`
|
|
158
|
+
- `application/json-seq` (json sequence) binary -> object `T` Sequence
|
|
159
|
+
- `SequenceStream`
|
|
160
|
+
- `RS` `<TEXT>` `LF` chunks -> `<TEXT>` Sequence
|
package/dist/index.d.ts
ADDED
|
@@ -41,28 +41,7 @@ class J extends TransformStream {
|
|
|
41
41
|
super(...t);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
function k({
|
|
45
|
-
let n = !0;
|
|
46
|
-
return {
|
|
47
|
-
args: [
|
|
48
|
-
{
|
|
49
|
-
transform(u, a) {
|
|
50
|
-
s && u.length <= 0 || (n ? (e && a.enqueue(r), n = !1) : a.enqueue(r), a.enqueue(u));
|
|
51
|
-
},
|
|
52
|
-
flush(u) {
|
|
53
|
-
n || t && u.enqueue(r);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
class O extends TransformStream {
|
|
60
|
-
constructor(e) {
|
|
61
|
-
const { args: t } = k(e);
|
|
62
|
-
super(...t);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function L({ parse: r, errorFallback: e }) {
|
|
44
|
+
function k({ parse: r, errorFallback: e }) {
|
|
66
45
|
return { args: [
|
|
67
46
|
{
|
|
68
47
|
transform(s, n) {
|
|
@@ -80,13 +59,13 @@ function L({ parse: r, errorFallback: e }) {
|
|
|
80
59
|
}
|
|
81
60
|
] };
|
|
82
61
|
}
|
|
83
|
-
class
|
|
62
|
+
class O extends TransformStream {
|
|
84
63
|
constructor(e) {
|
|
85
|
-
const { args: t } =
|
|
64
|
+
const { args: t } = k(e);
|
|
86
65
|
super(...t);
|
|
87
66
|
}
|
|
88
67
|
}
|
|
89
|
-
class m extends
|
|
68
|
+
class m extends O {
|
|
90
69
|
constructor(e) {
|
|
91
70
|
let { errorFallback: t, parse: s } = e ?? {};
|
|
92
71
|
s ??= JSON.parse, t ??= !1, super({ parse: s, errorFallback: t });
|
|
@@ -99,7 +78,7 @@ const X = m, f = {
|
|
|
99
78
|
init: "init",
|
|
100
79
|
flush: "flush"
|
|
101
80
|
};
|
|
102
|
-
function
|
|
81
|
+
function L({ begin: r, end: e, chunkEndSplit: t, fallbackSkip: s }) {
|
|
103
82
|
const n = [], c = new RegExp(`(${RegExp.escape(r)}|${RegExp.escape(e)})`, "u"), u = s === !0 ? () => !0 : s === !1 ? () => !1 : s;
|
|
104
83
|
let a = f.init;
|
|
105
84
|
return {
|
|
@@ -135,26 +114,26 @@ function S(r, e) {
|
|
|
135
114
|
const t = r.splice(0, r.length).join("");
|
|
136
115
|
t.length <= 0 || e.enqueue(t);
|
|
137
116
|
}
|
|
138
|
-
class
|
|
117
|
+
class F extends TransformStream {
|
|
139
118
|
constructor(e) {
|
|
140
|
-
const { args: t } =
|
|
119
|
+
const { args: t } = L(e);
|
|
141
120
|
super(...t);
|
|
142
121
|
}
|
|
143
122
|
}
|
|
144
123
|
const q = "", w = `
|
|
145
|
-
`,
|
|
146
|
-
class b extends
|
|
124
|
+
`, y = q, j = w;
|
|
125
|
+
class b extends F {
|
|
147
126
|
constructor(e) {
|
|
148
127
|
let { begin: t, end: s, chunkEndSplit: n, fallbackSkip: c } = e ?? {};
|
|
149
|
-
t ??=
|
|
128
|
+
t ??= y, s ??= j, n ??= !1, c ??= !1, super({ begin: t, end: s, chunkEndSplit: n, fallbackSkip: c });
|
|
150
129
|
}
|
|
151
130
|
}
|
|
152
131
|
const Y = b, Z = b;
|
|
153
|
-
function
|
|
132
|
+
function N(r) {
|
|
154
133
|
const { label: e, fatal: t, begin: s, end: n, parse: c, errorFallback: u } = r, a = new TextDecoderStream(e, { fatal: t }), o = new b({ begin: s, end: n }), i = new m({ parse: c, errorFallback: u }), { writable: d } = a, l = a.readable.pipeThrough(o).pipeThrough(i);
|
|
155
134
|
return { writable: d, readable: l };
|
|
156
135
|
}
|
|
157
|
-
class
|
|
136
|
+
class D {
|
|
158
137
|
#e;
|
|
159
138
|
#t;
|
|
160
139
|
get writable() {
|
|
@@ -167,11 +146,60 @@ class P {
|
|
|
167
146
|
({
|
|
168
147
|
readable: this.#t,
|
|
169
148
|
writable: this.#e
|
|
170
|
-
} =
|
|
149
|
+
} = N(e));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const ee = D, x = `
|
|
153
|
+
`, $ = `\r
|
|
154
|
+
`, P = [x, $];
|
|
155
|
+
class _ extends J {
|
|
156
|
+
constructor(e) {
|
|
157
|
+
let { splitter: t, chunkEndSplit: s } = e ?? {};
|
|
158
|
+
t ??= P, s ??= !1, super({ splitter: t, chunkEndSplit: s });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function C(r) {
|
|
162
|
+
const { label: e, fatal: t, splitter: s, chunkEndSplit: n, parse: c, errorFallback: u } = r ?? {}, a = new TextDecoderStream(e, { fatal: t }), o = new _({ splitter: s, chunkEndSplit: n }), i = new m({ parse: c, errorFallback: u }), { writable: d } = a, l = a.readable.pipeThrough(o).pipeThrough(i);
|
|
163
|
+
return { writable: d, readable: l };
|
|
164
|
+
}
|
|
165
|
+
class te {
|
|
166
|
+
#e;
|
|
167
|
+
#t;
|
|
168
|
+
get writable() {
|
|
169
|
+
return this.#e;
|
|
170
|
+
}
|
|
171
|
+
get readable() {
|
|
172
|
+
return this.#t;
|
|
173
|
+
}
|
|
174
|
+
constructor(e) {
|
|
175
|
+
({
|
|
176
|
+
readable: this.#t,
|
|
177
|
+
writable: this.#e
|
|
178
|
+
} = C(e));
|
|
171
179
|
}
|
|
172
180
|
}
|
|
173
|
-
|
|
174
|
-
|
|
181
|
+
function v({ delimiter: r, start: e, end: t, skip: s }) {
|
|
182
|
+
let n = !0;
|
|
183
|
+
return {
|
|
184
|
+
args: [
|
|
185
|
+
{
|
|
186
|
+
transform(u, a) {
|
|
187
|
+
s && u.length <= 0 || (n ? (e && a.enqueue(r), n = !1) : a.enqueue(r), a.enqueue(u));
|
|
188
|
+
},
|
|
189
|
+
flush(u) {
|
|
190
|
+
n || t && u.enqueue(r);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
class A extends TransformStream {
|
|
197
|
+
constructor(e) {
|
|
198
|
+
const { args: t } = v(e);
|
|
199
|
+
super(...t);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function B({ stringify: r, errorFallback: e }) {
|
|
175
203
|
return { args: [
|
|
176
204
|
{
|
|
177
205
|
transform(s, n) {
|
|
@@ -189,19 +217,19 @@ function _({ stringify: r, errorFallback: e }) {
|
|
|
189
217
|
}
|
|
190
218
|
] };
|
|
191
219
|
}
|
|
192
|
-
class
|
|
220
|
+
class G extends TransformStream {
|
|
193
221
|
constructor(e) {
|
|
194
|
-
const { args: t } =
|
|
222
|
+
const { args: t } = B(e);
|
|
195
223
|
super(...t);
|
|
196
224
|
}
|
|
197
225
|
}
|
|
198
|
-
class
|
|
226
|
+
class T extends G {
|
|
199
227
|
constructor(e) {
|
|
200
228
|
let { errorFallback: t, stringify: s } = e ?? {};
|
|
201
229
|
t ??= !1, s ??= JSON.stringify, super({ stringify: s, errorFallback: t });
|
|
202
230
|
}
|
|
203
231
|
}
|
|
204
|
-
function
|
|
232
|
+
function K({ begin: r, end: e, skip: t }) {
|
|
205
233
|
return {
|
|
206
234
|
args: [
|
|
207
235
|
{
|
|
@@ -212,52 +240,23 @@ function v({ begin: r, end: e, skip: t }) {
|
|
|
212
240
|
]
|
|
213
241
|
};
|
|
214
242
|
}
|
|
215
|
-
class
|
|
243
|
+
class z extends TransformStream {
|
|
216
244
|
constructor(e) {
|
|
217
|
-
const { args: t } =
|
|
245
|
+
const { args: t } = K(e);
|
|
218
246
|
super(...t);
|
|
219
247
|
}
|
|
220
248
|
}
|
|
221
|
-
const
|
|
222
|
-
class
|
|
249
|
+
const H = q, M = w, Q = !1;
|
|
250
|
+
class I extends z {
|
|
223
251
|
constructor(e) {
|
|
224
252
|
let { begin: t, end: s, skip: n, ...c } = e ?? {};
|
|
225
|
-
t ??=
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
const te = T;
|
|
229
|
-
function z(r) {
|
|
230
|
-
const { begin: e, end: t, stringify: s, errorFallback: n } = r, c = new TextEncoderStream(), u = new T({ begin: e, end: t }), a = new x({ stringify: s, errorFallback: n }), { writable: o } = a, i = a.readable.pipeThrough(u).pipeThrough(c);
|
|
231
|
-
return { writable: o, readable: i };
|
|
232
|
-
}
|
|
233
|
-
class ne {
|
|
234
|
-
#e;
|
|
235
|
-
#t;
|
|
236
|
-
get writable() {
|
|
237
|
-
return this.#e;
|
|
238
|
-
}
|
|
239
|
-
get readable() {
|
|
240
|
-
return this.#t;
|
|
241
|
-
}
|
|
242
|
-
constructor(e = {}) {
|
|
243
|
-
({
|
|
244
|
-
readable: this.#t,
|
|
245
|
-
writable: this.#e
|
|
246
|
-
} = z(e));
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
const I = `
|
|
250
|
-
`, H = `\r
|
|
251
|
-
`, M = [I, H];
|
|
252
|
-
class Q extends J {
|
|
253
|
-
constructor(e) {
|
|
254
|
-
let { splitter: t, chunkEndSplit: s } = e ?? {};
|
|
255
|
-
t ??= M, s ??= !1, super({ splitter: t, chunkEndSplit: s });
|
|
253
|
+
t ??= H, s ??= M, n ??= Q, super({ begin: t, end: s, skip: n, ...c });
|
|
256
254
|
}
|
|
257
255
|
}
|
|
256
|
+
const ne = I;
|
|
258
257
|
function U(r) {
|
|
259
|
-
const {
|
|
260
|
-
return { writable:
|
|
258
|
+
const { begin: e, end: t, stringify: s, errorFallback: n } = r, c = new TextEncoderStream(), u = new I({ begin: e, end: t }), a = new T({ stringify: s, errorFallback: n }), { writable: o } = a, i = a.readable.pipeThrough(u).pipeThrough(c);
|
|
259
|
+
return { writable: o, readable: i };
|
|
261
260
|
}
|
|
262
261
|
class re {
|
|
263
262
|
#e;
|
|
@@ -268,21 +267,21 @@ class re {
|
|
|
268
267
|
get readable() {
|
|
269
268
|
return this.#t;
|
|
270
269
|
}
|
|
271
|
-
constructor(e) {
|
|
270
|
+
constructor(e = {}) {
|
|
272
271
|
({
|
|
273
272
|
readable: this.#t,
|
|
274
273
|
writable: this.#e
|
|
275
274
|
} = U(e));
|
|
276
275
|
}
|
|
277
276
|
}
|
|
278
|
-
class V extends
|
|
277
|
+
class V extends A {
|
|
279
278
|
constructor(e) {
|
|
280
279
|
let { delimiter: t, start: s, end: n, skip: c } = e ?? {};
|
|
281
|
-
t ??=
|
|
280
|
+
t ??= x, s ??= !1, n ??= !1, c ??= !0, super({ delimiter: t, start: s, end: n, skip: c });
|
|
282
281
|
}
|
|
283
282
|
}
|
|
284
283
|
function W(r) {
|
|
285
|
-
const { delimiter: e, skip: t, start: s, end: n, stringify: c, errorFallback: u } = r, a = new TextEncoderStream(), o = new V({ delimiter: e, end: n, skip: t, start: s }), i = new
|
|
284
|
+
const { delimiter: e, skip: t, start: s, end: n, stringify: c, errorFallback: u } = r, a = new TextEncoderStream(), o = new V({ delimiter: e, end: n, skip: t, start: s }), i = new T({ stringify: c, errorFallback: u }), { writable: d } = i, l = i.readable.pipeThrough(o).pipeThrough(a);
|
|
286
285
|
return { writable: d, readable: l };
|
|
287
286
|
}
|
|
288
287
|
class se {
|
|
@@ -302,25 +301,25 @@ class se {
|
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
303
|
export {
|
|
305
|
-
|
|
304
|
+
te as InputJsonLinesStream,
|
|
306
305
|
m as InputJsonSequenceParseStream,
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
D as InputJsonSequenceStream,
|
|
307
|
+
_ as InputLineFeedSeparattedSequenceStream,
|
|
309
308
|
b as InputRecordSequenceStream,
|
|
310
309
|
Z as InputSequenceStream,
|
|
311
310
|
X as JsonSequenceFormatStream,
|
|
312
311
|
ee as JsonSequenceStream,
|
|
313
312
|
se as OutputJsonLinesStream,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
313
|
+
re as OutputJsonSequenceStream,
|
|
314
|
+
T as OutputJsonSequenceStringifyStream,
|
|
315
|
+
I as OutputRecordSequenceStream,
|
|
316
|
+
ne as OutputSequenceStream,
|
|
318
317
|
V as OutputTextJoinLineFeedSequenceStream,
|
|
319
|
-
|
|
320
|
-
|
|
318
|
+
O as ParseStream,
|
|
319
|
+
F as RecordToSequenceStream,
|
|
321
320
|
Y as SequenceStream,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
321
|
+
z as SequenceToRecordStream,
|
|
322
|
+
G as StringifyStream,
|
|
323
|
+
A as TextJoinStream,
|
|
325
324
|
J as TextSplitStream
|
|
326
325
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(o,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(o=typeof globalThis<"u"?globalThis:o||self,g(o.index={}))})(this,(function(o){"use strict";function g({splitter:r,chunkEndSplit:e}){const{separator:t,checker:s}=D(r),n=[];return{args:[{transform(c,a){e||(c=[...n.splice(0,n.length),c].join(""));for(const i of c.split(t))if(!(i.length<=0)){if(s.test(i)){h(n,a);continue}n.push(i)}e&&h(n,a)},flush(c){h(n,c)}}]}}function D(r){typeof r=="string"&&(r=[r]);const e=r.map(t=>RegExp.escape(t)).join("|");return{separator:new RegExp(`(${e})`,"ug"),checker:new RegExp(`^(${e})$`)}}function h(r,e){if(r.length<=0)return;const t=r.splice(0,r.length).join("");e.enqueue(t)}class I extends TransformStream{constructor(e){const{args:t}=g(e);super(...t)}}function $({parse:r,errorFallback:e}){return{args:[{transform(s,n){try{const u=r(s);u&&n.enqueue(u)}catch(u){if(!e)return;const c=n.error.bind(n),a=n.enqueue.bind(n),i=e(u,{chunk:s,error:c,enqueue:a});if(i?.then)return i.catch(()=>{})}}}]}}class J extends TransformStream{constructor(e){const{args:t}=$(e);super(...t)}}class b extends J{constructor(e){let{errorFallback:t,parse:s}=e??{};s??=JSON.parse,t??=!1,super({parse:s,errorFallback:t})}}const C=b,d={begin:"begin",end:"end",record:"record",init:"init",flush:"flush"};function _({begin:r,end:e,chunkEndSplit:t,fallbackSkip:s}){const n=[],u=new RegExp(`(${RegExp.escape(r)}|${RegExp.escape(e)})`,"u"),c=s===!0?()=>!0:s===!1?()=>!1:s;let a=d.init;return{args:[{transform(S,f){t||(S=[...n.splice(0,n.length),S].join(""));for(const l of S.split(u)){if(l===r){const m=d.begin;a===d.end||a===void 0?(p(n,f),a=m):c(l,a,m)||(p(n,f),a=m);continue}if(l===e){const m=d.end;a===d.record||a===d.begin?(p(n,f),a=m):c(l,a,m)||(p(n,f),a=m);continue}const P=d.record;a===d.begin||a===d.record?(n.push(l),a=P):c(l,a,d.record)||(n.push(l),a=P)}t&&(p(n,f),a=d.end)},flush(S){c("",a,d.flush)||p(n,S)}}]}}function p(r,e){if(r.length<=0)return;const t=r.splice(0,r.length).join("");t.length<=0||e.enqueue(t)}class R extends TransformStream{constructor(e){const{args:t}=_(e);super(...t)}}const E="",O=`
|
|
2
|
+
`,v=E,A=O;class q extends R{constructor(e){let{begin:t,end:s,chunkEndSplit:n,fallbackSkip:u}=e??{};t??=v,s??=A,n??=!1,u??=!1,super({begin:t,end:s,chunkEndSplit:n,fallbackSkip:u})}}const B=q,G=q;function K(r){const{label:e,fatal:t,begin:s,end:n,parse:u,errorFallback:c}=r,a=new TextDecoderStream(e,{fatal:t}),i=new q({begin:s,end:n}),S=new b({parse:u,errorFallback:c}),{writable:f}=a,l=a.readable.pipeThrough(i).pipeThrough(S);return{writable:f,readable:l}}class L{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e={}){({readable:this.#t,writable:this.#e}=K(e))}}const M=L,x=`
|
|
3
|
+
`,z=[x,`\r
|
|
4
|
+
`];class y extends I{constructor(e){let{splitter:t,chunkEndSplit:s}=e??{};t??=z,s??=!1,super({splitter:t,chunkEndSplit:s})}}function H(r){const{label:e,fatal:t,splitter:s,chunkEndSplit:n,parse:u,errorFallback:c}=r??{},a=new TextDecoderStream(e,{fatal:t}),i=new y({splitter:s,chunkEndSplit:n}),S=new b({parse:u,errorFallback:c}),{writable:f}=a,l=a.readable.pipeThrough(i).pipeThrough(S);return{writable:f,readable:l}}class Q{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e){({readable:this.#t,writable:this.#e}=H(e))}}function U({delimiter:r,start:e,end:t,skip:s}){let n=!0;return{args:[{transform(c,a){s&&c.length<=0||(n?(e&&a.enqueue(r),n=!1):a.enqueue(r),a.enqueue(c))},flush(c){n||t&&c.enqueue(r)}}]}}class k extends TransformStream{constructor(e){const{args:t}=U(e);super(...t)}}function V({stringify:r,errorFallback:e}){return{args:[{transform(s,n){try{const u=r(s);(u?.length??0)>0&&n.enqueue(u)}catch(u){if(!e)return;const c=n.error.bind(n),a=n.enqueue.bind(n),i=e(u,{chunk:s,error:c,enqueue:a});if(i?.then)return i.catch(()=>{})}}}]}}class F extends TransformStream{constructor(e){const{args:t}=V(e);super(...t)}}class T extends F{constructor(e){let{errorFallback:t,stringify:s}=e??{};t??=!1,s??=JSON.stringify,super({stringify:s,errorFallback:t})}}function W({begin:r,end:e,skip:t}){return{args:[{transform(n,u){t&&n.length<=0||(u.enqueue(r),u.enqueue(n),u.enqueue(e))}}]}}class j extends TransformStream{constructor(e){const{args:t}=W(e);super(...t)}}const X=E,Y=O,Z=!1;class w extends j{constructor(e){let{begin:t,end:s,skip:n,...u}=e??{};t??=X,s??=Y,n??=Z,super({begin:t,end:s,skip:n,...u})}}const ee=w;function te(r){const{begin:e,end:t,stringify:s,errorFallback:n}=r,u=new TextEncoderStream,c=new w({begin:e,end:t}),a=new T({stringify:s,errorFallback:n}),{writable:i}=a,S=a.readable.pipeThrough(c).pipeThrough(u);return{writable:i,readable:S}}class ne{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e={}){({readable:this.#t,writable:this.#e}=te(e))}}class N extends k{constructor(e){let{delimiter:t,start:s,end:n,skip:u}=e??{};t??=x,s??=!1,n??=!1,u??=!0,super({delimiter:t,start:s,end:n,skip:u})}}function re(r){const{delimiter:e,skip:t,start:s,end:n,stringify:u,errorFallback:c}=r,a=new TextEncoderStream,i=new N({delimiter:e,end:n,skip:t,start:s}),S=new T({stringify:u,errorFallback:c}),{writable:f}=S,l=S.readable.pipeThrough(i).pipeThrough(a);return{writable:f,readable:l}}class se{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e={}){({readable:this.#t,writable:this.#e}=re(e))}}o.InputJsonLinesStream=Q,o.InputJsonSequenceParseStream=b,o.InputJsonSequenceStream=L,o.InputLineFeedSeparattedSequenceStream=y,o.InputRecordSequenceStream=q,o.InputSequenceStream=G,o.JsonSequenceFormatStream=C,o.JsonSequenceStream=M,o.OutputJsonLinesStream=se,o.OutputJsonSequenceStream=ne,o.OutputJsonSequenceStringifyStream=T,o.OutputRecordSequenceStream=w,o.OutputSequenceStream=ee,o.OutputTextJoinLineFeedSequenceStream=N,o.ParseStream=J,o.RecordToSequenceStream=R,o.SequenceStream=B,o.SequenceToRecordStream=j,o.StringifyStream=F,o.TextJoinStream=k,o.TextSplitStream=I,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InputJsonSequenceParseStreamOptions } from "./InputJsonSequenceParseStream";
|
|
2
|
-
import type { InputLineFeedSeparattedSequenceStreamOptions } from "./InputLineFeedSeparattedSequenceStream";
|
|
1
|
+
import type { InputJsonSequenceParseStreamOptions } from "./InputJsonSequenceParseStream.js";
|
|
2
|
+
import type { InputLineFeedSeparattedSequenceStreamOptions } from "./InputLineFeedSeparattedSequenceStream.js";
|
|
3
3
|
export type InputJsonLinesStreamOptions<T> = {
|
|
4
4
|
label?: string;
|
|
5
5
|
} & TextDecoderOptions & InputLineFeedSeparattedSequenceStreamOptions & InputJsonSequenceParseStreamOptions<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ParseStream } from "./ParseStream";
|
|
2
|
-
import type { ParseStreamOptions } from "./ParseStream";
|
|
1
|
+
import { ParseStream } from "./ParseStream.js";
|
|
2
|
+
import type { ParseStreamOptions } from "./ParseStream.js";
|
|
3
3
|
export type InputJsonSequenceParseStreamOptions<T> = Partial<ParseStreamOptions<T>>;
|
|
4
4
|
/**
|
|
5
5
|
* string の sequence を 連続した `T` の sequence に変換する TransformStream
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InputJsonSequenceParseStreamOptions } from "./InputJsonSequenceParseStream";
|
|
2
|
-
import type { InputRecordSequenceStreamOptions } from "./InputRecordSequenceStream";
|
|
1
|
+
import type { InputJsonSequenceParseStreamOptions } from "./InputJsonSequenceParseStream.js";
|
|
2
|
+
import type { InputRecordSequenceStreamOptions } from "./InputRecordSequenceStream.js";
|
|
3
3
|
export type InputJsonSequenceStreamOptions<T> = {
|
|
4
4
|
label?: string;
|
|
5
5
|
} & TextDecoderOptions & InputJsonSequenceParseStreamOptions<T> & InputRecordSequenceStreamOptions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TextSplitStream
|
|
1
|
+
import { TextSplitStream } from "./TextSplitStream.js";
|
|
2
|
+
import type { TextSplitStreamOptions } from "./TextSplitStream.js";
|
|
2
3
|
export type InputLineFeedSeparattedSequenceStreamOptions = Partial<TextSplitStreamOptions>;
|
|
3
4
|
/**
|
|
4
5
|
* Stream to convert to LF or CRLF delimited sequence
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RecordToSequenceStream } from "./RecordToSequenceStream";
|
|
2
|
-
import type { RecordToSequenceStreamOptions } from "./RecordToSequenceStream";
|
|
1
|
+
import { RecordToSequenceStream } from "./RecordToSequenceStream.js";
|
|
2
|
+
import type { RecordToSequenceStreamOptions } from "./RecordToSequenceStream.js";
|
|
3
3
|
export type InputRecordSequenceStreamOptions = Partial<RecordToSequenceStreamOptions>;
|
|
4
4
|
/**
|
|
5
5
|
* RS で始まって LF で1行を表す 連続した文字列データを 行データとして整形して返す
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./TextSplitStream.js";
|
|
2
|
+
export * from "./InputJsonSequenceStream.js";
|
|
3
|
+
export * from "./InputJsonSequenceParseStream.js";
|
|
4
|
+
export * from "./InputRecordSequenceStream.js";
|
|
5
|
+
export * from "./InputJsonLinesStream.js";
|
|
6
|
+
export * from "./InputLineFeedSeparattedSequenceStream.js";
|
|
7
|
+
export * from "./RecordToSequenceStream.js";
|
|
8
|
+
export * from "./ParseStream.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OutputJsonSequenceStringifyStreamOptions } from "./OutputJsonSequenceStringifyStream";
|
|
2
|
-
import type { OutputTextJoinLineFeedSequenceStreamOptions } from "./OutputTextJoinLineFeedSequenceStream";
|
|
1
|
+
import type { OutputJsonSequenceStringifyStreamOptions } from "./OutputJsonSequenceStringifyStream.js";
|
|
2
|
+
import type { OutputTextJoinLineFeedSequenceStreamOptions } from "./OutputTextJoinLineFeedSequenceStream.js";
|
|
3
3
|
export type OutputJsonLinesStreamOptions<T> = OutputJsonSequenceStringifyStreamOptions<T> & OutputTextJoinLineFeedSequenceStreamOptions;
|
|
4
4
|
/**
|
|
5
5
|
* A composite stream that serializes typed values (`T`) into the NDJSON / JSON Lines format
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OutputJsonSequenceStringifyStreamOptions } from "./OutputJsonSequenceStringifyStream";
|
|
2
|
-
import type { OutputRecordSequenceStreamOptions } from "./OutputRecordSequenceStream";
|
|
1
|
+
import type { OutputJsonSequenceStringifyStreamOptions } from "./OutputJsonSequenceStringifyStream.js";
|
|
2
|
+
import type { OutputRecordSequenceStreamOptions } from "./OutputRecordSequenceStream.js";
|
|
3
3
|
export type OutputJsonSequenceStreamOptions<T> = OutputJsonSequenceStringifyStreamOptions<T> & OutputRecordSequenceStreamOptions;
|
|
4
4
|
/**
|
|
5
5
|
* A composite stream that serializes typed values (`T`) into the `application/json-seq` format
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StringifyStream } from "./StringifyStream";
|
|
2
|
-
import type { StringifyStreamOptions } from "./StringifyStream";
|
|
1
|
+
import { StringifyStream } from "./StringifyStream.js";
|
|
2
|
+
import type { StringifyStreamOptions } from "./StringifyStream.js";
|
|
3
3
|
export type OutputJsonSequenceStringifyStreamOptions<T> = Partial<StringifyStreamOptions<T>>;
|
|
4
4
|
/**
|
|
5
5
|
* 連続した `T` の sequence を string の sequence に変換する TransformStream
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SequenceToRecordStream } from "./SequenceToRecordStream";
|
|
2
|
-
import type { SequenceToRecordStreamOptions } from "./SequenceToRecordStream";
|
|
1
|
+
import { SequenceToRecordStream } from "./SequenceToRecordStream.js";
|
|
2
|
+
import type { SequenceToRecordStreamOptions } from "./SequenceToRecordStream.js";
|
|
3
3
|
export type OutputRecordSequenceStreamOptions = Partial<SequenceToRecordStreamOptions>;
|
|
4
4
|
/**
|
|
5
5
|
* Converts line data into continuous string data starting with RS and each LF represents one line.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TextJoinStream } from "./TextJoinStream";
|
|
2
|
-
import type { TextJoinStreamOptions } from "./TextJoinStream";
|
|
1
|
+
import { TextJoinStream } from "./TextJoinStream.js";
|
|
2
|
+
import type { TextJoinStreamOptions } from "./TextJoinStream.js";
|
|
3
3
|
export type OutputTextJoinLineFeedSequenceStreamOptions = Partial<TextJoinStreamOptions>;
|
|
4
4
|
/**
|
|
5
5
|
* Put LF between sequences Convert to a stream
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./TextJoinStream.js";
|
|
2
|
+
export * from "./OutputJsonSequenceStream.js";
|
|
3
|
+
export * from "./OutputJsonSequenceStringifyStream.js";
|
|
4
|
+
export * from "./OutputRecordSequenceStream.js";
|
|
5
|
+
export * from "./OutputJsonLinesStream.js";
|
|
6
|
+
export * from "./OutputTextJoinLineFeedSequenceStream.js";
|
|
7
|
+
export * from "./SequenceToRecordStream.js";
|
|
8
|
+
export * from "./StringifyStream.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TransformStreamConstructor.js";
|
package/package.json
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-seq-stream",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "application/json-seq support stream / async iterator library",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"CHANGELOG.md"
|
|
8
|
+
],
|
|
5
9
|
"type": "module",
|
|
6
|
-
"main": "./index.js",
|
|
10
|
+
"main": "./dist/index.js",
|
|
7
11
|
"exports": {
|
|
8
12
|
".": {
|
|
9
13
|
"import": {
|
|
10
|
-
"types": "./index.d.ts",
|
|
11
|
-
"default": "./index.js"
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
12
16
|
},
|
|
13
17
|
"require": {
|
|
14
|
-
"types": "./index.d.ts",
|
|
15
|
-
"default": "./index.umd.cjs"
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.umd.cjs"
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"scripts": {
|
|
20
24
|
"test:watch": "vitest watch --coverage",
|
|
21
25
|
"test": "vitest run --coverage --coverage.reporter=cobertura --coverage.reporter=text",
|
|
22
|
-
"lint": "eslint
|
|
23
|
-
"
|
|
24
|
-
"
|
|
26
|
+
"lint": "npx --node-options='--experimental-strip-types' eslint --flag unstable_native_nodejs_ts_config",
|
|
27
|
+
"build": "vite build && tsc --project tsconfig.build.json",
|
|
28
|
+
"clean": "node utils/remove.ts -- -f ./dist -f ./TestResults"
|
|
25
29
|
},
|
|
26
30
|
"repository": {
|
|
27
31
|
"type": "git",
|
|
@@ -39,25 +43,26 @@
|
|
|
39
43
|
"author": "juners",
|
|
40
44
|
"license": "MIT",
|
|
41
45
|
"engines": {
|
|
42
|
-
"node": "
|
|
46
|
+
"node": ">=24.x"
|
|
43
47
|
},
|
|
44
48
|
"bugs": {
|
|
45
49
|
"url": "https://github.com/juner/json-seq-stream/issues"
|
|
46
50
|
},
|
|
47
51
|
"homepage": "https://github.com/juner/json-seq-stream#readme",
|
|
48
52
|
"devDependencies": {
|
|
49
|
-
"@eslint/js": "^9.
|
|
50
|
-
"@eslint/json": "^0.
|
|
51
|
-
"@eslint/markdown": "^
|
|
52
|
-
"@stylistic/eslint-plugin": "^5.
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"eslint": "^9.
|
|
56
|
-
"
|
|
53
|
+
"@eslint/js": "^9.39.1",
|
|
54
|
+
"@eslint/json": "^0.14.0",
|
|
55
|
+
"@eslint/markdown": "^7.5.1",
|
|
56
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
57
|
+
"@types/fs-extra": "^11.0.4",
|
|
58
|
+
"@vitest/coverage-v8": "^4.0.8",
|
|
59
|
+
"eslint": "^9.39.1",
|
|
60
|
+
"fs-extra": "^11.3.2",
|
|
61
|
+
"globals": "^16.5.0",
|
|
57
62
|
"path": "^0.12.7",
|
|
58
|
-
"typescript": "^5.
|
|
59
|
-
"typescript-eslint": "^8.
|
|
60
|
-
"vite": "^7.
|
|
61
|
-
"vitest": "^
|
|
63
|
+
"typescript": "^5.9.3",
|
|
64
|
+
"typescript-eslint": "^8.46.4",
|
|
65
|
+
"vite": "^7.2.2",
|
|
66
|
+
"vitest": "^4.0.8"
|
|
62
67
|
}
|
|
63
68
|
}
|
package/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from "./TextSplitStream";
|
|
2
|
-
export * from "./TextJoinStream";
|
|
3
|
-
export * from "./InputJsonSequenceStream";
|
|
4
|
-
export * from "./OutputJsonSequenceStream";
|
|
5
|
-
export * from "./InputJsonSequenceParseStream";
|
|
6
|
-
export * from "./OutputJsonSequenceStringifyStream";
|
|
7
|
-
export * from "./InputRecordSequenceStream";
|
|
8
|
-
export * from "./OutputRecordSequenceStream";
|
|
9
|
-
export * from "./InputJsonLinesStream";
|
|
10
|
-
export * from "./OutputJsonLinesStream";
|
|
11
|
-
export * from "./InputLineFeedSeparattedSequenceStream";
|
|
12
|
-
export * from "./OutputTextJoinLineFeedSequenceStream";
|
|
13
|
-
export * from "./SequenceToRecordStream";
|
|
14
|
-
export * from "./RecordToSequenceStream";
|
|
15
|
-
export * from "./StringifyStream";
|
|
16
|
-
export * from "./ParseStream";
|
package/index.umd.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
(function(o,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(o=typeof globalThis<"u"?globalThis:o||self,g(o.index={}))})(this,function(o){"use strict";function g({splitter:r,chunkEndSplit:e}){const{separator:t,checker:s}=D(r),n=[];return{args:[{transform(c,a){e||(c=[...n.splice(0,n.length),c].join(""));for(const i of c.split(t))if(!(i.length<=0)){if(s.test(i)){h(n,a);continue}n.push(i)}e&&h(n,a)},flush(c){h(n,c)}}]}}function D(r){typeof r=="string"&&(r=[r]);const e=r.map(t=>RegExp.escape(t)).join("|");return{separator:new RegExp(`(${e})`,"ug"),checker:new RegExp(`^(${e})$`)}}function h(r,e){if(r.length<=0)return;const t=r.splice(0,r.length).join("");e.enqueue(t)}class I extends TransformStream{constructor(e){const{args:t}=g(e);super(...t)}}function $({delimiter:r,start:e,end:t,skip:s}){let n=!0;return{args:[{transform(c,a){s&&c.length<=0||(n?(e&&a.enqueue(r),n=!1):a.enqueue(r),a.enqueue(c))},flush(c){n||t&&c.enqueue(r)}}]}}class J extends TransformStream{constructor(e){const{args:t}=$(e);super(...t)}}function C({parse:r,errorFallback:e}){return{args:[{transform(s,n){try{const u=r(s);u&&n.enqueue(u)}catch(u){if(!e)return;const c=n.error.bind(n),a=n.enqueue.bind(n),i=e(u,{chunk:s,error:c,enqueue:a});if(i?.then)return i.catch(()=>{})}}}]}}class R extends TransformStream{constructor(e){const{args:t}=C(e);super(...t)}}class b extends R{constructor(e){let{errorFallback:t,parse:s}=e??{};s??=JSON.parse,t??=!1,super({parse:s,errorFallback:t})}}const _=b,d={begin:"begin",end:"end",record:"record",init:"init",flush:"flush"};function v({begin:r,end:e,chunkEndSplit:t,fallbackSkip:s}){const n=[],u=new RegExp(`(${RegExp.escape(r)}|${RegExp.escape(e)})`,"u"),c=s===!0?()=>!0:s===!1?()=>!1:s;let a=d.init;return{args:[{transform(S,f){t||(S=[...n.splice(0,n.length),S].join(""));for(const l of S.split(u)){if(l===r){const m=d.begin;a===d.end||a===void 0?(p(n,f),a=m):c(l,a,m)||(p(n,f),a=m);continue}if(l===e){const m=d.end;a===d.record||a===d.begin?(p(n,f),a=m):c(l,a,m)||(p(n,f),a=m);continue}const P=d.record;a===d.begin||a===d.record?(n.push(l),a=P):c(l,a,d.record)||(n.push(l),a=P)}t&&(p(n,f),a=d.end)},flush(S){c("",a,d.flush)||p(n,S)}}]}}function p(r,e){if(r.length<=0)return;const t=r.splice(0,r.length).join("");t.length<=0||e.enqueue(t)}class E extends TransformStream{constructor(e){const{args:t}=v(e);super(...t)}}const O="",L=`
|
|
2
|
-
`,A=O,B=L;class q extends E{constructor(e){let{begin:t,end:s,chunkEndSplit:n,fallbackSkip:u}=e??{};t??=A,s??=B,n??=!1,u??=!1,super({begin:t,end:s,chunkEndSplit:n,fallbackSkip:u})}}const G=q,K=q;function M(r){const{label:e,fatal:t,begin:s,end:n,parse:u,errorFallback:c}=r,a=new TextDecoderStream(e,{fatal:t}),i=new q({begin:s,end:n}),S=new b({parse:u,errorFallback:c}),{writable:f}=a,l=a.readable.pipeThrough(i).pipeThrough(S);return{writable:f,readable:l}}class x{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e={}){({readable:this.#t,writable:this.#e}=M(e))}}const z=x;function H({stringify:r,errorFallback:e}){return{args:[{transform(s,n){try{const u=r(s);(u?.length??0)>0&&n.enqueue(u)}catch(u){if(!e)return;const c=n.error.bind(n),a=n.enqueue.bind(n),i=e(u,{chunk:s,error:c,enqueue:a});if(i?.then)return i.catch(()=>{})}}}]}}class y extends TransformStream{constructor(e){const{args:t}=H(e);super(...t)}}class T extends y{constructor(e){let{errorFallback:t,stringify:s}=e??{};t??=!1,s??=JSON.stringify,super({stringify:s,errorFallback:t})}}function Q({begin:r,end:e,skip:t}){return{args:[{transform(n,u){t&&n.length<=0||(u.enqueue(r),u.enqueue(n),u.enqueue(e))}}]}}class k extends TransformStream{constructor(e){const{args:t}=Q(e);super(...t)}}const U=O,V=L,W=!1;class w extends k{constructor(e){let{begin:t,end:s,skip:n,...u}=e??{};t??=U,s??=V,n??=W,super({begin:t,end:s,skip:n,...u})}}const X=w;function Y(r){const{begin:e,end:t,stringify:s,errorFallback:n}=r,u=new TextEncoderStream,c=new w({begin:e,end:t}),a=new T({stringify:s,errorFallback:n}),{writable:i}=a,S=a.readable.pipeThrough(c).pipeThrough(u);return{writable:i,readable:S}}class Z{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e={}){({readable:this.#t,writable:this.#e}=Y(e))}}const F=`
|
|
3
|
-
`,ee=[F,`\r
|
|
4
|
-
`];class j extends I{constructor(e){let{splitter:t,chunkEndSplit:s}=e??{};t??=ee,s??=!1,super({splitter:t,chunkEndSplit:s})}}function te(r){const{label:e,fatal:t,splitter:s,chunkEndSplit:n,parse:u,errorFallback:c}=r??{},a=new TextDecoderStream(e,{fatal:t}),i=new j({splitter:s,chunkEndSplit:n}),S=new b({parse:u,errorFallback:c}),{writable:f}=a,l=a.readable.pipeThrough(i).pipeThrough(S);return{writable:f,readable:l}}class ne{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e){({readable:this.#t,writable:this.#e}=te(e))}}class N extends J{constructor(e){let{delimiter:t,start:s,end:n,skip:u}=e??{};t??=F,s??=!1,n??=!1,u??=!0,super({delimiter:t,start:s,end:n,skip:u})}}function re(r){const{delimiter:e,skip:t,start:s,end:n,stringify:u,errorFallback:c}=r,a=new TextEncoderStream,i=new N({delimiter:e,end:n,skip:t,start:s}),S=new T({stringify:u,errorFallback:c}),{writable:f}=S,l=S.readable.pipeThrough(i).pipeThrough(a);return{writable:f,readable:l}}class se{#e;#t;get writable(){return this.#e}get readable(){return this.#t}constructor(e={}){({readable:this.#t,writable:this.#e}=re(e))}}o.InputJsonLinesStream=ne,o.InputJsonSequenceParseStream=b,o.InputJsonSequenceStream=x,o.InputLineFeedSeparattedSequenceStream=j,o.InputRecordSequenceStream=q,o.InputSequenceStream=K,o.JsonSequenceFormatStream=_,o.JsonSequenceStream=z,o.OutputJsonLinesStream=se,o.OutputJsonSequenceStream=Z,o.OutputJsonSequenceStringifyStream=T,o.OutputRecordSequenceStream=w,o.OutputSequenceStream=X,o.OutputTextJoinLineFeedSequenceStream=N,o.ParseStream=R,o.RecordToSequenceStream=E,o.SequenceStream=G,o.SequenceToRecordStream=k,o.StringifyStream=y,o.TextJoinStream=J,o.TextSplitStream=I,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|