Skip to content

Commit

Permalink
Move ReadableStream
Browse files Browse the repository at this point in the history
  • Loading branch information
lxsmnsyc committed Dec 5, 2023
1 parent fd97598 commit 5ce753d
Show file tree
Hide file tree
Showing 19 changed files with 645 additions and 540 deletions.
3 changes: 2 additions & 1 deletion packages/plugins/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
"devDependencies": ["**/*.test.ts"]
}
],
"prefer-template": "off"
"prefer-template": "off",
"@typescript-eslint/no-explicit-any": "off"
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`ReadableStream > crossSerializeAsync > scoped > supports ReadableStream 1`] = `"($R=>$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))(($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[2].next("foo"),$R[2].next("bar"),$R[2].next("baz"),$R[2].return(void 0),$R[2])))($R["example"])"`;
exports[`ReadableStream > crossSerializeAsync > scoped > supports ReadableStream errors 1`] = `"($R=>$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))(($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[2].throw($R[4]=Object.assign(new Error("Oops!"),{stack:""})),$R[2])))($R["example"])"`;
exports[`ReadableStream > crossSerializeAsync > supports ReadableStream 1`] = `"$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))(($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[2].next("foo"),$R[2].next("bar"),$R[2].next("baz"),$R[2].return(void 0),$R[2]))"`;
exports[`ReadableStream > crossSerializeAsync > supports ReadableStream errors 1`] = `"$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))(($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),$R[2].throw($R[4]=Object.assign(new Error("Oops!"),{stack:""})),$R[2]))"`;
exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 1`] = `"($R=>$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))()))($R["example"])"`;
exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 2`] = `"($R=>$R[2].next("foo"))($R["example"])"`;
exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 3`] = `"($R=>$R[2].next("bar"))($R["example"])"`;
exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 4`] = `"($R=>$R[2].next("baz"))($R["example"])"`;
exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream 5`] = `"($R=>$R[2].return(void 0))($R["example"])"`;
exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream errors 1`] = `"($R=>$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))()))($R["example"])"`;
exports[`ReadableStream > crossSerializeStream > scoped > supports ReadableStream errors 2`] = `"($R=>$R[2].throw($R[4]=Object.assign(new Error("Oops!"),{stack:""})))($R["example"])"`;
exports[`ReadableStream > crossSerializeStream > supports ReadableStream 1`] = `"$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))())"`;
exports[`ReadableStream > crossSerializeStream > supports ReadableStream 2`] = `"$R[2].next("foo")"`;
exports[`ReadableStream > crossSerializeStream > supports ReadableStream 3`] = `"$R[2].next("bar")"`;
exports[`ReadableStream > crossSerializeStream > supports ReadableStream 4`] = `"$R[2].next("baz")"`;
exports[`ReadableStream > crossSerializeStream > supports ReadableStream 5`] = `"$R[2].return(void 0)"`;
exports[`ReadableStream > crossSerializeStream > supports ReadableStream errors 1`] = `"$R[0]=($R[1]=d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))($R[2]=($R[3]=(b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))())"`;
exports[`ReadableStream > crossSerializeStream > supports ReadableStream errors 2`] = `"$R[2].throw($R[4]=Object.assign(new Error("Oops!"),{stack:""}))"`;
exports[`ReadableStream > serializeAsync > supports ReadableStream 1`] = `"((h,j)=>((d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))((j=((b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),j.next("foo"),j.next("bar"),j.next("baz"),j.return(void 0),j))))()"`;
exports[`ReadableStream > serializeAsync > supports ReadableStream errors 1`] = `"((h,j)=>((d=>new ReadableStream({start:c=>{d.on({next:v=>{c.enqueue(v)},throw:v=>{c.error(v)},return:()=>{c.close()}})}}))((j=((b,a,s,l,p,f,e,n)=>(b=[],a=!0,s=!1,l=[],s=0,f=(v,m,x)=>{for(x=0;x<s;x++)l[x]&&l[x][m](v)},n=(o,x,z,c)=>{for(x=0,z=b.length;x<z;x++)(c=b[x],x===z-1?o[s?"return":"throw"](c):o.next(c))},e=(o,t)=>(a&&(l[t=p++]=o),n(o),()=>{a&&(l[t]=void 0)}),{__SEROVAL_STREAM__:!0,on:o=>e(o),next:v=>{a&&(b.push(v),f(v,"next"))},throw:v=>{a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)},return:v=>{a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)}}))(),j.throw(Object.assign(new Error("Oops!"),{stack:""})),j))))()"`;
exports[`ReadableStream > serializeAsync > supports ReadableStream errors 2`] = `[Error: Oops!]`;
exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream 1`] = `"{"t":40,"i":0,"s":{"factory":{"t":40,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":47,"i":2,"a":[{"t":48,"i":2,"f":{"t":1,"s":"foo"}},{"t":48,"i":2,"f":{"t":1,"s":"bar"}},{"t":48,"i":2,"f":{"t":1,"s":"baz"}},{"t":50,"i":2,"f":{"t":2,"s":1}}],"f":{"t":41,"i":3,"s":9}}},"c":"seroval/plugins/web/ReadableStream"}"`;
exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 1`] = `"{"t":40,"i":0,"s":{"factory":{"t":40,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":47,"i":2,"a":[{"t":49,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}],"f":{"t":41,"i":3,"s":9}}},"c":"seroval/plugins/web/ReadableStream"}"`;
exports[`ReadableStream > toCrossJSONAsync > supports ReadableStream errors 2`] = `[Error: Oops!]`;
exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 1`] = `"{"t":40,"i":0,"s":{"factory":{"t":40,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":47,"i":2,"a":[],"f":{"t":41,"i":3,"s":9}}},"c":"seroval/plugins/web/ReadableStream"}"`;
exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 2`] = `"{"t":48,"i":2,"f":{"t":1,"s":"foo"}}"`;
exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 3`] = `"{"t":48,"i":2,"f":{"t":1,"s":"bar"}}"`;
exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 4`] = `"{"t":48,"i":2,"f":{"t":1,"s":"baz"}}"`;
exports[`ReadableStream > toCrossJSONStream > supports ReadableStream 5`] = `"{"t":50,"i":2,"f":{"t":2,"s":1}}"`;
exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 1`] = `"{"t":40,"i":0,"s":{"factory":{"t":40,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":47,"i":2,"a":[],"f":{"t":41,"i":3,"s":9}}},"c":"seroval/plugins/web/ReadableStream"}"`;
exports[`ReadableStream > toCrossJSONStream > supports ReadableStream errors 2`] = `"{"t":49,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}"`;
exports[`ReadableStream > toJSONAsync > supports ReadableStream 1`] = `"{"t":{"t":40,"i":0,"s":{"factory":{"t":40,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":47,"i":2,"a":[{"t":48,"i":2,"f":{"t":1,"s":"foo"}},{"t":48,"i":2,"f":{"t":1,"s":"bar"}},{"t":48,"i":2,"f":{"t":1,"s":"baz"}},{"t":50,"i":2,"f":{"t":2,"s":1}}],"f":{"t":41,"i":3,"s":9}}},"c":"seroval/plugins/web/ReadableStream"},"f":16383,"m":[2]}"`;
exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 1`] = `"{"t":{"t":40,"i":0,"s":{"factory":{"t":40,"i":1,"c":"seroval-plugins/web/ReadableStreamFactory"},"stream":{"t":47,"i":2,"a":[{"t":49,"i":2,"f":{"t":13,"i":4,"s":0,"m":"Oops!","p":{"k":["stack"],"v":[{"t":1,"s":""}],"s":1}}}],"f":{"t":41,"i":3,"s":9}}},"c":"seroval/plugins/web/ReadableStream"},"f":16383,"m":[2]}"`;
exports[`ReadableStream > toJSONAsync > supports ReadableStream errors 2`] = `[Error: Oops!]`;
Loading

0 comments on commit 5ce753d

Please sign in to comment.