aboutsummaryrefslogtreecommitdiff
path: root/node_modules/workbox-precaching
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/workbox-precaching')
-rw-r--r--node_modules/workbox-precaching/LICENSE201
-rw-r--r--node_modules/workbox-precaching/README.md1
-rw-r--r--node_modules/workbox-precaching/_default.mjs305
-rw-r--r--node_modules/workbox-precaching/_public.mjs22
-rw-r--r--node_modules/workbox-precaching/_types.mjs65
-rw-r--r--node_modules/workbox-precaching/_version.mjs1
-rw-r--r--node_modules/workbox-precaching/browser.mjs23
-rw-r--r--node_modules/workbox-precaching/controllers/PrecacheController.mjs393
-rw-r--r--node_modules/workbox-precaching/index.mjs35
-rw-r--r--node_modules/workbox-precaching/models/PrecacheEntry.mjs78
-rw-r--r--node_modules/workbox-precaching/models/PrecachedDetailsModel.mjs143
-rw-r--r--node_modules/workbox-precaching/package.json30
-rw-r--r--node_modules/workbox-precaching/utils/cleanRedirect.mjs45
-rw-r--r--node_modules/workbox-precaching/utils/printCleanupDetails.mjs61
-rw-r--r--node_modules/workbox-precaching/utils/printInstallDetails.mjs71
-rw-r--r--node_modules/workbox-precaching/utils/showWarningsIfNeeded.mjs63
16 files changed, 1537 insertions, 0 deletions
diff --git a/node_modules/workbox-precaching/LICENSE b/node_modules/workbox-precaching/LICENSE
new file mode 100644
index 00000000..136b9039
--- /dev/null
+++ b/node_modules/workbox-precaching/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2017 Google, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/node_modules/workbox-precaching/README.md b/node_modules/workbox-precaching/README.md
new file mode 100644
index 00000000..c1f629bc
--- /dev/null
+++ b/node_modules/workbox-precaching/README.md
@@ -0,0 +1 @@
+This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-precaching
diff --git a/node_modules/workbox-precaching/_default.mjs b/node_modules/workbox-precaching/_default.mjs
new file mode 100644
index 00000000..b791572d
--- /dev/null
+++ b/node_modules/workbox-precaching/_default.mjs
@@ -0,0 +1,305 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import {assert} from 'workbox-core/_private/assert.mjs';
+import {cacheNames} from 'workbox-core/_private/cacheNames.mjs';
+import {logger} from 'workbox-core/_private/logger.mjs';
+import {getFriendlyURL} from 'workbox-core/_private/getFriendlyURL.mjs';
+import PrecacheController from './controllers/PrecacheController.mjs';
+import './_version.mjs';
+
+if (process.env.NODE_ENV !== 'production') {
+ assert.isSwEnv('workbox-precaching');
+}
+
+let installActivateListenersAdded = false;
+let fetchListenersAdded = false;
+let suppressWarnings = false;
+let plugins = [];
+
+const cacheName = cacheNames.getPrecacheName();
+const precacheController = new PrecacheController(cacheName);
+
+const _removeIgnoreUrlParams = (origUrlObject, ignoreUrlParametersMatching) => {
+ // Exclude initial '?'
+ const searchString = origUrlObject.search.slice(1);
+
+ // Split into an array of 'key=value' strings
+ const keyValueStrings = searchString.split('&');
+ const keyValuePairs = keyValueStrings.map((keyValueString) => {
+ // Split each 'key=value' string into a [key, value] array
+ return keyValueString.split('=');
+ });
+ const filteredKeyValuesPairs = keyValuePairs.filter((keyValuePair) => {
+ return ignoreUrlParametersMatching
+ .every((ignoredRegex) => {
+ // Return true iff the key doesn't match any of the regexes.
+ return !ignoredRegex.test(keyValuePair[0]);
+ });
+ });
+ const filteredStrings = filteredKeyValuesPairs.map((keyValuePair) => {
+ // Join each [key, value] array into a 'key=value' string
+ return keyValuePair.join('=');
+ });
+
+ // Join the array of 'key=value' strings into a string with '&' in
+ // between each
+ const urlClone = new URL(origUrlObject);
+ urlClone.search = filteredStrings.join('&');
+ return urlClone;
+};
+
+/**
+ * This function will take the request URL and manipulate it based on the
+ * configuration options.
+ *
+ * @param {string} url
+ * @param {Object} options
+ * @return {string|null} Returns the URL in the cache that matches the request
+ * if available, other null.
+ *
+ * @private
+ */
+const _getPrecachedUrl = (url, {
+ ignoreUrlParametersMatching = [/^utm_/],
+ directoryIndex = 'index.html',
+ cleanUrls = true,
+ urlManipulation = null,
+} = {}) => {
+ const urlObject = new URL(url, location);
+
+ // Change '/some-url#123' => '/some-url'
+ urlObject.hash = '';
+
+ const urlWithoutIgnoredParams = _removeIgnoreUrlParams(
+ urlObject, ignoreUrlParametersMatching
+ );
+
+ let urlsToAttempt = [
+ // Test the URL that was fetched
+ urlObject,
+ // Test the URL without search params
+ urlWithoutIgnoredParams,
+ ];
+
+ // Test the URL with a directory index
+ if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {
+ const directoryUrl = new URL(urlWithoutIgnoredParams);
+ directoryUrl.pathname += directoryIndex;
+ urlsToAttempt.push(directoryUrl);
+ }
+
+ // Test the URL with a '.html' extension
+ if (cleanUrls) {
+ const cleanUrl = new URL(urlWithoutIgnoredParams);
+ cleanUrl.pathname += '.html';
+ urlsToAttempt.push(cleanUrl);
+ }
+
+ if (urlManipulation) {
+ const additionalUrls = urlManipulation({url: urlObject});
+ urlsToAttempt = urlsToAttempt.concat(additionalUrls);
+ }
+
+ const cachedUrls = precacheController.getCachedUrls();
+ for (const possibleUrl of urlsToAttempt) {
+ if (cachedUrls.indexOf(possibleUrl.href) !== -1) {
+ // It's a perfect match
+ if (process.env.NODE_ENV !== 'production') {
+ logger.debug(`Precaching found a match for ` +
+ getFriendlyURL(possibleUrl.toString()));
+ }
+ return possibleUrl.href;
+ }
+ }
+
+ return null;
+};
+
+const moduleExports = {};
+
+/**
+ * Add items to the precache list, removing any duplicates and
+ * store the files in the
+ * ["precache cache"]{@link module:workbox-core.cacheNames} when the service
+ * worker installs.
+ *
+ * This method can be called multiple times.
+ *
+ * Please note: This method **will not** serve any of the cached files for you,
+ * it only precaches files. To respond to a network request you call
+ * [addRoute()]{@link module:workbox-precaching.addRoute}.
+ *
+ * If you have a single array of files to precache, you can just call
+ * [precacheAndRoute()]{@link module:workbox-precaching.precacheAndRoute}.
+ *
+ * @param {Array<Object|string>} entries Array of entries to precache.
+ *
+ * @alias workbox.precaching.precache
+ */
+moduleExports.precache = (entries) => {
+ precacheController.addToCacheList(entries);
+
+ if (installActivateListenersAdded || entries.length <= 0) {
+ return;
+ }
+
+ installActivateListenersAdded = true;
+ self.addEventListener('install', (event) => {
+ event.waitUntil(precacheController.install({
+ event,
+ plugins,
+ suppressWarnings,
+ }));
+ });
+ self.addEventListener('activate', (event) => {
+ event.waitUntil(precacheController.activate({
+ event,
+ plugins,
+ }));
+ });
+};
+
+/**
+ * Add a `fetch` listener to the service worker that will
+ * respond to
+ * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}
+ * with precached assets.
+ *
+ * Requests for assets that aren't precached, the `FetchEvent` will not be
+ * responded to, allowing the event to fall through to other `fetch` event
+ * listeners.
+ *
+ * @param {Object} options
+ * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
+ * check cache entries for a URLs ending with '/' to see if there is a hit when
+ * appending the `directoryIndex` value.
+ * @param {Array<RegExp>} [options.ignoreUrlParametersMatching=[/^utm_/]] An
+ * array of regex's to remove search params when looking for a cache match.
+ * @param {boolean} [options.cleanUrls=true] The `cleanUrls` option will
+ * check the cache for the URL with a `.html` added to the end of the end.
+ * @param {workbox.precaching~urlManipulation} [options.urlManipulation]
+ * This is a function that should take a URL and return an array of
+ * alternative URL's that should be checked for precache matches.
+ *
+ * @alias workbox.precaching.addRoute
+ */
+moduleExports.addRoute = (options) => {
+ if (fetchListenersAdded) {
+ // TODO: Throw error here.
+ return;
+ }
+
+ fetchListenersAdded = true;
+ self.addEventListener('fetch', (event) => {
+ const precachedUrl = _getPrecachedUrl(event.request.url, options);
+ if (!precachedUrl) {
+ if (process.env.NODE_ENV !== 'production') {
+ logger.debug(`Precaching found no match for ` +
+ getFriendlyURL(event.request.url));
+ }
+ return;
+ }
+
+ let responsePromise = caches.open(cacheName)
+ .then((cache) => {
+ return cache.match(precachedUrl);
+ }).then((cachedResponse) => {
+ if (cachedResponse) {
+ return cachedResponse;
+ }
+
+ // Fall back to the network if we don't have a cached response (perhaps
+ // due to manual cache cleanup).
+ if (process.env.NODE_ENV !== 'production') {
+ logger.debug(`The precached response for ` +
+ `${getFriendlyURL(precachedUrl)} in ${cacheName} was not found. ` +
+ `Falling back to the network instead.`);
+ }
+
+ return fetch(precachedUrl);
+ });
+
+ if (process.env.NODE_ENV !== 'production') {
+ responsePromise = responsePromise.then((response) => {
+ // Workbox is going to handle the route.
+ // print the routing details to the console.
+ logger.groupCollapsed(`Precaching is responding to: ` +
+ getFriendlyURL(event.request.url));
+ logger.log(`Serving the precached url: ${precachedUrl}`);
+
+ // The Request and Response objects contains a great deal of
+ // information, hide it under a group in case developers want to see it.
+ logger.groupCollapsed(`View request details here.`);
+ logger.unprefixed.log(event.request);
+ logger.groupEnd();
+
+ logger.groupCollapsed(`View response details here.`);
+ logger.unprefixed.log(response);
+ logger.groupEnd();
+
+ logger.groupEnd();
+ return response;
+ });
+ }
+ event.respondWith(responsePromise);
+ });
+};
+
+/**
+ * This method will add entries to the precache list and add a route to
+ * respond to fetch events.
+ *
+ * This is a convenience method that will call
+ * [precache()]{@link module:workbox-precaching.precache} and
+ * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.
+ *
+ * @param {Array<Object|string>} entries Array of entries to precache.
+ * @param {Object} options See
+ * [addRoute() options]{@link module:workbox-precaching.addRoute}.
+ *
+ * @alias workbox.precaching.precacheAndRoute
+ */
+moduleExports.precacheAndRoute = (entries, options) => {
+ moduleExports.precache(entries);
+ moduleExports.addRoute(options);
+};
+
+/**
+ * Warnings will be logged if any of the precached assets are entered without
+ * a `revision` property. This is extremely dangerous if the URL's aren't
+ * revisioned. However, the warnings can be supressed with this method.
+ *
+ * @param {boolean} suppress
+ *
+ * @alias workbox.precaching.suppressWarnings
+ */
+moduleExports.suppressWarnings = (suppress) => {
+ suppressWarnings = suppress;
+};
+
+/**
+ * Add plugins to precaching.
+ *
+ * @param {Array<Object>} newPlugins
+ *
+ * @alias workbox.precaching.addPlugins
+ */
+moduleExports.addPlugins = (newPlugins) => {
+ plugins = plugins.concat(newPlugins);
+};
+
+export default moduleExports;
diff --git a/node_modules/workbox-precaching/_public.mjs b/node_modules/workbox-precaching/_public.mjs
new file mode 100644
index 00000000..f6733bf9
--- /dev/null
+++ b/node_modules/workbox-precaching/_public.mjs
@@ -0,0 +1,22 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import PrecacheController from './controllers/PrecacheController.mjs';
+import './_version.mjs';
+
+export {
+ PrecacheController,
+};
diff --git a/node_modules/workbox-precaching/_types.mjs b/node_modules/workbox-precaching/_types.mjs
new file mode 100644
index 00000000..224a195a
--- /dev/null
+++ b/node_modules/workbox-precaching/_types.mjs
@@ -0,0 +1,65 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import './_version.mjs';
+
+/**
+ * @typedef {Object} InstallResult
+ * @property {
+ * Array<workbox.precaching.PrecacheEntry|string>
+ * } updatedEntries List of entries
+ * supplied for precaching that were precached.
+ * @property {Array<workbox.precaching.PrecacheEntry|string>}
+ * notUpdatedEntries List of entries
+ * supplied for precaching that were already precached.
+ *
+ * @memberof workbox.precaching
+ */
+
+/**
+ * @typedef {Object} CleanupResult
+ * @property {Array<string>} deletedCacheRequests List of URLs that were
+ * deleted from the precache cache.
+ * @property {Array<string>} deletedRevisionDetails
+ * List of URLs that were deleted from the precache cache.
+ *
+ * @memberof workbox.precaching
+ */
+
+/**
+ * @typedef {Object} PrecacheEntry
+ * @property {string} url URL to precache.
+ * @property {string} revision Revision information for the URL.
+ *
+ * @memberof workbox.precaching
+ */
+
+/**
+ * The "urlManipulation" callback can be used to determine if there are any
+ * additional permutations of a URL that should be used to check against
+ * the available precached files.
+ *
+ * For example, Workbox supports checking for '/index.html' when the URL
+ * '/' is provided. This callback allows additional, custom checks.
+ *
+ * @callback ~urlManipulation
+ * @param {Object} context
+ * @param {URL} context.url The request's URL.
+ * @return {Array<URL>} To add additional urls to test, return an Array of
+ * URL's. Please note that these **should not be Strings**, but URL objects.
+ *
+ * @memberof workbox.precaching
+ */
diff --git a/node_modules/workbox-precaching/_version.mjs b/node_modules/workbox-precaching/_version.mjs
new file mode 100644
index 00000000..0c59270d
--- /dev/null
+++ b/node_modules/workbox-precaching/_version.mjs
@@ -0,0 +1 @@
+try{self.workbox.v['workbox:precaching:3.6.3']=1;}catch(e){} // eslint-disable-line \ No newline at end of file
diff --git a/node_modules/workbox-precaching/browser.mjs b/node_modules/workbox-precaching/browser.mjs
new file mode 100644
index 00000000..20950ace
--- /dev/null
+++ b/node_modules/workbox-precaching/browser.mjs
@@ -0,0 +1,23 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import * as publicAPI from './_public.mjs';
+import defaultExport from './_default.mjs';
+import './_version.mjs';
+
+const finalExport = Object.assign(defaultExport, publicAPI);
+
+export default finalExport;
diff --git a/node_modules/workbox-precaching/controllers/PrecacheController.mjs b/node_modules/workbox-precaching/controllers/PrecacheController.mjs
new file mode 100644
index 00000000..d4b704b3
--- /dev/null
+++ b/node_modules/workbox-precaching/controllers/PrecacheController.mjs
@@ -0,0 +1,393 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import {cacheNames} from 'workbox-core/_private/cacheNames.mjs';
+import {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';
+import {fetchWrapper} from 'workbox-core/_private/fetchWrapper.mjs';
+import {cacheWrapper} from 'workbox-core/_private/cacheWrapper.mjs';
+import {assert} from 'workbox-core/_private/assert.mjs';
+import PrecacheEntry from '../models/PrecacheEntry.mjs';
+import PrecachedDetailsModel from '../models/PrecachedDetailsModel.mjs';
+import showWarningsIfNeeded from '../utils/showWarningsIfNeeded.mjs';
+import printInstallDetails from '../utils/printInstallDetails.mjs';
+import printCleanupDetails from '../utils/printCleanupDetails.mjs';
+import cleanRedirect from '../utils/cleanRedirect.mjs';
+import '../_version.mjs';
+
+/**
+ * Performs efficient precaching of assets.
+ *
+ * @memberof workbox.precaching
+ */
+class PrecacheController {
+ /**
+ * Create a new PrecacheController.
+ *
+ * @param {string} cacheName
+ */
+ constructor(cacheName) {
+ this._cacheName = cacheNames.getPrecacheName(cacheName);
+ this._entriesToCacheMap = new Map();
+ this._precacheDetailsModel = new PrecachedDetailsModel(this._cacheName);
+ }
+
+ /**
+ * This method will add items to the precache list, removing duplicates
+ * and ensuring the information is valid.
+ *
+ * @param {
+ * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>
+ * } entries Array of entries to
+ * precache.
+ */
+ addToCacheList(entries) {
+ if (process.env.NODE_ENV !== 'production') {
+ assert.isArray(entries, {
+ moduleName: 'workbox-precaching',
+ className: 'PrecacheController',
+ funcName: 'addToCacheList',
+ paramName: 'entries',
+ });
+ }
+
+ entries.map((userEntry) => {
+ this._addEntryToCacheList(
+ this._parseEntry(userEntry)
+ );
+ });
+ }
+
+ /**
+ * This method returns a precache entry.
+ *
+ * @private
+ * @param {string|Object} input
+ * @return {PrecacheEntry}
+ */
+ _parseEntry(input) {
+ switch (typeof input) {
+ case 'string': {
+ if (process.env.NODE_ENV !== 'production') {
+ if (input.length === 0) {
+ throw new WorkboxError(
+ 'add-to-cache-list-unexpected-type', {
+ entry: input,
+ }
+ );
+ }
+ }
+
+ return new PrecacheEntry(input, input, input);
+ }
+ case 'object': {
+ if (process.env.NODE_ENV !== 'production') {
+ if (!input || !input.url) {
+ throw new WorkboxError(
+ 'add-to-cache-list-unexpected-type', {
+ entry: input,
+ }
+ );
+ }
+ }
+
+ return new PrecacheEntry(
+ input, input.url, input.revision || input.url, !!input.revision);
+ }
+ default:
+ throw new WorkboxError('add-to-cache-list-unexpected-type', {
+ entry: input,
+ });
+ }
+ }
+
+ /**
+ * Adds an entry to the precache list, accounting for possible duplicates.
+ *
+ * @private
+ * @param {PrecacheEntry} entryToAdd
+ */
+ _addEntryToCacheList(entryToAdd) {
+ // Check if the entry is already part of the map
+ const existingEntry = this._entriesToCacheMap.get(entryToAdd._entryId);
+ if (!existingEntry) {
+ this._entriesToCacheMap.set(entryToAdd._entryId, entryToAdd);
+ return;
+ }
+
+ // Duplicates are fine, but make sure the revision information
+ // is the same.
+ if (existingEntry._revision !== entryToAdd._revision) {
+ throw new WorkboxError('add-to-cache-list-conflicting-entries', {
+ firstEntry: existingEntry._originalInput,
+ secondEntry: entryToAdd._originalInput,
+ });
+ }
+ }
+
+ /**
+ * Call this method from a service work install event to start
+ * precaching assets.
+ *
+ * @param {Object} options
+ * @param {boolean} [options.suppressWarnings] Suppress warning messages.
+ * @param {Event} [options.event] The install event (if needed).
+ * @param {Array<Object>} [options.plugins] Plugins to be used for fetching
+ * and caching during install.
+ * @return {Promise<workbox.precaching.InstallResult>}
+ */
+ async install({suppressWarnings = false, event, plugins} = {}) {
+ if (process.env.NODE_ENV !== 'production') {
+ if (suppressWarnings !== true) {
+ showWarningsIfNeeded(this._entriesToCacheMap);
+ }
+
+ if (plugins) {
+ assert.isArray(plugins, {
+ moduleName: 'workbox-precaching',
+ className: 'PrecacheController',
+ funcName: 'install',
+ paramName: 'plugins',
+ });
+ }
+ }
+
+ // Empty the temporary cache.
+ // NOTE: We remove all entries instead of deleting the cache as the cache
+ // may be marked for deletion but still exist until a later stage
+ // resulting in unexpected behavior of being deletect when all references
+ // are dropped.
+ // https://github.com/GoogleChrome/workbox/issues/1368
+ const tempCache = await caches.open(this._getTempCacheName());
+ const requests = await tempCache.keys();
+ await Promise.all(requests.map((request) => {
+ return tempCache.delete(request);
+ }));
+
+ const entriesToPrecache = [];
+ const entriesAlreadyPrecached = [];
+
+ for (const precacheEntry of this._entriesToCacheMap.values()) {
+ if (await this._precacheDetailsModel._isEntryCached(
+ this._cacheName, precacheEntry)) {
+ entriesAlreadyPrecached.push(precacheEntry);
+ } else {
+ entriesToPrecache.push(precacheEntry);
+ }
+ }
+
+ // Wait for all requests to be cached.
+ await Promise.all(entriesToPrecache.map((precacheEntry) => {
+ return this._cacheEntryInTemp({event, plugins, precacheEntry});
+ }));
+
+ if (process.env.NODE_ENV !== 'production') {
+ printInstallDetails(entriesToPrecache, entriesAlreadyPrecached);
+ }
+
+ return {
+ updatedEntries: entriesToPrecache,
+ notUpdatedEntries: entriesAlreadyPrecached,
+ };
+ }
+
+ /**
+ * Takes the current set of temporary files and moves them to the final
+ * cache, deleting the temporary cache once copying is complete.
+ *
+ * @param {Object} options
+ * @param {Array<Object>} options.plugins Plugins to be used for fetching
+ * and caching during install.
+ * @return {
+ * Promise<workbox.precaching.CleanupResult>}
+ * Resolves with an object containing details of the deleted cache requests
+ * and precache revision details.
+ */
+ async activate(options = {}) {
+ const tempCache = await caches.open(this._getTempCacheName());
+
+ const requests = await tempCache.keys();
+ // Process each request/response one at a time, deleting the temporary entry
+ // when done, to help avoid triggering quota errors.
+ for (const request of requests) {
+ const response = await tempCache.match(request);
+ await cacheWrapper.put({
+ cacheName: this._cacheName,
+ request,
+ response,
+ plugins: options.plugins,
+ });
+ await tempCache.delete(request);
+ }
+
+ return this._cleanup();
+ }
+
+ /**
+ * Returns the name of the temporary cache.
+ *
+ * @return {string}
+ *
+ * @private
+ */
+ _getTempCacheName() {
+ return `${this._cacheName}-temp`;
+ }
+
+ /**
+ * Requests the entry and saves it to the cache if the response
+ * is valid.
+ *
+ * @private
+ * @param {Object} options
+ * @param {BaseCacheEntry} options.precacheEntry The entry to fetch and cache.
+ * @param {Event} [options.event] The install event (if passed).
+ * @param {Array<Object>} [options.plugins] An array of plugins to apply to
+ * fetch and caching.
+ * @return {Promise<boolean>} Returns a promise that resolves once the entry
+ * has been fetched and cached or skipped if no update is needed. The
+ * promise resolves with true if the entry was cached / updated and
+ * false if the entry is already cached and up-to-date.
+ */
+ async _cacheEntryInTemp({precacheEntry, event, plugins}) {
+ let response = await fetchWrapper.fetch({
+ request: precacheEntry._networkRequest,
+ event,
+ fetchOptions: null,
+ plugins,
+ });
+
+ if (response.redirected) {
+ response = await cleanRedirect(response);
+ }
+
+ await cacheWrapper.put({
+ cacheName: this._getTempCacheName(),
+ request: precacheEntry._cacheRequest,
+ response,
+ event,
+ plugins,
+ });
+
+ await this._precacheDetailsModel._addEntry(precacheEntry);
+
+ return true;
+ }
+
+ /**
+ * Compare the URLs and determines which assets are no longer required
+ * in the cache.
+ *
+ * This should be called in the service worker activate event.
+ *
+ * @return {
+ * Promise<workbox.precaching.CleanupResult>}
+ * Resolves with an object containing details of the deleted cache requests
+ * and precache revision details.
+ *
+ * @private
+ */
+ async _cleanup() {
+ const expectedCacheUrls = [];
+ this._entriesToCacheMap.forEach((entry) => {
+ const fullUrl = new URL(entry._cacheRequest.url, location).toString();
+ expectedCacheUrls.push(fullUrl);
+ });
+
+ const [deletedCacheRequests, deletedRevisionDetails] = await Promise.all([
+ this._cleanupCache(expectedCacheUrls),
+ this._cleanupDetailsModel(expectedCacheUrls),
+ ]);
+
+ if (process.env.NODE_ENV !== 'production') {
+ printCleanupDetails(deletedCacheRequests, deletedRevisionDetails);
+ }
+
+ return {
+ deletedCacheRequests,
+ deletedRevisionDetails,
+ };
+ }
+
+ /**
+ * Goes through all the cache entries and removes any that are
+ * outdated.
+ *
+ * @private
+ * @param {Array<string>} expectedCacheUrls Array of URLs that are
+ * expected to be cached.
+ * @return {Promise<Array<string>>} Resolves to an array of URLs
+ * of cached requests that were deleted.
+ */
+ async _cleanupCache(expectedCacheUrls) {
+ if (!await caches.has(this._cacheName)) {
+ // Cache doesn't exist, so nothing to delete
+ return [];
+ }
+
+ const cache = await caches.open(this._cacheName);
+ const cachedRequests = await cache.keys();
+ const cachedRequestsToDelete = cachedRequests.filter((cachedRequest) => {
+ return !expectedCacheUrls.includes(
+ new URL(cachedRequest.url, location).toString()
+ );
+ });
+
+ await Promise.all(
+ cachedRequestsToDelete.map((cacheUrl) => cache.delete(cacheUrl))
+ );
+
+ return cachedRequestsToDelete.map((request) => request.url);
+ }
+
+ /**
+ * Goes through all entries in indexedDB and removes any that are outdated.
+ *
+ * @private
+ * @param {Array<string>} expectedCacheUrls Array of URLs that are
+ * expected to be cached.
+ * @return {Promise<Array<string>>} Resolves to an array of URLs removed
+ * from indexedDB.
+ */
+ async _cleanupDetailsModel(expectedCacheUrls) {
+ const revisionedEntries = await this._precacheDetailsModel._getAllEntries();
+ const detailsToDelete = revisionedEntries
+ .filter((entry) => {
+ const fullUrl = new URL(entry.value.url, location).toString();
+ return !expectedCacheUrls.includes(fullUrl);
+ });
+
+ await Promise.all(
+ detailsToDelete.map(
+ (entry) => this._precacheDetailsModel._deleteEntry(entry.primaryKey)
+ )
+ );
+ return detailsToDelete.map((entry) => {
+ return entry.value.url;
+ });
+ }
+
+ /**
+ * Returns an array of fully qualified URL's that will be precached.
+ *
+ * @return {Array<string>} An array of URLs.
+ */
+ getCachedUrls() {
+ return Array.from(this._entriesToCacheMap.keys())
+ .map((url) => new URL(url, location).href);
+ }
+}
+
+export default PrecacheController;
diff --git a/node_modules/workbox-precaching/index.mjs b/node_modules/workbox-precaching/index.mjs
new file mode 100644
index 00000000..1b8c3bd2
--- /dev/null
+++ b/node_modules/workbox-precaching/index.mjs
@@ -0,0 +1,35 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import defaultPrecachingExport from './_default.mjs';
+import './_version.mjs';
+
+/**
+ * Most consumers of this module will want to use the
+ * [precacheAndRoute()]{@link workbox.precaching.precacheAndRoute}
+ * method to add assets to the Cache and respond to network requests with these
+ * cached assets.
+ *
+ * If you require finer grained control, you can use the
+ * [PrecacheController]{@link workbox.precaching.PrecacheController}
+ * to determine when performed.
+ *
+ * @namespace workbox.precaching
+ */
+
+export * from './_public.mjs';
+
+export default defaultPrecachingExport;
diff --git a/node_modules/workbox-precaching/models/PrecacheEntry.mjs b/node_modules/workbox-precaching/models/PrecacheEntry.mjs
new file mode 100644
index 00000000..8138edfa
--- /dev/null
+++ b/node_modules/workbox-precaching/models/PrecacheEntry.mjs
@@ -0,0 +1,78 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import '../_version.mjs';
+
+/**
+ * Used as a consistent way of referencing a URL to precache.
+ *
+ * @private
+ * @memberof module:workbox-precaching
+ */
+export default class PrecacheEntry {
+/**
+ * This class ensures all cache list entries are consistent and
+ * adds cache busting if required.
+ *
+ * @param {*} originalInput
+ * @param {string} url
+ * @param {string} revision
+ * @param {boolean} shouldCacheBust
+ */
+ constructor(originalInput, url, revision, shouldCacheBust) {
+ this._originalInput = originalInput;
+ this._entryId = url;
+ this._revision = revision;
+ const requestAsCacheKey = new Request(url, {credentials: 'same-origin'});
+ this._cacheRequest = requestAsCacheKey;
+ this._networkRequest = shouldCacheBust ?
+ this._cacheBustRequest(requestAsCacheKey) : requestAsCacheKey;
+ }
+
+ /**
+ * This method will either use Request.cache option OR append a cache
+ * busting parameter to the URL.
+ *
+ * @param {Request} request The request to cache bust
+ * @return {Request} A cachebusted Request
+ *
+ * @private
+ */
+ _cacheBustRequest(request) {
+ let url = request.url;
+ const requestOptions = {
+ credentials: 'same-origin',
+ };
+ if ('cache' in Request.prototype) {
+ // Make use of the Request cache mode where we can.
+ // Reload skips the HTTP cache for outgoing requests and updates
+ // the cache with the returned response.
+ requestOptions.cache = 'reload';
+ } else {
+ const parsedURL = new URL(url, location);
+
+ // This is done so the minifier can mangle 'global.encodeURIComponent'
+ const _encodeURIComponent = encodeURIComponent;
+
+ parsedURL.search += (parsedURL.search ? '&' : '') +
+ _encodeURIComponent(`_workbox-cache-bust`) + '=' +
+ _encodeURIComponent(this._revision);
+ url = parsedURL.toString();
+ }
+
+ return new Request(url, requestOptions);
+ }
+}
diff --git a/node_modules/workbox-precaching/models/PrecachedDetailsModel.mjs b/node_modules/workbox-precaching/models/PrecachedDetailsModel.mjs
new file mode 100644
index 00000000..55f1420d
--- /dev/null
+++ b/node_modules/workbox-precaching/models/PrecachedDetailsModel.mjs
@@ -0,0 +1,143 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import {DBWrapper} from 'workbox-core/_private/DBWrapper.mjs';
+import '../_version.mjs';
+
+// Allows minifier to mangle this name
+const REVISON_IDB_FIELD = 'revision';
+const URL_IDB_FIELD = 'url';
+const DB_STORE_NAME = 'precached-details-models';
+/**
+ * This model will track the relevant information of entries that
+ * are cached and their matching revision details.
+ *
+ * @private
+ */
+class PrecachedDetailsModel {
+ /**
+ * Construct a new model for a specific cache.
+ *
+ * @param {string} dbName
+ * @private
+ */
+ constructor(dbName) {
+ // This ensures the db name contains only letters, numbers, '-', '_' and '$'
+ const filteredDBName = dbName.replace(/[^\w-]/g, '_');
+ this._db = new DBWrapper(filteredDBName, 2, {
+ onupgradeneeded: this._handleUpgrade,
+ });
+ }
+
+ /**
+ * Should perform an upgrade of indexedDB.
+ *
+ * @param {Event} evt
+ *
+ * @private
+ */
+ _handleUpgrade(evt) {
+ const db = evt.target.result;
+ if (evt.oldVersion < 2) {
+ // IndexedDB version 1 used both 'workbox-precaching' and
+ // 'precached-details-model' before upgrading to version 2.
+ // Delete them and create a new store with latest schema.
+ if (db.objectStoreNames.contains('workbox-precaching')) {
+ db.deleteObjectStore('workbox-precaching');
+ }
+ if (db.objectStoreNames.contains(DB_STORE_NAME)) {
+ db.deleteObjectStore(DB_STORE_NAME);
+ }
+ }
+ db.createObjectStore(DB_STORE_NAME);
+ }
+
+ /**
+ * Check if an entry is already cached. Returns false if
+ * the entry isn't cached or the revision has changed.
+ *
+ * @param {string} cacheName
+ * @param {PrecacheEntry} precacheEntry
+ * @return {boolean}
+ *
+ * @private
+ */
+ async _isEntryCached(cacheName, precacheEntry) {
+ const revisionDetails = await this._getRevision(precacheEntry._entryId);
+ if (revisionDetails !== precacheEntry._revision) {
+ return false;
+ }
+
+ const openCache = await caches.open(cacheName);
+ const cachedResponse = await openCache.match(precacheEntry._cacheRequest);
+ return !!cachedResponse;
+ }
+
+ /**
+ * @return {Promise<Array>}
+ *
+ * @private
+ */
+ async _getAllEntries() {
+ return await this._db.getAllMatching(DB_STORE_NAME, {
+ includeKeys: true,
+ });
+ }
+
+ /**
+ * Get the current revision details.
+ *
+ * @param {Object} entryId
+ * @return {Promise<string|null>}
+ *
+ * @private
+ */
+ async _getRevision(entryId) {
+ const data = await this._db.get(DB_STORE_NAME, entryId);
+ return data ? data[REVISON_IDB_FIELD] : null;
+ }
+
+ /**
+ * Add an entry to the details model.
+ *
+ * @param {PrecacheEntry} precacheEntry
+ *
+ * @private
+ */
+ async _addEntry(precacheEntry) {
+ await this._db.put(
+ DB_STORE_NAME,
+ {
+ [REVISON_IDB_FIELD]: precacheEntry._revision,
+ [URL_IDB_FIELD]: precacheEntry._cacheRequest.url,
+ },
+ precacheEntry._entryId
+ );
+ }
+
+ /**
+ * Delete entry from details model.
+ *
+ * @param {string} entryId
+ *
+ * @private
+ */
+ async _deleteEntry(entryId) {
+ await this._db.delete(DB_STORE_NAME, entryId);
+ }
+}
+
+export default PrecachedDetailsModel;
diff --git a/node_modules/workbox-precaching/package.json b/node_modules/workbox-precaching/package.json
new file mode 100644
index 00000000..4c0c3494
--- /dev/null
+++ b/node_modules/workbox-precaching/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "workbox-precaching",
+ "version": "3.6.3",
+ "license": "Apache-2.0",
+ "author": "Google's Web DevRel Team",
+ "description": "This module efficiently precaches assets.",
+ "repository": "googlechrome/workbox",
+ "bugs": "https://github.com/googlechrome/workbox/issues",
+ "homepage": "https://github.com/GoogleChrome/workbox",
+ "keywords": [
+ "workbox",
+ "workboxjs",
+ "service worker",
+ "sw"
+ ],
+ "scripts": {
+ "build": "gulp build-packages --package workbox-precaching",
+ "version": "npm run build",
+ "prepare": "npm run build"
+ },
+ "workbox": {
+ "browserNamespace": "workbox.precaching",
+ "packageType": "browser"
+ },
+ "main": "build/workbox-precaching.prod.js",
+ "module": "index.mjs",
+ "dependencies": {
+ "workbox-core": "^3.6.3"
+ }
+}
diff --git a/node_modules/workbox-precaching/utils/cleanRedirect.mjs b/node_modules/workbox-precaching/utils/cleanRedirect.mjs
new file mode 100644
index 00000000..aa3013ed
--- /dev/null
+++ b/node_modules/workbox-precaching/utils/cleanRedirect.mjs
@@ -0,0 +1,45 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import '../_version.mjs';
+
+/**
+ * @param {Response} response
+ * @return {Response}
+ *
+ * @private
+ * @memberof module:workbox-precaching
+ */
+const cleanRedirect = async (response) => {
+ const clonedResponse = response.clone();
+
+ // Not all browsers support the Response.body stream, so fall back
+ // to reading the entire body into memory as a blob.
+ const bodyPromise = 'body' in clonedResponse ?
+ Promise.resolve(clonedResponse.body) :
+ clonedResponse.blob();
+
+ const body = await bodyPromise;
+
+ // new Response() is happy when passed either a stream or a Blob.
+ return new Response(body, {
+ headers: clonedResponse.headers,
+ status: clonedResponse.status,
+ statusText: clonedResponse.statusText,
+ });
+};
+
+export default cleanRedirect;
diff --git a/node_modules/workbox-precaching/utils/printCleanupDetails.mjs b/node_modules/workbox-precaching/utils/printCleanupDetails.mjs
new file mode 100644
index 00000000..9138f820
--- /dev/null
+++ b/node_modules/workbox-precaching/utils/printCleanupDetails.mjs
@@ -0,0 +1,61 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import {logger} from 'workbox-core/_private/logger.mjs';
+import '../_version.mjs';
+
+const logGroup = (groupTitle, urls) => {
+ logger.groupCollapsed(groupTitle);
+
+ urls.forEach((url) => {
+ logger.log(url);
+ });
+
+ logger.groupEnd();
+};
+
+/**
+ * @param {Array<string>} deletedCacheRequests
+ * @param {Array<string>} deletedRevisionDetails
+ *
+ * @private
+ * @memberof module:workbox-precachig
+ */
+export default (deletedCacheRequests, deletedRevisionDetails) => {
+ if (deletedCacheRequests.length === 0 &&
+ deletedRevisionDetails.length === 0) {
+ return;
+ }
+
+ const cacheDeleteCount = deletedCacheRequests.length;
+ const revisionDeleteCount = deletedRevisionDetails.length;
+
+ const cacheDeleteText =
+ `${cacheDeleteCount} cached ` +
+ `request${cacheDeleteCount === 1 ? ' was' : 's were'} deleted`;
+ const revisionDeleteText =
+ `${revisionDeleteCount} ` +
+ `${revisionDeleteCount === 1 ? 'entry' : 'entries'} ` +
+ `${revisionDeleteCount === 1 ? 'was' : 'were'} deleted from IndexedDB.`;
+
+ logger.groupCollapsed(
+ `During precaching cleanup, ${cacheDeleteText} and ${revisionDeleteText}`);
+
+ logGroup('Deleted Cache Requests', deletedCacheRequests);
+ logGroup('Revision Details Deleted from DB', deletedRevisionDetails);
+
+ logger.groupEnd();
+};
diff --git a/node_modules/workbox-precaching/utils/printInstallDetails.mjs b/node_modules/workbox-precaching/utils/printInstallDetails.mjs
new file mode 100644
index 00000000..13bf5339
--- /dev/null
+++ b/node_modules/workbox-precaching/utils/printInstallDetails.mjs
@@ -0,0 +1,71 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import {logger} from 'workbox-core/_private/logger.mjs';
+import '../_version.mjs';
+
+/**
+ * @param {string} groupTitle
+ * @param {Array<PrecacheEntry>} entries
+ *
+ * @private
+ */
+const _nestedGroup = (groupTitle, entries) => {
+ if (entries.length === 0) {
+ return;
+ }
+
+ logger.groupCollapsed(groupTitle);
+
+ entries.forEach((entry) => {
+ logger.log(entry._originalInput);
+ });
+
+ logger.groupEnd();
+};
+
+/**
+ * @param {Array<Object>} entriesToPrecache
+ * @param {Array<Object>} alreadyPrecachedEntries
+ *
+ * @private
+ * @memberof module:workbox-precachig
+ */
+export default (entriesToPrecache, alreadyPrecachedEntries) => {
+ // Goal is to print the message:
+ // Precaching X files.
+ // Or:
+ // Precaching X files. Y files were cached and up-to-date.
+
+ const precachedCount = entriesToPrecache.length;
+ const alreadyPrecachedCount = alreadyPrecachedEntries.length;
+ let printText =
+ `Precaching ${precachedCount} file${precachedCount === 1 ? '' : 's'}.`;
+ if (alreadyPrecachedCount > 0) {
+ printText += ` ${alreadyPrecachedCount} ` +
+ `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;
+ }
+
+ logger.groupCollapsed(printText);
+
+ _nestedGroup(
+ `View precached URLs.`,
+ entriesToPrecache);
+ _nestedGroup(
+ `View URLs that were already precached.`,
+ alreadyPrecachedEntries);
+ logger.groupEnd();
+};
diff --git a/node_modules/workbox-precaching/utils/showWarningsIfNeeded.mjs b/node_modules/workbox-precaching/utils/showWarningsIfNeeded.mjs
new file mode 100644
index 00000000..37bbcb36
--- /dev/null
+++ b/node_modules/workbox-precaching/utils/showWarningsIfNeeded.mjs
@@ -0,0 +1,63 @@
+/*
+ Copyright 2017 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+import {logger} from 'workbox-core/_private/logger.mjs';
+import '../_version.mjs';
+
+/**
+ * This method will print out a warning if a precache entry doesn't have
+ * a `revision` value.
+ *
+ * This is common if the asset if revisioned in the url like `index.1234.css`.
+ *
+ * @param {Map} entriesMap
+ *
+ * @private
+ * @memberof module:workbox-preaching
+ */
+export default (entriesMap) => {
+ const urlOnlyEntries = [];
+ entriesMap.forEach(
+ (entry) => {
+ if (typeof entry === 'string' || !entry._originalInput.revision) {
+ urlOnlyEntries.push(entry._originalInput);
+ }
+ }
+ );
+
+ if (urlOnlyEntries.length === 0) {
+ // No warnings needed.
+ return;
+ }
+
+ logger.groupCollapsed('Are your precached assets revisioned?');
+
+ const urlsList = urlOnlyEntries.map((urlOnlyEntry) => {
+ return ` - ${JSON.stringify(urlOnlyEntry)}`;
+ }).join(`\n`);
+
+ logger.warn(
+ `The following precache entries might not be revisioned:` +
+ `\n\n` +
+ urlsList +
+ `\n\n`
+ );
+
+ logger.unprefixed.warn(`You can learn more about why this might be a ` +
+ `problem here: https://developers.google.com/web/tools/workbox/modules/workbox-precaching`);
+
+ logger.groupEnd();
+};