workbox-precaching
Advanced tools
Comparing version 6.0.0-alpha.0 to 6.0.0-alpha.1
"use strict"; | ||
// @ts-ignore | ||
try { | ||
self['workbox:precaching:5.1.3'] && _(); | ||
self['workbox:precaching:6.0.0-alpha.0'] && _(); | ||
} | ||
catch (e) { } |
@@ -6,3 +6,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self['workbox:precaching:5.1.3'] && _(); | ||
self['workbox:precaching:6.0.0-alpha.0'] && _(); | ||
} catch (e) {} | ||
@@ -9,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.precaching=function(t,e,n,s,i,c,r){"use strict";try{self["workbox:precaching:5.1.3"]&&_()}catch(t){}function o(t){if(!t)throw new n.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if("string"==typeof t){const e=new URL(t,location.href);return{cacheKey:e.href,url:e.href}}const{revision:e,url:s}=t;if(!s)throw new n.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(s,location.href);return{cacheKey:t.href,url:t.href}}const i=new URL(s,location.href),c=new URL(s,location.href);return i.searchParams.set("__WB_REVISION__",e),{cacheKey:i.href,url:c.href}}const a={cacheWillUpdate:async({response:t})=>t.redirected?await c.copyResponse(t):t};class h extends r.Strategy{constructor(t){super(t),this.plugins.push(a)}t(t,e){return e.event&&"install"===e.event.type?this.s(t,e):this.i(t,e)}async i(t,e){let s=await e.cacheMatch(t);if(!s){if(e.params&&!1===e.params.fallbackToNetwork)throw new n.WorkboxError("missing-precache-entry",{cacheName:this.cacheName,url:t.url});s=await e.fetch(t)}return s}async s(t,e){const s=await e.fetchAndCachePut(t);let i=Boolean(s);if(s&&s.status>=400&&!this.o()&&(i=!1),!i)throw new n.WorkboxError("bad-precaching-response",{url:t.url,status:s.status});return s}o(){return this.plugins.some(t=>t.cacheWillUpdate&&t!==a)}}class l{constructor(t){this.h=!1,this.l=[],this.u=e.cacheNames.getPrecacheName(t),this.p=new Map,this.R=new Map,this.g=new Map,this.L={cacheKeyWillBeUsed:async({request:t,params:e})=>e&&e.cacheKey||this.getCacheKeyForURL(t.url)||t}}addPlugins(t){this.l.push(...t)}addRoute(t){if(!this.U){const e=this.createMatchCallback(t),n=this.createHandler(!0),c=new s.Route(e,n),r=new i.Router;r.registerRoute(c),r.addFetchListener(),r.addCacheListener(),this.U=r}}precache(t){this.addToCacheList(t),this.h||(self.addEventListener("install",t=>{t.waitUntil(this.install({event:t}))}),self.addEventListener("activate",t=>{t.waitUntil(this.activate())}),this.h=!0)}precacheAndRoute(t,e){this.precache(t),this.addRoute(e)}addToCacheList(t){const e=[];for(const s of t){"string"==typeof s?e.push(s):s&&void 0===s.revision&&e.push(s.url);const{cacheKey:t,url:i}=o(s),c="string"!=typeof s&&s.revision?"reload":"default";if(this.p.has(i)&&this.p.get(i)!==t)throw new n.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:this.p.get(i),secondEntry:t});if("string"!=typeof s&&s.integrity){if(this.g.has(t)&&this.g.get(t)!==s.integrity)throw new n.WorkboxError("add-to-cache-list-conflicting-integrities",{url:i});this.g.set(t,s.integrity)}if(this.p.set(i,t),this.R.set(i,c),e.length>0){const t=`Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(t)}}}async install({event:t,plugins:e}){e&&this.addPlugins(e);const n=[],s=[],i=await self.caches.open(this.u),c=await i.keys(),r=new Set(c.map(t=>t.url));for(const[t,e]of this.p)r.has(e)?s.push(t):n.push({cacheKey:e,url:t});for(const{cacheKey:e,url:s}of n){const n=this.g.get(e),i=this.R.get(s);await this.m({cacheKey:e,cacheMode:i,event:t,integrity:n,url:s})}return{updatedURLs:n.map(t=>t.url),notUpdatedURLs:s}}async activate(){const t=await self.caches.open(this.u),e=await t.keys(),n=new Set(this.p.values()),s=[];for(const i of e)n.has(i.url)||(await t.delete(i),s.push(i.url));return{deletedURLs:s}}async m({cacheKey:t,url:e,cacheMode:n,event:s,integrity:i}){const c=new Request(e,{integrity:i,cache:n,credentials:"same-origin"});await Promise.all(this.K().handleAll({params:{cacheKey:t},request:c,event:s}))}getURLsToCacheKeys(){return this.p}getCachedURLs(){return[...this.p.keys()]}getCacheKeyForURL(t){const e=new URL(t,location.href);return this.p.get(e.href)}async matchPrecache(t){const e=t instanceof Request?t.url:t,n=this.getCacheKeyForURL(e);if(n){return(await self.caches.open(this.u)).match(n)}}createMatchCallback(t){return({request:e})=>{const n=this.getURLsToCacheKeys();for(const s of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:n="index.html",cleanURLs:s=!0,urlManipulation:i}={}){const c=new URL(t,location.href);c.hash="",yield c.href;const r=function(t,e=[]){for(const n of[...t.searchParams.keys()])e.some(t=>t.test(n))&&t.searchParams.delete(n);return t}(c,e);if(yield r.href,n&&r.pathname.endsWith("/")){const t=new URL(r.href);t.pathname+=n,yield t.href}if(s){const t=new URL(r.href);t.pathname+=".html",yield t.href}if(i){const t=i({url:c});for(const e of t)yield e.href}}(e.url,t)){const t=n.get(s);if(t)return{cacheKey:t}}}}createHandler(t=!0){return e=>{const n=e.request instanceof Request?e.request:new Request(e.request);return e.params=e.params||{},e.params.fallbackToNetwork=t,e.params.cacheKey||(e.params.cacheKey=this.getCacheKeyForURL(n.url)),this.K().handle(e)}}createHandlerBoundToURL(t,e=!0){if(!this.getCacheKeyForURL(t))throw new n.WorkboxError("non-precached-url",{url:t});const s=this.createHandler(e),i=new Request(t);return t=>s(Object.assign(t,{request:i}))}K(){return this._||(this._=new h({cacheName:this.u,matchOptions:{ignoreSearch:!0},plugins:[this.L,...this.l]})),this._}}let u;const f=()=>(u||(u=new l),u);return t.PrecacheController=l,t.PrecacheFallbackPlugin=class{constructor({fallbackURL:t,precacheController:e}){this.handlerDidError=()=>this.v.matchPrecache(this.k),this.k=t,this.v=e||f()}},t.addPlugins=function(t){return f().addPlugins(t)},t.addRoute=function(t){return f().addRoute(t)},t.cleanupOutdatedCaches=function(){self.addEventListener("activate",t=>{const n=e.cacheNames.getPrecacheName();t.waitUntil((async(t,e="-precache-")=>{const n=(await self.caches.keys()).filter(n=>n.includes(e)&&n.includes(self.registration.scope)&&n!==t);return await Promise.all(n.map(t=>self.caches.delete(t))),n})(n).then(t=>{}))})},t.createHandler=function(t=!0){return f().createHandler(t)},t.createHandlerBoundToURL=function(t){return f().createHandlerBoundToURL(t)},t.getCacheKeyForURL=function(t){return f().getCacheKeyForURL(t)},t.matchPrecache=function(t){return f().matchPrecache(t)},t.precache=function(t){f().precache(t)},t.precacheAndRoute=function(t,e){f().precacheAndRoute(t,e)},t}({},workbox.core._private,workbox.core._private,workbox.routing,workbox.routing,workbox.core,workbox.strategies); | ||
this.workbox=this.workbox||{},this.workbox.precaching=function(t,e,n,s,i,c,r){"use strict";try{self["workbox:precaching:6.0.0-alpha.0"]&&_()}catch(t){}function o(t){if(!t)throw new n.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if("string"==typeof t){const e=new URL(t,location.href);return{cacheKey:e.href,url:e.href}}const{revision:e,url:s}=t;if(!s)throw new n.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(s,location.href);return{cacheKey:t.href,url:t.href}}const i=new URL(s,location.href),c=new URL(s,location.href);return i.searchParams.set("__WB_REVISION__",e),{cacheKey:i.href,url:c.href}}const a={cacheWillUpdate:async({response:t})=>t.redirected?await c.copyResponse(t):t};class h extends r.Strategy{constructor(t){super(t),this.plugins.push(a)}t(t,e){return e.event&&"install"===e.event.type?this.s(t,e):this.i(t,e)}async i(t,e){let s=await e.cacheMatch(t);if(!s){if(e.params&&!1===e.params.fallbackToNetwork)throw new n.WorkboxError("missing-precache-entry",{cacheName:this.cacheName,url:t.url});s=await e.fetch(t)}return s}async s(t,e){const s=await e.fetchAndCachePut(t);let i=Boolean(s);if(s&&s.status>=400&&!this.o()&&(i=!1),!i)throw new n.WorkboxError("bad-precaching-response",{url:t.url,status:s.status});return s}o(){return this.plugins.some(t=>t.cacheWillUpdate&&t!==a)}}class l{constructor(t){this.h=!1,this.l=[],this.u=e.cacheNames.getPrecacheName(t),this.p=new Map,this.R=new Map,this.g=new Map,this.L={cacheKeyWillBeUsed:async({request:t,params:e})=>e&&e.cacheKey||this.getCacheKeyForURL(t.url)||t}}addPlugins(t){this.l.push(...t)}addRoute(t){if(!this.U){const e=this.createMatchCallback(t),n=this.createHandler(!0),c=new s.Route(e,n),r=new i.Router;r.registerRoute(c),r.addFetchListener(),r.addCacheListener(),this.U=r}}precache(t){this.addToCacheList(t),this.h||(self.addEventListener("install",t=>{t.waitUntil(this.install({event:t}))}),self.addEventListener("activate",t=>{t.waitUntil(this.activate())}),this.h=!0)}precacheAndRoute(t,e){this.precache(t),this.addRoute(e)}addToCacheList(t){const e=[];for(const s of t){"string"==typeof s?e.push(s):s&&void 0===s.revision&&e.push(s.url);const{cacheKey:t,url:i}=o(s),c="string"!=typeof s&&s.revision?"reload":"default";if(this.p.has(i)&&this.p.get(i)!==t)throw new n.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:this.p.get(i),secondEntry:t});if("string"!=typeof s&&s.integrity){if(this.g.has(t)&&this.g.get(t)!==s.integrity)throw new n.WorkboxError("add-to-cache-list-conflicting-integrities",{url:i});this.g.set(t,s.integrity)}if(this.p.set(i,t),this.R.set(i,c),e.length>0){const t=`Workbox is precaching URLs without revision info: ${e.join(", ")}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(t)}}}async install({event:t,plugins:e}){e&&this.addPlugins(e);const n=[],s=[],i=await self.caches.open(this.u),c=await i.keys(),r=new Set(c.map(t=>t.url));for(const[t,e]of this.p)r.has(e)?s.push(t):n.push({cacheKey:e,url:t});for(const{cacheKey:e,url:s}of n){const n=this.g.get(e),i=this.R.get(s);await this.m({cacheKey:e,cacheMode:i,event:t,integrity:n,url:s})}return{updatedURLs:n.map(t=>t.url),notUpdatedURLs:s}}async activate(){const t=await self.caches.open(this.u),e=await t.keys(),n=new Set(this.p.values()),s=[];for(const i of e)n.has(i.url)||(await t.delete(i),s.push(i.url));return{deletedURLs:s}}async m({cacheKey:t,url:e,cacheMode:n,event:s,integrity:i}){const c=new Request(e,{integrity:i,cache:n,credentials:"same-origin"});await Promise.all(this.K().handleAll({params:{cacheKey:t},request:c,event:s}))}getURLsToCacheKeys(){return this.p}getCachedURLs(){return[...this.p.keys()]}getCacheKeyForURL(t){const e=new URL(t,location.href);return this.p.get(e.href)}async matchPrecache(t){const e=t instanceof Request?t.url:t,n=this.getCacheKeyForURL(e);if(n){return(await self.caches.open(this.u)).match(n)}}createMatchCallback(t){return({request:e})=>{const n=this.getURLsToCacheKeys();for(const s of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:n="index.html",cleanURLs:s=!0,urlManipulation:i}={}){const c=new URL(t,location.href);c.hash="",yield c.href;const r=function(t,e=[]){for(const n of[...t.searchParams.keys()])e.some(t=>t.test(n))&&t.searchParams.delete(n);return t}(c,e);if(yield r.href,n&&r.pathname.endsWith("/")){const t=new URL(r.href);t.pathname+=n,yield t.href}if(s){const t=new URL(r.href);t.pathname+=".html",yield t.href}if(i){const t=i({url:c});for(const e of t)yield e.href}}(e.url,t)){const t=n.get(s);if(t)return{cacheKey:t}}}}createHandler(t=!0){return e=>{const n=e.request instanceof Request?e.request:new Request(e.request);return e.params=e.params||{},e.params.fallbackToNetwork=t,e.params.cacheKey||(e.params.cacheKey=this.getCacheKeyForURL(n.url)),this.K().handle(e)}}createHandlerBoundToURL(t,e=!0){if(!this.getCacheKeyForURL(t))throw new n.WorkboxError("non-precached-url",{url:t});const s=this.createHandler(e),i=new Request(t);return t=>s(Object.assign(t,{request:i}))}K(){return this._||(this._=new h({cacheName:this.u,matchOptions:{ignoreSearch:!0},plugins:[this.L,...this.l]})),this._}}let u;const f=()=>(u||(u=new l),u);return t.PrecacheController=l,t.PrecacheFallbackPlugin=class{constructor({fallbackURL:t,precacheController:e}){this.handlerDidError=()=>this.v.matchPrecache(this.k),this.k=t,this.v=e||f()}},t.addPlugins=function(t){return f().addPlugins(t)},t.addRoute=function(t){return f().addRoute(t)},t.cleanupOutdatedCaches=function(){self.addEventListener("activate",t=>{const n=e.cacheNames.getPrecacheName();t.waitUntil((async(t,e="-precache-")=>{const n=(await self.caches.keys()).filter(n=>n.includes(e)&&n.includes(self.registration.scope)&&n!==t);return await Promise.all(n.map(t=>self.caches.delete(t))),n})(n).then(t=>{}))})},t.createHandler=function(t=!0){return f().createHandler(t)},t.createHandlerBoundToURL=function(t){return f().createHandlerBoundToURL(t)},t.getCacheKeyForURL=function(t){return f().getCacheKeyForURL(t)},t.matchPrecache=function(t){return f().matchPrecache(t)},t.precache=function(t){f().precache(t)},t.precacheAndRoute=function(t,e){f().precacheAndRoute(t,e)},t}({},workbox.core._private,workbox.core._private,workbox.routing,workbox.routing,workbox.core,workbox.strategies); | ||
//# sourceMappingURL=workbox-precaching.prod.js.map |
{ | ||
"name": "workbox-precaching", | ||
"version": "6.0.0-alpha.0", | ||
"version": "6.0.0-alpha.1", | ||
"license": "MIT", | ||
@@ -24,7 +24,7 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-core": "^6.0.0-alpha.0", | ||
"workbox-routing": "^6.0.0-alpha.0", | ||
"workbox-strategies": "^6.0.0-alpha.0" | ||
"workbox-core": "^6.0.0-alpha.1", | ||
"workbox-routing": "^6.0.0-alpha.1", | ||
"workbox-strategies": "^6.0.0-alpha.1" | ||
}, | ||
"gitHead": "3dfe1f4c5ed450bc4b7420321f1a113ff4382d1b" | ||
"gitHead": "dd408f0c17a50fb68cac485133123775c3d4dfc2" | ||
} |
// @ts-ignore | ||
try{self['workbox:precaching:5.1.3']&&_()}catch(e){} | ||
try{self['workbox:precaching:6.0.0-alpha.0']&&_()}catch(e){} |
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances 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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
436110