json-seq-stream 1.0.9 → 1.0.11

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +180 -0
  2. package/dist/index.d.ts +2 -0
  3. package/{index.js → dist/index.js} +93 -94
  4. package/{InputLineFeedSeparattedSequenceStream.d.ts → dist/input/InputLineFeedSeparattedSequenceStream.d.ts} +2 -1
  5. package/dist/input/index.d.ts +8 -0
  6. package/{index.d.ts → dist/output/index.d.ts} +0 -8
  7. package/dist/types/TransformStreamConstructor.d.ts +1 -0
  8. package/dist/types/index.d.ts +1 -0
  9. package/package.json +15 -15
  10. package/index.umd.cjs +0 -4
  11. /package/{InputJsonLinesStream.d.ts → dist/input/InputJsonLinesStream.d.ts} +0 -0
  12. /package/{InputJsonSequenceParseStream.d.ts → dist/input/InputJsonSequenceParseStream.d.ts} +0 -0
  13. /package/{InputJsonSequenceStream.d.ts → dist/input/InputJsonSequenceStream.d.ts} +0 -0
  14. /package/{InputRecordSequenceStream.d.ts → dist/input/InputRecordSequenceStream.d.ts} +0 -0
  15. /package/{ParseStream.d.ts → dist/input/ParseStream.d.ts} +0 -0
  16. /package/{RecordToSequenceStream.d.ts → dist/input/RecordToSequenceStream.d.ts} +0 -0
  17. /package/{TextSplitStream.d.ts → dist/input/TextSplitStream.d.ts} +0 -0
  18. /package/{jsonlines.d.ts → dist/jsonlines.d.ts} +0 -0
  19. /package/{OutputJsonLinesStream.d.ts → dist/output/OutputJsonLinesStream.d.ts} +0 -0
  20. /package/{OutputJsonSequenceStream.d.ts → dist/output/OutputJsonSequenceStream.d.ts} +0 -0
  21. /package/{OutputJsonSequenceStringifyStream.d.ts → dist/output/OutputJsonSequenceStringifyStream.d.ts} +0 -0
  22. /package/{OutputRecordSequenceStream.d.ts → dist/output/OutputRecordSequenceStream.d.ts} +0 -0
  23. /package/{OutputTextJoinLineFeedSequenceStream.d.ts → dist/output/OutputTextJoinLineFeedSequenceStream.d.ts} +0 -0
  24. /package/{SequenceToRecordStream.d.ts → dist/output/SequenceToRecordStream.d.ts} +0 -0
  25. /package/{StringifyStream.d.ts → dist/output/StringifyStream.d.ts} +0 -0
  26. /package/{TextJoinStream.d.ts → dist/output/TextJoinStream.d.ts} +0 -0
  27. /package/{rfc7464.d.ts → dist/rfc7464.d.ts} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,180 @@
