Comparing version 1.1.0 to 1.2.0
@@ -1,1 +0,1 @@ | ||
import{SWR as v}from"swrev";import{onDestroy as h}from"svelte";import{writable as u}from"svelte/store";var i=class extends v{useSvelte(t,r){let e=()=>{},s=u(this.get(this.resolveKey(t)),()=>()=>e()),l=u(void 0,()=>()=>e()),R=a=>s.set(a),S=a=>l.set(a);e=this.use(t,R,S,{loadInitialCache:!1,...r}).unsubscribe,h(()=>e());let d=(a,W)=>this.mutate(this.resolveKey(t),a,W),p=a=>this.revalidate(this.resolveKey(t),a),D=a=>this.clear(this.resolveKey(t),a);return{data:s,error:l,mutate:d,revalidate:p,clear:D}}},c=o=>{let t=new i(o);return{useSWR:(r,e)=>t.useSvelte(r,e),mutate:(r,e,s)=>t.mutate(r,e,s),revalidate:(r,e)=>t.revalidate(r,e),clear:(r,e)=>t.clear(r,e)}},n=c(),O=n.useSWR,m=n.mutate,K=n.revalidate,f=n.clear;export{i as SSWR,f as clear,c as createSWR,m as mutate,K as revalidate,O as useSWR}; | ||
import{SWR as S}from"swrev";import{onDestroy as p,onMount as D}from"svelte";import{writable as c}from"svelte/store";var l=class extends S{useSvelte(t,r){let e,s=c(void 0,()=>()=>e?.()),d=c(void 0,()=>()=>e?.());return D(()=>{s.set(this.get(this.resolveKey(t)));let a=o=>s.set(o),i=o=>d.set(o);e=this.use(t,a,i,{loadInitialCache:!1,...r}).unsubscribe}),p(()=>e?.()),{data:s,error:d,mutate:(a,i)=>this.mutate(this.resolveKey(t),a,i),revalidate:a=>this.revalidate(this.resolveKey(t),a),clear:a=>this.clear(this.resolveKey(t),a)}}},R=u=>{let t=new l(u);return{useSWR:(r,e)=>t.useSvelte(r,e),mutate:(r,e,s)=>t.mutate(r,e,s),revalidate:(r,e)=>t.revalidate(r,e),clear:(r,e)=>t.clear(r,e)}},n=R(),W=n.useSWR,v=n.mutate,h=n.revalidate,m=n.clear;export{l as SSWR,m as clear,R as createSWR,v as mutate,h as revalidate,W as useSWR}; |
@@ -1,1 +0,1 @@ | ||
(()=>{var m=Object.create,o=Object.defineProperty,K=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,E=Object.getOwnPropertyNames,P=Object.getOwnPropertyDescriptor,y=t=>o(t,"__esModule",{value:!0}),x=(t,r,a)=>{if(y(t),r&&typeof r=="object"||typeof r=="function")for(let e of E(r))!f.call(t,e)&&e!=="default"&&o(t,e,{get:()=>r[e],enumerable:!(a=P(r,e))||a.enumerable});return t},l=t=>t&&t.__esModule?t:x(o(t!=null?m(K(t)):{},"default",{value:t,enumerable:!0}),t),R=l(require("swrev")),S=l(require("svelte")),u=l(require("svelte/store")),d=class extends R.SWR{useSvelte(r,a){let e=()=>{},n=u.writable(this.get(this.resolveKey(r)),()=>()=>e()),c=u.writable(void 0,()=>()=>e()),p=s=>n.set(s),D=s=>c.set(s);e=this.use(r,p,D,{loadInitialCache:!1,...a}).unsubscribe,S.onDestroy(()=>e());let W=(s,O)=>this.mutate(this.resolveKey(r),s,O),v=s=>this.revalidate(this.resolveKey(r),s),h=s=>this.clear(this.resolveKey(r),s);return{data:n,error:c,mutate:W,revalidate:v,clear:h}}},C=t=>{let r=new d(t);return{useSWR:(a,e)=>r.useSvelte(a,e),mutate:(a,e,n)=>r.mutate(a,e,n),revalidate:(a,e)=>r.revalidate(a,e),clear:(a,e)=>r.clear(a,e)}},i=C(),q=i.useSWR,z=i.mutate,A=i.revalidate,B=i.clear;})(); | ||
(()=>{var W=Object.create,d=Object.defineProperty,v=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,m=Object.getOwnPropertyNames,O=Object.getOwnPropertyDescriptor;var f=t=>d(t,"__esModule",{value:!0});var K=(t,r,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of m(r))!h.call(t,e)&&e!=="default"&&d(t,e,{get:()=>r[e],enumerable:!(a=O(r,e))||a.enumerable});return t},c=t=>K(f(d(t!=null?W(v(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var p=c(require("swrev")),i=c(require("svelte")),R=c(require("svelte/store")),D=class extends p.SWR{useSvelte(r,a){let e,n=(0,R.writable)(void 0,()=>()=>e?.()),S=(0,R.writable)(void 0,()=>()=>e?.());return(0,i.onMount)(()=>{n.set(this.get(this.resolveKey(r)));let s=u=>n.set(u),l=u=>S.set(u);e=this.use(r,s,l,{loadInitialCache:!1,...a}).unsubscribe}),(0,i.onDestroy)(()=>e?.()),{data:n,error:S,mutate:(s,l)=>this.mutate(this.resolveKey(r),s,l),revalidate:s=>this.revalidate(this.resolveKey(r),s),clear:s=>this.clear(this.resolveKey(r),s)}}},E=t=>{let r=new D(t);return{useSWR:(a,e)=>r.useSvelte(a,e),mutate:(a,e,n)=>r.mutate(a,e,n),revalidate:(a,e)=>r.revalidate(a,e),clear:(a,e)=>r.clear(a,e)}},o=E(),j=o.useSWR,q=o.mutate,z=o.revalidate,A=o.clear;})(); |
@@ -1,2 +0,2 @@ | ||
import { Writable } from 'svelte/store'; | ||
import * as svelte_store from 'svelte/store'; | ||
import { SWR, SWRKey, SWROptions, SWRMutateOptions, SWRRevalidateOptions, CacheClearOptions } from 'swrev'; | ||
@@ -13,4 +13,4 @@ | ||
useSvelte<D = any, E = Error>(key: SWRKey | undefined | (() => SWRKey | undefined), options?: Partial<SWROptions<D>>): { | ||
data: Writable<D | undefined>; | ||
error: Writable<E | undefined>; | ||
data: svelte_store.Writable<D | undefined>; | ||
error: svelte_store.Writable<E | undefined>; | ||
mutate: (value: D, options: Partial<SWRMutateOptions<D>>) => void; | ||
@@ -27,4 +27,4 @@ revalidate: (options: Partial<SWRRevalidateOptions<D>>) => void; | ||
useSWR: <D = G, E = Error>(key: SWRKey, options?: Partial<SWROptions<D>> | undefined) => { | ||
data: Writable<D | undefined>; | ||
error: Writable<E | undefined>; | ||
data: svelte_store.Writable<D | undefined>; | ||
error: svelte_store.Writable<E | undefined>; | ||
mutate: (value: D, options: Partial<SWRMutateOptions<D>>) => void; | ||
@@ -39,4 +39,4 @@ revalidate: (options: Partial<SWRRevalidateOptions<D>>) => void; | ||
declare const useSWR: <D = unknown, E = Error>(key: SWRKey, options?: Partial<SWROptions<D>> | undefined) => { | ||
data: Writable<D | undefined>; | ||
error: Writable<E | undefined>; | ||
data: svelte_store.Writable<D | undefined>; | ||
error: svelte_store.Writable<E | undefined>; | ||
mutate: (value: D, options: Partial<SWRMutateOptions<D>>) => void; | ||
@@ -43,0 +43,0 @@ revalidate: (options: Partial<SWRRevalidateOptions<D>>) => void; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _swrev = require('swrev');var _svelte = require('svelte');var _store = require('svelte/store');var i=class extends _swrev.SWR{useSvelte(t,r){let e=()=>{},s=_store.writable.call(void 0, this.get(this.resolveKey(t)),()=>()=>e()),l=_store.writable.call(void 0, void 0,()=>()=>e()),R=a=>s.set(a),S=a=>l.set(a);e=this.use(t,R,S,{loadInitialCache:!1,...r}).unsubscribe,_svelte.onDestroy.call(void 0, ()=>e());let d=(a,W)=>this.mutate(this.resolveKey(t),a,W),p=a=>this.revalidate(this.resolveKey(t),a),D=a=>this.clear(this.resolveKey(t),a);return{data:s,error:l,mutate:d,revalidate:p,clear:D}}},c= exports.createSWR =o=>{let t=new i(o);return{useSWR:(r,e)=>t.useSvelte(r,e),mutate:(r,e,s)=>t.mutate(r,e,s),revalidate:(r,e)=>t.revalidate(r,e),clear:(r,e)=>t.clear(r,e)}},n=c(),O= exports.useSWR =n.useSWR,m= exports.mutate =n.mutate,K= exports.revalidate =n.revalidate,f= exports.clear =n.clear;exports.SSWR = i; exports.clear = f; exports.createSWR = c; exports.mutate = m; exports.revalidate = K; exports.useSWR = O; | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _swrev = require('swrev');var _svelte = require('svelte');var _store = require('svelte/store');var l=class extends _swrev.SWR{useSvelte(t,r){let e,s=_store.writable.call(void 0, void 0,()=>()=>_optionalChain([e, 'optionalCall', _ => _()])),d=_store.writable.call(void 0, void 0,()=>()=>_optionalChain([e, 'optionalCall', _2 => _2()]));return _svelte.onMount.call(void 0, ()=>{s.set(this.get(this.resolveKey(t)));let a=o=>s.set(o),i=o=>d.set(o);e=this.use(t,a,i,{loadInitialCache:!1,...r}).unsubscribe}),_svelte.onDestroy.call(void 0, ()=>_optionalChain([e, 'optionalCall', _3 => _3()])),{data:s,error:d,mutate:(a,i)=>this.mutate(this.resolveKey(t),a,i),revalidate:a=>this.revalidate(this.resolveKey(t),a),clear:a=>this.clear(this.resolveKey(t),a)}}},R= exports.createSWR =u=>{let t=new l(u);return{useSWR:(r,e)=>t.useSvelte(r,e),mutate:(r,e,s)=>t.mutate(r,e,s),revalidate:(r,e)=>t.revalidate(r,e),clear:(r,e)=>t.clear(r,e)}},n=R(),W= exports.useSWR =n.useSWR,v= exports.mutate =n.mutate,h= exports.revalidate =n.revalidate,m= exports.clear =n.clear;exports.SSWR = l; exports.clear = m; exports.createSWR = R; exports.mutate = v; exports.revalidate = h; exports.useSWR = W; |
{ | ||
"name": "sswr", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Svelte stale while revalidate (SWR) data fetching strategy", | ||
@@ -5,0 +5,0 @@ "repository": "github.com/ConsoleTVs/sswr", |
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
21694
61