Socket
Socket
Sign inDemoInstall

workbox-core

Package Overview
Dependencies
Maintainers
4
Versions
84
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-alpha.5 to 3.0.0-alpha.6

35

build/workbox-core.dev.js

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

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

@@ -132,7 +132,12 @@

'incorrect-class': ({ expectedClass, paramName, moduleName, className,
funcName }) => {
if (!expectedClass || !paramName || !moduleName || !funcName) {
funcName, isReturnValueProblem }) => {
if (!expectedClass || !moduleName || !funcName) {
throw new Error(`Unexpected input to 'incorrect-class' error.`);
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}.${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;
if (isReturnValueProblem) {
return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;
},

@@ -507,6 +512,7 @@

const isInstance = (object, expectedClass, { moduleName, className, funcName, paramName }) => {
const isInstance = (object, expectedClass, { moduleName, className, funcName,
paramName, isReturnValueProblem }) => {
if (!(object instanceof expectedClass)) {
throw new WorkboxError('incorrect-class', { paramName, expectedClass,
moduleName, className, funcName });
moduleName, className, funcName, isReturnValueProblem });
}

@@ -921,2 +927,16 @@ };

});
{
if (responseToCache) {
finalExports$2.isInstance(responseToCache, Response, {
moduleName: 'Plugin',
funcName: pluginEvents.CACHE_WILL_UPDATE,
isReturnValueProblem: true
});
}
}
if (!responseToCache) {
break;
}
}

@@ -929,3 +949,2 @@ }

if (responseToCache.status === 0) {
// TODO: Add a link to guide on third-party request handling
defaultExport$1.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);

@@ -940,3 +959,3 @@ } else {

return responseToCache;
return responseToCache ? responseToCache : null;
});

@@ -943,0 +962,0 @@

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

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