1
+ # CHANGELOG
2
+
3
+ ## v1.0.11
4
+
5
+ - [npm:json-seq-stream@1.0.11](https://www.npmjs.com/package/json-seq-stream/v/1.0.11)
6
+ - [github:juner/json-seq-stream/releases/tag/v1.0.11](https://github.com/juner/json-seq-stream/releases/tag/v1.0.11)
7
+
8
+ - release
9
+ - 2026/11/16
10
+
11
+ - fix
12
+ - unify package exports to ESM to resolve `FalseESM` type resolution issue
13
+ - rename `TransformStreamConstructor.d.ts` to `.ts` so its declaration is emitted to `dist/types/`
14
+
15
+ - dev
16
+ - update ESLint configuration to use recommended configs for plugins
17
+
18
+ - build
19
+ - emit ES module format only in Vite build
20
+ - add `.npmrc` with `engine-strict=true`
21
+
22
+
23
+ ## v1.0.10
24
+
25
+ - [npm:json-seq-stream@1.0.10](https://www.npmjs.com/package/json-seq-stream/v/1.0.10)
26
+ - [github:juner/json-seq/stream/release/tag/v1.0.10](https://github.com/juner/json-seq-stream/releases/tag/v1.0.10)
27
+
28
+ - release
29
+ - 2026/03/10
30
+
31
+ - refactor
32
+ - reorganize TypeScript types and project structure
33
+ - split sources into `input/` and `output/` directories
34
+ - remove `cpx` and replace with `fs-extra`
35
+ - add internal utilities `copy.ts` and `remove.ts`
36
+
37
+ - dev
38
+ - improve ESLint configuration
39
+ - fix lint rules not being properly applied
40
+ - add `.editorconfig`
41
+ - enable `verbatimModuleSyntax`
42
+
43
+ - build
44
+ - adjust npm publish workflow
45
+ - refine files included in npm package
46
+
47
+ - misc
48
+ - update `engines` version
49
+
50
+
51
+ ## v1.0.9
52
+
53
+ - [npm:json-seq-stream@1.0.9](https://www.npmjs.com/package/json-seq-stream/v/1.0.9)
54
+ - [github:juner/json-seq-stream/stream/release/tag/v1.0.9](https://github.com/juner/json-seq-stream/releases/tag/v1.0.9)
55
+
56
+ - release
57
+ - 2025/11/13
58
+
59
+ - fix
60
+ - fix: use modern esm type resolution for consumers with NodeNext [#9](https://github.com/juner/json-seq-stream/pull/9)
61
+
62
+ ## v1.0.8
63
+
64
+ 🐛 Bug fix for record separator (RS).
65
+
66
+ - [npm:json-seq-stream@1.0.8](https://www.npmjs.com/package/json-seq-stream/v/1.0.8)
67
+ - [github:juner/json-seq-stream/releases/tag/v1.0.8](https://github.com/juner/json-seq-stream/releases/tag/v1.0.8)
68
+
69
+ - release
70
+ - 2025/08/29
71
+
72
+ - fix
73
+ - Incorrectly used `\u00e1` instead of the correct `\u001e` for RS (Record Separator).
74
+
75
+ ## v1.0.7
76
+
77
+ 🚀 Supports `application/jsonl` (JSON Lines) and `application/x-ndjson` (NDJSON) and some generalization of functionality.
78
+
79
+ - [npm:json-seq-stream@1.0.7](https://www.npmjs.com/package/json-seq-stream/v/1.0.7)
80
+ - [github:juner/json-seq-stream/releases/tag/v1.0.7](https://github.com/juner/json-seq-stream/releases/tag/v1.0.7)
81
+
82
+ - release
83
+ - 2025/07/17
84
+
85
+ - design
86
+ - Generalized core transformation streams (`ParseStream`, `StringifyStream`, etc.)
87
+ - These now form the base of higher-level format-specific classes
88
+ - Options required for instantiation
89
+ - docs
90
+ - Updated `README.md` with JSON Lines usage examples
91
+ - rename
92
+ - `InputSequenceStream` -> `InputRecordSequenceStream`
93
+ - sequence -> record sequence
94
+ - `OutputJsonSequenceStfingifyStream<T>` -> `OutputJsonSequenceStringifyStream<T>`
95
+ - typo
96
+ - `OutputSequenceStream` -> `OutputRecordSequenceStream`
97
+ - sequence -> record sequence
98
+ - new feature
99
+ - `InputJsonLinesStream<T>`
100
+ - `application/jsonl` (JSON Lines) / `application/x-ndjson` (NDJSON) binary -> object `T` sequence
101
+ - `OutputJsonLinesStream<T>`
102
+ - object `T` sequence -> `application/jsonl` (JSON Lines) / `application/x-ndjson` (NDJSON) binary
103
+ - `InputLineFeedSeparattedSequenceStream`
104
+ - `LF` (or `CRLF`) seprated `<TEXT>` chunk -> `<TEXT>` sequence
105
+ - base of NDJSON / JSONL parsing logic
106
+ - `OutputRecordSequenceStream`
107
+ - `<TEXT>` sequence -> `RS` `<TEXT>` `LF` chunks
108
+ - `OutputTextJoinLineFeedSequenceStream`
109
+ - `<TEXT>` sequence -> `LF` separeted `<TEXT>` chunks
110
+ - base of NDJSON / JSONL parsing logic
111
+ - `ParseStream<T>`
112
+ - general: `<TEXT>` sequence -> object `T` sequence
113
+ - `RecordToSequenceStream`
114
+ - general: `BEGIN` `<TEXT>` `END` chunks -> `<TEXT>` sequence
115
+ - `SequenceToRecordStream`
116
+ - general: `<TEXT>` sequence -> `BEGIN` `<TEXT>` `END` chunks
117
+ - `StringifyStream<T>`
118
+ - general: object `T` sequence -> `<TEXT>` sequence
119
+ - `TextJoinStream`
120
+ - general: `<TEXT>` sequence -> `DELIMITER` separeted `<TEXT>` chunks
121
+ - useful for composing structured output (e.g., for logging or NDJSON)
122
+ - `TextSplitStream`
123
+ - general: `DELIMITER` separeted `<TEXT>` chunks -> `<TEXT>` sequence
124
+ - useful for parsing plain delimited logs, TSV/CSV-style streams
125
+ - deprecated (to be removed in v2.0.0)
126
+ - `InputSequenceStream`
127
+ - rename after `InputRecordSequenceStream`
128
+ - `OutputJsonSequenceStfingifyStream<T>`
129
+ - rename after `OutputJsonSequenceStringifyStream<T>`
130
+ - `OutputSequenceStream`
131
+ - rename after `OutputRecordSequenceStream`
132
+
133
+ ## v1.0.6
134
+
135
+ 🚀 Both input and output of application/json-seq are now supported.
136
+
137
+ - [npm:json-seq-stream@1.0.6](https://www.npmjs.com/package/json-seq-stream/v/1.0.6)
138
+ - [github:juner/json-seq-stream/releases/tag/v1.0.6](https://github.com/juner/json-seq-stream/releases/tag/v1.0.6)
139
+
140
+ - release
141
+ - 2025/07/15
142
+
143
+ - rename
144
+ - `JsonSequenceFormatStream<T>` -> `InputJsonSequenceParseStream<T>`
145
+ - add `Input` prefix
146
+ - `JsonSequenceStream<T>` -> `InputJsonSequenceStream<T>`
147
+ - add `Input` prefix
148
+ - `SequenceStream` -> `InputSequenceStream`
149
+ - add `Input` prefix
150
+ - new features
151
+ - `OutputJsonSequenceStfingifyStream<T>`
152
+ - object `T` Sequence -> `JSON Text <T>`
153
+ - `OutputJsonSequenceStream<T>`
154
+ - object `T` Sequence -> `application/json-seq` (json sequence) binary
155
+ - `OutputSequenceStream`
156
+ - `<TEXT>` sequence -> `RS` `<TEXT>` `LF` chunks
157
+ - deprecated (to be removed in v2.0.0)
158
+ - `JsonSequenceFormatStream<T>`
159
+   - rename after `InputJsonSequenceParseStream<T>`
160
+ - `JsonSequenceStream<T>`
161
+   - rename after `InputJsonSequenceStream<T>`
162
+ - `SequenceStream`
163
+   - rename after `InputSequenceStream`
164
+
165
+ ## v1.0.5
166
+
167
+ 🚀 First working release
168
+
169
+ - [npm:json-seq-stream@1.0.5](https://www.npmjs.com/package/json-seq-stream/v/1.0.5)
170
+
171
+ - release
172
+ - 2025/07/10
173
+
174
+ - new features
175
+ - `JsonSequenceFormatStream<T>`
176
+ - `JSON Text <T>` Sequence -> object `T` Sequence
177
+ - `JsonSequenceStream<T>`
178
+ - `application/json-seq` (json sequence) binary -> object `T` Sequence
179
+ - `SequenceStream`
180
+ - `RS` `<TEXT>` `LF` chunks -> `<TEXT>` Sequence
@@ -0,0 +1,2 @@
1
+ export * from "./input/index.js";
2
+ export * from "./output/index.js";
@@ -41,28 +41,7 @@ class J extends TransformStream {
41
41
  super(...t);
42
42
  }
43
43
  }
44
- function k({ delimiter: r, start: e, end: t, skip: s }) {
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 F extends TransformStream {
62
+ class O extends TransformStream {
84
63
  constructor(e) {
85
- const { args: t } = L(e);
64
+ const { args: t } = k(e);
86
65
  super(...t);
87
66
  }
88
67
  }
89
- class m extends F {
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,8 +78,8 @@ const X = m, f = {
99
78
  init: "init",
100
79
  flush: "flush"
101
80
  };
102
- function y({ begin: r, end: e, chunkEndSplit: t, fallbackSkip: s }) {
103
- const n = [], c = new RegExp(`(${RegExp.escape(r)}|${RegExp.escape(e)})`, "u"), u = s === !0 ? (() => !0) : s === !1 ? (() => !1) : s;
81
+ function L({ begin: r, end: e, chunkEndSplit: t, fallbackSkip: s }) {
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 {
106
85
  args: [
@@ -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 j extends TransformStream {
117
+ class F extends TransformStream {
139
118
  constructor(e) {
140
- const { args: t } = y(e);
119
+ const { args: t } = L(e);
141
120
  super(...t);
142
121
  }
143
122
  }
144
123
  const q = "", w = `
145
- `, N = q, D = w;
146
- class b extends j {
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 ??= N, s ??= D, n ??= !1, c ??= !1, super({ begin: t, end: s, chunkEndSplit: n, fallbackSkip: c });
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 $(r) {
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 P {
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
- } = $(e));
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
- const ee = P;
174
- function _({ stringify: r, errorFallback: e }) {
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 C extends TransformStream {
220
+ class G extends TransformStream {
193
221
  constructor(e) {
194
- const { args: t } = _(e);
222
+ const { args: t } = B(e);
195
223
  super(...t);
196
224
  }
197
225
  }
198
- class x extends C {
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 v({ begin: r, end: e, skip: t }) {
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 A extends TransformStream {
243
+ class z extends TransformStream {
216
244
  constructor(e) {
217
- const { args: t } = v(e);
245
+ const { args: t } = K(e);
218
246
  super(...t);
219
247
  }
220
248
  }
221
- const B = q, G = w, K = !1;
222
- class T extends A {
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 ??= B, s ??= G, n ??= K, super({ begin: t, end: s, skip: n, ...c });
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 { label: e, fatal: t, splitter: s, chunkEndSplit: n, parse: c, errorFallback: u } = r ?? {}, a = new TextDecoderStream(e, { fatal: t }), o = new Q({ splitter: s, chunkEndSplit: n }), i = new m({ parse: c, errorFallback: u }), { writable: d } = a, l = a.readable.pipeThrough(o).pipeThrough(i);
260
- return { writable: d, readable: l };
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 O {
277
+ class V extends A {
279
278
  constructor(e) {
280
279
  let { delimiter: t, start: s, end: n, skip: c } = e ?? {};
281
- t ??= I, s ??= !1, n ??= !1, c ??= !0, super({ delimiter: t, start: s, end: n, skip: c });
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 x({ stringify: c, errorFallback: u }), { writable: d } = i, l = i.readable.pipeThrough(o).pipeThrough(a);
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
- re as InputJsonLinesStream,
304
+ te as InputJsonLinesStream,
306
305
  m as InputJsonSequenceParseStream,
307
- P as InputJsonSequenceStream,
308
- Q as InputLineFeedSeparattedSequenceStream,
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
- ne as OutputJsonSequenceStream,
315
- x as OutputJsonSequenceStringifyStream,
316
- T as OutputRecordSequenceStream,
317
- te as OutputSequenceStream,
313
+ re as OutputJsonSequenceStream,
314
+ T as OutputJsonSequenceStringifyStream,
315
+ I as OutputRecordSequenceStream,
316
+ ne as OutputSequenceStream,
318
317
  V as OutputTextJoinLineFeedSequenceStream,
319
- F as ParseStream,
320
- j as RecordToSequenceStream,
318
+ O as ParseStream,
319
+ F as RecordToSequenceStream,
321
320
  Y as SequenceStream,
322
- A as SequenceToRecordStream,
323
- C as StringifyStream,
324
- O as TextJoinStream,
321
+ z as SequenceToRecordStream,
322
+ G as StringifyStream,
323
+ A as TextJoinStream,
325
324
  J as TextSplitStream
326
325
  };
@@ -1,4 +1,5 @@
1
- import { TextSplitStream, TextSplitStreamOptions } from "./TextSplitStream.js";
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
@@ -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,16 +1,8 @@
1
- export * from "./TextSplitStream.js";
2
1
  export * from "./TextJoinStream.js";
3
- export * from "./InputJsonSequenceStream.js";
4
2
  export * from "./OutputJsonSequenceStream.js";
5
- export * from "./InputJsonSequenceParseStream.js";
6
3
  export * from "./OutputJsonSequenceStringifyStream.js";
7
- export * from "./InputRecordSequenceStream.js";
8
4
  export * from "./OutputRecordSequenceStream.js";
9
- export * from "./InputJsonLinesStream.js";
10
5
  export * from "./OutputJsonLinesStream.js";
11
- export * from "./InputLineFeedSeparattedSequenceStream.js";
12
6
  export * from "./OutputTextJoinLineFeedSequenceStream.js";
13
7
  export * from "./SequenceToRecordStream.js";
14
- export * from "./RecordToSequenceStream.js";
15
8
  export * from "./StringifyStream.js";
16
- export * from "./ParseStream.js";
@@ -0,0 +1 @@
1
+ export type TransformStreamConstructor<I, O> = new (transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>) => TransformStream<I, O>;
@@ -0,0 +1 @@
1
+ export * from "./TransformStreamConstructor.js";
package/package.json CHANGED
@@ -1,27 +1,26 @@
1
1
  {
2
2
  "name": "json-seq-stream",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
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",
11
+ "types": "./dist/index.d.ts",
7
12
  "exports": {
8
13
  ".": {
9
- "import": {
10
- "types": "./index.d.ts",
11
- "default": "./index.js"
12
- },
13
- "require": {
14
- "types": "./index.d.ts",
15
- "default": "./index.umd.cjs"
16
- }
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
17
16
  }
18
17
  },
19
18
  "scripts": {
20
19
  "test:watch": "vitest watch --coverage",
21
20
  "test": "vitest run --coverage --coverage.reporter=cobertura --coverage.reporter=text",
22
- "lint": "eslint .",
23
- "lint:fix": "eslint . --fix",
24
- "build": "vite build && tsc --project tsconfig.build.json && cpx ./package.json dist && cpx README.md dist && cpx LICENSE dist"
21
+ "lint": "npx --node-options='--experimental-strip-types' eslint --flag unstable_native_nodejs_ts_config",
22
+ "build": "vite build && tsc --project tsconfig.build.json",
23
+ "clean": "node utils/remove.ts -- -f ./dist -f ./TestResults"
25
24
  },
26
25
  "repository": {
27
26
  "type": "git",
@@ -39,7 +38,7 @@
39
38
  "author": "juners",
40
39
  "license": "MIT",
41
40
  "engines": {
42
- "node": "^24.x"
41
+ "node": ">=24.x"
43
42
  },
44
43
  "bugs": {
45
44
  "url": "https://github.com/juner/json-seq-stream/issues"
@@ -50,9 +49,10 @@
50
49
  "@eslint/json": "^0.14.0",
51
50
  "@eslint/markdown": "^7.5.1",
52
51
  "@stylistic/eslint-plugin": "^5.5.0",
52
+ "@types/fs-extra": "^11.0.4",
53
53
  "@vitest/coverage-v8": "^4.0.8",
54
- "cpx": "^1.2.1",
55
54
  "eslint": "^9.39.1",
55
+ "fs-extra": "^11.3.2",
56
56
  "globals": "^16.5.0",
57
57
  "path": "^0.12.7",
58
58
  "typescript": "^5.9.3",
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