Comparing version 1.9.0 to 1.10.0
@@ -1,1 +0,1 @@ | ||
(function(t,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("swrev"),require("svelte")):typeof define=="function"&&define.amd?define(["exports","swrev","svelte"],h):(t=typeof globalThis<"u"?globalThis:t||self,h(t.sswr={},t.swrev,t.svelte))})(this,function(t,h,m){"use strict";function b(){}function q(e){return e()}function E(e){e.forEach(q)}function O(e){return typeof e=="function"}function D(e,r){return e!=e?r==r:e!==r||e&&typeof e=="object"||typeof e=="function"}function j(e,...r){if(e==null)return b;const s=e.subscribe(...r);return s.unsubscribe?()=>s.unsubscribe():s}Promise.resolve();const v=[];function K(e,r){return{subscribe:W(e,r).subscribe}}function W(e,r=b){let s;const n=new Set;function o(c){if(D(e,c)&&(e=c,s)){const l=!v.length;for(const i of n)i[1](),v.push(i,e);if(l){for(let i=0;i<v.length;i+=2)v[i][0](v[i+1]);v.length=0}}}function f(c){o(c(e))}function w(c,l=b){const i=[c,l];return n.add(i),n.size===1&&(s=r(o)||b),c(e),()=>{n.delete(i),n.size===0&&(s(),s=null)}}return{set:o,update:f,subscribe:w}}function R(e,r,s){const n=!Array.isArray(e),o=n?[e]:e,f=r.length<2;return K(s,w=>{let c=!1;const l=[];let i=0,S=b;const u=()=>{if(i)return;S();const a=r(n?l[0]:l,w);f?w(a):S=O(a)?a:b},d=o.map((a,y)=>j(a,$=>{l[y]=$,i&=~(1<<y),c&&u()},()=>{i|=1<<y}));return c=!0,u(),function(){E(d),S()}})}class _ extends h.SWR{useSWR(r,s){let n;const o=W(void 0,()=>()=>n==null?void 0:n()),f=W(void 0,()=>()=>n==null?void 0:n());m.beforeUpdate(()=>{const u=a=>{f.set(void 0),o.set(a)},d=a=>f.set(a);n||(n=this.use(r,u,d,{loadInitialCache:!0,...s}).unsubscribe)}),m.onDestroy(()=>n==null?void 0:n());const w=(u,d)=>this.mutate(this.resolveKey(r),u,{revalidateOptions:s,...d}),c=u=>this.revalidate(this.resolveKey(r),{...s,...u}),l=u=>this.clear(this.resolveKey(r),u),i=R([o,f],([u,d])=>u===void 0&&d===void 0),S=R([o,f],([u,d])=>u!==void 0&&d===void 0);return{data:o,error:f,mutate:w,revalidate:c,clear:l,isLoading:i,isValid:S}}}const g=e=>new _(e);t.swr=g();const T=e=>(t.swr=g(e),t.swr),z=(e,r)=>t.swr.subscribe(e,r),A=(e,r)=>t.swr.subscribeErrors(e,r),P=e=>t.swr.get(e),C=e=>t.swr.getOrWait(e),I=(e,r,s,n)=>t.swr.use(e,r,s,n),L=(e,r)=>t.swr.useSWR(e,r),M=(e,r,s)=>t.swr.mutate(e,r,s),U=(e,r)=>t.swr.revalidate(e,r),V=(e,r)=>t.swr.clear(e,r);t.SSWR=_,t.clear=V,t.createDefaultSWR=T,t.createSWR=g,t.get=P,t.getOrWait=C,t.mutate=M,t.revalidate=U,t.subscribe=z,t.subscribeErrors=A,t.use=I,t.useSWR=L,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}); | ||
(function(t,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("swrev"),require("svelte")):typeof define=="function"&&define.amd?define(["exports","swrev","svelte"],h):(t=typeof globalThis<"u"?globalThis:t||self,h(t.sswr={},t.swrev,t.svelte))})(this,function(t,h,m){"use strict";function b(){}function q(e){return e()}function D(e){e.forEach(q)}function E(e){return typeof e=="function"}function O(e,r){return e!=e?r==r:e!==r||e&&typeof e=="object"||typeof e=="function"}function j(e,...r){if(e==null)return b;const s=e.subscribe(...r);return s.unsubscribe?()=>s.unsubscribe():s}Promise.resolve();const v=[];function K(e,r){return{subscribe:W(e,r).subscribe}}function W(e,r=b){let s;const n=new Set;function o(c){if(O(e,c)&&(e=c,s)){const l=!v.length;for(const i of n)i[1](),v.push(i,e);if(l){for(let i=0;i<v.length;i+=2)v[i][0](v[i+1]);v.length=0}}}function f(c){o(c(e))}function w(c,l=b){const i=[c,l];return n.add(i),n.size===1&&(s=r(o)||b),c(e),()=>{n.delete(i),n.size===0&&(s(),s=null)}}return{set:o,update:f,subscribe:w}}function R(e,r,s){const n=!Array.isArray(e),o=n?[e]:e,f=r.length<2;return K(s,w=>{let c=!1;const l=[];let i=0,S=b;const u=()=>{if(i)return;S();const a=r(n?l[0]:l,w);f?w(a):S=E(a)?a:b},d=o.map((a,y)=>j(a,$=>{l[y]=$,i&=~(1<<y),c&&u()},()=>{i|=1<<y}));return c=!0,u(),function(){D(d),S()}})}class _ extends h.SWR{useSWR(r,s){let n;const o=W(void 0,()=>()=>n==null?void 0:n()),f=W(void 0,()=>()=>n==null?void 0:n());m.beforeUpdate(()=>{const u=a=>{f.set(void 0),o.set(a)},d=a=>f.set(a);n||(n=this.subscribe(r,u,d,{loadInitialCache:!0,...s}).unsubscribe)}),m.onDestroy(()=>n==null?void 0:n());const w=(u,d)=>this.mutate(this.resolveKey(r),u,{revalidateOptions:s,...d}),c=u=>this.revalidate(this.resolveKey(r),{...s,...u}),l=u=>this.clear(this.resolveKey(r),u),i=R([o,f],([u,d])=>u===void 0&&d===void 0),S=R([o,f],([u,d])=>u!==void 0&&d===void 0);return{data:o,error:f,mutate:w,revalidate:c,clear:l,isLoading:i,isValid:S}}}const g=e=>new _(e);t.swr=g();const T=e=>(t.swr=g(e),t.swr),z=(e,r)=>t.swr.subscribeData(e,r),A=(e,r)=>t.swr.subscribeErrors(e,r),P=e=>t.swr.get(e),C=e=>t.swr.getWait(e),I=(e,r,s,n)=>t.swr.subscribe(e,r,s,n),L=(e,r)=>t.swr.useSWR(e,r),M=(e,r,s)=>t.swr.mutate(e,r,s),U=(e,r)=>t.swr.revalidate(e,r),V=(e,r)=>t.swr.clear(e,r);t.SSWR=_,t.clear=V,t.createDefaultSWR=T,t.createSWR=g,t.get=P,t.getOrWait=C,t.mutate=M,t.revalidate=U,t.subscribe=z,t.subscribeErrors=A,t.use=I,t.useSWR=L,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}); |
{ | ||
"name": "sswr", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"description": "Svelte stale while revalidate (SWR) data fetching strategy", | ||
@@ -35,4 +35,4 @@ "repository": "github.com/ConsoleTVs/sswr", | ||
"dependencies": { | ||
"swrev": "^1.10.5" | ||
"swrev": "^3.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26367
0
+ Addedswrev@3.0.0(transitive)
- Removed@ungap/event-target@0.2.4(transitive)
- Removedswrev@1.11.0(transitive)
Updatedswrev@^3.0.0