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

workbox-strategies

Package Overview
Dependencies
Maintainers
4
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-strategies - npm Package Compare versions

Comparing version 4.0.0-beta.0 to 4.0.0-beta.1

94

build/workbox-strategies.dev.js
this.workbox = this.workbox || {};
this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,getFriendlyURL_mjs,WorkboxError_mjs) {
this.workbox.strategies = (function (exports,logger_mjs,assert_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,getFriendlyURL_mjs,WorkboxError_mjs) {
'use strict';
try {
self.workbox.v['workbox:strategies:4.0.0-beta.0'] = 1;
self.workbox.v['workbox:strategies:4.0.0-beta.1'] = 1;
} catch (e) {} // eslint-disable-line

@@ -27,3 +27,3 @@

var messages = {
const messages = {
strategyStart: (strategyName, request) => `Using ${strategyName} to ` + `respond to '${getFriendlyURL(request.url)}'`,

@@ -33,3 +33,3 @@ printFinalResponse: response => {

logger_mjs.logger.groupCollapsed(`View the final response here.`);
logger_mjs.logger.unprefixed.log(response);
logger_mjs.logger.log(response);
logger_mjs.logger.groupEnd();

@@ -362,6 +362,6 @@ }

*/
var cacheOkAndOpaquePlugin = {
const cacheOkAndOpaquePlugin = {
/**
* Return return a response (i.e. allow caching) if the
* response is ok (i.e. 200) or is opaque.
* Returns a valid response (to allow caching) if the status is 200 (OK) or
* 0 (opaque).
*

@@ -377,3 +377,3 @@ * @param {Object} options

}) => {
if (response.ok || response.status === 0) {
if (response.status === 200 || response.status === 0) {
return response;

@@ -1067,18 +1067,21 @@ }

*/
const mapping = {
cacheFirst: CacheFirst,
cacheOnly: CacheOnly,
networkFirst: NetworkFirst,
networkOnly: NetworkOnly,
staleWhileRevalidate: StaleWhileRevalidate
};
var publicAPI = /*#__PURE__*/Object.freeze({
CacheFirst: CacheFirst,
CacheOnly: CacheOnly,
NetworkFirst: NetworkFirst,
NetworkOnly: NetworkOnly,
StaleWhileRevalidate: StaleWhileRevalidate
});
const deprecate = strategy => {
const StrategyCtr = mapping[strategy];
return options => {
{
const strategyCtrName = strategy[0].toUpperCase() + strategy.slice(1);
logger_mjs.logger.warn(`The 'workbox.strategies.${strategy}()' function has been` + `deprecated and will be removed in a future version of Workbox.\n` + `Please use 'new workbox.strategies.${strategyCtrName}()'' instead.`);
}
/*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
return new StrategyCtr(options);
};
};
/**

@@ -1088,4 +1091,7 @@ * @function workbox.strategies.cacheFirst

* constructor for more info.
* @deprecated since v4.0.0
*/
const cacheFirst = deprecate('cacheFirst');
/**

@@ -1095,4 +1101,6 @@ * @function workbox.strategies.cacheOnly

* constructor for more info.
* @deprecated since v4.0.0
*/
const cacheOnly = deprecate('cacheOnly');
/**

@@ -1102,4 +1110,6 @@ * @function workbox.strategies.networkFirst

* constructor for more info.
* @deprecated since v4.0.0
*/
const networkFirst = deprecate('networkFirst');
/**

@@ -1109,4 +1119,6 @@ * @function workbox.strategies.networkOnly

* constructor for more info.
* @deprecated since v4.0.0
*/
const networkOnly = deprecate('networkOnly');
/**

@@ -1116,32 +1128,22 @@ * @function workbox.strategies.staleWhileRevalidate

* {@link workbox.strategies.StaleWhileRevalidate} constructor for more info.
* @deprecated since v4.0.0
*/
const mapping = {
cacheFirst: CacheFirst,
cacheOnly: CacheOnly,
networkFirst: NetworkFirst,
networkOnly: NetworkOnly,
staleWhileRevalidate: StaleWhileRevalidate
};
const defaultExport = {};
Object.keys(mapping).forEach(keyName => {
defaultExport[keyName] = (options = {}) => {
const StrategyClass = mapping[keyName];
return new StrategyClass(Object.assign(options));
};
});
const staleWhileRevalidate = deprecate('staleWhileRevalidate');
/*
Copyright 2018 Google LLC
exports.CacheFirst = CacheFirst;
exports.CacheOnly = CacheOnly;
exports.NetworkFirst = NetworkFirst;
exports.NetworkOnly = NetworkOnly;
exports.StaleWhileRevalidate = StaleWhileRevalidate;
exports.cacheFirst = cacheFirst;
exports.cacheOnly = cacheOnly;
exports.networkFirst = networkFirst;
exports.networkOnly = networkOnly;
exports.staleWhileRevalidate = staleWhileRevalidate;
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
const finalExport = Object.assign(defaultExport, publicAPI);
return exports;
return finalExport;
}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));
}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-strategies.dev.js.map

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

this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s,n){"use strict";try{self.workbox.v["workbox:strategies:4.0.0-beta.0"]=1}catch(e){}class r{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null,this.n=t.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:s}){"string"==typeof s&&(s=new Request(s));let r,i=await t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.n,plugins:this.t});if(!i)try{i=await this.r(s,e)}catch(e){r=e}if(!i)throw new n.WorkboxError("no-response",{url:s.url,error:r});return i}async r(e,n){const r=await s.fetchWrapper.fetch({request:e,event:n,fetchOptions:this.s,plugins:this.t}),i=r.clone(),h=t.cacheWrapper.put({cacheName:this.e,request:e,response:i,event:n,plugins:this.t});if(n)try{n.waitUntil(h)}catch(e){}return r}}class i{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.n=t.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:s}){"string"==typeof s&&(s=new Request(s));const r=await t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.n,plugins:this.t});if(!r)throw new n.WorkboxError("no-response",{url:s.url});return r}}var h={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class u{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[h,...t.plugins]}else this.t=[h];this.i=t.networkTimeoutSeconds,this.s=t.fetchOptions||null,this.n=t.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){const s=[];"string"==typeof t&&(t=new Request(t));const r=[];let i;if(this.i){const{id:n,promise:h}=this.h({request:t,event:e,logs:s});i=n,r.push(h)}const h=this.u({timeoutId:i,request:t,event:e,logs:s});r.push(h);let u=await Promise.race(r);if(u||(u=await h),!u)throw new n.WorkboxError("no-response",{url:t.url});return u}h({request:e,logs:t,event:s}){let n;return{promise:new Promise(t=>{n=setTimeout(async()=>{t(await this.a({request:e,event:s}))},1e3*this.i)}),id:n}}async u({timeoutId:e,request:n,logs:r,event:i}){let h,u;try{u=await s.fetchWrapper.fetch({request:n,event:i,fetchOptions:this.s,plugins:this.t})}catch(e){h=e}if(e&&clearTimeout(e),h||!u)u=await this.a({request:n,event:i});else{const e=u.clone(),s=t.cacheWrapper.put({cacheName:this.e,request:n,response:e,event:i,plugins:this.t});if(i)try{i.waitUntil(s)}catch(e){}}return u}a({event:e,request:s}){return t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.n,plugins:this.t})}}class a{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){let r,i;"string"==typeof t&&(t=new Request(t));try{i=await s.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.s,plugins:this.t})}catch(e){r=e}if(!i)throw new n.WorkboxError("no-response",{url:t.url,error:r});return i}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[h,...t.plugins]}else this.t=[h];this.s=t.fetchOptions||null,this.n=t.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:s}){"string"==typeof s&&(s=new Request(s));const r=this.r({request:s,event:e});let i,h=await t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.n,plugins:this.t});if(h){if(e)try{e.waitUntil(r)}catch(i){}}else try{h=await r}catch(e){i=e}if(!h)throw new n.WorkboxError("no-response",{url:s.url,error:i});return h}async r({request:e,event:n}){const r=await s.fetchWrapper.fetch({request:e,event:n,fetchOptions:this.s,plugins:this.t}),i=t.cacheWrapper.put({cacheName:this.e,request:e,response:r.clone(),event:n,plugins:this.t});if(n)try{n.waitUntil(i)}catch(e){}return r}}var o=Object.freeze({CacheFirst:r,CacheOnly:i,NetworkFirst:u,NetworkOnly:a,StaleWhileRevalidate:c});const l={cacheFirst:r,cacheOnly:i,networkFirst:u,networkOnly:a,staleWhileRevalidate:c},q={};return Object.keys(l).forEach(e=>{q[e]=((t={})=>{return new(0,l[e])(Object.assign(t))})}),Object.assign(q,o)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s,n,r){"use strict";try{self.workbox.v["workbox:strategies:4.0.0-beta.1"]=1}catch(e){}class i{constructor(e={}){this.e=t.cacheNames.getRuntimeName(e.cacheName),this.t=e.plugins||[],this.s=e.fetchOptions||null,this.n=e.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){"string"==typeof t&&(t=new Request(t));let n,i=await s.cacheWrapper.match({cacheName:this.e,request:t,event:e,matchOptions:this.n,plugins:this.t});if(!i)try{i=await this.r(t,e)}catch(e){n=e}if(!i)throw new r.WorkboxError("no-response",{url:t.url,error:n});return i}async r(e,t){const r=await n.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.s,plugins:this.t}),i=r.clone(),h=s.cacheWrapper.put({cacheName:this.e,request:e,response:i,event:t,plugins:this.t});if(t)try{t.waitUntil(h)}catch(e){}return r}}class h{constructor(e={}){this.e=t.cacheNames.getRuntimeName(e.cacheName),this.t=e.plugins||[],this.n=e.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){"string"==typeof t&&(t=new Request(t));const n=await s.cacheWrapper.match({cacheName:this.e,request:t,event:e,matchOptions:this.n,plugins:this.t});if(!n)throw new r.WorkboxError("no-response",{url:t.url});return n}}const u={cacheWillUpdate:({response:e})=>200===e.status||0===e.status?e:null};class a{constructor(e={}){if(this.e=t.cacheNames.getRuntimeName(e.cacheName),e.plugins){let t=e.plugins.some(e=>!!e.cacheWillUpdate);this.t=t?e.plugins:[u,...e.plugins]}else this.t=[u];this.i=e.networkTimeoutSeconds,this.s=e.fetchOptions||null,this.n=e.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){const s=[];"string"==typeof t&&(t=new Request(t));const n=[];let i;if(this.i){const{id:r,promise:h}=this.h({request:t,event:e,logs:s});i=r,n.push(h)}const h=this.u({timeoutId:i,request:t,event:e,logs:s});n.push(h);let u=await Promise.race(n);if(u||(u=await h),!u)throw new r.WorkboxError("no-response",{url:t.url});return u}h({request:e,logs:t,event:s}){let n;return{promise:new Promise(t=>{n=setTimeout(async()=>{t(await this.a({request:e,event:s}))},1e3*this.i)}),id:n}}async u({timeoutId:e,request:t,logs:r,event:i}){let h,u;try{u=await n.fetchWrapper.fetch({request:t,event:i,fetchOptions:this.s,plugins:this.t})}catch(e){h=e}if(e&&clearTimeout(e),h||!u)u=await this.a({request:t,event:i});else{const e=u.clone(),n=s.cacheWrapper.put({cacheName:this.e,request:t,response:e,event:i,plugins:this.t});if(i)try{i.waitUntil(n)}catch(e){}}return u}a({event:e,request:t}){return s.cacheWrapper.match({cacheName:this.e,request:t,event:e,matchOptions:this.n,plugins:this.t})}}class c{constructor(e={}){this.e=t.cacheNames.getRuntimeName(e.cacheName),this.t=e.plugins||[],this.s=e.fetchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){let s,i;"string"==typeof t&&(t=new Request(t));try{i=await n.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.s,plugins:this.t})}catch(e){s=e}if(!i)throw new r.WorkboxError("no-response",{url:t.url,error:s});return i}}class o{constructor(e={}){if(this.e=t.cacheNames.getRuntimeName(e.cacheName),this.t=e.plugins||[],e.plugins){let t=e.plugins.some(e=>!!e.cacheWillUpdate);this.t=t?e.plugins:[u,...e.plugins]}else this.t=[u];this.s=e.fetchOptions||null,this.n=e.matchOptions||null}async handle({event:e,request:t}){return this.makeRequest({event:e,request:t||e.request})}async makeRequest({event:e,request:t}){"string"==typeof t&&(t=new Request(t));const n=this.r({request:t,event:e});let i,h=await s.cacheWrapper.match({cacheName:this.e,request:t,event:e,matchOptions:this.n,plugins:this.t});if(h){if(e)try{e.waitUntil(n)}catch(i){}}else try{h=await n}catch(e){i=e}if(!h)throw new r.WorkboxError("no-response",{url:t.url,error:i});return h}async r({request:e,event:t}){const r=await n.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.s,plugins:this.t}),i=s.cacheWrapper.put({cacheName:this.e,request:e,response:r.clone(),event:t,plugins:this.t});if(t)try{t.waitUntil(i)}catch(e){}return r}}const l={cacheFirst:i,cacheOnly:h,networkFirst:a,networkOnly:c,staleWhileRevalidate:o},q=e=>{const t=l[e];return e=>new t(e)},w=q("cacheFirst"),p=q("cacheOnly"),v=q("networkFirst"),y=q("networkOnly"),m=q("staleWhileRevalidate");return e.CacheFirst=i,e.CacheOnly=h,e.NetworkFirst=a,e.NetworkOnly=c,e.StaleWhileRevalidate=o,e.cacheFirst=w,e.cacheOnly=p,e.networkFirst=v,e.networkOnly=y,e.staleWhileRevalidate=m,e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-strategies.prod.js.map
{
"name": "workbox-strategies",
"version": "4.0.0-beta.0",
"version": "4.0.0-beta.1",
"license": "MIT",

@@ -30,5 +30,5 @@ "author": "Google's Web DevRel Team",

"dependencies": {
"workbox-core": "^4.0.0-beta.0"
"workbox-core": "^4.0.0-beta.1"
},
"gitHead": "bc90cc4bdb1f8ad435564aa84b0c90acfac611e2"
"gitHead": "dda07c48e184f57ce5dfe3b3e93af316989a0877"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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