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

workbox-precaching

Package Overview
Dependencies
Maintainers
4
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-precaching - npm Package Compare versions

Comparing version 6.0.0-alpha.3 to 6.0.0-rc.0

2

_version.js
"use strict";
// @ts-ignore
try {
self['workbox:precaching:6.0.0-alpha.2'] && _();
self['workbox:precaching:6.0.0-alpha.3'] && _();
}
catch (e) { }

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

try {
self['workbox:precaching:6.0.0-alpha.2'] && _();
self['workbox:precaching:6.0.0-alpha.3'] && _();
} catch (e) {}

@@ -27,0 +27,0 @@

@@ -1,2 +0,2 @@

this.workbox=this.workbox||{},this.workbox.precaching=function(t,e,s,n,i,c,r,o){"use strict";function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t}).apply(this,arguments)}try{self["workbox:precaching:6.0.0-alpha.2"]&&_()}catch(t){}function h(t){if(!t)throw new s.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:n}=t;if(!n)throw new s.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(n,location.href);return{cacheKey:t.href,url:t.href}}const i=new URL(n,location.href),c=new URL(n,location.href);return i.searchParams.set("__WB_REVISION__",e),{cacheKey:i.href,url:c.href}}class l{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:t,state:e})=>{e&&(e.originalRequest=t)},this.cachedResponseWillBeUsed=async({event:t,state:e,cachedResponse:s})=>{if("install"===t.type){const t=e.originalRequest.url;s?this.notUpdatedURLs.push(t):this.updatedURLs.push(t)}return s}}}class u{constructor({precacheController:t}){this.cacheKeyWillBeUsed=async({request:t,params:e})=>{const s=e&&e.cacheKey||this.t.getCacheKeyForURL(t.url);return s?new Request(s):t},this.t=t}}const f={cacheWillUpdate:async({response:t})=>t.redirected?await i.copyResponse(t):t};class w extends c.Strategy{constructor(t={}){t.cacheName=e.cacheNames.getPrecacheName(t.cacheName),super(t),this.i=!1!==t.fallbackToNetwork,this.plugins.push(f)}async o(t,e){const s=await e.cacheMatch(t);return s||(e.event&&"install"===e.event.type?await this.h(t,e):await this.l(t,e))}async l(t,e){let n;if(!this.i)throw new s.WorkboxError("missing-precache-entry",{cacheName:this.cacheName,url:t.url});return n=await e.fetch(t),n}async h(t,e){const n=await e.fetchAndCachePut(t);let i=Boolean(n);if(n&&n.status>=400&&!this.u()&&(i=!1),!i)throw new s.WorkboxError("bad-precaching-response",{url:t.url,status:n.status});return n}u(){return this.plugins.some((t=>t.cacheWillUpdate&&t!==f))}}class d{constructor({cacheName:t,plugins:s=[],fallbackToNetwork:n=!0}={}){this.p=new Map,this.R=new Map,this.L=new Map,this.U=new w({cacheName:e.cacheNames.getPrecacheName(t),plugins:[...s,new u({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this.U}precache(t){this.addToCacheList(t),this.g||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this.g=!0)}addToCacheList(t){const e=[];for(const n of t){"string"==typeof n?e.push(n):n&&void 0===n.revision&&e.push(n.url);const{cacheKey:t,url:i}=h(n),c="string"!=typeof n&&n.revision?"reload":"default";if(this.p.has(i)&&this.p.get(i)!==t)throw new s.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:this.p.get(i),secondEntry:t});if("string"!=typeof n&&n.integrity){if(this.L.has(t)&&this.L.get(t)!==n.integrity)throw new s.WorkboxError("add-to-cache-list-conflicting-integrities",{url:i});this.L.set(t,n.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)}}}install(t){return n.waitUntil(t,(async()=>{const e=new l;this.strategy.plugins.push(e);for(const[e,s]of this.p){const n=this.L.get(s),i=this.R.get(e),c=new Request(e,{integrity:n,cache:i,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:s},request:c,event:t}))}const{updatedURLs:s,notUpdatedURLs:n}=e;return{updatedURLs:s,notUpdatedURLs:n}}))}activate(t){return n.waitUntil(t,(async()=>{const t=await self.caches.open(this.strategy.cacheName),e=await t.keys(),s=new Set(this.p.values()),n=[];for(const i of e)s.has(i.url)||(await t.delete(i),n.push(i.url));return{deletedURLs:n}}))}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,s=this.getCacheKeyForURL(e);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(t){const e=this.getCacheKeyForURL(t);if(!e)throw new s.WorkboxError("non-precached-url",{url:t});return s=>(s.request=new Request(t),s.params=a({cacheKey:e},s.params),this.strategy.handle(s))}}let y;const p=()=>(y||(y=new d),y);class R extends o.Route{constructor(t,e){super((({request:s})=>{const n=t.getURLsToCacheKeys();for(const t of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:i}={}){const c=new URL(t,location.href);c.hash="",yield c.href;const r=function(t,e=[]){for(const s of[...t.searchParams.keys()])e.some((t=>t.test(s)))&&t.searchParams.delete(s);return t}(c,e);if(yield r.href,s&&r.pathname.endsWith("/")){const t=new URL(r.href);t.pathname+=s,yield t.href}if(n){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}}(s.url,e)){const e=n.get(t);if(e)return{cacheKey:e}}}),t.strategy)}}function L(t){const e=p(),s=new R(e,t);r.registerRoute(s)}function U(t){p().precache(t)}return t.PrecacheController=d,t.PrecacheFallbackPlugin=class{constructor({fallbackURL:t,precacheController:e}){this.handlerDidError=()=>this.t.matchPrecache(this.m),this.m=t,this.t=e||p()}},t.PrecacheRoute=R,t.PrecacheStrategy=w,t.addPlugins=function(t){p().strategy.plugins.push(...t)},t.addRoute=L,t.cleanupOutdatedCaches=function(){self.addEventListener("activate",(t=>{const s=e.cacheNames.getPrecacheName();t.waitUntil((async(t,e="-precache-")=>{const s=(await self.caches.keys()).filter((s=>s.includes(e)&&s.includes(self.registration.scope)&&s!==t));return await Promise.all(s.map((t=>self.caches.delete(t)))),s})(s).then((t=>{})))}))},t.createHandlerBoundToURL=function(t){return p().createHandlerBoundToURL(t)},t.getCacheKeyForURL=function(t){return p().getCacheKeyForURL(t)},t.matchPrecache=function(t){return p().matchPrecache(t)},t.precache=U,t.precacheAndRoute=function(t,e){U(t),L(e)},t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core,workbox.strategies,workbox.routing,workbox.routing);
this.workbox=this.workbox||{},this.workbox.precaching=function(t,e,s,n,i,c,r,o){"use strict";function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t}).apply(this,arguments)}try{self["workbox:precaching:6.0.0-alpha.3"]&&_()}catch(t){}function h(t){if(!t)throw new s.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:n}=t;if(!n)throw new s.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(n,location.href);return{cacheKey:t.href,url:t.href}}const i=new URL(n,location.href),c=new URL(n,location.href);return i.searchParams.set("__WB_REVISION__",e),{cacheKey:i.href,url:c.href}}class l{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:t,state:e})=>{e&&(e.originalRequest=t)},this.cachedResponseWillBeUsed=async({event:t,state:e,cachedResponse:s})=>{if("install"===t.type){const t=e.originalRequest.url;s?this.notUpdatedURLs.push(t):this.updatedURLs.push(t)}return s}}}class u{constructor({precacheController:t}){this.cacheKeyWillBeUsed=async({request:t,params:e})=>{const s=e&&e.cacheKey||this.t.getCacheKeyForURL(t.url);return s?new Request(s):t},this.t=t}}const f={cacheWillUpdate:async({response:t})=>t.redirected?await i.copyResponse(t):t};class w extends c.Strategy{constructor(t={}){t.cacheName=e.cacheNames.getPrecacheName(t.cacheName),super(t),this.i=!1!==t.fallbackToNetwork,this.plugins.push(f)}async o(t,e){const s=await e.cacheMatch(t);return s||(e.event&&"install"===e.event.type?await this.h(t,e):await this.l(t,e))}async l(t,e){let n;if(!this.i)throw new s.WorkboxError("missing-precache-entry",{cacheName:this.cacheName,url:t.url});return n=await e.fetch(t),n}async h(t,e){const n=await e.fetchAndCachePut(t);let i=Boolean(n);if(n&&n.status>=400&&!this.u()&&(i=!1),!i)throw new s.WorkboxError("bad-precaching-response",{url:t.url,status:n.status});return n}u(){return this.plugins.some((t=>t.cacheWillUpdate&&t!==f))}}class d{constructor({cacheName:t,plugins:s=[],fallbackToNetwork:n=!0}={}){this.p=new Map,this.R=new Map,this.L=new Map,this.U=new w({cacheName:e.cacheNames.getPrecacheName(t),plugins:[...s,new u({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this.U}precache(t){this.addToCacheList(t),this.g||(self.addEventListener("install",this.install),self.addEventListener("activate",this.activate),this.g=!0)}addToCacheList(t){const e=[];for(const n of t){"string"==typeof n?e.push(n):n&&void 0===n.revision&&e.push(n.url);const{cacheKey:t,url:i}=h(n),c="string"!=typeof n&&n.revision?"reload":"default";if(this.p.has(i)&&this.p.get(i)!==t)throw new s.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:this.p.get(i),secondEntry:t});if("string"!=typeof n&&n.integrity){if(this.L.has(t)&&this.L.get(t)!==n.integrity)throw new s.WorkboxError("add-to-cache-list-conflicting-integrities",{url:i});this.L.set(t,n.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)}}}install(t){return n.waitUntil(t,(async()=>{const e=new l;this.strategy.plugins.push(e);for(const[e,s]of this.p){const n=this.L.get(s),i=this.R.get(e),c=new Request(e,{integrity:n,cache:i,credentials:"same-origin"});await Promise.all(this.strategy.handleAll({params:{cacheKey:s},request:c,event:t}))}const{updatedURLs:s,notUpdatedURLs:n}=e;return{updatedURLs:s,notUpdatedURLs:n}}))}activate(t){return n.waitUntil(t,(async()=>{const t=await self.caches.open(this.strategy.cacheName),e=await t.keys(),s=new Set(this.p.values()),n=[];for(const i of e)s.has(i.url)||(await t.delete(i),n.push(i.url));return{deletedURLs:n}}))}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,s=this.getCacheKeyForURL(e);if(s){return(await self.caches.open(this.strategy.cacheName)).match(s)}}createHandlerBoundToURL(t){const e=this.getCacheKeyForURL(t);if(!e)throw new s.WorkboxError("non-precached-url",{url:t});return s=>(s.request=new Request(t),s.params=a({cacheKey:e},s.params),this.strategy.handle(s))}}let y;const p=()=>(y||(y=new d),y);class R extends o.Route{constructor(t,e){super((({request:s})=>{const n=t.getURLsToCacheKeys();for(const t of function*(t,{ignoreURLParametersMatching:e=[/^utm_/,/^fbclid$/],directoryIndex:s="index.html",cleanURLs:n=!0,urlManipulation:i}={}){const c=new URL(t,location.href);c.hash="",yield c.href;const r=function(t,e=[]){for(const s of[...t.searchParams.keys()])e.some((t=>t.test(s)))&&t.searchParams.delete(s);return t}(c,e);if(yield r.href,s&&r.pathname.endsWith("/")){const t=new URL(r.href);t.pathname+=s,yield t.href}if(n){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}}(s.url,e)){const e=n.get(t);if(e)return{cacheKey:e}}}),t.strategy)}}function L(t){const e=p(),s=new R(e,t);r.registerRoute(s)}function U(t){p().precache(t)}return t.PrecacheController=d,t.PrecacheFallbackPlugin=class{constructor({fallbackURL:t,precacheController:e}){this.handlerDidError=()=>this.t.matchPrecache(this.m),this.m=t,this.t=e||p()}},t.PrecacheRoute=R,t.PrecacheStrategy=w,t.addPlugins=function(t){p().strategy.plugins.push(...t)},t.addRoute=L,t.cleanupOutdatedCaches=function(){self.addEventListener("activate",(t=>{const s=e.cacheNames.getPrecacheName();t.waitUntil((async(t,e="-precache-")=>{const s=(await self.caches.keys()).filter((s=>s.includes(e)&&s.includes(self.registration.scope)&&s!==t));return await Promise.all(s.map((t=>self.caches.delete(t)))),s})(s).then((t=>{})))}))},t.createHandlerBoundToURL=function(t){return p().createHandlerBoundToURL(t)},t.getCacheKeyForURL=function(t){return p().getCacheKeyForURL(t)},t.matchPrecache=function(t){return p().matchPrecache(t)},t.precache=U,t.precacheAndRoute=function(t,e){U(t),L(e)},t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core,workbox.strategies,workbox.routing,workbox.routing);
//# sourceMappingURL=workbox-precaching.prod.js.map
{
"name": "workbox-precaching",
"version": "6.0.0-alpha.3",
"version": "6.0.0-rc.0",
"license": "MIT",

@@ -24,7 +24,7 @@ "author": "Google's Web DevRel Team",

"dependencies": {
"workbox-core": "^6.0.0-alpha.3",
"workbox-routing": "^6.0.0-alpha.3",
"workbox-strategies": "^6.0.0-alpha.3"
"workbox-core": "^6.0.0-rc.0",
"workbox-routing": "^6.0.0-rc.0",
"workbox-strategies": "^6.0.0-rc.0"
},
"gitHead": "00ba07467b253751e874f53f424f2adb1c06e176"
"gitHead": "43c375f60c986a23a25a1c04ad83ed94783c39d1"
}
// @ts-ignore
try{self['workbox:precaching:6.0.0-alpha.2']&&_()}catch(e){}
try{self['workbox:precaching:6.0.0-alpha.3']&&_()}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

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