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

workbox-core

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-core - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.2

23

build/workbox-core.dev.js

@@ -43,3 +43,3 @@ /* eslint-disable */

try {
self.workbox.v['workbox:core:3.0.0-beta.1'] = 1;
self.workbox.v['workbox:core:3.0.0-beta.2'] = 1;
} catch (e) {} // eslint-disable-line

@@ -259,2 +259,5 @@

return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;
},
'attempt-to-cache-non-get-request': ({ url, method }) => {
return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;
}

@@ -576,4 +579,2 @@ };

const MAX_AGE_REGEX = /max-age\s*=\s*(\d*)/g;
/**

@@ -617,4 +618,3 @@ * Logs a warning to the user recommending changing

const cacheControlHeader = response.headers.get('cache-control');
const maxAgeResult = MAX_AGE_REGEX.exec(cacheControlHeader);
const maxAgeResult = /max-age\s*=\s*(\d*)/g.exec(cacheControlHeader);
if (maxAgeResult) {

@@ -630,2 +630,6 @@ if (parseInt(maxAgeResult[1], 10) === 0) {

if (cacheControlHeader.indexOf('no-store') !== -1) {
return;
}
showWarning(cacheControlHeader);

@@ -921,2 +925,11 @@ } catch (err) {

{
if (responseToCache.method && responseToCache.method !== 'GET') {
throw new WorkboxError('attempt-to-cache-non-get-request', {
url: getFriendlyURL(request.url),
method: responseToCache.method
});
}
}
const cache = yield caches.open(cacheName);

@@ -923,0 +936,0 @@

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

self.babelHelpers={asyncToGenerator:function(e){return function(){var r=e.apply(this,arguments);return new Promise(function(e,t){return function n(o,i){try{var l=r[o](i),c=l.value}catch(e){return void t(e)}if(!l.done)return Promise.resolve(c).then(function(e){n("next",e)},function(e){n("throw",e)});e(c)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.0.0-beta.1"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const r=(e,...r)=>{let t=e;return r.length>0&&(t+=` :: ${JSON.stringify(r)}`),t};class t extends Error{constructor(e,t){let n=r(e,t);super(n),this.name=e,this.details=t}}const n={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},o=e=>[n.prefix,e,n.suffix].filter(e=>e.length>0).join("-"),i={updateDetails:e=>{Object.keys(n).forEach(r=>{void 0!==e[r]&&(n[r]=e[r])})},getGoogleAnalyticsName:e=>e||o(n.googleAnalytics),getPrecacheName:e=>e||o(n.precache),getRuntimeName:e=>e||o(n.runtime)},l=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let c=e.warn;const u=e=>c<=e,s=e=>c=e,a=()=>c,d=e.error,f=function(r,t,n){const o=0===r.indexOf("group")?d:e[r];if(!u(o))return;if(!n||"groupCollapsed"===r&&l)return void console[r](...t);const i=["%cworkbox",`background: ${n}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...i,...t)},h=()=>{u(d)&&console.groupEnd()},p={groupEnd:h,unprefixed:{groupEnd:h}},y={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};Object.keys(y).forEach(e=>(b=e,g=y[e],p[b]=((...e)=>f(b,e,g)),void(p.unprefixed[b]=((...e)=>f(b,e)))));var b,g;var v=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:i.getGoogleAnalyticsName(),precache:i.getPrecacheName(),runtime:i.getRuntimeName()}}setCacheNameDetails(e){i.updateDetails(e)}get logLevel(){return a()}setLogLevel(r){if(r>e.silent||r<e.debug)throw new t("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:r});s(r)}};var m="cacheDidUpdate",w="cacheWillUpdate",L="cachedResponseWillBeUsed",E="fetchDidFail",H="requestWillFetch",x=(e,r)=>e.filter(e=>r in e);const q=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield O(r,t,n);if(!o)return;const i=yield caches.open(e),l=x(n,m);let c=l.length>0?yield N(e,r):null;yield i.put(r,o);for(let t of l)yield t[m].call(t,{cacheName:e,request:r,oldResponse:c,newResponse:o})});return function(r,t,n){return e.apply(this,arguments)}})(),N=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield(yield caches.open(e)).match(r,t);for(let i of n)L in i&&(o=yield i[L].call(i,{cacheName:e,request:r,matchOptions:t,cachedResponse:o}));return o});return function(r,t,n){return e.apply(this,arguments)}})(),O=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t){let n=r,o=!1;for(let r of t)if(w in r&&(o=!0,!(n=yield r[w].call(r,{request:e,response:n}))))break;return o||(n=n.ok?n:null),n||null});return function(r,t,n){return e.apply(this,arguments)}})(),k={put:q,match:N},R={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,n=[]){"string"==typeof e&&(e=new Request(e));const o=x(n,E),i=o.length>0?e.clone():null;try{for(let r of n)H in r&&(e=yield r[H].call(r,{request:e.clone()}))}catch(e){throw new t("plugin-error-request-will-fetch",{thrownError:e})}const l=e.clone();try{return yield fetch(e,r)}catch(e){for(let e of o)yield e[E].call(e,{originalRequest:i.clone(),request:l.clone()});throw e}});return function(r,t){return e.apply(this,arguments)}})()};class A{constructor(e,r,{onupgradeneeded:t,onversionchange:n=this.e}={}){this.r=e,this.t=r,this.n=t,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(r,t){let n=!1;setTimeout(function(){n=!0,t(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.r,e.t);o.onerror=function(e){return t(o.error)},o.onupgradeneeded=function(r){n?(o.transaction.abort(),r.target.result.close()):e.n&&e.n(r)},o.onsuccess=function(t){const o=t.target.result;n?o.close():(o.onversionchange=e.e,r(o))}}),e})()}get(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("get",e,"readonly",...r)})()}add(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("add",e,"readwrite",...r)})()}put(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("put",e,"readwrite",...r)})()}delete(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.i("delete",e,"readwrite",...r)})()}getAll(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",r,t):yield n.getAllMatching(e,{query:r,count:t})})()}getAllMatching(e,r={}){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.transaction([e],"readonly",function(t,n){const o=t[e],i=[];(r.index?o.index(r.index):o).openCursor(r.query,r.direction).onsuccess=function(e){const t=e.target.result;if(t){const{primaryKey:e,key:o,value:l}=t;i.push(r.includeKeys?{primaryKey:e,key:o,value:l}:l),r.count&&i.length>=r.count?n(i):t.continue()}else n(i)}})})()}transaction(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){yield n.open();return yield new Promise(function(o,i){const l=n.o.transaction(e,r);l.onerror=function(e){return i(e.target.error)},l.onabort=function(e){return i(e.target.error)},l.oncomplete=function(){return o()};const c={};for(const r of e)c[r]=l.objectStore(r);t(c,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),l.abort()})})})()}i(e,r,t,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([r],t,function(t,o){t[r][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}A.prototype.OPEN_TIMEOUT=2e3;var D=Object.freeze({logger:p,assert:null,cacheNames:i,cacheWrapper:k,fetchWrapper:R,WorkboxError:t,DBWrapper:A,getFriendlyURL:e=>{const r=new URL(e,location);return r.origin===location.origin?r.pathname:r.href}});return Object.assign(v,{LOG_LEVELS:e,_private:D})}();
self.babelHelpers={asyncToGenerator:function(e){return function(){var r=e.apply(this,arguments);return new Promise(function(e,t){return function n(o,i){try{var l=r[o](i),c=l.value}catch(e){return void t(e)}if(!l.done)return Promise.resolve(c).then(function(e){n("next",e)},function(e){n("throw",e)});e(c)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.0.0-beta.2"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const r=(e,...r)=>{let t=e;return r.length>0&&(t+=` :: ${JSON.stringify(r)}`),t};class t extends Error{constructor(e,t){let n=r(e,t);super(n),this.name=e,this.details=t}}const n={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},o=e=>[n.prefix,e,n.suffix].filter(e=>e.length>0).join("-"),i={updateDetails:e=>{Object.keys(n).forEach(r=>{void 0!==e[r]&&(n[r]=e[r])})},getGoogleAnalyticsName:e=>e||o(n.googleAnalytics),getPrecacheName:e=>e||o(n.precache),getRuntimeName:e=>e||o(n.runtime)},l=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let c=e.warn;const u=e=>c<=e,s=e=>c=e,a=()=>c,d=e.error,f=function(r,t,n){const o=0===r.indexOf("group")?d:e[r];if(!u(o))return;if(!n||"groupCollapsed"===r&&l)return void console[r](...t);const i=["%cworkbox",`background: ${n}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...i,...t)},h=()=>{u(d)&&console.groupEnd()},p={groupEnd:h,unprefixed:{groupEnd:h}},y={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};Object.keys(y).forEach(e=>(b=e,g=y[e],p[b]=((...e)=>f(b,e,g)),void(p.unprefixed[b]=((...e)=>f(b,e)))));var b,g;var v=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:i.getGoogleAnalyticsName(),precache:i.getPrecacheName(),runtime:i.getRuntimeName()}}setCacheNameDetails(e){i.updateDetails(e)}get logLevel(){return a()}setLogLevel(r){if(r>e.silent||r<e.debug)throw new t("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:r});s(r)}};var m="cacheDidUpdate",w="cacheWillUpdate",L="cachedResponseWillBeUsed",E="fetchDidFail",H="requestWillFetch",x=(e,r)=>e.filter(e=>r in e);const q=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield O(r,t,n);if(!o)return;const i=yield caches.open(e),l=x(n,m);let c=l.length>0?yield N(e,r):null;yield i.put(r,o);for(let t of l)yield t[m].call(t,{cacheName:e,request:r,oldResponse:c,newResponse:o})});return function(r,t,n){return e.apply(this,arguments)}})(),N=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield(yield caches.open(e)).match(r,t);for(let i of n)L in i&&(o=yield i[L].call(i,{cacheName:e,request:r,matchOptions:t,cachedResponse:o}));return o});return function(r,t,n){return e.apply(this,arguments)}})(),O=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,t){let n=r,o=!1;for(let r of t)if(w in r&&(o=!0,!(n=yield r[w].call(r,{request:e,response:n}))))break;return o||(n=n.ok?n:null),n||null});return function(r,t,n){return e.apply(this,arguments)}})(),k={put:q,match:N},R={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,n=[]){"string"==typeof e&&(e=new Request(e));const o=x(n,E),i=o.length>0?e.clone():null;try{for(let r of n)H in r&&(e=yield r[H].call(r,{request:e.clone()}))}catch(e){throw new t("plugin-error-request-will-fetch",{thrownError:e})}const l=e.clone();try{return yield fetch(e,r)}catch(e){for(let e of o)yield e[E].call(e,{originalRequest:i.clone(),request:l.clone()});throw e}});return function(r,t){return e.apply(this,arguments)}})()};class A{constructor(e,r,{onupgradeneeded:t,onversionchange:n=this.e}={}){this.r=e,this.t=r,this.n=t,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(r,t){let n=!1;setTimeout(function(){n=!0,t(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.r,e.t);o.onerror=function(e){return t(o.error)},o.onupgradeneeded=function(r){n?(o.transaction.abort(),r.target.result.close()):e.n&&e.n(r)},o.onsuccess=function(t){const o=t.target.result;n?o.close():(o.onversionchange=e.e,r(o))}}),e})()}get(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("get",e,"readonly",...r)})()}add(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("add",e,"readwrite",...r)})()}put(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("put",e,"readwrite",...r)})()}delete(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.i("delete",e,"readwrite",...r)})()}getAll(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",r,t):yield n.getAllMatching(e,{query:r,count:t})})()}getAllMatching(e,r={}){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.transaction([e],"readonly",function(t,n){const o=t[e],i=[];(r.index?o.index(r.index):o).openCursor(r.query,r.direction).onsuccess=function(e){const t=e.target.result;if(t){const{primaryKey:e,key:o,value:l}=t;i.push(r.includeKeys?{primaryKey:e,key:o,value:l}:l),r.count&&i.length>=r.count?n(i):t.continue()}else n(i)}})})()}transaction(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){yield n.open();return yield new Promise(function(o,i){const l=n.o.transaction(e,r);l.onerror=function(e){return i(e.target.error)},l.onabort=function(e){return i(e.target.error)},l.oncomplete=function(){return o()};const c={};for(const r of e)c[r]=l.objectStore(r);t(c,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),l.abort()})})})()}i(e,r,t,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([r],t,function(t,o){t[r][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}A.prototype.OPEN_TIMEOUT=2e3;var D=Object.freeze({logger:p,assert:null,cacheNames:i,cacheWrapper:k,fetchWrapper:R,WorkboxError:t,DBWrapper:A,getFriendlyURL:e=>{const r=new URL(e,location);return r.origin===location.origin?r.pathname:r.href}});return Object.assign(v,{LOG_LEVELS:e,_private:D})}();
//# sourceMappingURL=workbox-core.prod.js.map
{
"name": "workbox-core",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"license": "Apache-2.0",

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

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