@laravel/stream-svelte 0.3.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/README.md +301 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.es.js +1095 -0
- package/dist/index.umd.js +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(i,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(i=typeof globalThis<"u"?globalThis:i||self,h(i.LaravelStreamSvelte={}))})(this,(function(i){"use strict";var wt=Object.defineProperty;var Dn=i=>{throw TypeError(i)};var bt=(i,h,m)=>h in i?wt(i,h,{enumerable:!0,configurable:!0,writable:!0,value:m}):i[h]=m;var Y=(i,h,m)=>bt(i,typeof h!="symbol"?h+"":h,m),Pe=(i,h,m)=>h.has(i)||Dn("Cannot "+m);var p=(i,h,m)=>(Pe(i,h,"read from private field"),m?m.call(i):h.get(i)),L=(i,h,m)=>h.has(i)?Dn("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(i):h.set(i,m),V=(i,h,m,ve)=>(Pe(i,h,"write to private field"),ve?ve.call(i,m):h.set(i,m),m),ie=(i,h,m)=>(Pe(i,h,"access private method"),m);var re,se,J,le,de,_e,K,oe,M,Ue,Ye,Rn;const h=Symbol(),m=!1;var ve=Array.prototype.indexOf,Ae=Array.prototype.includes;const G=()=>{};function Ve(e){for(var n=0;n<e.length;n++)e[n]()}function kn(){var e,n,t=new Promise((r,s)=>{e=r,n=s});return{promise:t,resolve:e,reject:n}}const I=2,xe=4,Tn=8,Je=1<<24,ae=16,H=32,W=64,Ke=128,X=512,y=1024,O=2048,Z=4096,Q=8192,$=16384,je=32768,ze=65536,Ge=1<<18,He=1<<19,An=1<<20,Ne=32768,We=1<<21,xn=1<<22,pe=1<<23,Xe=new class extends Error{constructor(){super(...arguments);Y(this,"name","StaleReactionError");Y(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function jn(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Nn(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Mn(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Ln(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function In(e,n){return e!=e?n==n:e!==n||e!==null&&typeof e=="object"||typeof e=="function"}let On=!1,ge=null;function Ze(e){ge=e}function Bn(){return!0}let ee=[];function qn(){var e=ee;ee=[],Ve(e)}function Qe(e){if(ee.length===0){var n=ee;queueMicrotask(()=>{n===ee&&qn()})}ee.push(e)}function Pn(e){var n=k;if(n===null)return C.f|=pe,e;if((n.f&je)===0){if((n.f&Ke)===0)throw e;n.b.error(e)}else $e(e,n)}function $e(e,n){for(;n!==null;){if((n.f&Ke)!==0)try{n.b.error(e);return}catch(t){e=t}n=n.parent}throw e}const Un=-7169;function F(e,n){e.f=e.f&Un|n}function en(e){(e.f&X)!==0||e.deps===null?F(e,y):F(e,Z)}function nn(e){if(e!==null)for(const n of e)(n.f&I)===0||(n.f&Ne)===0||(n.f^=Ne,nn(n.deps))}function Yn(e,n,t){(e.f&O)!==0?n.add(e):(e.f&Z)!==0&&t.add(e),nn(e.deps),F(e,y)}const me=new Set;let g=null,j=null,R=[],Me=null,Le=!1;const qe=class qe{constructor(){L(this,M);Y(this,"committed",!1);Y(this,"current",new Map);Y(this,"previous",new Map);L(this,re,new Set);L(this,se,new Set);L(this,J,0);L(this,le,0);L(this,de,null);L(this,_e,new Set);L(this,K,new Set);Y(this,"skipped_effects",new Set);Y(this,"is_fork",!1);L(this,oe,!1)}is_deferred(){return this.is_fork||p(this,le)>0}process(n){var s;R=[],this.apply();var t=[],r=[];for(const l of n)ie(this,M,Ue).call(this,l,t,r);if(this.is_deferred()){ie(this,M,Ye).call(this,r),ie(this,M,Ye).call(this,t);for(const l of this.skipped_effects)ln(l)}else{for(const l of p(this,re))l();p(this,re).clear(),p(this,J)===0&&ie(this,M,Rn).call(this),g=null,tn(r),tn(t),(s=p(this,de))==null||s.resolve()}j=null}capture(n,t){t!==h&&!this.previous.has(n)&&this.previous.set(n,t),(n.f&pe)===0&&(this.current.set(n,n.v),j==null||j.set(n,n.v))}activate(){g=this,this.apply()}deactivate(){g===this&&(g=null,j=null)}flush(){if(this.activate(),R.length>0){if(Vn(),g!==null&&g!==this)return}else p(this,J)===0&&this.process([]);this.deactivate()}discard(){for(const n of p(this,se))n(this);p(this,se).clear()}increment(n){V(this,J,p(this,J)+1),n&&V(this,le,p(this,le)+1)}decrement(n){V(this,J,p(this,J)-1),n&&V(this,le,p(this,le)-1),!p(this,oe)&&(V(this,oe,!0),Qe(()=>{V(this,oe,!1),this.is_deferred()?R.length>0&&this.flush():this.revive()}))}revive(){for(const n of p(this,_e))p(this,K).delete(n),F(n,O),fe(n);for(const n of p(this,K))F(n,Z),fe(n);this.flush()}oncommit(n){p(this,re).add(n)}ondiscard(n){p(this,se).add(n)}settled(){return(p(this,de)??V(this,de,kn())).promise}static ensure(){if(g===null){const n=g=new qe;me.add(g),Qe(()=>{g===n&&n.flush()})}return g}apply(){}};re=new WeakMap,se=new WeakMap,J=new WeakMap,le=new WeakMap,de=new WeakMap,_e=new WeakMap,K=new WeakMap,oe=new WeakMap,M=new WeakSet,Ue=function(n,t,r){n.f^=y;for(var s=n.first,l=null;s!==null;){var a=s.f,u=(a&(H|W))!==0,f=u&&(a&y)!==0,c=f||(a&Q)!==0||this.skipped_effects.has(s);if(!c&&s.fn!==null){u?s.f^=y:l!==null&&(a&(xe|Tn|Je))!==0?l.b.defer_effect(s):(a&xe)!==0?t.push(s):Ie(s)&&((a&ae)!==0&&p(this,K).add(s),De(s));var v=s.first;if(v!==null){s=v;continue}}var o=s.parent;for(s=s.next;s===null&&o!==null;)o===l&&(l=null),s=o.next,o=o.parent}},Ye=function(n){for(var t=0;t<n.length;t+=1)Yn(n[t],p(this,_e),p(this,K))},Rn=function(){var s;if(me.size>1){this.previous.clear();var n=j,t=!0;for(const l of me){if(l===this){t=!1;continue}const a=[];for(const[f,c]of this.current){if(l.current.has(f))if(t&&c!==l.current.get(f))l.current.set(f,c);else continue;a.push(f)}if(a.length===0)continue;const u=[...l.current.keys()].filter(f=>!this.current.has(f));if(u.length>0){var r=R;R=[];const f=new Set,c=new Map;for(const v of a)rn(v,u,f,c);if(R.length>0){g=l,l.apply();for(const v of R)ie(s=l,M,Ue).call(s,v,[],[]);l.deactivate()}R=r}}g=null,j=n}this.committed=!0,me.delete(this)};let Ee=qe;function Vn(){Le=!0;var e=null;try{for(var n=0;R.length>0;){var t=Ee.ensure();if(n++>1e3){var r,s;Jn()}t.process(R),an.clear()}}finally{Le=!1,Me=null}}function Jn(){try{Ln()}catch(e){$e(e,Me)}}let B=null;function tn(e){var n=e.length;if(n!==0){for(var t=0;t<n;){var r=e[t++];if((r.f&($|Q))===0&&Ie(r)&&(B=new Set,De(r),r.deps===null&&r.first===null&&r.nodes===null&&(r.teardown===null&&r.ac===null?vn(r):r.fn=null),(B==null?void 0:B.size)>0)){an.clear();for(const s of B){if((s.f&($|Q))!==0)continue;const l=[s];let a=s.parent;for(;a!==null;)B.has(a)&&(B.delete(a),l.push(a)),a=a.parent;for(let u=l.length-1;u>=0;u--){const f=l[u];(f.f&($|Q))===0&&De(f)}}B.clear()}}B=null}}function rn(e,n,t,r){if(!t.has(e)&&(t.add(e),e.reactions!==null))for(const s of e.reactions){const l=s.f;(l&I)!==0?rn(s,n,t,r):(l&(xn|ae))!==0&&(l&O)===0&&sn(s,n,r)&&(F(s,O),fe(s))}}function sn(e,n,t){const r=t.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const s of e.deps){if(Ae.call(n,s))return!0;if((s.f&I)!==0&&sn(s,n,t))return t.set(s,!0),!0}return t.set(e,!1),!1}function fe(e){for(var n=Me=e;n.parent!==null;){n=n.parent;var t=n.f;if(Le&&n===k&&(t&ae)!==0&&(t&Ge)===0)return;if((t&(W|H))!==0){if((t&y)===0)return;n.f^=y}}R.push(n)}function ln(e){if(!((e.f&H)!==0&&(e.f&y)!==0)){F(e,y);for(var n=e.first;n!==null;)ln(n),n=n.next}}function on(e){var n=e.effects;if(n!==null){e.effects=null;for(var t=0;t<n.length;t+=1)ue(n[t])}}function Kn(e){for(var n=e.parent;n!==null;){if((n.f&I)===0)return(n.f&$)===0?n:null;n=n.parent}return null}function zn(e){var n,t=k;ye(Kn(e));try{e.f&=~Ne,on(e),n=En(e)}finally{ye(t)}return n}function Gn(e){var n=zn(e);if(!e.equals(n)&&(e.wv=nt(),(!(g!=null&&g.is_fork)||e.deps===null)&&(e.v=n,e.deps===null))){F(e,y);return}be||(j!==null?(cn()||g!=null&&g.is_fork)&&j.set(e,n):en(e))}const an=new Map;var Hn;function Wn(e){return Hn.call(e)}function fn(e){var n=C,t=k;Se(null),ye(null);try{return e()}finally{Se(n),ye(t)}}function Xn(e){k===null&&(C===null&&Mn(),Nn()),be&&jn()}function Zn(e,n){var t=n.last;t===null?n.last=n.first=e:(t.next=e,e.prev=t,n.last=e)}function un(e,n,t){var r=k;r!==null&&(r.f&Q)!==0&&(e|=Q);var s={ctx:ge,deps:null,nodes:null,f:e|O|X,first:null,fn:n,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};if(t)try{De(s),s.f|=je}catch(u){throw ue(s),u}else n!==null&&fe(s);var l=s;if(t&&l.deps===null&&l.teardown===null&&l.nodes===null&&l.first===l.last&&(l.f&He)===0&&(l=l.first,(e&ae)!==0&&(e&ze)!==0&&l!==null&&(l.f|=ze)),l!==null&&(l.parent=r,r!==null&&Zn(l,r),C!==null&&(C.f&I)!==0&&(e&W)===0)){var a=C;(a.effects??(a.effects=[])).push(l)}return s}function cn(){return C!==null&&!P}function we(e){Xn();var n=k.f,t=!C&&(n&H)!==0&&(n&je)===0;if(t){var r=ge;(r.e??(r.e=[])).push(e)}else return Qn(e)}function Qn(e){return un(xe|An,e,!1)}function hn(e){Ee.ensure();const n=un(W|He,e,!0);return()=>{ue(n)}}function dn(e){var n=e.teardown;if(n!==null){const t=be,r=C;pn(!0),Se(null);try{n.call(null)}finally{pn(t),Se(r)}}}function _n(e,n=!1){var t=e.first;for(e.first=e.last=null;t!==null;){const s=t.ac;s!==null&&fn(()=>{s.abort(Xe)});var r=t.next;(t.f&W)!==0?t.parent=null:ue(t,n),t=r}}function $n(e){for(var n=e.first;n!==null;){var t=n.next;(n.f&H)===0&&ue(n),n=t}}function ue(e,n=!0){var t=!1;(n||(e.f&Ge)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(et(e.nodes.start,e.nodes.end),t=!0),_n(e,n&&!t),Ce(e,0),F(e,$);var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)l.stop();dn(e);var s=e.parent;s!==null&&s.first!==null&&vn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function et(e,n){for(;e!==null;){var t=e===n?null:Wn(e);e.remove(),e=t}}function vn(e){var n=e.parent,t=e.prev,r=e.next;t!==null&&(t.next=r),r!==null&&(r.prev=t),n!==null&&(n.first===e&&(n.first=r),n.last===e&&(n.last=t))}let be=!1;function pn(e){be=e}let C=null,P=!1;function Se(e){C=e}let k=null;function ye(e){k=e}let ce=null,N=null,T=0,q=null,gn=1,Fe=0;function nt(){return++gn}function Ie(e){var n=e.f;if((n&O)!==0)return!0;if(n&I&&(e.f&=-32769),(n&Z)!==0){for(var t=e.deps,r=t.length,s=0;s<r;s++){var l=t[s];if(Ie(l)&&Gn(l),l.wv>e.wv)return!0}(n&X)!==0&&j===null&&F(e,y)}return!1}function mn(e,n,t=!0){var r=e.reactions;if(r!==null&&!(ce!==null&&Ae.call(ce,e)))for(var s=0;s<r.length;s++){var l=r[s];(l.f&I)!==0?mn(l,n,!1):n===l&&(t?F(l,O):(l.f&y)!==0&&F(l,Z),fe(l))}}function En(e){var w;var n=N,t=T,r=q,s=C,l=ce,a=ge,u=P,f=e.f;N=null,T=0,q=null,C=(f&(H|W))===0?e:null,ce=null,Ze(e.ctx),P=!1,++Fe,e.ac!==null&&(fn(()=>{e.ac.abort(Xe)}),e.ac=null);try{e.f|=We;var c=e.fn,v=c(),o=e.deps,A=g==null?void 0:g.is_fork;if(N!==null){var E;if(A||Ce(e,T),o!==null&&T>0)for(o.length=T+N.length,E=0;E<N.length;E++)o[T+E]=N[E];else e.deps=o=N;if(cn()&&(e.f&X)!==0)for(E=T;E<o.length;E++)((w=o[E]).reactions??(w.reactions=[])).push(e)}else!A&&o!==null&&T<o.length&&(Ce(e,T),o.length=T);if(Bn()&&q!==null&&!P&&o!==null&&(e.f&(I|Z|O))===0)for(E=0;E<q.length;E++)mn(q[E],e);if(s!==null&&s!==e){if(Fe++,s.deps!==null)for(let b=0;b<t;b+=1)s.deps[b].rv=Fe;if(n!==null)for(const b of n)b.rv=Fe;q!==null&&(r===null?r=q:r.push(...q))}return(e.f&pe)!==0&&(e.f^=pe),v}catch(b){return Pn(b)}finally{e.f^=We,N=n,T=t,q=r,C=s,ce=l,Ze(a),P=u}}function tt(e,n){let t=n.reactions;if(t!==null){var r=ve.call(t,e);if(r!==-1){var s=t.length-1;s===0?t=n.reactions=null:(t[r]=t[s],t.pop())}}if(t===null&&(n.f&I)!==0&&(N===null||!Ae.call(N,n))){var l=n;(l.f&X)!==0&&(l.f^=X,l.f&=-32769),en(l),on(l),Ce(l,0)}}function Ce(e,n){var t=e.deps;if(t!==null)for(var r=n;r<t.length;r++)tt(e,t[r])}function De(e){var n=e.f;if((n&$)===0){F(e,y);var t=k;k=e;try{(n&(ae|Je))!==0?$n(e):_n(e),dn(e);var r=En(e);e.teardown=typeof r=="function"?r:null,e.wv=gn;var s;m&&On&&(e.f&O)!==0&&e.deps}finally{k=t}}}function rt(e){var n=P;try{return P=!0,e()}finally{P=n}}function wn(e,n,t){if(e==null)return n(void 0),t&&t(void 0),G;const r=rt(()=>e.subscribe(n,t));return r.unsubscribe?()=>r.unsubscribe():r}const ne=[];function st(e,n){return{subscribe:Oe(e,n).subscribe}}function Oe(e,n=G){let t=null;const r=new Set;function s(u){if(In(e,u)&&(e=u,t)){const f=!ne.length;for(const c of r)c[1](),ne.push(c,e);if(f){for(let c=0;c<ne.length;c+=2)ne[c][0](ne[c+1]);ne.length=0}}}function l(u){s(u(e))}function a(u,f=G){const c=[u,f];return r.add(c),r.size===1&&(t=n(s,l)||G),u(e),()=>{r.delete(c),r.size===0&&t&&(t(),t=null)}}return{set:s,update:l,subscribe:a}}function lt(e,n,t){const r=!Array.isArray(e),s=r?[e]:e;if(!s.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const l=n.length<2;return st(t,(a,u)=>{let f=!1;const c=[];let v=0,o=G;const A=()=>{if(v)return;o();const w=n(r?c[0]:c,a,u);l?a(w):o=typeof w=="function"?w:G},E=s.map((w,b)=>wn(w,d=>{c[b]=d,v&=~(1<<b),f&&A()},()=>{v|=1<<b}));return f=!0,A(),function(){Ve(E),o(),f=!1}})}function ot(e){let n;return wn(e,t=>n=t)(),n}const Be="data: ",it=(e,{eventName:n="update",endSignal:t="</stream>",glue:r=" ",replace:s=!1,onMessage:l=()=>null,onComplete:a=()=>null,onError:u=()=>null}={})=>{const f=typeof e=="function"?e:()=>e,c=Array.isArray(n)?n:[n],v=Oe({message:"",messageParts:[]});let o=null,A=f();const E=()=>{v.set({message:"",messageParts:[]})},w=(_=!1)=>{c.forEach(x=>{o==null||o.removeEventListener(x,b)}),o==null||o.removeEventListener("error",d),o==null||o.close(),o=null,_&&E()},b=_=>{if([t,`${Be}${t}`].includes(_.data)){w(),a();return}v.update(x=>{let S=[...x.messageParts];s&&(S=[]);const z=_.data.startsWith(Be)?_.data.substring(Be.length):_.data;return S=[...S,z],{message:S.join(r),messageParts:S}}),l(_)},d=_=>{const x=_ instanceof Error?_:new Error(_.type?`EventSource ${_.type}`:"EventSource error");u(x),w()},D=()=>{E(),o=new EventSource(f()),c.forEach(_=>{o.addEventListener(_,b)}),o.addEventListener("error",d)};return hn(()=>{we(()=>(D(),()=>{w()})),we(()=>{const _=f();_!==A&&(A=_,w(),D())})}),{subscribe:v.subscribe,close:w,clearMessage:E}},at="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ft=(e=21)=>{let n="",t=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)n+=at[t[e]&63];return n};const he=new Map,ut=(e,n)=>{he.has(e)||he.set(e,{onData:[],onError:[],onFinish:[],onResponse:[],onCancel:[],onBeforeSend:[]});const t=he.get(e);return n.onData&&t.onData.push(n.onData),n.onError&&t.onError.push(n.onError),n.onFinish&&t.onFinish.push(n.onFinish),n.onResponse&&t.onResponse.push(n.onResponse),n.onCancel&&t.onCancel.push(n.onCancel),n.onBeforeSend&&t.onBeforeSend.push(n.onBeforeSend),()=>{vt(e,n)}},te=(e,n,...t)=>{const r=he.get(e);return r?r[n].map(s=>s(...t)):[]},bn=e=>{te(e,"onFinish")},Sn=(e,n)=>{te(e,"onError",n)},ct=(e,n)=>{te(e,"onResponse",n)},ht=e=>{te(e,"onCancel")},dt=(e,n)=>{te(e,"onData",n)},_t=(e,n)=>{const t=te(e,"onBeforeSend",n);for(const r of t){if(r===!1)return!1;if(r!==null&&typeof r=="object")return r}return null},vt=(e,n)=>{const t=he.get(e);t&&(n.onData&&(t.onData=t.onData.filter(r=>r!==n.onData)),n.onError&&(t.onError=t.onError.filter(r=>r!==n.onError)),n.onFinish&&(t.onFinish=t.onFinish.filter(r=>r!==n.onFinish)),n.onResponse&&(t.onResponse=t.onResponse.filter(r=>r!==n.onResponse)),n.onCancel&&(t.onCancel=t.onCancel.filter(r=>r!==n.onCancel)),n.onBeforeSend&&(t.onBeforeSend=t.onBeforeSend.filter(r=>r!==n.onBeforeSend)))},Re=new Map,U=new Map,ke=e=>{const n=Re.get(e);if(n)return n;const t={controller:new AbortController,data:"",isFetching:!1,isStreaming:!1,jsonData:null};return Re.set(e,t),t},yn=e=>(U.has(e)||U.set(e,[]),U.get(e)),Fn=e=>{var n;return U.has(e)&&((n=U.get(e))==null?void 0:n.length)},pt=(e,n)=>(yn(e).push(n),()=>{U.set(e,yn(e).filter(t=>t!==n)),Fn(e)||(Re.delete(e),U.delete(e))}),gt=(e,n)=>{var r;Re.set(e,{...ke(e),...n});const t=ke(e);(r=U.get(e))==null||r.forEach(s=>s(t))},Cn=(e,n={})=>{const t=typeof e=="function"?e:()=>e,r=n.id??ft(),s=ke(r),l=Oe({data:s.data,jsonData:s.jsonData,isFetching:s.isFetching,isStreaming:s.isStreaming}),a=(()=>{var _;const d={"Content-Type":"application/json","X-STREAM-ID":r},D=n.csrfToken??((_=document.querySelector('meta[name="csrf-token"]'))==null?void 0:_.getAttribute("content"));return D&&(d["X-CSRF-TOKEN"]=D),d})();let u,f,c=t();const v=d=>{gt(r,d)},o=()=>{ke(r).controller.abort();const D=ot(l);(D.isFetching||D.isStreaming)&&ht(r),v({isFetching:!1,isStreaming:!1})},A=d=>{const D=new AbortController,_={method:"POST",signal:D.signal,headers:{...a,...n.headers??{}},body:JSON.stringify(d??{}),credentials:n.credentials??"same-origin"},x=_t(r,_);x!==!1&&(v({isFetching:!0,controller:D}),fetch(t(),x??_).then(async S=>{if(!S.ok){const z=await S.text();throw new Error(z)}if(!S.body)throw new Error("ReadableStream not yet supported in this browser.");return ct(r,S),v({isFetching:!1,isStreaming:!0}),b(S.body.getReader())}).catch(S=>{v({isFetching:!1,isStreaming:!1}),Sn(r,S),bn(r)}))},E=d=>{o(),A(d),w()},w=()=>{v({data:"",jsonData:null})},b=async(d,D="")=>d.read().then(({done:_,value:x})=>{const S=x!==void 0?new TextDecoder("utf-8").decode(x):"",z=D+S;dt(r,S);const Te={data:z};if(!_)return v(Te),b(d,z);if(Te.isStreaming=!1,n.json)try{Te.jsonData=JSON.parse(z)}catch(Et){Sn(r,Et)}return v(Te),bn(r),""});return hn(()=>{we(()=>(u=pt(r,d=>{l.set({data:d.data,jsonData:d.jsonData,isFetching:d.isFetching,isStreaming:d.isStreaming})}),f=ut(r,n),window.addEventListener("beforeunload",o),n.initialInput&&A(n.initialInput),()=>{u&&u(),f&&f(),window.removeEventListener("beforeunload",o),Fn(r)||o()})),we(()=>{const d=t();d!==c&&(c=d,o(),w())})}),{subscribe:l.subscribe,id:r,send:E,cancel:o,clearData:w}},mt=(e,n={})=>{const t=Cn(e,{...n,json:!0});return{subscribe:lt(t,s=>({data:s.jsonData,strData:s.data,isFetching:s.isFetching,isStreaming:s.isStreaming})).subscribe,id:t.id,send:t.send,cancel:t.cancel,clearData:t.clearData}};i.useEventStream=it,i.useJsonStream=mt,i.useStream=Cn,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@laravel/stream-svelte",
|
|
3
|
+
"version": "0.3.10",
|
|
4
|
+
"description": "Laravel streaming helpers for Svelte 5",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"laravel",
|
|
7
|
+
"stream",
|
|
8
|
+
"use-stream",
|
|
9
|
+
"server-sent-events",
|
|
10
|
+
"sse",
|
|
11
|
+
"svelte",
|
|
12
|
+
"svelte5",
|
|
13
|
+
"runes"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://github.com/laravel/stream/tree/main/packages/svelte#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/laravel/stream.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/laravel/stream/issues"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "Taylor Otwell"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "dist/index.umd.js",
|
|
29
|
+
"module": "dist/index.es.js",
|
|
30
|
+
"types": "dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.es.js",
|
|
35
|
+
"require": "./dist/index.umd.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"svelte": "./dist/index.es.js",
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.14.0",
|
|
44
|
+
"esbuild": "^0.24.0",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.21.0",
|
|
46
|
+
"@typescript-eslint/parser": "^8.21.0",
|
|
47
|
+
"eslint": "^9.0.0",
|
|
48
|
+
"jsdom": "^26.0.0",
|
|
49
|
+
"msw": "^2.8.2",
|
|
50
|
+
"prettier": "^3.5.3",
|
|
51
|
+
"svelte": "^5.0.0",
|
|
52
|
+
"typescript": "^5.3.0",
|
|
53
|
+
"vite": "^6.0.0",
|
|
54
|
+
"vite-plugin-dts": "^4.5.3",
|
|
55
|
+
"vitest": "^3.1.1"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"svelte": "^5.0.0"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"nanoid": "^5.1.5"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "vite build",
|
|
65
|
+
"lint": "eslint --config eslint.config.mjs \"src/**/*.ts\" \"src/**/*.svelte.ts\"",
|
|
66
|
+
"prepublish": "pnpm run build",
|
|
67
|
+
"release": "vitest --run && pnpm publish --no-git-checks",
|
|
68
|
+
"test": "vitest",
|
|
69
|
+
"format": "prettier --write ."
|
|
70
|
+
}
|
|
71
|
+
}
|