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

workbox-strategies

Package Overview
Dependencies
Maintainers
1
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 3.0.0-alpha.1 to 3.0.0-alpha.2

59

build/workbox-strategies.dev.js
this.workbox = this.workbox || {};
this.workbox.strategies = (function (cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,assert_mjs,logger_mjs,CacheExpirationPlugin_mjs,CacheableResponsePlugin_mjs) {
this.workbox.strategies = (function (cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,assert_mjs,logger_mjs) {
'use strict';
try {
self.workbox.v['workbox:strategies:3.0.0-alpha.1'] = 1;
self.workbox.v['workbox:strategies:3.0.0-alpha.2'] = 1;
} catch (e) {} // eslint-disable-line

@@ -317,3 +317,3 @@

* By default, this strategy will cache responses with a 200 status code as
* well as [opaque responses]{@link https://docs.google.com/document/d/1nHIjXdmXs9nT6_lcGcsZY5UZ-tL9JxXESlKbzAJdBG4/edit?usp=sharing}.
* well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.
* Opaque responses are are cross-origin requests where the response doesn't

@@ -638,3 +638,3 @@ * support [CORS]{@link https://enable-cors.org/}.

* By default, this strategy will cache responses with a 200 status code as
* well as [opaque responses]{@link https://docs.google.com/document/d/1nHIjXdmXs9nT6_lcGcsZY5UZ-tL9JxXESlKbzAJdBG4/edit?usp=sharing}.
* well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.
* Opaque responses are are cross-origin requests where the response doesn't

@@ -780,48 +780,2 @@ * support [CORS]{@link https://enable-cors.org/}.

const pluginBuilder = options => {
const plugins = [];
// TODO: Assert plugins is an array
const pluginParamsToClass = {
cacheExpiration: CacheExpirationPlugin_mjs.CacheExpirationPlugin,
cacheableResponse: CacheableResponsePlugin_mjs.CacheableResponsePlugin
// TODO: Add support for 'broadcastCacheUpdate': BroadcastCacheUpdatePlugin,
};
for (const [pluginId, config] of Object.entries(options)) {
// Special case for the `cacheName` config.
if (pluginId === 'cacheName') {
continue;
}
const PluginClass = pluginParamsToClass[pluginId];
if (PluginClass) {
plugins.push(new PluginClass(config));
} else {
// Nested if statement to ensure rollup can strip this statement
{
logger_mjs.logger.warn(`Unknown plugin config '${pluginId}' passed in to` + ` 'workbox.strategies'.`);
}
}
}
return plugins.concat(options.plugins || []);
};
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**

@@ -864,4 +818,3 @@ * @function workbox.strategies.cacheFirst

const StrategyClass = mapping[keyName];
const plugins = pluginBuilder(options);
return new StrategyClass(Object.assign(options, { plugins }));
return new StrategyClass(Object.assign(options));
};

@@ -890,3 +843,3 @@ });

}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.expiration,workbox.cacheableResponse));
}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-strategies.dev.js.map

2

build/workbox-strategies.prod.js

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

this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r,n,s){"use strict";try{self.workbox.v["workbox:strategies:3.0.0-alpha.1"]=1}catch(e){}class i{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);if(!s)try{s=yield r.r(e)}catch(e){n=e}if(n)throw n;return s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t),i=s.clone();return e.waitUntil(t.cacheWrapper.put(n.e,e.request,i,n.t)),s})()}}class l{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield t.cacheWrapper.match(r.e,e.request,null,r.t)})()}}var o={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class c{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:[o,...t.plugins]}else this.t=[o];this.n=t.networkTimeoutSeconds}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=[],n=[];let s;if(t.n){const{id:i,promise:l}=t.s(e,r);s=i,n.push(l)}const i=t.i(s,e,r);n.push(i);return yield Promise.race(n)})()}s(e,t){var r=this;let n;return{promise:new Promise(t=>{const s=(()=>{var n=babelHelpers.asyncToGenerator(function*(){t(yield r.l(e.request))});return function(){return n.apply(this,arguments)}})();n=setTimeout(s,1e3*this.n)}),id:n}}i(e,n,s){var i=this;return babelHelpers.asyncToGenerator(function*(){let s,l;try{l=yield r.fetchWrapper.fetch(n.request,i.t)}catch(e){s=e}if(e&&clearTimeout(e),s||!l)l=yield i.l(n.request);else{const e=l.clone();n.waitUntil(t.cacheWrapper.put(i.e,n.request,e,i.t))}return l})()}l(e){return t.cacheWrapper.match(this.e,e,null,this.t)}}class a{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){let n,s;try{s=yield r.fetchWrapper.fetch(e.request,null,t.t)}catch(e){n=e}if(n)throw n;return s})()}}class u{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:[o,...t.plugins]}else this.t=[o]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.r(e);let s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);return s?e.waitUntil(n):s=yield n,s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t);return e.waitUntil(t.cacheWrapper.put(n.e,e.request,s.clone(),n.t)),s})()}}var h=Object.freeze({CacheFirst:i,CacheOnly:l,NetworkFirst:c,NetworkOnly:a,StaleWhileRevalidate:u});const b={cacheFirst:i,cacheOnly:l,networkFirst:c,networkOnly:a,staleWhileRevalidate:u},d={};Object.keys(b).forEach(e=>{d[e]=((t={})=>{const r=b[e],i=(e=>{const t=[],r={cacheExpiration:n.CacheExpirationPlugin,cacheableResponse:s.CacheableResponsePlugin};for(const[n,s]of Object.entries(e)){if("cacheName"===n)continue;const e=r[n];e&&t.push(new e(s))}return t.concat(e.plugins||[])})(t);return new r(Object.assign(t,{plugins:i}))})});return Object.assign(d,h)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.expiration,workbox.cacheableResponse);
this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){"use strict";try{self.workbox.v["workbox:strategies:3.0.0-alpha.2"]=1}catch(e){}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);if(!s)try{s=yield r.r(e)}catch(e){n=e}if(n)throw n;return s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t),i=s.clone();return e.waitUntil(t.cacheWrapper.put(n.e,e.request,i,n.t)),s})()}}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield t.cacheWrapper.match(r.e,e.request,null,r.t)})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class l{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:[i,...t.plugins]}else this.t=[i];this.n=t.networkTimeoutSeconds}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=[],n=[];let s;if(t.n){const{id:i,promise:l}=t.s(e,r);s=i,n.push(l)}const i=t.i(s,e,r);return n.push(i),yield Promise.race(n)})()}s(e,t){var r=this;let n;return{promise:new Promise(t=>{const s=(()=>{var n=babelHelpers.asyncToGenerator(function*(){t(yield r.l(e.request))});return function(){return n.apply(this,arguments)}})();n=setTimeout(s,1e3*this.n)}),id:n}}i(e,n,s){var i=this;return babelHelpers.asyncToGenerator(function*(){let s,l;try{l=yield r.fetchWrapper.fetch(n.request,i.t)}catch(e){s=e}if(e&&clearTimeout(e),s||!l)l=yield i.l(n.request);else{const e=l.clone();n.waitUntil(t.cacheWrapper.put(i.e,n.request,e,i.t))}return l})()}l(e){return t.cacheWrapper.match(this.e,e,null,this.t)}}class o{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){let n,s;try{s=yield r.fetchWrapper.fetch(e.request,null,t.t)}catch(e){n=e}if(n)throw n;return s})()}}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:[i,...t.plugins]}else this.t=[i]}handle({event:e}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.r(e);let s=yield t.cacheWrapper.match(r.e,e.request,null,r.t);return s?e.waitUntil(n):s=yield n,s})()}r(e){var n=this;return babelHelpers.asyncToGenerator(function*(){const s=yield r.fetchWrapper.fetch(e.request,null,n.t);return e.waitUntil(t.cacheWrapper.put(n.e,e.request,s.clone(),n.t)),s})()}}var a=Object.freeze({CacheFirst:n,CacheOnly:s,NetworkFirst:l,NetworkOnly:o,StaleWhileRevalidate:c});const h={cacheFirst:n,cacheOnly:s,networkFirst:l,networkOnly:o,staleWhileRevalidate:c},u={};return Object.keys(h).forEach(e=>{u[e]=((t={})=>new(0,h[e])(Object.assign(t)))}),Object.assign(u,a)}(workbox.core._private,workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-strategies.prod.js.map
{
"name": "workbox-strategies",
"version": "3.0.0-alpha.1",
"version": "3.0.0-alpha.2",
"license": "Apache-2.0",

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

"dependencies": {
"workbox-cache-expiration": "^3.0.0-alpha.1",
"workbox-cacheable-response": "^3.0.0-alpha.1",
"workbox-core": "^3.0.0-alpha.1"
"workbox-core": "^3.0.0-alpha.2"
}
}

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