workbox-core
Advanced tools
Comparing version 3.0.0-alpha.6 to 3.0.0-beta.0
@@ -43,3 +43,3 @@ /* eslint-disable */ | ||
try { | ||
self.workbox.v['workbox:core:3.0.0-alpha.6'] = 1; | ||
self.workbox.v['workbox:core:3.0.0-beta.0'] = 1; | ||
} catch (e) {} // eslint-disable-line | ||
@@ -825,5 +825,6 @@ | ||
// TODO If response is not safe to cache - print info to log. | ||
if (!responseToCache) { | ||
{ | ||
defaultExport$1.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache); | ||
} | ||
return; | ||
@@ -893,2 +894,11 @@ } | ||
}); | ||
{ | ||
if (cachedResponse) { | ||
finalExports$2.isInstance(cachedResponse, Response, { | ||
moduleName: 'Plugin', | ||
funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED, | ||
isReturnValueProblem: true | ||
}); | ||
} | ||
} | ||
} | ||
@@ -1005,4 +1015,11 @@ } | ||
// TODO Move to assertion | ||
// assert.isInstance({request}, Request); | ||
{ | ||
finalExports$2.isInstance(request, Request, { | ||
paramName: request, | ||
expectedClass: 'Request', | ||
moduleName: 'workbox-core', | ||
className: 'fetchWrapper', | ||
funcName: 'wrappedFetch' | ||
}); | ||
} | ||
@@ -1023,4 +1040,11 @@ const failedFetchPlugins = pluginUtils.filter(plugins, pluginEvents.FETCH_DID_FAIL); | ||
// TODO: Move to assertion | ||
// isInstance({request}, Request); | ||
{ | ||
if (request) { | ||
finalExports$2.isInstance(request, Request, { | ||
moduleName: 'Plugin', | ||
funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED, | ||
isReturnValueProblem: true | ||
}); | ||
} | ||
} | ||
} | ||
@@ -1039,4 +1063,2 @@ } | ||
// TODO Log when the plugin filtered URL is different from the input request | ||
try { | ||
@@ -1043,0 +1065,0 @@ const response = yield fetch(request, fetchOptions); |
@@ -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.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})}(); | ||
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-beta.0"]=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.6", | ||
"version": "3.0.0-beta.0", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
164036
2687
3
17