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 3.3.1 to 3.4.1

26

build/workbox-strategies.dev.js

@@ -6,3 +6,3 @@ this.workbox = this.workbox || {};

try {
self.workbox.v['workbox:strategies:3.3.1'] = 1;
self.workbox.v['workbox:strategies:3.4.1'] = 1;
} catch (e) {} // eslint-disable-line

@@ -80,2 +80,3 @@

* of all fetch() requests made by this strategy.
* @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)
*/

@@ -86,2 +87,3 @@ constructor(options = {}) {

this._fetchOptions = options.fetchOptions || null;
this._matchOptions = options.matchOptions || null;
}

@@ -153,3 +155,3 @@

let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, null, _this2._plugins);
let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);

@@ -212,3 +214,3 @@ let error;

return babelHelpers.asyncToGenerator(function* () {
const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins);
const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins, event ? event.preloadResponse : undefined);

@@ -266,2 +268,3 @@ // Keep the service worker while we put the request to the cache

* to use in conjunction with this caching strategy.
* @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)
*/

@@ -271,2 +274,3 @@ constructor(options = {}) {

this._plugins = options.plugins || [];
this._matchOptions = options.matchOptions || null;
}

@@ -336,3 +340,3 @@

const response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, null, _this2._plugins);
const response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);

@@ -427,2 +431,3 @@ {

* of all fetch() requests made by this strategy.
* @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)
* @param {number} options.networkTimeoutSeconds If set, any network requests

@@ -459,2 +464,3 @@ * that fail to respond within the timeout will fallback to the cache.

this._fetchOptions = options.fetchOptions || null;
this._matchOptions = options.matchOptions || null;
}

@@ -613,3 +619,3 @@

try {
response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this4._fetchOptions, _this4._plugins);
response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this4._fetchOptions, _this4._plugins, event ? event.preloadResponse : undefined);
} catch (err) {

@@ -671,3 +677,3 @@ error = err;

_respondFromCache(request) {
return cacheWrapper_mjs.cacheWrapper.match(this._cacheName, request, null, this._plugins);
return cacheWrapper_mjs.cacheWrapper.match(this._cacheName, request, this._matchOptions, this._plugins);
}

@@ -783,3 +789,3 @@ }

try {
response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this2._fetchOptions, _this2._plugins);
response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this2._fetchOptions, _this2._plugins, event ? event.preloadResponse : undefined);
} catch (err) {

@@ -854,2 +860,3 @@ error = err;

* of all fetch() requests made by this strategy.
* @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)
*/

@@ -869,2 +876,3 @@ constructor(options = {}) {

this._fetchOptions = options.fetchOptions || null;
this._matchOptions = options.matchOptions || null;
}

@@ -938,3 +946,3 @@

let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, null, _this2._plugins);
let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);

