json-seq-stream 1.0.10 → 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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
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
|
+
|
|
3
23
|
## v1.0.10
|
|
4
24
|
|
|
5
25
|
- [npm:json-seq-stream@1.0.10](https://www.npmjs.com/package/json-seq-stream/v/1.0.10)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TransformStreamConstructor<I, O> = new (transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>) => TransformStream<I, O>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-seq-stream",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "application/json-seq support stream / async iterator library",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -8,16 +8,11 @@
|
|
|
8
8
|
],
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": {
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"default": "./dist/index.js"
|
|
16
|
-
},
|
|
17
|
-
"require": {
|
|
18
|
-
"types": "./dist/index.d.ts",
|
|
19
|
-
"default": "./dist/index.umd.cjs"
|
|
20
|
-
}
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
21
16
|
}
|
|
22
17
|
},
|
|
23
18
|
"scripts": {
|
package/dist/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 $({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"})}));
|