v1.0 with SW PWA enabled
This commit is contained in:
19
frontend/node_modules/workbox-recipes/LICENSE
generated
vendored
Normal file
19
frontend/node_modules/workbox-recipes/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1
frontend/node_modules/workbox-recipes/README.md
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/README.md
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-recipes
|
||||
0
frontend/node_modules/workbox-recipes/_version.d.ts
generated
vendored
Normal file
0
frontend/node_modules/workbox-recipes/_version.d.ts
generated
vendored
Normal file
6
frontend/node_modules/workbox-recipes/_version.js
generated
vendored
Normal file
6
frontend/node_modules/workbox-recipes/_version.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
// @ts-ignore
|
||||
try {
|
||||
self['workbox:recipes:7.3.0'] && _();
|
||||
}
|
||||
catch (e) { }
|
||||
1
frontend/node_modules/workbox-recipes/_version.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/_version.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
try{self['workbox:recipes:7.4.0']&&_()}catch(e){}// eslint-disable-line
|
||||
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
18
frontend/node_modules/workbox-recipes/googleFontsCache.d.ts
generated
vendored
Normal file
18
frontend/node_modules/workbox-recipes/googleFontsCache.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import './_version.js';
|
||||
export interface GoogleFontCacheOptions {
|
||||
cachePrefix?: string;
|
||||
maxAgeSeconds?: number;
|
||||
maxEntries?: number;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function googleFontsCache(options?: GoogleFontCacheOptions): void;
|
||||
export { googleFontsCache };
|
||||
47
frontend/node_modules/workbox-recipes/googleFontsCache.js
generated
vendored
Normal file
47
frontend/node_modules/workbox-recipes/googleFontsCache.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import { registerRoute } from 'workbox-routing/registerRoute.js';
|
||||
import { StaleWhileRevalidate } from 'workbox-strategies/StaleWhileRevalidate.js';
|
||||
import { CacheFirst } from 'workbox-strategies/CacheFirst.js';
|
||||
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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(({ url }) => url.origin === 'https://fonts.googleapis.com', new StaleWhileRevalidate({
|
||||
cacheName: sheetCacheName,
|
||||
}));
|
||||
// Cache the underlying font files with a cache-first strategy for 1 year.
|
||||
registerRoute(({ url }) => url.origin === 'https://fonts.gstatic.com', new CacheFirst({
|
||||
cacheName: fontCacheName,
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({
|
||||
statuses: [0, 200],
|
||||
}),
|
||||
new ExpirationPlugin({
|
||||
maxAgeSeconds,
|
||||
maxEntries,
|
||||
}),
|
||||
],
|
||||
}));
|
||||
}
|
||||
export { googleFontsCache };
|
||||
1
frontend/node_modules/workbox-recipes/googleFontsCache.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/googleFontsCache.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './googleFontsCache.js';
|
||||
25
frontend/node_modules/workbox-recipes/imageCache.d.ts
generated
vendored
Normal file
25
frontend/node_modules/workbox-recipes/imageCache.d.ts
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
import { RouteMatchCallback, WorkboxPlugin } from 'workbox-core/types.js';
|
||||
import './_version.js';
|
||||
export interface ImageCacheOptions {
|
||||
cacheName?: string;
|
||||
matchCallback?: RouteMatchCallback;
|
||||
maxAgeSeconds?: number;
|
||||
maxEntries?: number;
|
||||
plugins?: Array<WorkboxPlugin>;
|
||||
warmCache?: Array<string>;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function imageCache(options?: ImageCacheOptions): void;
|
||||
export { imageCache };
|
||||
51
frontend/node_modules/workbox-recipes/imageCache.js
generated
vendored
Normal file
51
frontend/node_modules/workbox-recipes/imageCache.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import { warmStrategyCache } from './warmStrategyCache';
|
||||
import { registerRoute } from 'workbox-routing/registerRoute.js';
|
||||
import { CacheFirst } from 'workbox-strategies/CacheFirst.js';
|
||||
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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({
|
||||
statuses: [0, 200],
|
||||
}));
|
||||
plugins.push(new ExpirationPlugin({
|
||||
maxEntries,
|
||||
maxAgeSeconds,
|
||||
}));
|
||||
const strategy = new CacheFirst({
|
||||
cacheName,
|
||||
plugins,
|
||||
});
|
||||
registerRoute(matchCallback, strategy);
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({ urls: options.warmCache, strategy });
|
||||
}
|
||||
}
|
||||
export { imageCache };
|
||||
1
frontend/node_modules/workbox-recipes/imageCache.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/imageCache.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './imageCache.js';
|
||||
11
frontend/node_modules/workbox-recipes/index.d.ts
generated
vendored
Normal file
11
frontend/node_modules/workbox-recipes/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import { googleFontsCache, GoogleFontCacheOptions } from './googleFontsCache';
|
||||
import { imageCache, ImageCacheOptions } from './imageCache';
|
||||
import { staticResourceCache, StaticResourceOptions } from './staticResourceCache';
|
||||
import { pageCache, PageCacheOptions } from './pageCache';
|
||||
import { offlineFallback, OfflineFallbackOptions } from './offlineFallback';
|
||||
import { warmStrategyCache, WarmStrategyCacheOptions } from './warmStrategyCache';
|
||||
import './_version.js';
|
||||
/**
|
||||
* @module workbox-recipes
|
||||
*/
|
||||
export { GoogleFontCacheOptions, googleFontsCache, imageCache, ImageCacheOptions, offlineFallback, OfflineFallbackOptions, pageCache, PageCacheOptions, staticResourceCache, StaticResourceOptions, warmStrategyCache, WarmStrategyCacheOptions, };
|
||||
18
frontend/node_modules/workbox-recipes/index.js
generated
vendored
Normal file
18
frontend/node_modules/workbox-recipes/index.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import { googleFontsCache } from './googleFontsCache';
|
||||
import { imageCache } from './imageCache';
|
||||
import { staticResourceCache, } from './staticResourceCache';
|
||||
import { pageCache } from './pageCache';
|
||||
import { offlineFallback } from './offlineFallback';
|
||||
import { warmStrategyCache } from './warmStrategyCache';
|
||||
import './_version.js';
|
||||
/**
|
||||
* @module workbox-recipes
|
||||
*/
|
||||
export { googleFontsCache, imageCache, offlineFallback, pageCache, staticResourceCache, warmStrategyCache, };
|
||||
1
frontend/node_modules/workbox-recipes/index.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/index.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './index.js';
|
||||
18
frontend/node_modules/workbox-recipes/offlineFallback.d.ts
generated
vendored
Normal file
18
frontend/node_modules/workbox-recipes/offlineFallback.d.ts
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import './_version.js';
|
||||
export interface OfflineFallbackOptions {
|
||||
pageFallback?: string;
|
||||
imageFallback?: string;
|
||||
fontFallback?: string;
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
declare function offlineFallback(options?: OfflineFallbackOptions): void;
|
||||
export { offlineFallback };
|
||||
59
frontend/node_modules/workbox-recipes/offlineFallback.js
generated
vendored
Normal file
59
frontend/node_modules/workbox-recipes/offlineFallback.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import { setCatchHandler } from 'workbox-routing/setCatchHandler.js';
|
||||
import { matchPrecache } from 'workbox-precaching/matchPrecache.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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(pageFallback)) ||
|
||||
(await cache.match(pageFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
if (dest === 'image' && imageFallback !== false) {
|
||||
const match = (await matchPrecache(imageFallback)) ||
|
||||
(await cache.match(imageFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
if (dest === 'font' && fontFallback !== false) {
|
||||
const match = (await matchPrecache(fontFallback)) ||
|
||||
(await cache.match(fontFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
return Response.error();
|
||||
};
|
||||
setCatchHandler(handler);
|
||||
}
|
||||
export { offlineFallback };
|
||||
1
frontend/node_modules/workbox-recipes/offlineFallback.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/offlineFallback.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './offlineFallback.js';
|
||||
37
frontend/node_modules/workbox-recipes/package.json
generated
vendored
Normal file
37
frontend/node_modules/workbox-recipes/package.json
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "workbox-recipes",
|
||||
"version": "7.4.0",
|
||||
"license": "MIT",
|
||||
"author": "Google's Web DevRel Team and Google's Aurora Team",
|
||||
"description": "A service worker helper library to manage common request and caching patterns",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/googlechrome/workbox.git"
|
||||
},
|
||||
"bugs": "https://github.com/googlechrome/workbox/issues",
|
||||
"homepage": "https://github.com/GoogleChrome/workbox",
|
||||
"keywords": [
|
||||
"workbox",
|
||||
"workboxjs",
|
||||
"service worker",
|
||||
"sw",
|
||||
"router",
|
||||
"routing"
|
||||
],
|
||||
"workbox": {
|
||||
"browserNamespace": "workbox.recipes",
|
||||
"packageType": "sw"
|
||||
},
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"types": "index.d.ts",
|
||||
"dependencies": {
|
||||
"workbox-cacheable-response": "7.4.0",
|
||||
"workbox-core": "7.4.0",
|
||||
"workbox-expiration": "7.4.0",
|
||||
"workbox-precaching": "7.4.0",
|
||||
"workbox-routing": "7.4.0",
|
||||
"workbox-strategies": "7.4.0"
|
||||
},
|
||||
"gitHead": "fa702feeddd417fcdfa495cd9428fb4a28632e92"
|
||||
}
|
||||
23
frontend/node_modules/workbox-recipes/pageCache.d.ts
generated
vendored
Normal file
23
frontend/node_modules/workbox-recipes/pageCache.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import { RouteMatchCallback, WorkboxPlugin } from 'workbox-core/types.js';
|
||||
import './_version.js';
|
||||
export interface PageCacheOptions {
|
||||
cacheName?: string;
|
||||
matchCallback?: RouteMatchCallback;
|
||||
networkTimeoutSeconds?: number;
|
||||
plugins?: Array<WorkboxPlugin>;
|
||||
warmCache?: Array<string>;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function pageCache(options?: PageCacheOptions): void;
|
||||
export { pageCache };
|
||||
46
frontend/node_modules/workbox-recipes/pageCache.js
generated
vendored
Normal file
46
frontend/node_modules/workbox-recipes/pageCache.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import { warmStrategyCache } from './warmStrategyCache';
|
||||
import { registerRoute } from 'workbox-routing/registerRoute.js';
|
||||
import { NetworkFirst } from 'workbox-strategies/NetworkFirst.js';
|
||||
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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({
|
||||
statuses: [0, 200],
|
||||
}));
|
||||
const strategy = new NetworkFirst({
|
||||
networkTimeoutSeconds,
|
||||
cacheName,
|
||||
plugins,
|
||||
});
|
||||
// Registers the route
|
||||
registerRoute(matchCallback, strategy);
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({ urls: options.warmCache, strategy });
|
||||
}
|
||||
}
|
||||
export { pageCache };
|
||||
1
frontend/node_modules/workbox-recipes/pageCache.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/pageCache.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './pageCache.js';
|
||||
2
frontend/node_modules/workbox-recipes/src/_version.ts
generated
vendored
Normal file
2
frontend/node_modules/workbox-recipes/src/_version.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// @ts-ignore
|
||||
try{self['workbox:recipes:7.4.0']&&_()}catch(e){}
|
||||
64
frontend/node_modules/workbox-recipes/src/googleFontsCache.ts
generated
vendored
Normal file
64
frontend/node_modules/workbox-recipes/src/googleFontsCache.ts
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import {registerRoute} from 'workbox-routing/registerRoute.js';
|
||||
import {StaleWhileRevalidate} from 'workbox-strategies/StaleWhileRevalidate.js';
|
||||
import {CacheFirst} from 'workbox-strategies/CacheFirst.js';
|
||||
import {CacheableResponsePlugin} from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import {ExpirationPlugin} from 'workbox-expiration/ExpirationPlugin.js';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
export interface GoogleFontCacheOptions {
|
||||
cachePrefix?: string;
|
||||
maxAgeSeconds?: number;
|
||||
maxEntries?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: GoogleFontCacheOptions = {}): void {
|
||||
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(
|
||||
({url}) => url.origin === 'https://fonts.googleapis.com',
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: sheetCacheName,
|
||||
}),
|
||||
);
|
||||
|
||||
// Cache the underlying font files with a cache-first strategy for 1 year.
|
||||
registerRoute(
|
||||
({url}) => url.origin === 'https://fonts.gstatic.com',
|
||||
new CacheFirst({
|
||||
cacheName: fontCacheName,
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({
|
||||
statuses: [0, 200],
|
||||
}),
|
||||
new ExpirationPlugin({
|
||||
maxAgeSeconds,
|
||||
maxEntries,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export {googleFontsCache};
|
||||
77
frontend/node_modules/workbox-recipes/src/imageCache.ts
generated
vendored
Normal file
77
frontend/node_modules/workbox-recipes/src/imageCache.ts
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import {warmStrategyCache} from './warmStrategyCache';
|
||||
import {registerRoute} from 'workbox-routing/registerRoute.js';
|
||||
import {CacheFirst} from 'workbox-strategies/CacheFirst.js';
|
||||
import {CacheableResponsePlugin} from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import {ExpirationPlugin} from 'workbox-expiration/ExpirationPlugin.js';
|
||||
import {
|
||||
RouteMatchCallback,
|
||||
RouteMatchCallbackOptions,
|
||||
WorkboxPlugin,
|
||||
} from 'workbox-core/types.js';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
export interface ImageCacheOptions {
|
||||
cacheName?: string;
|
||||
matchCallback?: RouteMatchCallback;
|
||||
maxAgeSeconds?: number;
|
||||
maxEntries?: number;
|
||||
plugins?: Array<WorkboxPlugin>;
|
||||
warmCache?: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: ImageCacheOptions = {}): void {
|
||||
const defaultMatchCallback = ({request}: RouteMatchCallbackOptions) =>
|
||||
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({
|
||||
statuses: [0, 200],
|
||||
}),
|
||||
);
|
||||
plugins.push(
|
||||
new ExpirationPlugin({
|
||||
maxEntries,
|
||||
maxAgeSeconds,
|
||||
}),
|
||||
);
|
||||
|
||||
const strategy = new CacheFirst({
|
||||
cacheName,
|
||||
plugins,
|
||||
});
|
||||
|
||||
registerRoute(matchCallback, strategy);
|
||||
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({urls: options.warmCache, strategy});
|
||||
}
|
||||
}
|
||||
|
||||
export {imageCache};
|
||||
38
frontend/node_modules/workbox-recipes/src/index.ts
generated
vendored
Normal file
38
frontend/node_modules/workbox-recipes/src/index.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
import {googleFontsCache, GoogleFontCacheOptions} from './googleFontsCache';
|
||||
import {imageCache, ImageCacheOptions} from './imageCache';
|
||||
import {
|
||||
staticResourceCache,
|
||||
StaticResourceOptions,
|
||||
} from './staticResourceCache';
|
||||
import {pageCache, PageCacheOptions} from './pageCache';
|
||||
import {offlineFallback, OfflineFallbackOptions} from './offlineFallback';
|
||||
import {warmStrategyCache, WarmStrategyCacheOptions} from './warmStrategyCache';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
/**
|
||||
* @module workbox-recipes
|
||||
*/
|
||||
|
||||
export {
|
||||
GoogleFontCacheOptions,
|
||||
googleFontsCache,
|
||||
imageCache,
|
||||
ImageCacheOptions,
|
||||
offlineFallback,
|
||||
OfflineFallbackOptions,
|
||||
pageCache,
|
||||
PageCacheOptions,
|
||||
staticResourceCache,
|
||||
StaticResourceOptions,
|
||||
warmStrategyCache,
|
||||
WarmStrategyCacheOptions,
|
||||
};
|
||||
87
frontend/node_modules/workbox-recipes/src/offlineFallback.ts
generated
vendored
Normal file
87
frontend/node_modules/workbox-recipes/src/offlineFallback.ts
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import {setCatchHandler} from 'workbox-routing/setCatchHandler.js';
|
||||
import {matchPrecache} from 'workbox-precaching/matchPrecache.js';
|
||||
import {RouteHandler, RouteHandlerCallbackOptions} from 'workbox-core/types.js';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
export interface OfflineFallbackOptions {
|
||||
pageFallback?: string;
|
||||
imageFallback?: string;
|
||||
fontFallback?: string;
|
||||
}
|
||||
|
||||
// Give TypeScript the correct global.
|
||||
declare let self: ServiceWorkerGlobalScope;
|
||||
|
||||
/**
|
||||
* 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: OfflineFallbackOptions = {}): void {
|
||||
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: RouteHandler = async (
|
||||
options: RouteHandlerCallbackOptions,
|
||||
) => {
|
||||
const dest = options.request.destination;
|
||||
const cache = await self.caches.open('workbox-offline-fallbacks');
|
||||
|
||||
if (dest === 'document') {
|
||||
const match =
|
||||
(await matchPrecache(pageFallback)) ||
|
||||
(await cache.match(pageFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
|
||||
if (dest === 'image' && imageFallback !== false) {
|
||||
const match =
|
||||
(await matchPrecache(imageFallback)) ||
|
||||
(await cache.match(imageFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
|
||||
if (dest === 'font' && fontFallback !== false) {
|
||||
const match =
|
||||
(await matchPrecache(fontFallback)) ||
|
||||
(await cache.match(fontFallback));
|
||||
return match || Response.error();
|
||||
}
|
||||
|
||||
return Response.error();
|
||||
};
|
||||
|
||||
setCatchHandler(handler);
|
||||
}
|
||||
|
||||
export {offlineFallback};
|
||||
69
frontend/node_modules/workbox-recipes/src/pageCache.ts
generated
vendored
Normal file
69
frontend/node_modules/workbox-recipes/src/pageCache.ts
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import {warmStrategyCache} from './warmStrategyCache';
|
||||
import {registerRoute} from 'workbox-routing/registerRoute.js';
|
||||
import {NetworkFirst} from 'workbox-strategies/NetworkFirst.js';
|
||||
import {CacheableResponsePlugin} from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import {
|
||||
RouteMatchCallback,
|
||||
RouteMatchCallbackOptions,
|
||||
WorkboxPlugin,
|
||||
} from 'workbox-core/types.js';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
export interface PageCacheOptions {
|
||||
cacheName?: string;
|
||||
matchCallback?: RouteMatchCallback;
|
||||
networkTimeoutSeconds?: number;
|
||||
plugins?: Array<WorkboxPlugin>;
|
||||
warmCache?: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: PageCacheOptions = {}): void {
|
||||
const defaultMatchCallback = ({request}: RouteMatchCallbackOptions) =>
|
||||
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({
|
||||
statuses: [0, 200],
|
||||
}),
|
||||
);
|
||||
|
||||
const strategy = new NetworkFirst({
|
||||
networkTimeoutSeconds,
|
||||
cacheName,
|
||||
plugins,
|
||||
});
|
||||
|
||||
// Registers the route
|
||||
registerRoute(matchCallback, strategy);
|
||||
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({urls: options.warmCache, strategy});
|
||||
}
|
||||
}
|
||||
|
||||
export {pageCache};
|
||||
66
frontend/node_modules/workbox-recipes/src/staticResourceCache.ts
generated
vendored
Normal file
66
frontend/node_modules/workbox-recipes/src/staticResourceCache.ts
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import {warmStrategyCache} from './warmStrategyCache';
|
||||
import {registerRoute} from 'workbox-routing/registerRoute.js';
|
||||
import {StaleWhileRevalidate} from 'workbox-strategies/StaleWhileRevalidate.js';
|
||||
import {CacheableResponsePlugin} from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import {
|
||||
RouteMatchCallback,
|
||||
RouteMatchCallbackOptions,
|
||||
WorkboxPlugin,
|
||||
} from 'workbox-core/types.js';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
export interface StaticResourceOptions {
|
||||
cacheName?: string;
|
||||
matchCallback?: RouteMatchCallback;
|
||||
plugins?: Array<WorkboxPlugin>;
|
||||
warmCache?: Array<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: StaticResourceOptions = {}): void {
|
||||
const defaultMatchCallback = ({request}: RouteMatchCallbackOptions) =>
|
||||
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({
|
||||
statuses: [0, 200],
|
||||
}),
|
||||
);
|
||||
|
||||
const strategy = new StaleWhileRevalidate({
|
||||
cacheName,
|
||||
plugins,
|
||||
});
|
||||
|
||||
registerRoute(matchCallback, strategy);
|
||||
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({urls: options.warmCache, strategy});
|
||||
}
|
||||
}
|
||||
|
||||
export {staticResourceCache};
|
||||
34
frontend/node_modules/workbox-recipes/src/warmStrategyCache.ts
generated
vendored
Normal file
34
frontend/node_modules/workbox-recipes/src/warmStrategyCache.ts
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
import {Strategy} from 'workbox-strategies/Strategy.js';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
export interface WarmStrategyCacheOptions {
|
||||
urls: Array<string>;
|
||||
strategy: Strategy;
|
||||
}
|
||||
|
||||
// Give TypeScript the correct global.
|
||||
declare let self: ServiceWorkerGlobalScope;
|
||||
|
||||
/**
|
||||
* @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: WarmStrategyCacheOptions): void {
|
||||
self.addEventListener('install', (event) => {
|
||||
const done = options.urls.map(
|
||||
(path) =>
|
||||
options.strategy.handleAll({
|
||||
event,
|
||||
request: new Request(path),
|
||||
})[1],
|
||||
);
|
||||
|
||||
event.waitUntil(Promise.all(done));
|
||||
});
|
||||
}
|
||||
|
||||
export {warmStrategyCache};
|
||||
21
frontend/node_modules/workbox-recipes/staticResourceCache.d.ts
generated
vendored
Normal file
21
frontend/node_modules/workbox-recipes/staticResourceCache.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import { RouteMatchCallback, WorkboxPlugin } from 'workbox-core/types.js';
|
||||
import './_version.js';
|
||||
export interface StaticResourceOptions {
|
||||
cacheName?: string;
|
||||
matchCallback?: RouteMatchCallback;
|
||||
plugins?: Array<WorkboxPlugin>;
|
||||
warmCache?: Array<string>;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function staticResourceCache(options?: StaticResourceOptions): void;
|
||||
export { staticResourceCache };
|
||||
44
frontend/node_modules/workbox-recipes/staticResourceCache.js
generated
vendored
Normal file
44
frontend/node_modules/workbox-recipes/staticResourceCache.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
import { warmStrategyCache } from './warmStrategyCache';
|
||||
import { registerRoute } from 'workbox-routing/registerRoute.js';
|
||||
import { StaleWhileRevalidate } from 'workbox-strategies/StaleWhileRevalidate.js';
|
||||
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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({
|
||||
statuses: [0, 200],
|
||||
}));
|
||||
const strategy = new StaleWhileRevalidate({
|
||||
cacheName,
|
||||
plugins,
|
||||
});
|
||||
registerRoute(matchCallback, strategy);
|
||||
// Warms the cache
|
||||
if (options.warmCache) {
|
||||
warmStrategyCache({ urls: options.warmCache, strategy });
|
||||
}
|
||||
}
|
||||
export { staticResourceCache };
|
||||
1
frontend/node_modules/workbox-recipes/staticResourceCache.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/staticResourceCache.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './staticResourceCache.js';
|
||||
17
frontend/node_modules/workbox-recipes/tsconfig.json
generated
vendored
Normal file
17
frontend/node_modules/workbox-recipes/tsconfig.json
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "./",
|
||||
"rootDir": "./src",
|
||||
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [
|
||||
{"path": "../workbox-core/"},
|
||||
{"path": "../workbox-routing/"},
|
||||
{"path": "../workbox-strategies/"},
|
||||
{"path": "../workbox-cacheable-response/"},
|
||||
{"path": "../workbox-expiration/"},
|
||||
{"path": "../workbox-precaching/"}
|
||||
]
|
||||
}
|
||||
1
frontend/node_modules/workbox-recipes/tsconfig.tsbuildinfo
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/tsconfig.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
frontend/node_modules/workbox-recipes/warmStrategyCache.d.ts
generated
vendored
Normal file
15
frontend/node_modules/workbox-recipes/warmStrategyCache.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { Strategy } from 'workbox-strategies/Strategy.js';
|
||||
import './_version.js';
|
||||
export interface WarmStrategyCacheOptions {
|
||||
urls: Array<string>;
|
||||
strategy: Strategy;
|
||||
}
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
declare function warmStrategyCache(options: WarmStrategyCacheOptions): void;
|
||||
export { warmStrategyCache };
|
||||
18
frontend/node_modules/workbox-recipes/warmStrategyCache.js
generated
vendored
Normal file
18
frontend/node_modules/workbox-recipes/warmStrategyCache.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
import './_version.js';
|
||||
/**
|
||||
* @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));
|
||||
});
|
||||
}
|
||||
export { warmStrategyCache };
|
||||
1
frontend/node_modules/workbox-recipes/warmStrategyCache.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-recipes/warmStrategyCache.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './warmStrategyCache.js';
|
||||
Reference in New Issue
Block a user