@@ -986,3 +994,3 @@ if (response) {

return babelHelpers.asyncToGenerator(function* () {
const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins);
const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins, event ? event.preloadResponse : undefined);

@@ -989,0 +997,0 @@ const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put(_this3._cacheName, request, response.clone(), _this3._plugins);

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

this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){"use strict";try{self.workbox.v["workbox:strategies:3.3.1"]=1}catch(e){}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));let s,i=yield t.cacheWrapper.match(n.e,r,null,n.t);if(!i)try{i=yield n.n(r,e)}catch(e){s=e}if(s)throw s;return i})()}n(e,n){var s=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,s.r,s.t),l=i.clone(),u=t.cacheWrapper.put(s.e,e,l,s.t);if(n)try{n.waitUntil(u)}catch(e){}return i})()}}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[]}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){return"string"==typeof r&&(r=new Request(r)),yield t.cacheWrapper.match(n.e,r,null,n.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.s=t.networkTimeoutSeconds,this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=[];"string"==typeof t&&(t=new Request(t));const s=[];let i;if(r.s){const{id:e,promise:l}=r.i(t,n);i=e,s.push(l)}const l=r.l(i,e,t,n);s.push(l);let u=yield Promise.race(s);return u||(u=yield l),u})()}i(e,t){var r=this;let n;var s;return{promise:new Promise(t=>{const i=(s=babelHelpers.asyncToGenerator(function*(){t(yield r.u(e))}),function(){return s.apply(this,arguments)});n=setTimeout(i,1e3*this.s)}),id:n}}l(e,n,s,i){var l=this;return babelHelpers.asyncToGenerator(function*(){let i,u;try{u=yield r.fetchWrapper.fetch(s,l.r,l.t)}catch(e){i=e}if(e&&clearTimeout(e),i||!u)u=yield l.u(s);else{const e=u.clone(),r=t.cacheWrapper.put(l.e,s,e,l.t);if(n)try{n.waitUntil(r)}catch(e){}}return u})()}u(e){return t.cacheWrapper.match(this.e,e,null,this.t)}}class u{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var n=this;return babelHelpers.asyncToGenerator(function*(){let e,s;"string"==typeof t&&(t=new Request(t));try{s=yield r.fetchWrapper.fetch(t,n.r,n.t)}catch(t){e=t}if(e)throw e;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];this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));const s=n.n(r,e);let i=yield t.cacheWrapper.match(n.e,r,null,n.t);if(i){if(e)try{e.waitUntil(s)}catch(e){}}else i=yield s;return i})()}n(e,n){var s=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,s.r,s.t),l=t.cacheWrapper.put(s.e,e,i.clone(),s.t);if(n)try{n.waitUntil(l)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:n,CacheOnly:s,NetworkFirst:l,NetworkOnly:u,StaleWhileRevalidate:c});const a={cacheFirst:n,cacheOnly:s,networkFirst:l,networkOnly:u,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private);
this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){"use strict";try{self.workbox.v["workbox:strategies:3.4.1"]=1}catch(e){}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));let n,i=yield t.cacheWrapper.match(s.e,r,s.s,s.t);if(!i)try{i=yield s.n(r,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,s){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,n.r,n.t,s?s.preloadResponse:void 0),l=i.clone(),u=t.cacheWrapper.put(n.e,e,l,n.t);if(s)try{s.waitUntil(u)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){return"string"==typeof r&&(r=new Request(r)),yield t.cacheWrapper.match(s.e,r,s.s,s.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.i=t.networkTimeoutSeconds,this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const s=[];"string"==typeof t&&(t=new Request(t));const n=[];let i;if(r.i){const{id:e,promise:l}=r.l(t,s);i=e,n.push(l)}const l=r.u(i,e,t,s);n.push(l);let u=yield Promise.race(n);return u||(u=yield l),u})()}l(e,t){var r=this;let s;var n;return{promise:new Promise(t=>{const i=(n=babelHelpers.asyncToGenerator(function*(){t(yield r.o(e))}),function(){return n.apply(this,arguments)});s=setTimeout(i,1e3*this.i)}),id:s}}u(e,s,n,i){var l=this;return babelHelpers.asyncToGenerator(function*(){let i,u;try{u=yield r.fetchWrapper.fetch(n,l.r,l.t,s?s.preloadResponse:void 0)}catch(e){i=e}if(e&&clearTimeout(e),i||!u)u=yield l.o(n);else{const e=u.clone(),r=t.cacheWrapper.put(l.e,n,e,l.t);if(s)try{s.waitUntil(r)}catch(e){}}return u})()}o(e){return t.cacheWrapper.match(this.e,e,this.s,this.t)}}class u{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){let n,i;"string"==typeof t&&(t=new Request(t));try{i=yield r.fetchWrapper.fetch(t,s.r,s.t,e?e.preloadResponse:void 0)}catch(e){n=e}if(n)throw n;return i})()}}class o{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];this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));const n=s.n(r,e);let i=yield t.cacheWrapper.match(s.e,r,s.s,s.t);if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n(e,s){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,n.r,n.t,s?s.preloadResponse:void 0),l=t.cacheWrapper.put(n.e,e,i.clone(),n.t);if(s)try{s.waitUntil(l)}catch(e){}return i})()}}var c=Object.freeze({CacheFirst:s,CacheOnly:n,NetworkFirst:l,NetworkOnly:u,StaleWhileRevalidate:o});const a={cacheFirst:s,cacheOnly:n,networkFirst:l,networkOnly:u,staleWhileRevalidate:o},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,c)}(workbox.core._private,workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-strategies.prod.js.map
{
"name": "workbox-strategies",
"version": "3.3.1",
"version": "3.4.1",
"license": "Apache-2.0",

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

"dependencies": {
"workbox-core": "^3.3.1"
"workbox-core": "^3.4.1"
}
}

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