Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sswr

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sswr - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

2

dist/esm/index.js

@@ -1,1 +0,1 @@

var c=Object.defineProperty;var u=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var D=(e,t,r)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&D(e,r,t[r]);if(u)for(var r of u(t))f.call(t,r)&&D(e,r,t[r]);return e};import{SWR as v}from"swrev";import{onDestroy as E,onMount as K}from"svelte";import{writable as W}from"svelte/store";var p=class extends v{useSWR(t,r){let n,i=W(void 0,()=>()=>n==null?void 0:n()),l=W(void 0,()=>()=>n==null?void 0:n());return K(()=>{i.set(this.get(this.resolveKey(t)));let o=d=>i.set(d),s=d=>l.set(d);n=this.use(t,o,s,R({loadInitialCache:!1},r)).unsubscribe}),E(()=>n==null?void 0:n()),{data:i,error:l,mutate:(o,s)=>this.mutate(this.resolveKey(t),o,s),revalidate:o=>this.revalidate(this.resolveKey(t),o),clear:o=>this.clear(this.resolveKey(t),o)}}},S=e=>new p(e),a=S(),q=e=>(a=S(e),a),z=(e,t)=>a.subscribe(e,t),A=(e,t)=>a.subscribeErrors(e,t),B=e=>a.get(e),F=e=>a.getOrWait(e),G=(e,t,r,n)=>a.use(e,t,r,n),H=(e,t)=>a.useSWR(e,t),J=(e,t,r)=>a.mutate(e,t,r),L=(e,t)=>a.revalidate(e,t),N=(e,t)=>a.clear(e,t);export{p as SSWR,N as clear,q as createDefaultSWR,S as createSWR,B as get,F as getOrWait,J as mutate,L as revalidate,z as subscribe,A as subscribeErrors,a as swr,G as use,H as useSWR};
var p=Object.defineProperty;var D=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var R=(e,t,r)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&R(e,r,t[r]);if(D)for(var r of D(t))v.call(t,r)&&R(e,r,t[r]);return e};import{SWR as f}from"swrev";import{onDestroy as E,onMount as O}from"svelte";import{writable as W}from"svelte/store";var S=class extends f{useSWR(t,r){let n,s=W(void 0,()=>()=>n==null?void 0:n()),u=W(void 0,()=>()=>n==null?void 0:n());return O(()=>{s.set(this.get(this.resolveKey(t)));let o=l=>s.set(l),d=l=>u.set(l);n=this.use(t,o,d,i({loadInitialCache:!1},r)).unsubscribe}),E(()=>n==null?void 0:n()),{data:s,error:u,mutate:(o,d)=>this.mutate(this.resolveKey(t),o,i({revalidateOptions:r},d)),revalidate:o=>this.revalidate(this.resolveKey(t),i(i({},r),o)),clear:o=>this.clear(this.resolveKey(t),o)}}},c=e=>new S(e),a=c(),q=e=>(a=c(e),a),z=(e,t)=>a.subscribe(e,t),A=(e,t)=>a.subscribeErrors(e,t),B=e=>a.get(e),F=e=>a.getOrWait(e),G=(e,t,r,n)=>a.use(e,t,r,n),H=(e,t)=>a.useSWR(e,t),J=(e,t,r)=>a.mutate(e,t,r),L=(e,t)=>a.revalidate(e,t),N=(e,t)=>a.clear(e,t);export{S as SSWR,N as clear,q as createDefaultSWR,c as createSWR,B as get,F as getOrWait,J as mutate,L as revalidate,z as subscribe,A as subscribeErrors,a as swr,G as use,H as useSWR};

@@ -1,1 +0,1 @@

