v1.0 with SW PWA enabled
This commit is contained in:
268
frontend/node_modules/workbox-recipes/build/workbox-recipes.dev.js
generated
vendored
Normal file
268
frontend/node_modules/workbox-recipes/build/workbox-recipes.dev.js
generated
vendored
Normal file
@ -0,0 +1,268 @@
|
||||
this.workbox = this.workbox || {};
|
||||
this.workbox.recipes = (function (exports, registerRoute_js, StaleWhileRevalidate_js, CacheFirst_js, CacheableResponsePlugin_js, ExpirationPlugin_js, NetworkFirst_js, setCatchHandler_js, matchPrecache_js) {
|
||||
'use strict';
|
||||
|
||||
// @ts-ignore
|
||||
try {
|
||||
self['workbox:recipes:7.3.0'] && _();
|
||||
} catch (e) {}
|
||||
|
||||
/*
|
||||
Copyright 2020 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
/**
|
||||
* An implementation of the [Google fonts]{@link https://developers.google.com/web/tools/workbox/guides/common-recipes#google_fonts} caching recipe
|
||||
*
|
||||
* @memberof workbox-recipes
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {string} [options.cachePrefix] Cache prefix for caching stylesheets and webfonts. Defaults to google-fonts
|
||||
* @param {number} [options.maxAgeSeconds] Maximum age, in seconds, that font entries will be cached for. Defaults to 1 year
|
||||
* @param {number} [options.maxEntries] Maximum number of fonts that will be cached. Defaults to 30
|
||||
*/
|
||||
function googleFontsCache(options = {}) {
|
||||
const sheetCacheName = `${options.cachePrefix || 'google-fonts'}-stylesheets`;
|
||||
const fontCacheName = `${options.cachePrefix || 'google-fonts'}-webfonts`;
|
||||
const maxAgeSeconds = options.maxAgeSeconds || 60 * 60 * 24 * 365;
|
||||
const maxEntries = options.maxEntries || 30;
|
||||
// Cache the Google Fonts stylesheets with a stale-while-revalidate strategy.
|
||||
registerRoute_js.registerRoute(({
|
||||
url
|
||||
}) => url.origin === 'https://fonts.googleapis.com', new StaleWhileRevalidate_js.StaleWhileRevalidate({
|
||||
cacheName: sheetCacheName
|
||||
}));
|
||||
// Cache the underlying font files with a cache-first strategy for 1 year.
|
||||
registerRoute_js.registerRoute(({
|
||||
url
|
||||
}) => url.origin === 'https://fonts.gstatic.com', new CacheFirst_js.CacheFirst({
|
||||
cacheName: fontCacheName,
|
||||
plugins: [new CacheableResponsePlugin_js.CacheableResponsePlugin({
|
||||
statuses: [0, 200]
|
||||
}), new ExpirationPlugin_js.ExpirationPlugin({
|
||||
maxAgeSeconds,
|
||||
maxEntries
|
||||
})]
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* @memberof workbox-recipes
|
||||
|
||||
* @param {Object} options
|
||||
* @param {string[]} options.urls Paths to warm the strategy's cache with
|
||||
* @param {Strategy} options.strategy Strategy to use
|
||||
*/
|
||||
function warmStrategyCache(options) {
|
||||
self.addEventListener('install', event => {
|
||||
const done = options.urls.map(path => options.strategy.handleAll({
|
||||
event,
|
||||
request: new Request(path)
|
||||
})[1]);
|
||||
event.waitUntil(Promise.all(done));
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
Copyright 2020 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
/**
|
||||
* An implementation of the [image caching recipe]{@link https://developers.google.com/web/tools/workbox/guides/common-recipes#caching_images}
|
||||
*
|
||||
* @memberof workbox-recipes
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {string} [options.cacheName] Name for cache. Defaults to images
|
||||
* @param {RouteMatchCallback} [options.matchCallback] Workbox callback function to call to match to. Defaults to request.destination === 'image';
|
||||
* @param {number} [options.maxAgeSeconds] Maximum age, in seconds, that font entries will be cached for. Defaults to 30 days
|
||||
* @param {number} [options.maxEntries] Maximum number of images that will be cached. Defaults to 60
|
||||
* @param {WorkboxPlugin[]} [options.plugins] Additional plugins to use for this recipe
|
||||
* @param {string[]} [options.warmCache] Paths to call to use to warm this cache
|
||||
*/
|
||||
function imageCache(options = {}) {
|
||||
const defaultMatchCallback = ({
|
||||
request
|
||||
}) => request.destination === 'image';
|
||||
const cacheName = options.cacheName || 'images';
|
||||
const matchCallback = options.matchCallback || defaultMatchCallback;
|
||||
const maxAgeSeconds = options.maxAgeSeconds || 30 * 24 * 60 * 60;
|
||||
const maxEntries = options.maxEntries || 60;
|
||||
const plugins = options.plugins || [];
|
||||
plugins.push(new CacheableResponsePlugin_js.CacheableResponsePlugin({
|
||||
statuses: [0, 200]
|
||||
}));
|
||||
plugins.push(new ExpirationPlugin_js.ExpirationPlugin({
|
||||
maxEntries,
|
||||
maxAgeSeconds
|
||||
}));
|
||||
const strategy = new CacheFirst_js.CacheFirst({
|
||||
cacheName,
|
||||
plugins
|
||||
});
|
||||
registerRoute_js.registerRoute(matchCallback, strategy);
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({
|
||||
urls: options.warmCache,
|
||||
strategy
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Copyright 2020 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
/**
|
||||
* An implementation of the [CSS and JavaScript files recipe]{@link https://developers.google.com/web/tools/workbox/guides/common-recipes#cache_css_and_javascript_files}
|
||||
*
|
||||
* @memberof workbox-recipes
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {string} [options.cacheName] Name for cache. Defaults to static-resources
|
||||
* @param {RouteMatchCallback} [options.matchCallback] Workbox callback function to call to match to. Defaults to request.destination === 'style' || request.destination === 'script' || request.destination === 'worker';
|
||||
* @param {WorkboxPlugin[]} [options.plugins] Additional plugins to use for this recipe
|
||||
* @param {string[]} [options.warmCache] Paths to call to use to warm this cache
|
||||
*/
|
||||
function staticResourceCache(options = {}) {
|
||||
const defaultMatchCallback = ({
|
||||
request
|
||||
}) => request.destination === 'style' || request.destination === 'script' || request.destination === 'worker';
|
||||
const cacheName = options.cacheName || 'static-resources';
|
||||
const matchCallback = options.matchCallback || defaultMatchCallback;
|
||||
const plugins = options.plugins || [];
|
||||
plugins.push(new CacheableResponsePlugin_js.CacheableResponsePlugin({
|
||||
statuses: [0, 200]
|
||||
}));
|
||||
const strategy = new StaleWhileRevalidate_js.StaleWhileRevalidate({
|
||||
cacheName,
|
||||
plugins
|
||||
});
|
||||
registerRoute_js.registerRoute(matchCallback, strategy);
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({
|
||||
urls: options.warmCache,
|
||||
strategy
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Copyright 2020 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
/**
|
||||
* An implementation of a page caching recipe with a network timeout
|
||||
*
|
||||
* @memberof workbox-recipes
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {string} [options.cacheName] Name for cache. Defaults to pages
|
||||
* @param {RouteMatchCallback} [options.matchCallback] Workbox callback function to call to match to. Defaults to request.mode === 'navigate';
|
||||
* @param {number} [options.networkTimoutSeconds] Maximum amount of time, in seconds, to wait on the network before falling back to cache. Defaults to 3
|
||||
* @param {WorkboxPlugin[]} [options.plugins] Additional plugins to use for this recipe
|
||||
* @param {string[]} [options.warmCache] Paths to call to use to warm this cache
|
||||
*/
|
||||
function pageCache(options = {}) {
|
||||
const defaultMatchCallback = ({
|
||||
request
|
||||
}) => request.mode === 'navigate';
|
||||
const cacheName = options.cacheName || 'pages';
|
||||
const matchCallback = options.matchCallback || defaultMatchCallback;
|
||||
const networkTimeoutSeconds = options.networkTimeoutSeconds || 3;
|
||||
const plugins = options.plugins || [];
|
||||
plugins.push(new CacheableResponsePlugin_js.CacheableResponsePlugin({
|
||||
statuses: [0, 200]
|
||||
}));
|
||||
const strategy = new NetworkFirst_js.NetworkFirst({
|
||||
networkTimeoutSeconds,
|
||||
cacheName,
|
||||
plugins
|
||||
});
|
||||
// Registers the route
|
||||
registerRoute_js.registerRoute(matchCallback, strategy);
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({
|
||||
urls: options.warmCache,
|
||||
strategy
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Copyright 2020 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
/**
|
||||
* An implementation of the [comprehensive fallbacks recipe]{@link https://developers.google.com/web/tools/workbox/guides/advanced-recipes#comprehensive_fallbacks}. Be sure to include the fallbacks in your precache injection
|
||||
*
|
||||
* @memberof workbox-recipes
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {string} [options.pageFallback] Precache name to match for pag fallbacks. Defaults to offline.html
|
||||
* @param {string} [options.imageFallback] Precache name to match for image fallbacks.
|
||||
* @param {string} [options.fontFallback] Precache name to match for font fallbacks.
|
||||
*/
|
||||
function offlineFallback(options = {}) {
|
||||
const pageFallback = options.pageFallback || 'offline.html';
|
||||
const imageFallback = options.imageFallback || false;
|
||||
const fontFallback = options.fontFallback || false;
|
||||
self.addEventListener('install', event => {
|
||||
const files = [pageFallback];
|
||||
if (imageFallback) {
|
||||
files.push(imageFallback);
|
||||
}
|
||||
if (fontFallback) {
|
||||
files.push(fontFallback);
|
||||
}
|
||||
event.waitUntil(self.caches.open('workbox-offline-fallbacks').then(cache => cache.addAll(files)));
|
||||
});
|
||||
const handler = async options => {
|
||||
const dest = options.request.destination;
|
||||
const cache = await self.caches.open('workbox-offline-fallbacks');
|
||||
if (dest === 'document') {
|
||||
const match = (await matchPrecache_js.matchPrecache(pageFallback)) || (await cache.match(pageFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
if (dest === 'image' && imageFallback !== false) {
|
||||
const match = (await matchPrecache_js.matchPrecache(imageFallback)) || (await cache.match(imageFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
if (dest === 'font' && fontFallback !== false) {
|
||||
const match = (await matchPrecache_js.matchPrecache(fontFallback)) || (await cache.match(fontFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
return Response.error();
|
||||
};
|
||||
setCatchHandler_js.setCatchHandler(handler);
|
||||
}
|
||||
|
||||
exports.googleFontsCache = googleFontsCache;
|
||||
exports.imageCache = imageCache;
|
||||
exports.offlineFallback = offlineFallback;
|
||||
exports.pageCache = pageCache;
|
||||
exports.staticResourceCache = staticResourceCache;
|
||||
exports.warmStrategyCache = warmStrategyCache;
|
||||
|
||||
return exports;
|
||||
|
||||
})({}, workbox.routing, workbox.strategies, workbox.strategies, workbox.cacheableResponse, workbox.expiration, workbox.strategies, workbox.routing, workbox.precaching);
|
||||
//# sourceMappingURL=workbox-recipes.dev.js.map
|
||||
1
frontend/node_modules/workbox-recipes/build/workbox-recipes.dev.js.map
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/build/workbox-recipes.dev.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
frontend/node_modules/workbox-recipes/build/workbox-recipes.prod.js
generated
vendored
Normal file
2
frontend/node_modules/workbox-recipes/build/workbox-recipes.prod.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
this.workbox=this.workbox||{},this.workbox.recipes=function(e,s,t,n,o,a,c,r,i){"use strict";try{self["workbox:recipes:7.3.0"]&&_()}catch(e){}function u(e){self.addEventListener("install",(s=>{const t=e.urls.map((t=>e.strategy.handleAll({event:s,request:new Request(t)})[1]));s.waitUntil(Promise.all(t))}))}return e.googleFontsCache=function(e={}){const c=`${e.cachePrefix||"google-fonts"}-stylesheets`,r=`${e.cachePrefix||"google-fonts"}-webfonts`,i=e.maxAgeSeconds||31536e3,u=e.maxEntries||30;s.registerRoute((({url:e})=>"https://fonts.googleapis.com"===e.origin),new t.StaleWhileRevalidate({cacheName:c})),s.registerRoute((({url:e})=>"https://fonts.gstatic.com"===e.origin),new n.CacheFirst({cacheName:r,plugins:[new o.CacheableResponsePlugin({statuses:[0,200]}),new a.ExpirationPlugin({maxAgeSeconds:i,maxEntries:u})]}))},e.imageCache=function(e={}){const t=e.cacheName||"images",c=e.matchCallback||(({request:e})=>"image"===e.destination),r=e.maxAgeSeconds||2592e3,i=e.maxEntries||60,w=e.plugins||[];w.push(new o.CacheableResponsePlugin({statuses:[0,200]})),w.push(new a.ExpirationPlugin({maxEntries:i,maxAgeSeconds:r}));const l=new n.CacheFirst({cacheName:t,plugins:w});s.registerRoute(c,l),e.warmCache&&u({urls:e.warmCache,strategy:l})},e.offlineFallback=function(e={}){const s=e.pageFallback||"offline.html",t=e.imageFallback||!1,n=e.fontFallback||!1;self.addEventListener("install",(e=>{const o=[s];t&&o.push(t),n&&o.push(n),e.waitUntil(self.caches.open("workbox-offline-fallbacks").then((e=>e.addAll(o))))})),r.setCatchHandler((async e=>{const o=e.request.destination,a=await self.caches.open("workbox-offline-fallbacks");if("document"===o){return await i.matchPrecache(s)||await a.match(s)||Response.error()}if("image"===o&&!1!==t){return await i.matchPrecache(t)||await a.match(t)||Response.error()}if("font"===o&&!1!==n){return await i.matchPrecache(n)||await a.match(n)||Response.error()}return Response.error()}))},e.pageCache=function(e={}){const t=e.cacheName||"pages",n=e.matchCallback||(({request:e})=>"navigate"===e.mode),a=e.networkTimeoutSeconds||3,r=e.plugins||[];r.push(new o.CacheableResponsePlugin({statuses:[0,200]}));const i=new c.NetworkFirst({networkTimeoutSeconds:a,cacheName:t,plugins:r});s.registerRoute(n,i),e.warmCache&&u({urls:e.warmCache,strategy:i})},e.staticResourceCache=function(e={}){const n=e.cacheName||"static-resources",a=e.matchCallback||(({request:e})=>"style"===e.destination||"script"===e.destination||"worker"===e.destination),c=e.plugins||[];c.push(new o.CacheableResponsePlugin({statuses:[0,200]}));const r=new t.StaleWhileRevalidate({cacheName:n,plugins:c});s.registerRoute(a,r),e.warmCache&&u({urls:e.warmCache,strategy:r})},e.warmStrategyCache=u,e}({},workbox.routing,workbox.strategies,workbox.strategies,workbox.cacheableResponse,workbox.expiration,workbox.strategies,workbox.routing,workbox.precaching);
|
||||
//# sourceMappingURL=workbox-recipes.prod.js.map
|
||||
1
frontend/node_modules/workbox-recipes/build/workbox-recipes.prod.js.map
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/build/workbox-recipes.prod.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user