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

workbox-precaching

Package Overview
Dependencies
Maintainers
3
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 3.0.0-alpha.2 to 3.0.0-alpha.3

utils/printInstallDetails.mjs

42

build/workbox-precaching.dev.js
this.workbox = this.workbox || {};
this.workbox.precaching = (function (cacheNames_mjs,WorkboxError_mjs,fetchWrapper_mjs,cacheWrapper_mjs,assert_mjs,logger_mjs,DBWrapper_mjs,getFriendlyURL_mjs) {
this.workbox.precaching = (function (cacheNames_mjs,WorkboxError_mjs,fetchWrapper_mjs,cacheWrapper_mjs,assert_mjs,DBWrapper_mjs,logger_mjs,getFriendlyURL_mjs) {
'use strict';
try {
self.workbox.v['workbox:precaching:3.0.0-alpha.2'] = 1;
self.workbox.v['workbox:precaching:3.0.0-alpha.3'] = 1;
} catch (e) {} // eslint-disable-line

@@ -65,3 +65,3 @@

// Reload skips the HTTP cache for outgoing requests and updates
// the cache with the returned reponse.
// the cache with the returned response.
requestOptions.cache = 'reload';

@@ -118,4 +118,11 @@ } else {

this._cacheName = cacheNames_mjs.cacheNames.getPrecacheName(cacheName);
this._db = new DBWrapper_mjs.DBWrapper(`workbox-precaching`, 1, {
this._db = new DBWrapper_mjs.DBWrapper(`workbox-precaching`, 2, {
onupgradeneeded: evt => {
if (evt.oldVersion < 2) {
try {
evt.target.result.deleteObjectStore('workbox-precaching');
} catch (err) {
// NOOP
}
}
evt.target.result.createObjectStore(DB_STORE_NAME);

@@ -159,3 +166,5 @@ }

return babelHelpers.asyncToGenerator(function* () {
return yield _this2._db.getAll(DB_STORE_NAME);
return yield _this2._db.getAllMatching(DB_STORE_NAME, {
includeKeys: true
});
})();

@@ -311,3 +320,3 @@ }

*/
var openInstallLogGroup = ((entriesToPrecache, alreadyPrecachedEntries) => {
var printInstallDetails = ((entriesToPrecache, alreadyPrecachedEntries) => {
// Goal is to print the message:

@@ -329,2 +338,3 @@ // Precaching X files.

_nestedGroup(`View URLs that were already precached.`, alreadyPrecachedEntries);
logger_mjs.logger.groupEnd();
});

@@ -579,6 +589,2 @@

{
openInstallLogGroup(entriesToPrecache, entriesAlreadyPrecached);
}
// Wait for all requests to be cached.

@@ -590,3 +596,3 @@ yield Promise.all(entriesToPrecache.map(function (precacheEntry) {

{
logger_mjs.logger.groupEnd();
printInstallDetails(entriesToPrecache, entriesAlreadyPrecached);
}

@@ -713,14 +719,12 @@

const revisionedEntries = yield _this5._precacheDetailsModel._getAllEntries();
const detailsToDelete = Object.keys(revisionedEntries).filter(function (entryId) {
const entry = revisionedEntries[entryId];
const fullUrl = new URL(entry.url, location).toString();
const detailsToDelete = revisionedEntries.filter(function (entry) {
const fullUrl = new URL(entry.value.url, location).toString();
return !expectedCacheUrls.includes(fullUrl);
});
yield Promise.all(detailsToDelete.map(function (detailsId) {
return _this5._precacheDetailsModel._deleteEntry(detailsId);
yield Promise.all(detailsToDelete.map(function (entry) {
return _this5._precacheDetailsModel._deleteEntry(entry.primaryKey);
}));
return detailsToDelete.map(function (detailsId) {
return revisionedEntries[detailsId].url;
return detailsToDelete.map(function (entry) {
return entry.value.url;
});

@@ -727,0 +731,0 @@ })();

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

this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){"use strict";try{self.workbox.v["workbox:precaching:3.0.0-alpha.2"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t);this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={};if("cache"in Request.prototype)n.cache="reload";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?"&":"")+n("_workbox-cache-bust")+"="+n(this.n),t=e.toString()}return new Request(t,n)}}const c="precached-details-models";class o{constructor(t){this.c=e.cacheNames.getPrecacheName(t),this.o=new s.DBWrapper("workbox-precaching",1,{onupgradeneeded:e=>{e.target.result.createObjectStore(c)}})}l(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.u(e.t))===e.n&&!!(yield(yield caches.open(t.c)).match(e.r))})()}a(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.o.getAll(c)})()}u(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.o.get(c,e);return n?n.revision:null})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.o.put(c,{revision:e.n,url:e.r.url},e.t)})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.o.delete(c,e)})()}}const l=(()=>{var e=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield"body"in t?Promise.resolve(t.body):t.blob();return new Response(n,["headers","status","statusText"].map(function(e){return t[e]}))});return function(t){return e.apply(this,arguments)}})();class u{constructor(t){this.c=e.cacheNames.getPrecacheName(t),this.f=new Map,this.y=new o(this.c)}addToCacheList(e){e.map(e=>{this.b(this.p(e))})}p(e){switch(typeof e){case"string":return new i(e,e,e);case"object":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new t.WorkboxError("add-to-cache-list-unexpected-type",{entry:e})}}b(e){const n=this.f.get(e.t);if(n){if(n.n!==e.n)throw new t.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:n.e,secondEntry:e.e})}else this.f.set(e.t,e)}install(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const e=[],n=[];for(const r of t.f.values())(yield t.y.l(r))?n.push(r):e.push(r);return yield Promise.all(e.map(function(e){return t.w(e)})),{updatedEntries:e,notUpdatedEntries:n}})()}w(e){var t=this;return babelHelpers.asyncToGenerator(function*(){let s=yield n.fetchWrapper.fetch(e.s);return s.redirected&&(s=yield l(s)),yield r.cacheWrapper.put(t.c,e.r,s),yield t.y.d(e),!0})()}cleanup(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.f.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e.R(t),e._(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}R(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.c)))return[];const n=yield caches.open(t.c),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.y.a(),r=Object.keys(n).filter(function(t){const r=n[t],s=new URL(r.url,location).toString();return!e.includes(s)});return yield Promise.all(r.map(function(e){return t.y.h(e)})),r.map(function(e){return n[e].url})})()}getCachedUrls(){return Array.from(this.f.keys()).map(e=>new URL(e,location).href)}}var a=Object.freeze({PrecacheController:u});let d=!1,h=!1,f=!1;const y=e.cacheNames.getPrecacheName(),b=new u(y),p={};return p.precache=(e=>{b.addToCacheList(e),d||e.length<=0||(d=!0,self.addEventListener("install",e=>{e.waitUntil(b.install({suppressWarnings:f}))}),self.addEventListener("activate",e=>{e.waitUntil(b.cleanup())}))}),p.addRoute=(e=>{h||(h=!0,self.addEventListener("fetch",t=>{const n=((e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n="index.html"}={})=>{const r=new URL(e,location);r.hash="";const s=b.getCachedUrls();if(-1!==s.indexOf(r.href))return r.href;let i=((e,t)=>{const n=e.search.slice(1).split("&").map(e=>e.split("=")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join("=")),r=new URL(e);return r.search=n.join("&"),r})(r,t);return-1!==s.indexOf(i.href)?i.href:n&&i.pathname.endsWith("/")&&(i.pathname+=n,-1!==s.indexOf(i.href))?i.href:null})(t.request.url,e);if(!n)return;let r=caches.open(y).then(e=>e.match(n));t.respondWith(r)}))}),p.precacheAndRoute=((e,t)=>{p.precache(e),p.addRoute(t)}),p.suppressWarnings=(e=>{f=e}),Object.assign(p,a)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){"use strict";try{self.workbox.v["workbox:precaching:3.0.0-alpha.3"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t);this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={};if("cache"in Request.prototype)n.cache="reload";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?"&":"")+n("_workbox-cache-bust")+"="+n(this.n),t=e.toString()}return new Request(t,n)}}const c="precached-details-models";class o{constructor(t){this.c=e.cacheNames.getPrecacheName(t),this.o=new s.DBWrapper("workbox-precaching",2,{onupgradeneeded:e=>{if(e.oldVersion<2)try{e.target.result.deleteObjectStore("workbox-precaching")}catch(e){}e.target.result.createObjectStore(c)}})}l(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.u(e.t))===e.n&&!!(yield(yield caches.open(t.c)).match(e.r))})()}a(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.o.getAllMatching(c,{includeKeys:!0})})()}u(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.o.get(c,e);return n?n.revision:null})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.o.put(c,{revision:e.n,url:e.r.url},e.t)})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.o.delete(c,e)})()}}const l=(()=>{var e=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield"body"in t?Promise.resolve(t.body):t.blob();return new Response(n,["headers","status","statusText"].map(function(e){return t[e]}))});return function(t){return e.apply(this,arguments)}})();class u{constructor(t){this.c=e.cacheNames.getPrecacheName(t),this.f=new Map,this.y=new o(this.c)}addToCacheList(e){e.map(e=>{this.b(this.p(e))})}p(e){switch(typeof e){case"string":return new i(e,e,e);case"object":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new t.WorkboxError("add-to-cache-list-unexpected-type",{entry:e})}}b(e){const n=this.f.get(e.t);if(n){if(n.n!==e.n)throw new t.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:n.e,secondEntry:e.e})}else this.f.set(e.t,e)}install(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const e=[],n=[];for(const r of t.f.values())(yield t.y.l(r))?n.push(r):e.push(r);return yield Promise.all(e.map(function(e){return t.w(e)})),{updatedEntries:e,notUpdatedEntries:n}})()}w(e){var t=this;return babelHelpers.asyncToGenerator(function*(){let s=yield n.fetchWrapper.fetch(e.s);return s.redirected&&(s=yield l(s)),yield r.cacheWrapper.put(t.c,e.r,s),yield t.y.h(e),!0})()}cleanup(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.f.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e.R(t),e._(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}R(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.c)))return[];const n=yield caches.open(t.c),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=(yield t.y.a()).filter(function(t){const n=new URL(t.value.url,location).toString();return!e.includes(n)});return yield Promise.all(n.map(function(e){return t.y.d(e.primaryKey)})),n.map(function(e){return e.value.url})})()}getCachedUrls(){return Array.from(this.f.keys()).map(e=>new URL(e,location).href)}}var a=Object.freeze({PrecacheController:u});let h=!1,d=!1,f=!1;const y=e.cacheNames.getPrecacheName(),b=new u(y),p={};return p.precache=(e=>{b.addToCacheList(e),h||e.length<=0||(h=!0,self.addEventListener("install",e=>{e.waitUntil(b.install({suppressWarnings:f}))}),self.addEventListener("activate",e=>{e.waitUntil(b.cleanup())}))}),p.addRoute=(e=>{d||(d=!0,self.addEventListener("fetch",t=>{const n=((e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n="index.html"}={})=>{const r=new URL(e,location);r.hash="";const s=b.getCachedUrls();if(-1!==s.indexOf(r.href))return r.href;let i=((e,t)=>{const n=e.search.slice(1).split("&").map(e=>e.split("=")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join("=")),r=new URL(e);return r.search=n.join("&"),r})(r,t);return-1!==s.indexOf(i.href)?i.href:n&&i.pathname.endsWith("/")&&(i.pathname+=n,-1!==s.indexOf(i.href))?i.href:null})(t.request.url,e);if(!n)return;let r=caches.open(y).then(e=>e.match(n));t.respondWith(r)}))}),p.precacheAndRoute=((e,t)=>{p.precache(e),p.addRoute(t)}),p.suppressWarnings=(e=>{f=e}),Object.assign(p,a)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-precaching.prod.js.map
{
"name": "workbox-precaching",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"license": "Apache-2.0",

@@ -28,4 +28,4 @@ "author": "Google's Web DevRel Team",

"dependencies": {
"workbox-core": "^3.0.0-alpha.2"
"workbox-core": "^3.0.0-alpha.3"
}
}

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