(()=>{var O=Object.create;var i=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames,S=Object.getOwnPropertySymbols,m=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var y=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,f=(e,t)=>{for(var r in t||(t={}))c.call(t,r)&&y(e,r,t[r]);if(S)for(var r of S(t))P.call(t,r)&&y(e,r,t[r]);return e};var g=e=>i(e,"__esModule",{value:!0});var D=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var C=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!c.call(e,n)&&n!=="default"&&i(e,n,{get:()=>t[n],enumerable:!(r=x(t,n))||r.enumerable});return e},R=e=>C(g(i(e!=null?O(m(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var v=R(D("swrev")),s=R(D("svelte")),W=R(D("svelte/store")),E=class extends v.SWR{useSWR(t,r){let n,d=(0,W.writable)(void 0,()=>()=>n==null?void 0:n()),p=(0,W.writable)(void 0,()=>()=>n==null?void 0:n());return(0,s.onMount)(()=>{d.set(this.get(this.resolveKey(t)));let o=u=>d.set(u),l=u=>p.set(u);n=this.use(t,o,l,f({loadInitialCache:!1},r)).unsubscribe}),(0,s.onDestroy)(()=>n==null?void 0:n()),{data:d,error:p,mutate:(o,l)=>this.mutate(this.resolveKey(t),o,l),revalidate:o=>this.revalidate(this.resolveKey(t),o),clear:o=>this.clear(this.resolveKey(t),o)}}},K=e=>new E(e),a=K(),F=e=>(a=K(e),a),G=(e,t)=>a.subscribe(e,t),H=(e,t)=>a.subscribeErrors(e,t),J=e=>a.get(e),L=e=>a.getOrWait(e),N=(e,t,r,n)=>a.use(e,t,r,n),Q=(e,t)=>a.useSWR(e,t),T=(e,t,r)=>a.mutate(e,t,r),U=(e,t)=>a.revalidate(e,t),V=(e,t)=>a.clear(e,t);})();
(()=>{var K=Object.create;var s=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,m=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var v=(e,t,r)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&v(e,r,t[r]);if(p)for(var r of p(t))P.call(t,r)&&v(e,r,t[r]);return e};var g=e=>s(e,"__esModule",{value:!0});var R=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var C=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!y.call(e,n)&&n!=="default"&&s(e,n,{get:()=>t[n],enumerable:!(r=x(t,n))||r.enumerable});return e},W=e=>C(g(s(e!=null?K(m(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var f=W(R("swrev")),d=W(R("svelte")),S=W(R("svelte/store")),E=class extends f.SWR{useSWR(t,r){let n,l=(0,S.writable)(void 0,()=>()=>n==null?void 0:n()),c=(0,S.writable)(void 0,()=>()=>n==null?void 0:n());return(0,d.onMount)(()=>{l.set(this.get(this.resolveKey(t)));let o=D=>l.set(D),u=D=>c.set(D);n=this.use(t,o,u,i({loadInitialCache:!1},r)).unsubscribe}),(0,d.onDestroy)(()=>n==null?void 0:n()),{data:l,error:c,mutate:(o,u)=>this.mutate(this.resolveKey(t),o,i({revalidateOptions:r},u)),revalidate:o=>this.revalidate(this.resolveKey(t),i(i({},r),o)),clear:o=>this.clear(this.resolveKey(t),o)}}},O=e=>new E(e),a=O(),F=e=>(a=O(e),a),G=(e,t)=>a.subscribe(e,t),H=(e,t)=>a.subscribeErrors(e,t),J=e=>a.get(e),L=e=>a.getOrWait(e),N=(e,t,r,n)=>a.use(e,t,r,n),Q=(e,t)=>a.useSWR(e,t),T=(e,t,r)=>a.mutate(e,t,r),U=(e,t)=>a.revalidate(e,t),V=(e,t)=>a.clear(e,t);})();

@@ -15,5 +15,5 @@ import * as svelte_store from 'svelte/store';

error: svelte_store.Writable<E | undefined>;
mutate: (value: D, options: Partial<SWRMutateOptions<D>>) => void;
revalidate: (options: Partial<SWRRevalidateOptions<D>>) => void;
clear: (options: Partial<CacheClearOptions>) => void;
mutate: (value: D, ops?: Partial<SWRMutateOptions<D>> | undefined) => void;
revalidate: (ops?: Partial<SWRRevalidateOptions<D>> | undefined) => void;
clear: (ops?: Partial<CacheClearOptions> | undefined) => void;
};

@@ -76,5 +76,5 @@ }

error: svelte_store.Writable<E | undefined>;
mutate: (value: D, options: Partial<SWRMutateOptions<D>>) => void;
revalidate: (options: Partial<SWRRevalidateOptions<D>>) => void;
clear: (options: Partial<CacheClearOptions>) => void;
mutate: (value: D, ops?: Partial<SWRMutateOptions<D>> | undefined) => void;
revalidate: (ops?: Partial<SWRRevalidateOptions<D>> | undefined) => void;
clear: (ops?: Partial<CacheClearOptions> | undefined) => void;
};

@@ -81,0 +81,0 @@ /**

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});var c=Object.defineProperty;var u=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var D=(e,t,r)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&D(e,r,t[r]);if(u)for(var r of u(t))f.call(t,r)&&D(e,r,t[r]);return e};var _swrev = require('swrev');var _svelte = require('svelte');var _store = require('svelte/store');var p=class extends _swrev.SWR{useSWR(t,r){let n,i=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n()),l=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n());return _svelte.onMount.call(void 0, ()=>{i.set(this.get(this.resolveKey(t)));let o=d=>i.set(d),s=d=>l.set(d);n=this.use(t,o,s,R({loadInitialCache:!1},r)).unsubscribe}),_svelte.onDestroy.call(void 0, ()=>n==null?void 0:n()),{data:i,error:l,mutate:(o,s)=>this.mutate(this.resolveKey(t),o,s),revalidate:o=>this.revalidate(this.resolveKey(t),o),clear:o=>this.clear(this.resolveKey(t),o)}}},S= exports.createSWR =e=>new p(e),a= exports.swr =S(),q= exports.createDefaultSWR =e=>(a= exports.swr =S(e),a),z= exports.subscribe =(e,t)=>a.subscribe(e,t),A= exports.subscribeErrors =(e,t)=>a.subscribeErrors(e,t),B= exports.get =e=>a.get(e),F= exports.getOrWait =e=>a.getOrWait(e),G= exports.use =(e,t,r,n)=>a.use(e,t,r,n),H= exports.useSWR =(e,t)=>a.useSWR(e,t),J= exports.mutate =(e,t,r)=>a.mutate(e,t,r),L= exports.revalidate =(e,t)=>a.revalidate(e,t),N= exports.clear =(e,t)=>a.clear(e,t);exports.SSWR = p; exports.clear = N; exports.createDefaultSWR = q; exports.createSWR = S; exports.get = B; exports.getOrWait = F; exports.mutate = J; exports.revalidate = L; exports.subscribe = z; exports.subscribeErrors = A; exports.swr = a; exports.use = G; exports.useSWR = H;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var p=Object.defineProperty;var D=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var R=(e,t,r)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&R(e,r,t[r]);if(D)for(var r of D(t))v.call(t,r)&&R(e,r,t[r]);return e};var _swrev = require('swrev');var _svelte = require('svelte');var _store = require('svelte/store');var S=class extends _swrev.SWR{useSWR(t,r){let n,s=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n()),u=_store.writable.call(void 0, void 0,()=>()=>n==null?void 0:n());return _svelte.onMount.call(void 0, ()=>{s.set(this.get(this.resolveKey(t)));let o=l=>s.set(l),d=l=>u.set(l);n=this.use(t,o,d,i({loadInitialCache:!1},r)).unsubscribe}),_svelte.onDestroy.call(void 0, ()=>n==null?void 0:n()),{data:s,error:u,mutate:(o,d)=>this.mutate(this.resolveKey(t),o,i({revalidateOptions:r},d)),revalidate:o=>this.revalidate(this.resolveKey(t),i(i({},r),o)),clear:o=>this.clear(this.resolveKey(t),o)}}},c= exports.createSWR =e=>new S(e),a= exports.swr =c(),q= exports.createDefaultSWR =e=>(a= exports.swr =c(e),a),z= exports.subscribe =(e,t)=>a.subscribe(e,t),A= exports.subscribeErrors =(e,t)=>a.subscribeErrors(e,t),B= exports.get =e=>a.get(e),F= exports.getOrWait =e=>a.getOrWait(e),G= exports.use =(e,t,r,n)=>a.use(e,t,r,n),H= exports.useSWR =(e,t)=>a.useSWR(e,t),J= exports.mutate =(e,t,r)=>a.mutate(e,t,r),L= exports.revalidate =(e,t)=>a.revalidate(e,t),N= exports.clear =(e,t)=>a.clear(e,t);exports.SSWR = S; exports.clear = N; exports.createDefaultSWR = q; exports.createSWR = c; exports.get = B; exports.getOrWait = F; exports.mutate = J; exports.revalidate = L; exports.subscribe = z; exports.subscribeErrors = A; exports.swr = a; exports.use = G; exports.useSWR = H;
{
"name": "sswr",
"version": "1.3.1",
"version": "1.4.0",
"description": "Svelte stale while revalidate (SWR) data fetching strategy",

@@ -12,2 +12,3 @@ "repository": "github.com/ConsoleTVs/sswr",

"typings": "dist/index.d.ts",
"svelte": "src/index.ts",
"files": [

@@ -14,0 +15,0 @@ "dist",

@@ -78,4 +78,2 @@ # SSWR (Svelte Stale While Revalidate)

_This step will no longer be necessary soon: it's not sswr fault: they are solving a problem in Vite for SvelteKit (as explained here: https://github.com/sveltejs/kit/issues/2147#issuecomment-895909001)._
## Getting Started

@@ -82,0 +80,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc