jekyll-pwa-plugin 2.1.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-plugin.rb +1 -1
  3. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.dev.js +1 -1
  4. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.dev.js.map +1 -1
  5. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.prod.js +1 -1
  6. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.prod.js.map +1 -1
  7. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.dev.js +5 -5
  8. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.dev.js.map +1 -1
  9. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.prod.js +1 -1
  10. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.prod.js.map +1 -1
  11. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.dev.js +12 -12
  12. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.dev.js.map +1 -1
  13. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.prod.js +1 -1
  14. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.prod.js.map +1 -1
  15. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.dev.js +1 -1
  16. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.dev.js.map +1 -1
  17. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.prod.js +1 -1
  18. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.prod.js.map +1 -1
  19. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-core.dev.js +542 -515
  20. data/lib/vendor/workbox-v3.6.2/workbox-core.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v3.6.2/workbox-core.prod.js +3 -0
  22. data/lib/vendor/workbox-v3.6.2/workbox-core.prod.js.map +1 -0
  23. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.dev.js +1 -1
  24. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.dev.js.map +1 -1
  25. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.prod.js +1 -1
  26. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.prod.js.map +1 -1
  27. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-navigation-preload.dev.js +39 -1
  28. data/lib/vendor/workbox-v3.6.2/workbox-navigation-preload.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js +3 -0
  30. data/lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js.map +1 -0
  31. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-precaching.dev.js +43 -23
  32. data/lib/vendor/workbox-v3.6.2/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js +3 -0
  34. data/lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.dev.js +1 -1
  36. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.dev.js.map +1 -1
  37. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.prod.js +1 -1
  38. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.prod.js.map +1 -1
  39. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-routing.dev.js +5 -5
  40. data/lib/vendor/workbox-v3.6.2/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-routing.prod.js +1 -1
  42. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-routing.prod.js.map +1 -1
  43. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-strategies.dev.js +150 -77
  44. data/lib/vendor/workbox-v3.6.2/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js +3 -0
  46. data/lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-streams.dev.js +23 -33
  48. data/lib/vendor/workbox-v3.6.2/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v3.6.2/workbox-streams.prod.js +3 -0
  50. data/lib/vendor/workbox-v3.6.2/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-sw.js +1 -1
  52. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-sw.js.map +1 -1
  53. metadata +54 -53
  54. data/lib/vendor/workbox-v3.4.1/workbox-core.dev.js.map +0 -1
  55. data/lib/vendor/workbox-v3.4.1/workbox-core.prod.js +0 -3
  56. data/lib/vendor/workbox-v3.4.1/workbox-core.prod.js.map +0 -1
  57. data/lib/vendor/workbox-v3.4.1/workbox-navigation-preload.dev.js.map +0 -1
  58. data/lib/vendor/workbox-v3.4.1/workbox-navigation-preload.prod.js +0 -3
  59. data/lib/vendor/workbox-v3.4.1/workbox-navigation-preload.prod.js.map +0 -1
  60. data/lib/vendor/workbox-v3.4.1/workbox-precaching.dev.js.map +0 -1
  61. data/lib/vendor/workbox-v3.4.1/workbox-precaching.prod.js +0 -3
  62. data/lib/vendor/workbox-v3.4.1/workbox-precaching.prod.js.map +0 -1
  63. data/lib/vendor/workbox-v3.4.1/workbox-routing.dev.js.map +0 -1
  64. data/lib/vendor/workbox-v3.4.1/workbox-strategies.dev.js.map +0 -1
  65. data/lib/vendor/workbox-v3.4.1/workbox-strategies.prod.js +0 -3
  66. data/lib/vendor/workbox-v3.4.1/workbox-strategies.prod.js.map +0 -1
  67. data/lib/vendor/workbox-v3.4.1/workbox-streams.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v3.4.1/workbox-streams.prod.js +0 -3
  69. data/lib/vendor/workbox-v3.4.1/workbox-streams.prod.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:strategies:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n var messages = {\n strategyStart: (strategyName, request) => `Using ${strategyName} to ` + `respond to '${getFriendlyURL(request.url)}'`,\n printFinalResponse: response => {\n if (response) {\n logger_mjs.logger.groupCollapsed(`View the final response here.`);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n }\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a [cache-first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network}\n * request strategy.\n *\n * A cache first strategy is useful for assets that have been revisioned,\n * such as URLs like `/styles/example.a8f5f1.css`, since they\n * can be cached for long periods of time.\n *\n * @memberof workbox.strategies\n */\n class CacheFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n let error;\n if (!response) {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will respond with a network request.`);\n }\n try {\n response = yield _this2._getFromNetwork(request, event);\n } catch (err) {\n error = err;\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network.`);\n }\n }\n } else {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}' cache.`);\n }\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n if (error) {\n // Don't swallow error as we'll want it to throw and enable catch\n // handlers in router.\n throw error;\n }\n\n return response;\n })();\n }\n\n /**\n * Handles the network and cache part of CacheFirst.\n *\n * @param {Request} request\n * @param {FetchEvent} [event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork(request, event) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this3._fetchOptions,\n plugins: _this3._plugins\n });\n\n // Keep the service worker while we put the request to the cache\n const responseClone = response.clone();\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._cacheName,\n request,\n response: responseClone,\n event,\n plugins: _this3._plugins\n });\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [cache-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class CacheOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n const response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheOnly', request));\n if (response) {\n logger_mjs.logger.log(`Found a cached response in the '${_this2._cacheName}'` + ` cache.`);\n messages.printFinalResponse(response);\n } else {\n logger_mjs.logger.log(`No response found in the '${_this2._cacheName}' cache.`);\n }\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var cacheOkAndOpaquePlugin = {\n /**\n * Return return a response (i.e. allow caching) if the\n * response is ok (i.e. 200) or is opaque.\n *\n * @param {Object} options\n * @param {Response} options.response\n * @return {Response|null}\n *\n * @private\n */\n cacheWillUpdate: ({ response }) => {\n if (response.ok || response.status === 0) {\n return response;\n }\n return null;\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-falling-back-to-cache}\n * request strategy.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class NetworkFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n * @param {number} options.networkTimeoutSeconds If set, any network requests\n * that fail to respond within the timeout will fallback to the cache.\n *\n * This option can be used to combat\n * \"[lie-fi]{@link https://developers.google.com/web/fundamentals/performance/poor-connectivity/#lie-fi}\"\n * scenarios.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._networkTimeoutSeconds = options.networkTimeoutSeconds;\n {\n if (this._networkTimeoutSeconds) {\n assert_mjs.assert.isType(this._networkTimeoutSeconds, 'number', {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'constructor',\n paramName: 'networkTimeoutSeconds'\n });\n }\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'makeRequest'\n });\n }\n\n const promises = [];\n let timeoutId;\n\n if (_this2._networkTimeoutSeconds) {\n const { id, promise } = _this2._getTimeoutPromise({ request, event, logs });\n timeoutId = id;\n promises.push(promise);\n }\n\n const networkPromise = _this2._getNetworkPromise({ timeoutId, request, event, logs });\n promises.push(networkPromise);\n\n // Promise.race() will resolve as soon as the first promise resolves.\n let response = yield Promise.race(promises);\n // If Promise.race() resolved with null, it might be due to a network\n // timeout + a cache miss. If that were to happen, we'd rather wait until\n // the networkPromise resolves instead of returning null.\n // Note that it's fine to await an already-resolved promise, so we don't\n // have to check to see if it's still \"in flight\".\n if (!response) {\n response = yield networkPromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @param {Array} options.logs A reference to the logs array\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getTimeoutPromise({ request, logs, event }) {\n var _this3 = this;\n\n let timeoutId;\n const timeoutPromise = new Promise(resolve => {\n const onNetworkTimeout = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n logs.push(`Timing out the network response at ` + `${_this3._networkTimeoutSeconds} seconds.`);\n }\n\n resolve((yield _this3._respondFromCache({ request, event })));\n });\n\n return function onNetworkTimeout() {\n return _ref.apply(this, arguments);\n };\n })();\n\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n\n return {\n promise: timeoutPromise,\n id: timeoutId\n };\n }\n\n /**\n * @param {Object} options\n * @param {number|undefined} options.timeoutId\n * @param {Request} options.request\n * @param {Array} options.logs A reference to the logs Array.\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getNetworkPromise({ timeoutId, request, logs, event }) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this4._fetchOptions,\n plugins: _this4._plugins\n });\n } catch (err) {\n error = err;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network. Will respond ` + `with a cached response.`);\n }\n }\n\n if (error || !response) {\n response = yield _this4._respondFromCache({ request, event });\n {\n if (response) {\n logs.push(`Found a cached response in the '${_this4._cacheName}'` + ` cache.`);\n } else {\n logs.push(`No response found in the '${_this4._cacheName}' cache.`);\n }\n }\n } else {\n // Keep the service worker alive while we put the request in the cache\n const responseClone = response.clone();\n const cachePut = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this4._cacheName,\n request,\n response: responseClone,\n event,\n plugins: _this4._plugins\n });\n\n if (event) {\n try {\n // The event has been responded to so we can keep the SW alive to\n // respond to the request\n event.waitUntil(cachePut);\n } catch (err) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n }\n\n return response;\n })();\n }\n\n /**\n * Used if the network timeouts or fails to make the request.\n *\n * @param {Object} options\n * @param {Request} request The request to match in the cache\n * @param {Event} [options.event]\n * @return {Promise<Object>}\n *\n * @private\n */\n _respondFromCache({ event, request }) {\n return cacheWrapper_mjs.cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins\n });\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class NetworkOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this2._fetchOptions,\n plugins: _this2._plugins\n });\n } catch (err) {\n error = err;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkOnly', request));\n if (response) {\n logger_mjs.logger.log(`Got response from network.`);\n } else {\n logger_mjs.logger.log(`Unable to get a response from the network.`);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n // If there was an error thrown, re-throw it to ensure the Routers\n // catch handler is triggered.\n if (error) {\n throw error;\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [stale-while-revalidate]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#stale-while-revalidate}\n * request strategy.\n *\n * Resources are requested from both the cache and the network in parallel.\n * The strategy will respond with the cached version if available, otherwise\n * wait for the network response. The cache is updated with the network response\n * with each successful request.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class StaleWhileRevalidate {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} options\n * @param {Request|string} options.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will\n * be called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n const fetchAndCachePromise = _this2._getFromNetwork({ request, event });\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match({\n cacheName: _this2._cacheName,\n request,\n event,\n matchOptions: _this2._matchOptions,\n plugins: _this2._plugins\n });\n\n if (response) {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}'` + ` cache. Will update with the network response in the background.`);\n }\n\n if (event) {\n try {\n event.waitUntil(fetchAndCachePromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n } else {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will wait for the network response.`);\n }\n response = yield fetchAndCachePromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('StaleWhileRevalidate', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Object} options\n * @param {Request} options.request\n * @param {Event} [options.event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork({ request, event }) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request,\n event,\n fetchOptions: _this3._fetchOptions,\n plugins: _this3._plugins\n });\n\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._cacheName,\n request,\n response: response.clone(),\n event,\n plugins: _this3._plugins\n });\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n CacheFirst: CacheFirst,\n CacheOnly: CacheOnly,\n NetworkFirst: NetworkFirst,\n NetworkOnly: NetworkOnly,\n StaleWhileRevalidate: StaleWhileRevalidate\n });\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @function workbox.strategies.cacheFirst\n * @param {Object} options See the {@link workbox.strategies.CacheFirst}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.cacheOnly\n * @param {Object} options See the {@link workbox.strategies.CacheOnly}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.networkFirst\n * @param {Object} options See the {@link workbox.strategies.NetworkFirst}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.networkOnly\n * @param {Object} options See the {@link workbox.strategies.NetworkOnly}\n * constructor for more info.\n */\n\n /**\n * @function workbox.strategies.staleWhileRevalidate\n * @param {Object} options See the\n * {@link workbox.strategies.StaleWhileRevalidate} constructor for more info.\n */\n\n const mapping = {\n cacheFirst: CacheFirst,\n cacheOnly: CacheOnly,\n networkFirst: NetworkFirst,\n networkOnly: NetworkOnly,\n staleWhileRevalidate: StaleWhileRevalidate\n };\n\n const defaultExport = {};\n Object.keys(mapping).forEach(keyName => {\n defaultExport[keyName] = (options = {}) => {\n const StrategyClass = mapping[keyName];\n return new StrategyClass(Object.assign(options));\n };\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(defaultExport, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-strategies.dev.js"}
@@ -0,0 +1,3 @@
1
+ this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s){"use strict";try{self.workbox.v["workbox:strategies:3.6.2"]=1}catch(e){}class r{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof s&&(s=new Request(s));let n,i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(!i)try{i=yield r.n(s,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,r){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=i.clone(),l=t.cacheWrapper.put({cacheName:n.e,request:e,response:u,event:r,plugins:n.t});if(r)try{r.waitUntil(l)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){return"string"==typeof s&&(s=new Request(s)),yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t})})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class u{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){const r=[];"string"==typeof t&&(t=new Request(t));const n=[];let i;if(s.i){const{id:u,promise:l}=s.u({request:t,event:e,logs:r});i=u,n.push(l)}const u=s.l({timeoutId:i,request:t,event:e,logs:r});n.push(u);let l=yield Promise.race(n);return l||(l=yield u),l})()}u({request:e,logs:t,event:s}){var r=this;let n;var i;return{promise:new Promise(t=>{const u=(i=babelHelpers.asyncToGenerator(function*(){t(yield r.c({request:e,event:s}))}),function(){return i.apply(this,arguments)});n=setTimeout(u,1e3*this.i)}),id:n}}l({timeoutId:e,request:r,logs:n,event:i}){var u=this;return babelHelpers.asyncToGenerator(function*(){let n,l;try{l=yield s.fetchWrapper.fetch({request:r,event:i,fetchOptions:u.s,plugins:u.t})}catch(e){n=e}if(e&&clearTimeout(e),n||!l)l=yield u.c({request:r,event:i});else{const e=l.clone(),s=t.cacheWrapper.put({cacheName:u.e,request:r,response:e,event:i,plugins:u.t});if(i)try{i.waitUntil(s)}catch(e){}}return l})()}c({event:e,request:s}){return t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.r,plugins:this.t})}}class l{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,i;"string"==typeof t&&(t=new Request(t));try{i=yield s.fetchWrapper.fetch({request:t,event:e,fetchOptions:r.s,plugins:r.t})}catch(e){n=e}if(n)throw n;return i})()}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof s&&(s=new Request(s));const n=r.n({request:s,event:e});let i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n({request:e,event:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=t.cacheWrapper.put({cacheName:n.e,request:e,response:i.clone(),event:r,plugins:n.t});if(r)try{r.waitUntil(u)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:r,CacheOnly:n,NetworkFirst:u,NetworkOnly:l,StaleWhileRevalidate:c});const a={cacheFirst:r,cacheOnly:n,networkFirst:u,networkOnly:l,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private);
2
+
3
+ //# sourceMappingURL=workbox-strategies.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s){\"use strict\";try{self.workbox.v[\"workbox:strategies:3.6.2\"]=1}catch(e){}class r{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof s&&(s=new Request(s));let n,i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(!i)try{i=yield r.n(s,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,r){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=i.clone(),l=t.cacheWrapper.put({cacheName:n.e,request:e,response:u,event:r,plugins:n.t});if(r)try{r.waitUntil(l)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){return\"string\"==typeof s&&(s=new Request(s)),yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t})})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class u{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){const r=[];\"string\"==typeof t&&(t=new Request(t));const n=[];let i;if(s.i){const{id:u,promise:l}=s.u({request:t,event:e,logs:r});i=u,n.push(l)}const u=s.l({timeoutId:i,request:t,event:e,logs:r});n.push(u);let l=yield Promise.race(n);return l||(l=yield u),l})()}u({request:e,logs:t,event:s}){var r=this;let n;var i;return{promise:new Promise(t=>{const u=(i=babelHelpers.asyncToGenerator(function*(){t(yield r.c({request:e,event:s}))}),function(){return i.apply(this,arguments)});n=setTimeout(u,1e3*this.i)}),id:n}}l({timeoutId:e,request:r,logs:n,event:i}){var u=this;return babelHelpers.asyncToGenerator(function*(){let n,l;try{l=yield s.fetchWrapper.fetch({request:r,event:i,fetchOptions:u.s,plugins:u.t})}catch(e){n=e}if(e&&clearTimeout(e),n||!l)l=yield u.c({request:r,event:i});else{const e=l.clone(),s=t.cacheWrapper.put({cacheName:u.e,request:r,response:e,event:i,plugins:u.t});if(i)try{i.waitUntil(s)}catch(e){}}return l})()}c({event:e,request:s}){return t.cacheWrapper.match({cacheName:this.e,request:s,event:e,matchOptions:this.r,plugins:this.t})}}class l{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){let n,i;\"string\"==typeof t&&(t=new Request(t));try{i=yield s.fetchWrapper.fetch({request:t,event:e,fetchOptions:r.s,plugins:r.t})}catch(e){n=e}if(n)throw n;return i})()}}class c{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.s=t.fetchOptions||null,this.r=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:s}){var r=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof s&&(s=new Request(s));const n=r.n({request:s,event:e});let i=yield t.cacheWrapper.match({cacheName:r.e,request:s,event:e,matchOptions:r.r,plugins:r.t});if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n({request:e,event:r}){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield s.fetchWrapper.fetch({request:e,event:r,fetchOptions:n.s,plugins:n.t}),u=t.cacheWrapper.put({cacheName:n.e,request:e,response:i.clone(),event:r,plugins:n.t});if(r)try{r.waitUntil(u)}catch(e){}return i})()}}var o=Object.freeze({CacheFirst:r,CacheOnly:n,NetworkFirst:u,NetworkOnly:l,StaleWhileRevalidate:c});const a={cacheFirst:r,cacheOnly:n,networkFirst:u,networkOnly:l,staleWhileRevalidate:c},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,o)}(workbox.core._private,workbox.core._private,workbox.core._private);\n"],"file":"workbox-strategies.prod.js"}
@@ -1,9 +1,9 @@
1
1
  this.workbox = this.workbox || {};
2
- this.workbox.streams = (function (logger_mjs,assert_mjs) {
2
+ this.workbox.streams = (function (exports,logger_mjs,assert_mjs) {
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:streams:3.4.1'] = 1;
6
+ self.workbox.v['workbox:streams:3.6.2'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -256,28 +256,6 @@ this.workbox.streams = (function (logger_mjs,assert_mjs) {
256
256
  return cachedIsSupported;
257
257
  }
258
258
 
259
- /*
260
- Copyright 2018 Google Inc.
261
-
262
- Licensed under the Apache License, Version 2.0 (the "License");
263
- you may not use this file except in compliance with the License.
264
- You may obtain a copy of the License at
265
-
266
- https://www.apache.org/licenses/LICENSE-2.0
267
-
268
- Unless required by applicable law or agreed to in writing, software
269
- distributed under the License is distributed on an "AS IS" BASIS,
270
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
271
- See the License for the specific language governing permissions and
272
- limitations under the License.
273
- */
274
-
275
- var publicAPI = /*#__PURE__*/Object.freeze({
276
- concatenate: concatenate,
277
- concatenateToResponse: concatenateToResponse,
278
- isSupported: isSupported
279
- });
280
-
281
259
  /*
282
260
  Copyright 2018 Google Inc. All Rights Reserved.
283
261
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -358,12 +336,21 @@ this.workbox.streams = (function (logger_mjs,assert_mjs) {
358
336
  })();
359
337
  }
360
338
 
361
- var defaultExport = {
362
- concatenate,
363
- concatenateToResponse,
364
- isSupported,
365
- strategy
366
- };
339
+ /*
340
+ Copyright 2018 Google Inc.
341
+
342
+ Licensed under the Apache License, Version 2.0 (the "License");
343
+ you may not use this file except in compliance with the License.
344
+ You may obtain a copy of the License at
345
+
346
+ https://www.apache.org/licenses/LICENSE-2.0
347
+
348
+ Unless required by applicable law or agreed to in writing, software
349
+ distributed under the License is distributed on an "AS IS" BASIS,
350
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
351
+ See the License for the specific language governing permissions and
352
+ limitations under the License.
353
+ */
367
354
 
368
355
  /*
369
356
  Copyright 2018 Google Inc.
@@ -381,10 +368,13 @@ this.workbox.streams = (function (logger_mjs,assert_mjs) {
381
368
  limitations under the License.
382
369
  */
383
370
 
384
- const finalExport = Object.assign(defaultExport, publicAPI);
371
+ exports.concatenate = concatenate;
372
+ exports.concatenateToResponse = concatenateToResponse;
373
+ exports.isSupported = isSupported;
374
+ exports.strategy = strategy;
385
375
 
386
- return finalExport;
376
+ return exports;
387
377
 
388
- }(workbox.core._private,workbox.core._private));
378
+ }({},workbox.core._private,workbox.core._private));
389
379
 
390
380
  //# sourceMappingURL=workbox-streams.dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.streams = (function (exports,logger_mjs,assert_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:streams:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes either a Response, a ReadableStream, or a\n * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the\n * ReadableStreamReader object associated with it.\n *\n * @param {workbox.streams.StreamSource} source\n * @return {ReadableStreamReader}\n * @private\n */\n function _getReaderFromSource(source) {\n if (source.body && source.body.getReader) {\n return source.body.getReader();\n }\n\n if (source.getReader) {\n return source.getReader();\n }\n\n // TODO: This should be possible to do by constructing a ReadableStream, but\n // I can't get it to work. As a hack, construct a new Response, and use the\n // reader associated with its body.\n return new Response(source).body.getReader();\n }\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).\n *\n * Returns an object exposing a ReadableStream with each individual stream's\n * data returned in sequence, along with a Promise which signals when the\n * stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @return {Object<{done: Promise, stream: ReadableStream}>}\n *\n * @memberof workbox.streams\n */\n function concatenate(sourcePromises) {\n {\n assert_mjs.assert.isArray(sourcePromises, {\n moduleName: 'workbox-streams',\n funcName: 'concatenate',\n paramName: 'sourcePromises'\n });\n }\n\n const readerPromises = sourcePromises.map(sourcePromise => {\n return Promise.resolve(sourcePromise).then(source => {\n return _getReaderFromSource(source);\n });\n });\n\n let fullyStreamedResolve;\n let fullyStreamedReject;\n const done = new Promise((resolve, reject) => {\n fullyStreamedResolve = resolve;\n fullyStreamedReject = reject;\n });\n\n let i = 0;\n const logMessages = [];\n const stream = new ReadableStream({\n pull(controller) {\n return readerPromises[i].then(reader => reader.read()).then(result => {\n if (result.done) {\n {\n logMessages.push(['Reached the end of source:', sourcePromises[i]]);\n }\n\n i++;\n if (i >= readerPromises.length) {\n // Log all the messages in the group at once in a single group.\n {\n logger_mjs.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);\n for (const message of logMessages) {\n if (Array.isArray(message)) {\n logger_mjs.logger.log(...message);\n } else {\n logger_mjs.logger.log(message);\n }\n }\n logger_mjs.logger.log('Finished reading all sources.');\n logger_mjs.logger.groupEnd();\n }\n\n controller.close();\n fullyStreamedResolve();\n return;\n }\n\n return this.pull(controller);\n } else {\n controller.enqueue(result.value);\n }\n }).catch(error => {\n {\n logger_mjs.logger.error('An error occurred:', error);\n }\n fullyStreamedReject(error);\n throw error;\n });\n },\n\n cancel() {\n {\n logger_mjs.logger.warn('The ReadableStream was cancelled.');\n }\n\n fullyStreamedResolve();\n }\n });\n\n return { done, stream };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * is available.\n *\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function createHeaders(headersInit = {}) {\n // See https://github.com/GoogleChrome/workbox/issues/1461\n const headers = new Headers(headersInit);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'text/html');\n }\n return headers;\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),\n * along with a\n * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).\n *\n * Returns an object exposing a Response whose body consists of each individual\n * stream's data returned in sequence, along with a Promise which signals when\n * the stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {Object<{done: Promise, response: Response}>}\n *\n * @memberof workbox.streams\n */\n function concatenateToResponse(sourcePromises, headersInit) {\n const { done, stream } = concatenate(sourcePromises);\n\n const headers = createHeaders(headersInit);\n const response = new Response(stream, { headers });\n\n return { done, response };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n let cachedIsSupported = undefined;\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * can be created.\n *\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function isSupported() {\n if (cachedIsSupported === undefined) {\n // See https://github.com/GoogleChrome/workbox/issues/1473\n try {\n new ReadableStream({ start() {} });\n cachedIsSupported = true;\n } catch (error) {\n cachedIsSupported = false;\n }\n }\n\n return cachedIsSupported;\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A shortcut to create a strategy that could be dropped-in to Workbox's router.\n *\n * On browsers that do not support constructing new `ReadableStream`s, this\n * strategy will automatically wait for all the `sourceFunctions` to complete,\n * and create a final response that concatenates their values together.\n *\n * @param {\n * Array<function(workbox.routing.Route~handlerCallback)>} sourceFunctions\n * Each function should return a {@link workbox.streams.StreamSource} (or a\n * Promise which resolves to one).\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {workbox.routing.Route~handlerCallback}\n *\n * @memberof workbox.streams\n */\n function strategy(sourceFunctions, headersInit) {\n return (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({ event, url, params }) {\n if (isSupported()) {\n const { done, response } = concatenateToResponse(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }), headersInit);\n event.waitUntil(done);\n return response;\n }\n\n {\n logger_mjs.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`);\n }\n\n // Fallback to waiting for everything to finish, and concatenating the\n // responses.\n const parts = yield Promise.all(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }).map((() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (responsePromise) {\n const response = yield responsePromise;\n if (response instanceof Response) {\n return response.blob();\n }\n\n // Otherwise, assume it's something like a string which can be used\n // as-is when constructing the final composite blob.\n return response;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })()));\n\n const headers = createHeaders(headersInit);\n // Constructing a new Response from a Blob source is well-supported.\n // So is constructing a new Blob from multiple source Blobs or strings.\n return new Response(new Blob(parts), { headers });\n });\n\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n })();\n }\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.concatenate = concatenate;\n exports.concatenateToResponse = concatenateToResponse;\n exports.isSupported = isSupported;\n exports.strategy = strategy;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private));\n"],"file":"workbox-streams.dev.js"}
@@ -0,0 +1,3 @@
1
+ this.workbox=this.workbox||{},this.workbox.streams=function(e){"use strict";try{self.workbox.v["workbox:streams:3.6.2"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});
2
+
3
+ //# sourceMappingURL=workbox-streams.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.streams=function(e){\"use strict\";try{self.workbox.v[\"workbox:streams:3.6.2\"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has(\"content-type\")||n.set(\"content-type\",\"text/html\"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});\n"],"file":"workbox-streams.prod.js"}
@@ -1,3 +1,3 @@
1
- var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.4.1"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.4.1",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();
1
+ var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.2"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.2",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();
2
2
 
3
3
  //# sourceMappingURL=workbox-sw.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-sw/browser.mjs"],"sourcesContent":["var workbox=function(){\"use strict\";try{self.workbox.v[\"workbox:sw:3.4.1\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.4.1\",e={backgroundSync:\"background-sync\",broadcastUpdate:\"broadcast-cache-update\",cacheableResponse:\"cacheable-response\",core:\"core\",expiration:\"cache-expiration\",googleAnalytics:\"google-analytics\",navigationPreload:\"navigation-preload\",precaching:\"precaching\",rangeRequests:\"range-requests\",routing:\"routing\",strategies:\"strategies\",streams:\"streams\"};return new class{constructor(){return this.v={},this.t={debug:\"localhost\"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?\"dev\":\"prod\",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error(\"Config must be set before accessing workbox.* modules\");Object.assign(this.t,t),this.e=this.t.debug?\"dev\":\"prod\"}skipWaiting(){self.addEventListener(\"install\",()=>self.skipWaiting())}clientsClaim(){self.addEventListener(\"activate\",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&\"\"===(s=r.split(\"/\"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join(\"/\")}}}();\n"],"file":"workbox-sw.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-sw/browser.mjs"],"sourcesContent":["var workbox=function(){\"use strict\";try{self.workbox.v[\"workbox:sw:3.6.2\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.6.2\",e={backgroundSync:\"background-sync\",broadcastUpdate:\"broadcast-cache-update\",cacheableResponse:\"cacheable-response\",core:\"core\",expiration:\"cache-expiration\",googleAnalytics:\"google-analytics\",navigationPreload:\"navigation-preload\",precaching:\"precaching\",rangeRequests:\"range-requests\",routing:\"routing\",strategies:\"strategies\",streams:\"streams\"};return new class{constructor(){return this.v={},this.t={debug:\"localhost\"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?\"dev\":\"prod\",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error(\"Config must be set before accessing workbox.* modules\");Object.assign(this.t,t),this.e=this.t.debug?\"dev\":\"prod\"}skipWaiting(){self.addEventListener(\"install\",()=>self.skipWaiting())}clientsClaim(){self.addEventListener(\"activate\",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&\"\"===(s=r.split(\"/\"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join(\"/\")}}}();\n"],"file":"workbox-sw.js"}
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-pwa-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pan Yuqi
8
+ - sekiyika
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-09-03 00:00:00.000000000 Z
12
+ date: 2018-10-18 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: This plugin provides PWA support for Jekyll. Generate a service worker
14
15
  and provides precache with Google Workbox.
@@ -18,56 +19,56 @@ extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - lib/jekyll-pwa-plugin.rb
21
- - lib/vendor/workbox-v3.4.1/workbox-background-sync.dev.js
22
- - lib/vendor/workbox-v3.4.1/workbox-background-sync.dev.js.map
23
- - lib/vendor/workbox-v3.4.1/workbox-background-sync.prod.js
24
- - lib/vendor/workbox-v3.4.1/workbox-background-sync.prod.js.map
25
- - lib/vendor/workbox-v3.4.1/workbox-broadcast-cache-update.dev.js
26
- - lib/vendor/workbox-v3.4.1/workbox-broadcast-cache-update.dev.js.map
27
- - lib/vendor/workbox-v3.4.1/workbox-broadcast-cache-update.prod.js
28
- - lib/vendor/workbox-v3.4.1/workbox-broadcast-cache-update.prod.js.map
29
- - lib/vendor/workbox-v3.4.1/workbox-cache-expiration.dev.js
30
- - lib/vendor/workbox-v3.4.1/workbox-cache-expiration.dev.js.map
31
- - lib/vendor/workbox-v3.4.1/workbox-cache-expiration.prod.js
32
- - lib/vendor/workbox-v3.4.1/workbox-cache-expiration.prod.js.map
33
- - lib/vendor/workbox-v3.4.1/workbox-cacheable-response.dev.js
34
- - lib/vendor/workbox-v3.4.1/workbox-cacheable-response.dev.js.map
35
- - lib/vendor/workbox-v3.4.1/workbox-cacheable-response.prod.js
36
- - lib/vendor/workbox-v3.4.1/workbox-cacheable-response.prod.js.map
37
- - lib/vendor/workbox-v3.4.1/workbox-core.dev.js
38
- - lib/vendor/workbox-v3.4.1/workbox-core.dev.js.map
39
- - lib/vendor/workbox-v3.4.1/workbox-core.prod.js
40
- - lib/vendor/workbox-v3.4.1/workbox-core.prod.js.map
41
- - lib/vendor/workbox-v3.4.1/workbox-google-analytics.dev.js
42
- - lib/vendor/workbox-v3.4.1/workbox-google-analytics.dev.js.map
43
- - lib/vendor/workbox-v3.4.1/workbox-google-analytics.prod.js
44
- - lib/vendor/workbox-v3.4.1/workbox-google-analytics.prod.js.map
45
- - lib/vendor/workbox-v3.4.1/workbox-navigation-preload.dev.js
46
- - lib/vendor/workbox-v3.4.1/workbox-navigation-preload.dev.js.map
47
- - lib/vendor/workbox-v3.4.1/workbox-navigation-preload.prod.js
48
- - lib/vendor/workbox-v3.4.1/workbox-navigation-preload.prod.js.map
49
- - lib/vendor/workbox-v3.4.1/workbox-precaching.dev.js
50
- - lib/vendor/workbox-v3.4.1/workbox-precaching.dev.js.map
51
- - lib/vendor/workbox-v3.4.1/workbox-precaching.prod.js
52
- - lib/vendor/workbox-v3.4.1/workbox-precaching.prod.js.map
53
- - lib/vendor/workbox-v3.4.1/workbox-range-requests.dev.js
54
- - lib/vendor/workbox-v3.4.1/workbox-range-requests.dev.js.map
55
- - lib/vendor/workbox-v3.4.1/workbox-range-requests.prod.js
56
- - lib/vendor/workbox-v3.4.1/workbox-range-requests.prod.js.map
57
- - lib/vendor/workbox-v3.4.1/workbox-routing.dev.js
58
- - lib/vendor/workbox-v3.4.1/workbox-routing.dev.js.map
59
- - lib/vendor/workbox-v3.4.1/workbox-routing.prod.js
60
- - lib/vendor/workbox-v3.4.1/workbox-routing.prod.js.map
61
- - lib/vendor/workbox-v3.4.1/workbox-strategies.dev.js
62
- - lib/vendor/workbox-v3.4.1/workbox-strategies.dev.js.map
63
- - lib/vendor/workbox-v3.4.1/workbox-strategies.prod.js
64
- - lib/vendor/workbox-v3.4.1/workbox-strategies.prod.js.map
65
- - lib/vendor/workbox-v3.4.1/workbox-streams.dev.js
66
- - lib/vendor/workbox-v3.4.1/workbox-streams.dev.js.map
67
- - lib/vendor/workbox-v3.4.1/workbox-streams.prod.js
68
- - lib/vendor/workbox-v3.4.1/workbox-streams.prod.js.map
69
- - lib/vendor/workbox-v3.4.1/workbox-sw.js
70
- - lib/vendor/workbox-v3.4.1/workbox-sw.js.map
22
+ - lib/vendor/workbox-v3.6.2/workbox-background-sync.dev.js
23
+ - lib/vendor/workbox-v3.6.2/workbox-background-sync.dev.js.map
24
+ - lib/vendor/workbox-v3.6.2/workbox-background-sync.prod.js
25
+ - lib/vendor/workbox-v3.6.2/workbox-background-sync.prod.js.map
26
+ - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.dev.js
27
+ - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.dev.js.map
28
+ - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.prod.js
29
+ - lib/vendor/workbox-v3.6.2/workbox-broadcast-cache-update.prod.js.map
30
+ - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.dev.js
31
+ - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.dev.js.map
32
+ - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.prod.js
33
+ - lib/vendor/workbox-v3.6.2/workbox-cache-expiration.prod.js.map
34
+ - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.dev.js
35
+ - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.dev.js.map
36
+ - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.prod.js
37
+ - lib/vendor/workbox-v3.6.2/workbox-cacheable-response.prod.js.map
38
+ - lib/vendor/workbox-v3.6.2/workbox-core.dev.js
39
+ - lib/vendor/workbox-v3.6.2/workbox-core.dev.js.map
40
+ - lib/vendor/workbox-v3.6.2/workbox-core.prod.js
41
+ - lib/vendor/workbox-v3.6.2/workbox-core.prod.js.map
42
+ - lib/vendor/workbox-v3.6.2/workbox-google-analytics.dev.js
43
+ - lib/vendor/workbox-v3.6.2/workbox-google-analytics.dev.js.map
44
+ - lib/vendor/workbox-v3.6.2/workbox-google-analytics.prod.js
45
+ - lib/vendor/workbox-v3.6.2/workbox-google-analytics.prod.js.map
46
+ - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.dev.js
47
+ - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.dev.js.map
48
+ - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js
49
+ - lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js.map
50
+ - lib/vendor/workbox-v3.6.2/workbox-precaching.dev.js
51
+ - lib/vendor/workbox-v3.6.2/workbox-precaching.dev.js.map
52
+ - lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js
53
+ - lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js.map
54
+ - lib/vendor/workbox-v3.6.2/workbox-range-requests.dev.js
55
+ - lib/vendor/workbox-v3.6.2/workbox-range-requests.dev.js.map
56
+ - lib/vendor/workbox-v3.6.2/workbox-range-requests.prod.js
57
+ - lib/vendor/workbox-v3.6.2/workbox-range-requests.prod.js.map
58
+ - lib/vendor/workbox-v3.6.2/workbox-routing.dev.js
59
+ - lib/vendor/workbox-v3.6.2/workbox-routing.dev.js.map
60
+ - lib/vendor/workbox-v3.6.2/workbox-routing.prod.js
61
+ - lib/vendor/workbox-v3.6.2/workbox-routing.prod.js.map
62
+ - lib/vendor/workbox-v3.6.2/workbox-strategies.dev.js
63
+ - lib/vendor/workbox-v3.6.2/workbox-strategies.dev.js.map
64
+ - lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js
65
+ - lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js.map
66
+ - lib/vendor/workbox-v3.6.2/workbox-streams.dev.js
67
+ - lib/vendor/workbox-v3.6.2/workbox-streams.dev.js.map
68
+ - lib/vendor/workbox-v3.6.2/workbox-streams.prod.js
69
+ - lib/vendor/workbox-v3.6.2/workbox-streams.prod.js.map
70
+ - lib/vendor/workbox-v3.6.2/workbox-sw.js
71
+ - lib/vendor/workbox-v3.6.2/workbox-sw.js.map
71
72
  homepage: https://github.com/lavas-project/jekyll-pwa
72
73
  licenses:
73
74
  - MIT
@@ -88,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
89
  version: '0'
89
90
  requirements: []
90
91
  rubyforge_project:
91
- rubygems_version: 2.6.12
92
+ rubygems_version: 2.5.2
92
93
  signing_key:
93
94
  specification_version: 4
94
95
  summary: PWA support for Jekyll.
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["/* eslint-disable */\n// This is extracted from the Babel runtime (original source: https://github.com/babel/babel/blob/9e0f5235b1ca5167c368a576ad7c5af62d20b0e3/packages/babel-helpers/src/helpers.js#L240).\n// As part of the Rollup bundling process, it's injected once into workbox-core\n// and reused throughout all of the other modules, avoiding code duplication.\n// See https://github.com/GoogleChrome/workbox/pull/1048#issuecomment-344698046\n// for further background.\nself.babelHelpers = {\n asyncToGenerator: function(fn) {\n return function() {\n var gen = fn.apply(this, arguments);\n return new Promise(function(resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function(value) {\n step('next', value);\n }, function(err) {\n step('throw', err);\n });\n }\n }\n\n return step('next');\n });\n };\n },\n};\n\nthis.workbox = this.workbox || {};\nthis.workbox.core = (function () {\n 'use strict';\n\n try {\n self.workbox.v['workbox:core:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The available log levels in Workbox: debug, log, warn, error and silent.\n *\n * @property {int} debug Prints all logs from Workbox. Useful for debugging.\n * @property {int} log Prints console log, warn, error and groups. Default for\n * debug builds.\n * @property {int} warn Prints console warn, error and groups. Default for\n * non-debug builds.\n * @property {int} error Print console error and groups.\n * @property {int} silent Force no logging from Workbox.\n *\n * @alias workbox.core.LOG_LEVELS\n */\n\n var LOG_LEVELS = {\n debug: 0,\n log: 1,\n warn: 2,\n error: 3,\n silent: 4\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var messages = {\n 'invalid-value': ({ paramName, validValueDescription, value }) => {\n if (!paramName || !validValueDescription) {\n throw new Error(`Unexpected input to 'invalid-value' error.`);\n }\n return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;\n },\n\n 'not-in-sw': ({ moduleName }) => {\n if (!moduleName) {\n throw new Error(`Unexpected input to 'not-in-sw' error.`);\n }\n return `The '${moduleName}' must be used in a service worker.`;\n },\n\n 'not-an-array': ({ moduleName, className, funcName, paramName }) => {\n if (!moduleName || !className || !funcName || !paramName) {\n throw new Error(`Unexpected input to 'not-an-array' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n\n 'incorrect-type': ({ expectedType, paramName, moduleName, className,\n funcName }) => {\n if (!expectedType || !paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-type' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}` + `${funcName}()' must be of type ${expectedType}.`;\n },\n\n 'incorrect-class': ({ expectedClass, paramName, moduleName, className,\n funcName, isReturnValueProblem }) => {\n if (!expectedClass || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n\n if (isReturnValueProblem) {\n return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n }\n\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n },\n\n 'missing-a-method': ({ expectedMethod, paramName, moduleName, className,\n funcName }) => {\n if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n\n 'add-to-cache-list-unexpected-type': ({ entry }) => {\n return `An unexpected entry was passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` + `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` + `strings with one or more characters, objects with a url property or ` + `Request objects.`;\n },\n\n 'add-to-cache-list-conflicting-entries': ({ firstEntry, secondEntry }) => {\n if (!firstEntry || !secondEntry) {\n throw new Error(`Unexpected input to ` + `'add-to-cache-list-duplicate-entries' error.`);\n }\n\n return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had matching ` + `URLs but different revision details. This means workbox-precaching ` + `is unable to determine cache the asset correctly. Please remove one ` + `of the entries.`;\n },\n\n 'plugin-error-request-will-fetch': ({ thrownError }) => {\n if (!thrownError) {\n throw new Error(`Unexpected input to ` + `'plugin-error-request-will-fetch', error.`);\n }\n\n return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownError.message}'.`;\n },\n\n 'invalid-cache-name': ({ cacheNameId, value }) => {\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n\n return `You must provide a name containing at least one character for ` + `setCacheDeatils({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;\n },\n\n 'unregister-route-but-not-found-with-method': ({ method }) => {\n if (!method) {\n throw new Error(`Unexpected input to ` + `'unregister-route-but-not-found-with-method' error.`);\n }\n\n return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;\n },\n\n 'unregister-route-route-not-registered': () => {\n return `The route you're trying to unregister was not previously ` + `registered.`;\n },\n\n 'queue-replay-failed': ({ name, count }) => {\n return `${count} requests failed, while trying to replay Queue: ${name}.`;\n },\n\n 'duplicate-queue-name': ({ name }) => {\n return `The Queue name '${name}' is already being used. ` + `All instances of backgroundSync.Queue must be given unique names.`;\n },\n\n 'expired-test-without-max-age': ({ methodName, paramName }) => {\n return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;\n },\n\n 'unsupported-route-type': ({ moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter was an unsupported type. ` + `Please check the docs for ${moduleName}.${className}.${funcName} for ` + `valid input types.`;\n },\n\n 'not-array-of-class': ({ value, expectedClass,\n moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter must be an array of ` + `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` + `Please check the call to ${moduleName}.${className}.${funcName}() ` + `to fix the issue.`;\n },\n\n 'max-entries-or-age-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.maxEntries or config.maxAgeSeconds` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'statuses-or-headers-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.statuses or config.headers` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'invalid-string': ({ moduleName, className, funcName, paramName }) => {\n if (!paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${className}.${funcName}() for ` + `more info.`;\n },\n 'channel-name-required': () => {\n return `You must provide a channelName to construct a ` + `BroadcastCacheUpdate instance.`;\n },\n 'invalid-responses-are-same-args': () => {\n return `The arguments passed into responsesAreSame() appear to be ` + `invalid. Please ensure valid Responses are used.`;\n },\n 'expire-custom-caches-only': () => {\n return `You must provide a 'cacheName' property when using the ` + `expiration plugin with a runtime caching strategy.`;\n },\n 'unit-must-be-bytes': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);\n }\n return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n 'single-range-only': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'single-range-only' error.`);\n }\n return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'invalid-range-values': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'invalid-range-values' error.`);\n }\n return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'no-range-header': () => {\n return `No Range header was found in the Request provided.`;\n },\n 'range-not-satisfiable': ({ size, start, end }) => {\n return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;\n },\n 'attempt-to-cache-non-get-request': ({ url, method }) => {\n return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;\n },\n 'cache-put-with-no-response': ({ url }) => {\n return `There was an attempt to cache '${url}' but the response was not ` + `defined.`;\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const generatorFunction = (code, ...args) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n\n return message(...args);\n };\n\n const exportedValue = generatorFunction;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Workbox errors should be thrown with this class.\n * This allows use to ensure the type easily in tests,\n * helps developers identify errors from workbox\n * easily and allows use to optimise error\n * messages correctly.\n *\n * @private\n */\n class WorkboxError extends Error {\n /**\n *\n * @param {string} errorCode The error code that\n * identifies this particular error.\n * @param {Object=} details Any relevant arguments\n * that will help developers identify issues should\n * be added as a key on the context object.\n */\n constructor(errorCode, details) {\n let message = exportedValue(errorCode, details);\n\n super(message);\n\n this.name = errorCode;\n this.details = details;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const _cacheNameDetails = {\n prefix: 'workbox',\n suffix: self.registration.scope,\n googleAnalytics: 'googleAnalytics',\n precache: 'precache',\n runtime: 'runtime'\n };\n\n const _createCacheName = cacheName => {\n return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value.length > 0).join('-');\n };\n\n const cacheNames = {\n updateDetails: details => {\n Object.keys(_cacheNameDetails).forEach(key => {\n if (typeof details[key] !== 'undefined') {\n _cacheNameDetails[key] = details[key];\n }\n });\n },\n getGoogleAnalyticsName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);\n },\n getPrecacheName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.precache);\n },\n getRuntimeName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Safari doesn't print all console.groupCollapsed() arguments.\n // Related bug: https://bugs.webkit.org/show_bug.cgi?id=182754\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n const GREY = `#7f8c8d`;\n const GREEN = `#2ecc71`;\n const YELLOW = `#f39c12`;\n const RED = `#c0392b`;\n const BLUE = `#3498db`;\n\n const getDefaultLogLevel = () => LOG_LEVELS.log;\n\n let logLevel = getDefaultLogLevel();\n const shouldPrint = minLevel => logLevel <= minLevel;\n const setLoggerLevel = newLogLevel => logLevel = newLogLevel;\n const getLoggerLevel = () => logLevel;\n\n // We always want groups to be logged unless logLevel is silent.\n const groupLevel = LOG_LEVELS.error;\n\n const _print = function (keyName, logArgs, levelColor) {\n const logLevel = keyName.indexOf('group') === 0 ? groupLevel : LOG_LEVELS[keyName];\n if (!shouldPrint(logLevel)) {\n return;\n }\n\n if (!levelColor || keyName === 'groupCollapsed' && isSafari) {\n console[keyName](...logArgs);\n return;\n }\n\n const logPrefix = ['%cworkbox', `background: ${levelColor}; color: white; padding: 2px 0.5em; ` + `border-radius: 0.5em;`];\n console[keyName](...logPrefix, ...logArgs);\n };\n\n const groupEnd = () => {\n if (shouldPrint(groupLevel)) {\n console.groupEnd();\n }\n };\n\n const defaultExport = {\n groupEnd,\n unprefixed: {\n groupEnd\n }\n };\n\n const setupLogs = (keyName, color) => {\n defaultExport[keyName] = (...args) => _print(keyName, args, color);\n defaultExport.unprefixed[keyName] = (...args) => _print(keyName, args);\n };\n\n const levelToColor = {\n debug: GREY,\n log: GREEN,\n warn: YELLOW,\n error: RED,\n groupCollapsed: BLUE\n };\n Object.keys(levelToColor).forEach(keyName => setupLogs(keyName, levelToColor[keyName]));\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n * This method returns true if the current context is a service worker.\n */\n const isSwEnv = moduleName => {\n if (!('ServiceWorkerGlobalScope' in self)) {\n throw new WorkboxError('not-in-sw', { moduleName });\n }\n };\n\n /*\n * This method throws if the supplied value is not an array.\n * The destructed values are required to produce a meaningful error for users.\n * The destructed and restructured object is so it's clear what is\n * needed.\n */\n const isArray = (value, { moduleName, className, funcName, paramName }) => {\n if (!Array.isArray(value)) {\n throw new WorkboxError('not-an-array', {\n moduleName,\n className,\n funcName,\n paramName\n });\n }\n };\n\n const hasMethod = (object, expectedMethod, { moduleName, className, funcName, paramName }) => {\n const type = typeof object[expectedMethod];\n if (type !== 'function') {\n throw new WorkboxError('missing-a-method', { paramName, expectedMethod,\n moduleName, className, funcName });\n }\n };\n\n const isType = (object, expectedType, { moduleName, className, funcName, paramName }) => {\n if (typeof object !== expectedType) {\n throw new WorkboxError('incorrect-type', { paramName, expectedType,\n moduleName, className, funcName });\n }\n };\n\n const isInstance = (object, expectedClass, { moduleName, className, funcName,\n paramName, isReturnValueProblem }) => {\n if (!(object instanceof expectedClass)) {\n throw new WorkboxError('incorrect-class', { paramName, expectedClass,\n moduleName, className, funcName, isReturnValueProblem });\n }\n };\n\n const isOneOf = (value, validValues, { paramName }) => {\n if (!validValues.includes(value)) {\n throw new WorkboxError('invalid-value', {\n paramName,\n value,\n validValueDescription: `Valid values are ${JSON.stringify(validValues)}.`\n });\n }\n };\n\n const isArrayOfClass = (value, expectedClass, { moduleName, className, funcName, paramName }) => {\n const error = new WorkboxError('not-array-of-class', {\n value, expectedClass,\n moduleName, className, funcName, paramName\n });\n if (!Array.isArray(value)) {\n throw error;\n }\n\n for (let item of value) {\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n };\n\n const finalAssertExports = {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isSwEnv,\n isType,\n isArrayOfClass\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Logs a warning to the user recommending changing\n * to max-age=0 or no-cache.\n *\n * @param {string} cacheControlHeader\n *\n * @private\n */\n function showWarning(cacheControlHeader) {\n const docsUrl = 'https://developers.google.com/web/tools/workbox/guides/service-worker-checklist#cache-control_of_your_service_worker_file';\n defaultExport.warn(`You are setting a 'cache-control' header of ` + `'${cacheControlHeader}' on your service worker file. This should be ` + `set to 'max-age=0' or 'no-cache' to ensure the latest service worker ` + `is served to your users. Learn more here: ${docsUrl}`);\n }\n\n /**\n * Checks for cache-control header on SW file and\n * warns the developer if it exists with a value\n * other than max-age=0 or no-cache.\n *\n * @return {Promise}\n * @private\n */\n function checkSWFileCacheHeaders() {\n // This is wrapped as an iife to allow async/await while making\n // rollup exclude it in builds.\n return babelHelpers.asyncToGenerator(function* () {\n try {\n const swFile = self.location.href;\n const response = yield fetch(swFile);\n if (!response.ok) {\n // Response failed so nothing we can check;\n return;\n }\n\n if (!response.headers.has('cache-control')) {\n // No cache control header.\n return;\n }\n\n const cacheControlHeader = response.headers.get('cache-control');\n const maxAgeResult = /max-age\\s*=\\s*(\\d*)/g.exec(cacheControlHeader);\n if (maxAgeResult) {\n if (parseInt(maxAgeResult[1], 10) === 0) {\n return;\n }\n }\n\n if (cacheControlHeader.indexOf('no-cache') !== -1) {\n return;\n }\n\n if (cacheControlHeader.indexOf('no-store') !== -1) {\n return;\n }\n\n showWarning(cacheControlHeader);\n } catch (err) {\n // NOOP\n }\n })();\n }\n\n const finalCheckSWFileCacheHeaders = checkSWFileCacheHeaders;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This class is never exposed publicly. Inidividual methods are exposed\n * using jsdoc alias commands.\n *\n * @memberof workbox.core\n * @private\n */\n class WorkboxCore {\n /**\n * You should not instantiate this object directly.\n *\n * @private\n */\n constructor() {\n // Give our version strings something to hang off of.\n try {\n self.workbox.v = self.workbox.v || {};\n } catch (err) {}\n // NOOP\n\n\n // A WorkboxCore instance must be exported before we can use the logger.\n // This is so it can get the current log level.\n {\n const padding = ' ';\n defaultExport.groupCollapsed('Welcome to Workbox!');\n defaultExport.unprefixed.log(`You are currently using a development build. ` + `By default this will switch to prod builds when not on localhost. ` + `You can force this with workbox.setConfig({debug: true|false}).`);\n defaultExport.unprefixed.log(`📖 Read the guides and documentation\\n` + `${padding}https://developers.google.com/web/tools/workbox/`);\n defaultExport.unprefixed.log(`❓ Use the [workbox] tag on Stack Overflow to ask questions\\n` + `${padding}https://stackoverflow.com/questions/ask?tags=workbox`);\n defaultExport.unprefixed.log(`🐛 Found a bug? Report it on GitHub\\n` + `${padding}https://github.com/GoogleChrome/workbox/issues/new`);\n defaultExport.groupEnd();\n\n if (typeof finalCheckSWFileCacheHeaders === 'function') {\n finalCheckSWFileCacheHeaders();\n }\n }\n }\n\n /**\n * Get the current cache names used by Workbox.\n *\n * `cacheNames.precache` is used for precached assets,\n * `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to\n * store `analytics.js`,\n * and `cacheNames.runtime` is used for everything else.\n *\n * @return {Object} An object with `precache` and `runtime` cache names.\n *\n * @alias workbox.core.cacheNames\n */\n get cacheNames() {\n return {\n googleAnalytics: cacheNames.getGoogleAnalyticsName(),\n precache: cacheNames.getPrecacheName(),\n runtime: cacheNames.getRuntimeName()\n };\n }\n\n /**\n * You can alter the default cache names used by the Workbox modules by\n * changing the cache name details.\n *\n * Cache names are generated as `<prefix>-<Cache Name>-<suffix>`.\n *\n * @param {Object} details\n * @param {Object} details.prefix The string to add to the beginning of\n * the precache and runtime cache names.\n * @param {Object} details.suffix The string to add to the end of\n * the precache and runtime cache names.\n * @param {Object} details.precache The cache name to use for precache\n * caching.\n * @param {Object} details.runtime The cache name to use for runtime caching.\n * @param {Object} details.googleAnalytics The cache name to use for\n * `workbox-google-analytics` caching.\n *\n * @alias workbox.core.setCacheNameDetails\n */\n setCacheNameDetails(details) {\n {\n Object.keys(details).forEach(key => {\n finalAssertExports.isType(details[key], 'string', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'setCacheNameDetails',\n paramName: `details.${key}`\n });\n });\n\n if ('precache' in details && details.precache.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'precache',\n value: details.precache\n });\n }\n\n if ('runtime' in details && details.runtime.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'runtime',\n value: details.runtime\n });\n }\n\n if ('googleAnalytics' in details && details.googleAnalytics.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'googleAnalytics',\n value: details.googleAnalytics\n });\n }\n }\n\n cacheNames.updateDetails(details);\n }\n\n /**\n * Get the current log level.\n *\n * @return {number}.\n *\n * @alias workbox.core.logLevel\n */\n get logLevel() {\n return getLoggerLevel();\n }\n\n /**\n * Set the current log level passing in one of the values from\n * [LOG_LEVELS]{@link module:workbox-core.LOG_LEVELS}.\n *\n * @param {number} newLevel The new log level to use.\n *\n * @alias workbox.core.setLogLevel\n */\n setLogLevel(newLevel) {\n {\n finalAssertExports.isType(newLevel, 'number', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'logLevel [setter]',\n paramName: `logLevel`\n });\n }\n\n if (newLevel > LOG_LEVELS.silent || newLevel < LOG_LEVELS.debug) {\n throw new WorkboxError('invalid-value', {\n paramName: 'logLevel',\n validValueDescription: `Please use a value from LOG_LEVELS, i.e ` + `'logLevel = workbox.core.LOG_LEVELS.debug'.`,\n value: newLevel\n });\n }\n\n setLoggerLevel(newLevel);\n }\n }\n\n var defaultExport$1 = new WorkboxCore();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class that wraps common IndexedDB functionality in a promise-based API.\n * It exposes all the underlying power and functionality of IndexedDB, but\n * wraps the most commonly used features in a way that's much simpler to use.\n *\n * @private\n */\n class DBWrapper {\n /**\n * @param {string} name\n * @param {number} version\n * @param {Object=} [callback]\n * @param {function(this:DBWrapper, Event)} [callbacks.onupgradeneeded]\n * @param {function(this:DBWrapper, Event)} [callbacks.onversionchange]\n * Defaults to DBWrapper.prototype._onversionchange when not specified.\n */\n constructor(name, version, {\n onupgradeneeded,\n onversionchange = this._onversionchange\n } = {}) {\n this._name = name;\n this._version = version;\n this._onupgradeneeded = onupgradeneeded;\n this._onversionchange = onversionchange;\n\n // If this is null, it means the database isn't open.\n this._db = null;\n }\n\n /**\n * Opens a connected to an IDBDatabase, invokes any onupgradedneeded\n * callback, and added an onversionchange callback to the database.\n *\n * @return {IDBDatabase}\n *\n * @private\n */\n open() {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (_this._db) return;\n\n _this._db = yield new Promise(function (resolve, reject) {\n // This flag is flipped to true if the timeout callback runs prior\n // to the request failing or succeeding. Note: we use a timeout instead\n // of an onblocked handler since there are cases where onblocked will\n // never never run. A timeout better handles all possible scenarios:\n // https://github.com/w3c/IndexedDB/issues/223\n let openRequestTimedOut = false;\n setTimeout(function () {\n openRequestTimedOut = true;\n reject(new Error('The open request was blocked and timed out'));\n }, _this.OPEN_TIMEOUT);\n\n const openRequest = indexedDB.open(_this._name, _this._version);\n openRequest.onerror = function (evt) {\n return reject(openRequest.error);\n };\n openRequest.onupgradeneeded = function (evt) {\n if (openRequestTimedOut) {\n openRequest.transaction.abort();\n evt.target.result.close();\n } else if (_this._onupgradeneeded) {\n _this._onupgradeneeded(evt);\n }\n };\n openRequest.onsuccess = function (evt) {\n const db = evt.target.result;\n if (openRequestTimedOut) {\n db.close();\n } else {\n db.onversionchange = _this._onversionchange;\n resolve(db);\n }\n };\n });\n\n return _this;\n })();\n }\n\n /**\n * Delegates to the native `get()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n get(storeName, ...args) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._call('get', storeName, 'readonly', ...args);\n })();\n }\n\n /**\n * Delegates to the native `add()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n add(storeName, ...args) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this3._call('add', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `put()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n put(storeName, ...args) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this4._call('put', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `delete()` method for the object store.\n *\n * @param {string} storeName\n * @param {...*} args The values passed to the delegated method.\n *\n * @private\n */\n delete(storeName, ...args) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._call('delete', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Deletes the underlying database, ensuring that any open connections are\n * closed first.\n *\n * @private\n */\n deleteDatabase() {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n _this6.close();\n _this6._db = null;\n yield new Promise(function (resolve, reject) {\n const request = indexedDB.deleteDatabase(_this6._name);\n request.onerror = function (evt) {\n return reject(evt.target.error);\n };\n request.onblocked = function () {\n return reject(new Error('Deletion was blocked.'));\n };\n request.onsuccess = function () {\n return resolve();\n };\n });\n })();\n }\n\n /**\n * Delegates to the native `getAll()` or polyfills it via the `find()`\n * method in older browsers.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n *\n * @private\n */\n getAll(storeName, query, count) {\n var _this7 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if ('getAll' in IDBObjectStore.prototype) {\n return yield _this7._call('getAll', storeName, 'readonly', query, count);\n } else {\n return yield _this7.getAllMatching(storeName, { query, count });\n }\n })();\n }\n\n /**\n * Supports flexible lookup in an object store by specifying an index,\n * query, direction, and count. This method returns an array of objects\n * with the signature .\n *\n * @param {string} storeName\n * @param {Object} [opts]\n * @param {IDBCursorDirection} [opts.direction]\n * @param {*} [opts.query]\n * @param {string} [opts.index] The index to use (if specified).\n * @param {number} [opts.count] The max number of results to return.\n * @param {boolean} [opts.includeKeys] When true, the structure of the\n * returned objects is changed from an array of values to an array of\n * objects in the form {key, primaryKey, value}.\n * @return {Array}\n *\n * @private\n */\n getAllMatching(storeName, opts = {}) {\n var _this8 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this8.transaction([storeName], 'readonly', function (stores, done) {\n const store = stores[storeName];\n const target = opts.index ? store.index(opts.index) : store;\n const results = [];\n\n // Passing `undefined` arguments to Edge's `openCursor(...)` causes\n // 'DOMException: DataError'\n // Details in issue: https://github.com/GoogleChrome/workbox/issues/1509\n const query = opts.query || null;\n const direction = opts.direction || 'next';\n target.openCursor(query, direction).onsuccess = function (evt) {\n const cursor = evt.target.result;\n if (cursor) {\n const { primaryKey, key, value } = cursor;\n results.push(opts.includeKeys ? { primaryKey, key, value } : value);\n if (opts.count && results.length >= opts.count) {\n done(results);\n } else {\n cursor.continue();\n }\n } else {\n done(results);\n }\n };\n });\n })();\n }\n\n /**\n * Accepts a list of stores, a transaction type, and a callback and\n * performs a transaction. A promise is returned that resolves to whatever\n * value the callback chooses. The callback holds all the transaction logic\n * and is invoked with three arguments:\n * 1. An object mapping object store names to IDBObjectStore values.\n * 2. A `done` function, that's used to resolve the promise when\n * when the transaction is done.\n * 3. An `abort` function that can be called to abort the transaction\n * at any time.\n *\n * @param {Array<string>} storeNames An array of object store names\n * involved in the transaction.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {function(Object, function(), function(*)):?IDBRequest} callback\n * @return {*} The result of the transaction ran by the callback.\n *\n * @private\n */\n transaction(storeNames, type, callback) {\n var _this9 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this9.open();\n const result = yield new Promise(function (resolve, reject) {\n const txn = _this9._db.transaction(storeNames, type);\n const done = function (value) {\n return resolve(value);\n };\n const abort = function () {\n reject(new Error('The transaction was manually aborted'));\n txn.abort();\n };\n txn.onerror = function (evt) {\n return reject(evt.target.error);\n };\n txn.onabort = function (evt) {\n return reject(evt.target.error);\n };\n txn.oncomplete = function () {\n return resolve();\n };\n\n const stores = {};\n for (const storeName of storeNames) {\n stores[storeName] = txn.objectStore(storeName);\n }\n callback(stores, done, abort);\n });\n return result;\n })();\n }\n\n /**\n * Delegates async to a native IDBObjectStore method.\n *\n * @param {string} method The method name.\n * @param {string} storeName The object store name.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {...*} args The list of args to pass to the native method.\n * @return {*} The result of the transaction.\n *\n * @private\n */\n _call(method, storeName, type, ...args) {\n var _this10 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this10.open();\n const callback = function (stores, done) {\n stores[storeName][method](...args).onsuccess = function (evt) {\n done(evt.target.result);\n };\n };\n\n return yield _this10.transaction([storeName], type, callback);\n })();\n }\n\n /**\n * The default onversionchange handler, which closes the database so other\n * connections can open without being blocked.\n *\n * @param {Event} evt\n *\n * @private\n */\n _onversionchange(evt) {\n this.close();\n }\n\n /**\n * Closes the connection opened by `DBWrapper.open()`. Generally this method\n * doesn't need to be called since:\n * 1. It's usually better to keep a connection open since opening\n * a new connection is somewhat slow.\n * 2. Connections are automatically closed when the reference is\n * garbage collected.\n * The primary use case for needing to close a connection is when another\n * reference (typically in another tab) needs to upgrade it and would be\n * blocked by the current, open connection.\n *\n * @private\n */\n close() {\n if (this._db) this._db.close();\n }\n }\n\n // Exposed to let users modify the default timeout on a per-instance\n // or global basis.\n DBWrapper.prototype.OPEN_TIMEOUT = 2000;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginEvents = {\n CACHE_DID_UPDATE: 'cacheDidUpdate',\n CACHE_WILL_UPDATE: 'cacheWillUpdate',\n CACHED_RESPONSE_WILL_BE_USED: 'cachedResponseWillBeUsed',\n FETCH_DID_FAIL: 'fetchDidFail',\n REQUEST_WILL_FETCH: 'requestWillFetch'\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginUtils = {\n filter: (plugins, callbackname) => {\n return plugins.filter(plugin => callbackname in plugin);\n }\n };\n\n /**\n * Runs all of the callback functions, one at a time sequentially, in the order\n * in which they were registered.\n *\n * @memberof workbox.core\n * @private\n */\n let executeQuotaErrorCallbacks = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n defaultExport.log(`About to run ${callbacks.size} callbacks to clean up caches.`);\n }\n\n for (const callback of callbacks) {\n yield callback();\n {\n defaultExport.log(callback, 'is complete.');\n }\n }\n\n {\n defaultExport.log('Finished running callbacks.');\n }\n });\n\n return function executeQuotaErrorCallbacks() {\n return _ref.apply(this, arguments);\n };\n })();\n\n const callbacks = new Set();\n\n /**\n * Adds a function to the set of callbacks that will be executed when there's\n * a quota error.\n *\n * @param {Function} callback\n * @memberof workbox.core\n */\n function registerQuotaErrorCallback(callback) {\n {\n finalAssertExports.isType(callback, 'function', {\n moduleName: 'workbox-core',\n funcName: 'register',\n paramName: 'callback'\n });\n }\n\n callbacks.add(callback);\n\n {\n defaultExport.log('Registered a callback to respond to quota errors.', callback);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around cache.put().\n *\n * Will call `cacheDidUpdate` on plugins if the cache was updated.\n *\n * @param {string} cacheName\n * @param {Request} request\n * @param {Response} response\n * @param {Array<Object>} [plugins]\n *\n * @private\n * @memberof module:workbox-core\n */\n const putWrapper = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (cacheName, request, response, plugins = []) {\n if (!response) {\n {\n defaultExport.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(request.url)}'.`);\n }\n\n throw new WorkboxError('cache-put-with-no-response', {\n url: getFriendlyURL(request.url)\n });\n }\n\n let responseToCache = yield _isResponseSafeToCache(request, response, plugins);\n\n if (!responseToCache) {\n {\n defaultExport.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache);\n }\n return;\n }\n\n {\n if (responseToCache.method && responseToCache.method !== 'GET') {\n throw new WorkboxError('attempt-to-cache-non-get-request', {\n url: getFriendlyURL(request.url),\n method: responseToCache.method\n });\n }\n }\n\n const cache = yield caches.open(cacheName);\n\n const updatePlugins = pluginUtils.filter(plugins, pluginEvents.CACHE_DID_UPDATE);\n\n let oldResponse = updatePlugins.length > 0 ? yield matchWrapper(cacheName, request) : null;\n\n {\n defaultExport.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(request.url)}.`);\n }\n\n try {\n yield cache.put(request, responseToCache);\n } catch (error) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n if (error.name === 'QuotaExceededError') {\n yield executeQuotaErrorCallbacks();\n }\n throw error;\n }\n\n for (let plugin of updatePlugins) {\n yield plugin[pluginEvents.CACHE_DID_UPDATE].call(plugin, {\n cacheName,\n request,\n oldResponse,\n newResponse: responseToCache\n });\n }\n });\n\n return function putWrapper(_x, _x2, _x3) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * This is a wrapper around cache.match().\n *\n * @param {string} cacheName Name of the cache to match against.\n * @param {Request} request The Request that will be used to look up cache\n * entries.\n * @param {Object} matchOptions Options passed to cache.match().\n * @param {Array<Object>} [plugins] Array of plugins.\n * @return {Response} A cached response if available.\n *\n * @private\n * @memberof module:workbox-core\n */\n const matchWrapper = (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (cacheName, request, matchOptions, plugins = []) {\n const cache = yield caches.open(cacheName);\n let cachedResponse = yield cache.match(request, matchOptions);\n {\n if (cachedResponse) {\n defaultExport.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n defaultExport.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (let plugin of plugins) {\n if (pluginEvents.CACHED_RESPONSE_WILL_BE_USED in plugin) {\n cachedResponse = yield plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED].call(plugin, {\n cacheName,\n request,\n matchOptions,\n cachedResponse\n });\n {\n if (cachedResponse) {\n finalAssertExports.isInstance(cachedResponse, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n return cachedResponse;\n });\n\n return function matchWrapper(_x4, _x5, _x6) {\n return _ref2.apply(this, arguments);\n };\n })();\n\n /**\n * This method will call cacheWillUpdate on the available plugins (or use\n * response.ok) to determine if the Response is safe and valid to cache.\n *\n * @param {Request} request\n * @param {Response} response\n * @param {Array<Object>} plugins\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const _isResponseSafeToCache = (() => {\n var _ref3 = babelHelpers.asyncToGenerator(function* (request, response, plugins) {\n let responseToCache = response;\n let pluginsUsed = false;\n for (let plugin of plugins) {\n if (pluginEvents.CACHE_WILL_UPDATE in plugin) {\n pluginsUsed = true;\n responseToCache = yield plugin[pluginEvents.CACHE_WILL_UPDATE].call(plugin, {\n request,\n response: responseToCache\n });\n\n {\n if (responseToCache) {\n finalAssertExports.isInstance(responseToCache, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHE_WILL_UPDATE,\n isReturnValueProblem: true\n });\n }\n }\n\n if (!responseToCache) {\n break;\n }\n }\n }\n\n if (!pluginsUsed) {\n {\n if (!responseToCache.ok) {\n if (responseToCache.status === 0) {\n defaultExport.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);\n } else {\n defaultExport.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);\n }\n }\n }\n responseToCache = responseToCache.ok ? responseToCache : null;\n }\n\n return responseToCache ? responseToCache : null;\n });\n\n return function _isResponseSafeToCache(_x7, _x8, _x9) {\n return _ref3.apply(this, arguments);\n };\n })();\n\n const cacheWrapper = {\n put: putWrapper,\n match: matchWrapper\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around the fetch API.\n *\n * Will call requestWillFetch on available plugins.\n *\n * @param {Request|string} request\n * @param {Object} fetchOptions\n * @param {Array<Object>} [plugins]\n * @param {Promise<Response>} [preloadResponse]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const wrappedFetch = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (request, fetchOptions, plugins = [], preloadResponse) {\n // We *should* be able to call `await preloadResponse` even if it's undefined,\n // but for some reason, doing so leads to errors in our Node unit tests.\n // To work around that, explicitly check preloadResponse's value first.\n if (preloadResponse) {\n const possiblePreloadResponse = yield preloadResponse;\n if (possiblePreloadResponse) {\n {\n defaultExport.log(`Using a preloaded navigation response for ` + `'${getFriendlyURL(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n finalAssertExports.isInstance(request, Request, {\n paramName: request,\n expectedClass: 'Request',\n moduleName: 'workbox-core',\n className: 'fetchWrapper',\n funcName: 'wrappedFetch'\n });\n }\n\n const failedFetchPlugins = pluginUtils.filter(plugins, pluginEvents.FETCH_DID_FAIL);\n\n // If there is a fetchDidFail plugin, we need to save a clone of the\n // original request before it's either modified by a requestWillFetch\n // plugin or before the original request's body is consumed via fetch().\n const originalRequest = failedFetchPlugins.length > 0 ? request.clone() : null;\n\n try {\n for (let plugin of plugins) {\n if (pluginEvents.REQUEST_WILL_FETCH in plugin) {\n request = yield plugin[pluginEvents.REQUEST_WILL_FETCH].call(plugin, {\n request: request.clone()\n });\n\n {\n if (request) {\n finalAssertExports.isInstance(request, Request, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n } catch (err) {\n throw new WorkboxError('plugin-error-request-will-fetch', {\n thrownError: err\n });\n }\n\n // The request can be altered by plugins with `requestWillFetch` making\n // the original request (Most likely from a `fetch` event) to be different\n // to the Request we make. Pass both to `fetchDidFail` to aid debugging.\n const pluginFilteredRequest = request.clone();\n\n try {\n const fetchResponse = yield fetch(request, fetchOptions);\n {\n defaultExport.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${fetchResponse.status}'.`);\n }\n return fetchResponse;\n } catch (error) {\n {\n defaultExport.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, error);\n }\n\n for (let plugin of failedFetchPlugins) {\n yield plugin[pluginEvents.FETCH_DID_FAIL].call(plugin, {\n error,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone()\n });\n }\n\n throw error;\n }\n });\n\n return function wrappedFetch(_x, _x2) {\n return _ref.apply(this, arguments);\n };\n })();\n\n const fetchWrapper = {\n fetch: wrappedFetch\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var _private = /*#__PURE__*/Object.freeze({\n DBWrapper: DBWrapper,\n WorkboxError: WorkboxError,\n assert: finalAssertExports,\n cacheNames: cacheNames,\n cacheWrapper: cacheWrapper,\n fetchWrapper: fetchWrapper,\n getFriendlyURL: getFriendlyURL,\n logger: defaultExport,\n registerQuotaErrorCallback: registerQuotaErrorCallback\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExports = Object.assign(defaultExport$1, {\n LOG_LEVELS,\n _private\n });\n\n return finalExports;\n\n}());\n"],"file":"workbox-core.dev.js"}
@@ -1,3 +0,0 @@
1
- self.babelHelpers={asyncToGenerator:function(e){return function(){var r=e.apply(this,arguments);return new Promise(function(e,t){return function n(o,i){try{var l=r[o](i),c=l.value}catch(e){return void t(e)}if(!l.done)return Promise.resolve(c).then(function(e){n("next",e)},function(e){n("throw",e)});e(c)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.4.1"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const r=(e,...r)=>{let t=e;return r.length>0&&(t+=` :: ${JSON.stringify(r)}`),t};class t extends Error{constructor(e,t){super(r(e,t)),this.name=e,this.details=t}}const n={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},o=e=>[n.prefix,e,n.suffix].filter(e=>e.length>0).join("-"),i={updateDetails:e=>{Object.keys(n).forEach(r=>{void 0!==e[r]&&(n[r]=e[r])})},getGoogleAnalyticsName:e=>e||o(n.googleAnalytics),getPrecacheName:e=>e||o(n.precache),getRuntimeName:e=>e||o(n.runtime)},l=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let c=(()=>e.warn)();const u=e=>c<=e,s=e=>c=e,a=()=>c,f=e.error,d=function(r,t,n){const o=0===r.indexOf("group")?f:e[r];if(!u(o))return;if(!n||"groupCollapsed"===r&&l)return void console[r](...t);const i=["%cworkbox",`background: ${n}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...i,...t)},h=()=>{u(f)&&console.groupEnd()},p={groupEnd:h,unprefixed:{groupEnd:h}},b={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};var y,g;Object.keys(b).forEach(e=>(e=e,g=b[e],p[e]=((...r)=>d(e,r,g)),void(p.unprefixed[e]=((...r)=>d(e,r)))));var v=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:i.getGoogleAnalyticsName(),precache:i.getPrecacheName(),runtime:i.getRuntimeName()}}setCacheNameDetails(e){i.updateDetails(e)}get logLevel(){return a()}setLogLevel(r){if(r>e.silent||r<e.debug)throw new t("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:r});s(r)}};class w{constructor(e,r,{onupgradeneeded:t,onversionchange:n=this.e}={}){this.r=e,this.t=r,this.n=t,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(r,t){let n=!1;setTimeout(function(){n=!0,t(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.r,e.t);o.onerror=function(e){return t(o.error)},o.onupgradeneeded=function(r){n?(o.transaction.abort(),r.target.result.close()):e.n&&e.n(r)},o.onsuccess=function(t){const o=t.target.result;n?o.close():(o.onversionchange=e.e,r(o))}}),e})()}get(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("get",e,"readonly",...r)})()}add(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("add",e,"readwrite",...r)})()}put(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i("put",e,"readwrite",...r)})()}delete(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.i("delete",e,"readwrite",...r)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(r,t){const n=indexedDB.deleteDatabase(e.r);n.onerror=function(e){return t(e.target.error)},n.onblocked=function(){return t(new Error("Deletion was blocked."))},n.onsuccess=function(){return r()}})})()}getAll(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",r,t):yield n.getAllMatching(e,{query:r,count:t})})()}getAllMatching(e,r={}){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.transaction([e],"readonly",function(t,n){const o=t[e],i=r.index?o.index(r.index):o,l=[],c=r.query||null,u=r.direction||"next";i.openCursor(c,u).onsuccess=function(e){const t=e.target.result;if(t){const{primaryKey:e,key:o,value:i}=t;l.push(r.includeKeys?{primaryKey:e,key:o,value:i}:i),r.count&&l.length>=r.count?n(l):t.continue()}else n(l)}})})()}transaction(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const l=n.o.transaction(e,r);l.onerror=function(e){return i(e.target.error)},l.onabort=function(e){return i(e.target.error)},l.oncomplete=function(){return o()};const c={};for(const r of e)c[r]=l.objectStore(r);t(c,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),l.abort()})})})()}i(e,r,t,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([r],t,function(t,o){t[r][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}w.prototype.OPEN_TIMEOUT=2e3;var m="cacheDidUpdate",E="cacheWillUpdate",L="cachedResponseWillBeUsed",x="fetchDidFail",H="requestWillFetch",k=(e,r)=>e.filter(e=>r in e);let q=(D=babelHelpers.asyncToGenerator(function*(){for(const e of N)yield e()}),function(){return D.apply(this,arguments)});var D;const N=new Set;const O=e=>{const r=new URL(e,location);return r.origin===location.origin?r.pathname:r.href},R=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,n,o=[]){if(!n)throw new t("cache-put-with-no-response",{url:O(r.url)});let i=yield W(r,n,o);if(!i)return;const l=yield caches.open(e),c=k(o,m);let u=c.length>0?yield A(e,r):null;try{yield l.put(r,i)}catch(e){throw"QuotaExceededError"===e.name&&(yield q()),e}for(let t of c)yield t[m].call(t,{cacheName:e,request:r,oldResponse:u,newResponse:i})});return function(r,t,n){return e.apply(this,arguments)}})(),A=(P=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield(yield caches.open(e)).match(r,t);for(let i of n)L in i&&(o=yield i[L].call(i,{cacheName:e,request:r,matchOptions:t,cachedResponse:o}));return o}),function(e,r,t){return P.apply(this,arguments)});var P;const W=(S=babelHelpers.asyncToGenerator(function*(e,r,t){let n=r,o=!1;for(let r of t)if(E in r&&(o=!0,!(n=yield r[E].call(r,{request:e,response:n}))))break;return o||(n=n.ok?n:null),n||null}),function(e,r,t){return S.apply(this,arguments)});var S;const _={put:R,match:A},j={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,n=[],o){if(o){const e=yield o;if(e)return e}"string"==typeof e&&(e=new Request(e));const i=k(n,x),l=i.length>0?e.clone():null;try{for(let r of n)H in r&&(e=yield r[H].call(r,{request:e.clone()}))}catch(e){throw new t("plugin-error-request-will-fetch",{thrownError:e})}const c=e.clone();try{return yield fetch(e,r)}catch(e){for(let r of i)yield r[x].call(r,{error:e,originalRequest:l.clone(),request:c.clone()});throw e}});return function(r,t){return e.apply(this,arguments)}})()};var B=Object.freeze({DBWrapper:w,WorkboxError:t,assert:null,cacheNames:i,cacheWrapper:_,fetchWrapper:j,getFriendlyURL:O,logger:p,registerQuotaErrorCallback:function(e){N.add(e)}});return Object.assign(v,{LOG_LEVELS:e,_private:B})}();
2
-
3
- //# sourceMappingURL=workbox-core.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["self.babelHelpers={asyncToGenerator:function(e){return function(){var r=e.apply(this,arguments);return new Promise(function(e,t){return function n(o,i){try{var l=r[o](i),c=l.value}catch(e){return void t(e)}if(!l.done)return Promise.resolve(c).then(function(e){n(\"next\",e)},function(e){n(\"throw\",e)});e(c)}(\"next\")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){\"use strict\";try{self.workbox.v[\"workbox:core:3.4.1\"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const r=(e,...r)=>{let t=e;return r.length>0&&(t+=` :: ${JSON.stringify(r)}`),t};class t extends Error{constructor(e,t){super(r(e,t)),this.name=e,this.details=t}}const n={prefix:\"workbox\",suffix:self.registration.scope,googleAnalytics:\"googleAnalytics\",precache:\"precache\",runtime:\"runtime\"},o=e=>[n.prefix,e,n.suffix].filter(e=>e.length>0).join(\"-\"),i={updateDetails:e=>{Object.keys(n).forEach(r=>{void 0!==e[r]&&(n[r]=e[r])})},getGoogleAnalyticsName:e=>e||o(n.googleAnalytics),getPrecacheName:e=>e||o(n.precache),getRuntimeName:e=>e||o(n.runtime)},l=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let c=(()=>e.warn)();const u=e=>c<=e,s=e=>c=e,a=()=>c,f=e.error,d=function(r,t,n){const o=0===r.indexOf(\"group\")?f:e[r];if(!u(o))return;if(!n||\"groupCollapsed\"===r&&l)return void console[r](...t);const i=[\"%cworkbox\",`background: ${n}; color: white; padding: 2px 0.5em; `+\"border-radius: 0.5em;\"];console[r](...i,...t)},h=()=>{u(f)&&console.groupEnd()},p={groupEnd:h,unprefixed:{groupEnd:h}},b={debug:\"#7f8c8d\",log:\"#2ecc71\",warn:\"#f39c12\",error:\"#c0392b\",groupCollapsed:\"#3498db\"};var y,g;Object.keys(b).forEach(e=>(e=e,g=b[e],p[e]=((...r)=>d(e,r,g)),void(p.unprefixed[e]=((...r)=>d(e,r)))));var v=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:i.getGoogleAnalyticsName(),precache:i.getPrecacheName(),runtime:i.getRuntimeName()}}setCacheNameDetails(e){i.updateDetails(e)}get logLevel(){return a()}setLogLevel(r){if(r>e.silent||r<e.debug)throw new t(\"invalid-value\",{paramName:\"logLevel\",validValueDescription:\"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.\",value:r});s(r)}};class w{constructor(e,r,{onupgradeneeded:t,onversionchange:n=this.e}={}){this.r=e,this.t=r,this.n=t,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(r,t){let n=!1;setTimeout(function(){n=!0,t(new Error(\"The open request was blocked and timed out\"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.r,e.t);o.onerror=function(e){return t(o.error)},o.onupgradeneeded=function(r){n?(o.transaction.abort(),r.target.result.close()):e.n&&e.n(r)},o.onsuccess=function(t){const o=t.target.result;n?o.close():(o.onversionchange=e.e,r(o))}}),e})()}get(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i(\"get\",e,\"readonly\",...r)})()}add(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i(\"add\",e,\"readwrite\",...r)})()}put(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.i(\"put\",e,\"readwrite\",...r)})()}delete(e,...r){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.i(\"delete\",e,\"readwrite\",...r)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(r,t){const n=indexedDB.deleteDatabase(e.r);n.onerror=function(e){return t(e.target.error)},n.onblocked=function(){return t(new Error(\"Deletion was blocked.\"))},n.onsuccess=function(){return r()}})})()}getAll(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return\"getAll\"in IDBObjectStore.prototype?yield n.i(\"getAll\",e,\"readonly\",r,t):yield n.getAllMatching(e,{query:r,count:t})})()}getAllMatching(e,r={}){var t=this;return babelHelpers.asyncToGenerator(function*(){return yield t.transaction([e],\"readonly\",function(t,n){const o=t[e],i=r.index?o.index(r.index):o,l=[],c=r.query||null,u=r.direction||\"next\";i.openCursor(c,u).onsuccess=function(e){const t=e.target.result;if(t){const{primaryKey:e,key:o,value:i}=t;l.push(r.includeKeys?{primaryKey:e,key:o,value:i}:i),r.count&&l.length>=r.count?n(l):t.continue()}else n(l)}})})()}transaction(e,r,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const l=n.o.transaction(e,r);l.onerror=function(e){return i(e.target.error)},l.onabort=function(e){return i(e.target.error)},l.oncomplete=function(){return o()};const c={};for(const r of e)c[r]=l.objectStore(r);t(c,function(e){return o(e)},function(){i(new Error(\"The transaction was manually aborted\")),l.abort()})})})()}i(e,r,t,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([r],t,function(t,o){t[r][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}w.prototype.OPEN_TIMEOUT=2e3;var m=\"cacheDidUpdate\",E=\"cacheWillUpdate\",L=\"cachedResponseWillBeUsed\",x=\"fetchDidFail\",H=\"requestWillFetch\",k=(e,r)=>e.filter(e=>r in e);let q=(D=babelHelpers.asyncToGenerator(function*(){for(const e of N)yield e()}),function(){return D.apply(this,arguments)});var D;const N=new Set;const O=e=>{const r=new URL(e,location);return r.origin===location.origin?r.pathname:r.href},R=(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,n,o=[]){if(!n)throw new t(\"cache-put-with-no-response\",{url:O(r.url)});let i=yield W(r,n,o);if(!i)return;const l=yield caches.open(e),c=k(o,m);let u=c.length>0?yield A(e,r):null;try{yield l.put(r,i)}catch(e){throw\"QuotaExceededError\"===e.name&&(yield q()),e}for(let t of c)yield t[m].call(t,{cacheName:e,request:r,oldResponse:u,newResponse:i})});return function(r,t,n){return e.apply(this,arguments)}})(),A=(P=babelHelpers.asyncToGenerator(function*(e,r,t,n=[]){let o=yield(yield caches.open(e)).match(r,t);for(let i of n)L in i&&(o=yield i[L].call(i,{cacheName:e,request:r,matchOptions:t,cachedResponse:o}));return o}),function(e,r,t){return P.apply(this,arguments)});var P;const W=(S=babelHelpers.asyncToGenerator(function*(e,r,t){let n=r,o=!1;for(let r of t)if(E in r&&(o=!0,!(n=yield r[E].call(r,{request:e,response:n}))))break;return o||(n=n.ok?n:null),n||null}),function(e,r,t){return S.apply(this,arguments)});var S;const _={put:R,match:A},j={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*(e,r,n=[],o){if(o){const e=yield o;if(e)return e}\"string\"==typeof e&&(e=new Request(e));const i=k(n,x),l=i.length>0?e.clone():null;try{for(let r of n)H in r&&(e=yield r[H].call(r,{request:e.clone()}))}catch(e){throw new t(\"plugin-error-request-will-fetch\",{thrownError:e})}const c=e.clone();try{return yield fetch(e,r)}catch(e){for(let r of i)yield r[x].call(r,{error:e,originalRequest:l.clone(),request:c.clone()});throw e}});return function(r,t){return e.apply(this,arguments)}})()};var B=Object.freeze({DBWrapper:w,WorkboxError:t,assert:null,cacheNames:i,cacheWrapper:_,fetchWrapper:j,getFriendlyURL:O,logger:p,registerQuotaErrorCallback:function(e){N.add(e)}});return Object.assign(v,{LOG_LEVELS:e,_private:B})}();\n"],"file":"workbox-core.prod.js"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.navigationPreload = (function (exports,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:navigation-preload:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @return {boolean} Whether or not the current browser supports enabling\n * navigation preload.\n *\n * @memberof workbox.navigationPreload\n */\n function isSupported() {\n return Boolean(self.registration && self.registration.navigationPreload);\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will enable it.\n *\n * @param {string} [headerValue] Optionally, allows developers to\n * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)\n * the value of the `Service-Worker-Navigation-Preload` header which will be\n * sent to the server when making the navigation request.\n *\n * @memberof workbox.navigationPreload\n */\n function enable(headerValue) {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.enable().then(() => {\n // Defaults to Service-Worker-Navigation-Preload: true if not set.\n if (headerValue) {\n self.registration.navigationPreload.setHeaderValue(headerValue);\n }\n\n {\n logger_mjs.logger.log(`Navigation preload is enabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.enable = enable;\n exports.isSupported = isSupported;\n\n return exports;\n\n}({},workbox.core._private));\n"],"file":"workbox-navigation-preload.dev.js"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){"use strict";try{self.workbox.v["workbox:navigation-preload:3.4.1"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.enable=function(t){e()&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});
2
-
3
- //# sourceMappingURL=workbox-navigation-preload.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){\"use strict\";try{self.workbox.v[\"workbox:navigation-preload:3.4.1\"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.enable=function(t){e()&&self.addEventListener(\"activate\",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});\n"],"file":"workbox-navigation-preload.prod.js"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-precaching/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,WorkboxError_mjs,fetchWrapper_mjs,cacheWrapper_mjs,assert_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:precaching:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Used as a consistent way of referencing a URL to precache.\n *\n * @private\n * @memberof module:workbox-precaching\n */\n class PrecacheEntry {\n /**\n * This class ensures all cache list entries are consistent and\n * adds cache busting if required.\n *\n * @param {*} originalInput\n * @param {string} url\n * @param {string} revision\n * @param {boolean} shouldCacheBust\n */\n constructor(originalInput, url, revision, shouldCacheBust) {\n this._originalInput = originalInput;\n this._entryId = url;\n this._revision = revision;\n const requestAsCacheKey = new Request(url, { credentials: 'same-origin' });\n this._cacheRequest = requestAsCacheKey;\n this._networkRequest = shouldCacheBust ? this._cacheBustRequest(requestAsCacheKey) : requestAsCacheKey;\n }\n\n /**\n * This method will either use Request.cache option OR append a cache\n * busting parameter to the URL.\n *\n * @param {Request} request The request to cache bust\n * @return {Request} A cachebusted Request\n *\n * @private\n */\n _cacheBustRequest(request) {\n let url = request.url;\n const requestOptions = {\n credentials: 'same-origin'\n };\n if ('cache' in Request.prototype) {\n // Make use of the Request cache mode where we can.\n // Reload skips the HTTP cache for outgoing requests and updates\n // the cache with the returned response.\n requestOptions.cache = 'reload';\n } else {\n const parsedURL = new URL(url, location);\n\n // This is done so the minifier can mangle 'global.encodeURIComponent'\n const _encodeURIComponent = encodeURIComponent;\n\n parsedURL.search += (parsedURL.search ? '&' : '') + _encodeURIComponent(`_workbox-cache-bust`) + '=' + _encodeURIComponent(this._revision);\n url = parsedURL.toString();\n }\n\n return new Request(url, requestOptions);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Allows minifier to mangle this name\n const REVISON_IDB_FIELD = 'revision';\n const URL_IDB_FIELD = 'url';\n const DB_STORE_NAME = 'precached-details-models';\n /**\n * This model will track the relevant information of entries that\n * are cached and their matching revision details.\n *\n * @private\n */\n class PrecachedDetailsModel {\n /**\n * Construct a new model for a specific cache.\n *\n * @param {string} dbName\n * @private\n */\n constructor(dbName) {\n // This ensures the db name contains only letters, numbers, '-', '_' and '$'\n const filteredDBName = dbName.replace(/[^\\w-]/g, '_');\n this._db = new DBWrapper_mjs.DBWrapper(filteredDBName, 2, {\n onupgradeneeded: this._handleUpgrade\n });\n }\n\n /**\n * Should perform an upgrade of indexedDB.\n *\n * @param {Event} evt\n *\n * @private\n */\n _handleUpgrade(evt) {\n const db = evt.target.result;\n if (evt.oldVersion < 2) {\n // IndexedDB version 1 used both 'workbox-precaching' and\n // 'precached-details-model' before upgrading to version 2.\n // Delete them and create a new store with latest schema.\n if (db.objectStoreNames.contains('workbox-precaching')) {\n db.deleteObjectStore('workbox-precaching');\n }\n if (db.objectStoreNames.contains(DB_STORE_NAME)) {\n db.deleteObjectStore(DB_STORE_NAME);\n }\n }\n db.createObjectStore(DB_STORE_NAME);\n }\n\n /**\n * Check if an entry is already cached. Returns false if\n * the entry isn't cached or the revision has changed.\n *\n * @param {string} cacheName\n * @param {PrecacheEntry} precacheEntry\n * @return {boolean}\n *\n * @private\n */\n _isEntryCached(cacheName, precacheEntry) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const revisionDetails = yield _this._getRevision(precacheEntry._entryId);\n if (revisionDetails !== precacheEntry._revision) {\n return false;\n }\n\n const openCache = yield caches.open(cacheName);\n const cachedResponse = yield openCache.match(precacheEntry._cacheRequest);\n return !!cachedResponse;\n })();\n }\n\n /**\n * @return {Promise<Array>}\n *\n * @private\n */\n _getAllEntries() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._db.getAllMatching(DB_STORE_NAME, {\n includeKeys: true\n });\n })();\n }\n\n /**\n * Get the current revision details.\n *\n * @param {Object} entryId\n * @return {Promise<string|null>}\n *\n * @private\n */\n _getRevision(entryId) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const data = yield _this3._db.get(DB_STORE_NAME, entryId);\n return data ? data[REVISON_IDB_FIELD] : null;\n })();\n }\n\n /**\n * Add an entry to the details model.\n *\n * @param {PrecacheEntry} precacheEntry\n *\n * @private\n */\n _addEntry(precacheEntry) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this4._db.put(DB_STORE_NAME, {\n [REVISON_IDB_FIELD]: precacheEntry._revision,\n [URL_IDB_FIELD]: precacheEntry._cacheRequest.url\n }, precacheEntry._entryId);\n })();\n }\n\n /**\n * Delete entry from details model.\n *\n * @param {string} entryId\n *\n * @private\n */\n _deleteEntry(entryId) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._db.delete(DB_STORE_NAME, entryId);\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This method will print out a warning if a precache entry doesn't have\n * a `revision` value.\n *\n * This is common if the asset if revisioned in the url like `index.1234.css`.\n *\n * @param {Map} entriesMap\n *\n * @private\n * @memberof module:workbox-preaching\n */\n var showWarningsIfNeeded = (entriesMap => {\n const urlOnlyEntries = [];\n entriesMap.forEach(entry => {\n if (typeof entry === 'string' || !entry._originalInput.revision) {\n urlOnlyEntries.push(entry._originalInput);\n }\n });\n\n if (urlOnlyEntries.length === 0) {\n // No warnings needed.\n return;\n }\n\n logger_mjs.logger.groupCollapsed('Are your precached assets revisioned?');\n\n const urlsList = urlOnlyEntries.map(urlOnlyEntry => {\n return ` - ${JSON.stringify(urlOnlyEntry)}`;\n }).join(`\\n`);\n\n logger_mjs.logger.warn(`The following precache entries might not be revisioned:` + `\\n\\n` + urlsList + `\\n\\n`);\n\n logger_mjs.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`);\n\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {string} groupTitle\n * @param {Array<PrecacheEntry>} entries\n *\n * @private\n */\n const _nestedGroup = (groupTitle, entries) => {\n if (entries.length === 0) {\n return;\n }\n\n logger_mjs.logger.groupCollapsed(groupTitle);\n\n entries.forEach(entry => {\n logger_mjs.logger.log(entry._originalInput);\n });\n\n logger_mjs.logger.groupEnd();\n };\n\n /**\n * @param {Array<Object>} entriesToPrecache\n * @param {Array<Object>} alreadyPrecachedEntries\n *\n * @private\n * @memberof module:workbox-precachig\n */\n var printInstallDetails = ((entriesToPrecache, alreadyPrecachedEntries) => {\n // Goal is to print the message:\n // Precaching X files.\n // Or:\n // Precaching X files. Y files were cached and up-to-date.\n\n const precachedCount = entriesToPrecache.length;\n const alreadyPrecachedCount = alreadyPrecachedEntries.length;\n let printText = `Precaching ${precachedCount} file${precachedCount === 1 ? '' : 's'}.`;\n if (alreadyPrecachedCount > 0) {\n printText += ` ${alreadyPrecachedCount} ` + `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;\n }\n\n logger_mjs.logger.groupCollapsed(printText);\n\n _nestedGroup(`View precached URLs.`, entriesToPrecache);\n _nestedGroup(`View URLs that were already precached.`, alreadyPrecachedEntries);\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const logGroup = (groupTitle, urls) => {\n logger_mjs.logger.groupCollapsed(groupTitle);\n\n urls.forEach(url => {\n logger_mjs.logger.log(url);\n });\n\n logger_mjs.logger.groupEnd();\n };\n\n /**\n * @param {Array<string>} deletedCacheRequests\n * @param {Array<string>} deletedRevisionDetails\n *\n * @private\n * @memberof module:workbox-precachig\n */\n var printCleanupDetails = ((deletedCacheRequests, deletedRevisionDetails) => {\n if (deletedCacheRequests.length === 0 && deletedRevisionDetails.length === 0) {\n return;\n }\n\n const cacheDeleteCount = deletedCacheRequests.length;\n const revisionDeleteCount = deletedRevisionDetails.length;\n\n const cacheDeleteText = `${cacheDeleteCount} cached ` + `request${cacheDeleteCount === 1 ? ' was' : 's were'} deleted`;\n const revisionDeleteText = `${revisionDeleteCount} ` + `${revisionDeleteCount === 1 ? 'entry' : 'entries'} ` + `${revisionDeleteCount === 1 ? 'was' : 'were'} deleted from IndexedDB.`;\n\n logger_mjs.logger.groupCollapsed(`During precaching cleanup, ${cacheDeleteText} and ${revisionDeleteText}`);\n\n logGroup('Deleted Cache Requests', deletedCacheRequests);\n logGroup('Revision Details Deleted from DB', deletedRevisionDetails);\n\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {Response} response\n * @return {Response}\n *\n * @private\n * @memberof module:workbox-precachig\n */\n const cleanRedirect = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (response) {\n const clonedResponse = response.clone();\n\n // Not all browsers support the Response.body stream, so fall back\n // to reading the entire body into memory as a blob.\n const bodyPromise = 'body' in clonedResponse ? Promise.resolve(clonedResponse.body) : clonedResponse.blob();\n\n const body = yield bodyPromise;\n\n // new Response() is happy when passed either a stream or a Blob.\n return new Response(body, ['headers', 'status', 'statusText'].map(function (key) {\n return clonedResponse[key];\n }));\n });\n\n return function cleanRedirect(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Performs efficient precaching of assets.\n *\n * @memberof workbox.precaching\n */\n class PrecacheController {\n /**\n * Create a new PrecacheController.\n *\n * @param {string} cacheName\n */\n constructor(cacheName) {\n this._cacheName = cacheNames_mjs.cacheNames.getPrecacheName(cacheName);\n this._entriesToCacheMap = new Map();\n this._precacheDetailsModel = new PrecachedDetailsModel(this._cacheName);\n }\n\n /**\n * This method will add items to the precache list, removing duplicates\n * and ensuring the information is valid.\n *\n * @param {\n * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>\n * } entries Array of entries to\n * precache.\n */\n addToCacheList(entries) {\n {\n assert_mjs.assert.isArray(entries, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'addToCacheList',\n paramName: 'entries'\n });\n }\n\n entries.map(userEntry => {\n this._addEntryToCacheList(this._parseEntry(userEntry));\n });\n }\n\n /**\n * This method returns a precache entry.\n *\n * @private\n * @param {string|Object} input\n * @return {PrecacheEntry}\n */\n _parseEntry(input) {\n switch (typeof input) {\n case 'string':\n {\n {\n if (input.length === 0) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n return new PrecacheEntry(input, input, input);\n }\n case 'object':\n {\n {\n if (!input || !input.url) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n return new PrecacheEntry(input, input.url, input.revision || input.url, !!input.revision);\n }\n default:\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n /**\n * Adds an entry to the precache list, accounting for possible duplicates.\n *\n * @private\n * @param {PrecacheEntry} entryToAdd\n */\n _addEntryToCacheList(entryToAdd) {\n // Check if the entry is already part of the map\n const existingEntry = this._entriesToCacheMap.get(entryToAdd._entryId);\n if (!existingEntry) {\n this._entriesToCacheMap.set(entryToAdd._entryId, entryToAdd);\n return;\n }\n\n // Duplicates are fine, but make sure the revision information\n // is the same.\n if (existingEntry._revision !== entryToAdd._revision) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-conflicting-entries', {\n firstEntry: existingEntry._originalInput,\n secondEntry: entryToAdd._originalInput\n });\n }\n }\n\n /**\n * Call this method from a service work install event to start\n * precaching assets.\n *\n * @param {Object} options\n * @param {boolean} options.suppressWarnings Suppress warning messages.\n * @param {Array<Object>} options.plugins Plugins to be used for fetching\n * and caching during install.\n * @return {\n * Promise<workbox.precaching.InstallResult>}\n */\n install(options = {}) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n if (options.suppressWarnings !== true) {\n showWarningsIfNeeded(_this._entriesToCacheMap);\n }\n\n if (options.plugins) {\n assert_mjs.assert.isArray(options.plugins, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'install',\n paramName: 'plugins'\n });\n }\n }\n\n // Empty the temporary cache.\n // NOTE: We remove all entries instead of deleting the cache as the cache\n // may be marked for deletion but still exist until a later stage\n // resulting in unexpected behavior of being deletect when all references\n // are dropped.\n // https://github.com/GoogleChrome/workbox/issues/1368\n const tempCache = yield caches.open(_this._getTempCacheName());\n const requests = yield tempCache.keys();\n yield Promise.all(requests.map(function (request) {\n return tempCache.delete(request);\n }));\n\n const entriesToPrecache = [];\n const entriesAlreadyPrecached = [];\n\n for (const precacheEntry of _this._entriesToCacheMap.values()) {\n if (yield _this._precacheDetailsModel._isEntryCached(_this._cacheName, precacheEntry)) {\n entriesAlreadyPrecached.push(precacheEntry);\n } else {\n entriesToPrecache.push(precacheEntry);\n }\n }\n\n // Wait for all requests to be cached.\n yield Promise.all(entriesToPrecache.map(function (precacheEntry) {\n return _this._cacheEntryInTemp(precacheEntry, options.plugins);\n }));\n\n {\n printInstallDetails(entriesToPrecache, entriesAlreadyPrecached);\n }\n\n return {\n updatedEntries: entriesToPrecache,\n notUpdatedEntries: entriesAlreadyPrecached\n };\n })();\n }\n\n /**\n * Takes the current set of temporary files and moves them to the final\n * cache, deleting the temporary cache once copying is complete.\n *\n * @param {Object} options\n * @param {Array<Object>} options.plugins Plugins to be used for fetching\n * and caching during install.\n * @return {\n * Promise<workbox.precaching.CleanupResult>}\n * Resolves with an object containing details of the deleted cache requests\n * and precache revision details.\n */\n activate(options = {}) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const tempCache = yield caches.open(_this2._getTempCacheName());\n\n const requests = yield tempCache.keys();\n // Process each request/response one at a time, deleting the temporary entry\n // when done, to help avoid triggering quota errors.\n for (const request of requests) {\n const response = yield tempCache.match(request);\n yield cacheWrapper_mjs.cacheWrapper.put(_this2._cacheName, request, response, options.plugins);\n yield tempCache.delete(request);\n }\n\n return _this2._cleanup();\n })();\n }\n\n /**\n * Returns the name of the temporary cache.\n *\n * @return {string}\n *\n * @private\n */\n _getTempCacheName() {\n return `${this._cacheName}-temp`;\n }\n\n /**\n * Requests the entry and saves it to the cache if the response\n * is valid.\n *\n * @private\n * @param {BaseCacheEntry} precacheEntry The entry to fetch and cache.\n * @param {Array<Object>} plugins Array of plugins to apply to fetch and\n * caching.\n * @return {Promise<boolean>} Returns a promise that resolves once the entry\n * has been fetched and cached or skipped if no update is needed. The\n * promise resolves with true if the entry was cached / updated and\n * false if the entry is already cached and up-to-date.\n */\n _cacheEntryInTemp(precacheEntry, plugins) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n let response = yield fetchWrapper_mjs.fetchWrapper.fetch(precacheEntry._networkRequest, null, plugins);\n\n if (response.redirected) {\n response = yield cleanRedirect(response);\n }\n\n yield cacheWrapper_mjs.cacheWrapper.put(_this3._getTempCacheName(), precacheEntry._cacheRequest, response, plugins);\n\n yield _this3._precacheDetailsModel._addEntry(precacheEntry);\n\n return true;\n })();\n }\n\n /**\n * Compare the URLs and determines which assets are no longer required\n * in the cache.\n *\n * This should be called in the service worker activate event.\n *\n * @return {\n * Promise<workbox.precaching.CleanupResult>}\n * Resolves with an object containing details of the deleted cache requests\n * and precache revision details.\n *\n * @private\n */\n _cleanup() {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const expectedCacheUrls = [];\n _this4._entriesToCacheMap.forEach(function (entry) {\n const fullUrl = new URL(entry._cacheRequest.url, location).toString();\n expectedCacheUrls.push(fullUrl);\n });\n\n const [deletedCacheRequests, deletedRevisionDetails] = yield Promise.all([_this4._cleanupCache(expectedCacheUrls), _this4._cleanupDetailsModel(expectedCacheUrls)]);\n\n {\n printCleanupDetails(deletedCacheRequests, deletedRevisionDetails);\n }\n\n return {\n deletedCacheRequests,\n deletedRevisionDetails\n };\n })();\n }\n\n /**\n * Goes through all the cache entries and removes any that are\n * outdated.\n *\n * @private\n * @param {Array<string>} expectedCacheUrls Array of URLs that are\n * expected to be cached.\n * @return {Promise<Array<string>>} Resolves to an array of URLs\n * of cached requests that were deleted.\n */\n _cleanupCache(expectedCacheUrls) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (!(yield caches.has(_this5._cacheName))) {\n // Cache doesn't exist, so nothing to delete\n return [];\n }\n\n const cache = yield caches.open(_this5._cacheName);\n const cachedRequests = yield cache.keys();\n const cachedRequestsToDelete = cachedRequests.filter(function (cachedRequest) {\n return !expectedCacheUrls.includes(new URL(cachedRequest.url, location).toString());\n });\n\n yield Promise.all(cachedRequestsToDelete.map(function (cacheUrl) {\n return cache.delete(cacheUrl);\n }));\n\n return cachedRequestsToDelete.map(function (request) {\n return request.url;\n });\n })();\n }\n\n /**\n * Goes through all entries in indexedDB and removes any that are outdated.\n *\n * @private\n * @param {Array<string>} expectedCacheUrls Array of URLs that are\n * expected to be cached.\n * @return {Promise<Array<string>>} Resolves to an array of URLs removed\n * from indexedDB.\n */\n _cleanupDetailsModel(expectedCacheUrls) {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const revisionedEntries = yield _this6._precacheDetailsModel._getAllEntries();\n const detailsToDelete = revisionedEntries.filter(function (entry) {\n const fullUrl = new URL(entry.value.url, location).toString();\n return !expectedCacheUrls.includes(fullUrl);\n });\n\n yield Promise.all(detailsToDelete.map(function (entry) {\n return _this6._precacheDetailsModel._deleteEntry(entry.primaryKey);\n }));\n return detailsToDelete.map(function (entry) {\n return entry.value.url;\n });\n })();\n }\n\n /**\n * Returns an array of fully qualified URL's that will be precached.\n *\n * @return {Array<string>} An array of URLs.\n */\n getCachedUrls() {\n return Array.from(this._entriesToCacheMap.keys()).map(url => new URL(url, location).href);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n PrecacheController: PrecacheController\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n {\n assert_mjs.assert.isSwEnv('workbox-precaching');\n }\n\n let installActivateListenersAdded = false;\n let fetchListenersAdded = false;\n let suppressWarnings = false;\n let plugins = [];\n\n const cacheName = cacheNames_mjs.cacheNames.getPrecacheName();\n const precacheController = new PrecacheController(cacheName);\n\n const _removeIgnoreUrlParams = (origUrlObject, ignoreUrlParametersMatching) => {\n // Exclude initial '?'\n const searchString = origUrlObject.search.slice(1);\n\n // Split into an array of 'key=value' strings\n const keyValueStrings = searchString.split('&');\n const keyValuePairs = keyValueStrings.map(keyValueString => {\n // Split each 'key=value' string into a [key, value] array\n return keyValueString.split('=');\n });\n const filteredKeyValuesPairs = keyValuePairs.filter(keyValuePair => {\n return ignoreUrlParametersMatching.every(ignoredRegex => {\n // Return true iff the key doesn't match any of the regexes.\n return !ignoredRegex.test(keyValuePair[0]);\n });\n });\n const filteredStrings = filteredKeyValuesPairs.map(keyValuePair => {\n // Join each [key, value] array into a 'key=value' string\n return keyValuePair.join('=');\n });\n\n // Join the array of 'key=value' strings into a string with '&' in\n // between each\n const urlClone = new URL(origUrlObject);\n urlClone.search = filteredStrings.join('&');\n return urlClone;\n };\n\n /**\n * This function will take the request URL and manipulate it based on the\n * configuration options.\n *\n * @param {string} url\n * @param {Object} options\n * @return {string|null} Returns the URL in the cache that matches the request\n * if available, other null.\n *\n * @private\n */\n const _getPrecachedUrl = (url, {\n ignoreUrlParametersMatching = [/^utm_/],\n directoryIndex = 'index.html',\n cleanUrls = true,\n urlManipulation = null\n } = {}) => {\n const urlObject = new URL(url, location);\n\n // Change '/some-url#123' => '/some-url'\n urlObject.hash = '';\n\n const urlWithoutIgnoredParams = _removeIgnoreUrlParams(urlObject, ignoreUrlParametersMatching);\n\n let urlsToAttempt = [\n // Test the URL that was fetched\n urlObject,\n // Test the URL without search params\n urlWithoutIgnoredParams];\n\n // Test the URL with a directory index\n if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {\n const directoryUrl = new URL(urlWithoutIgnoredParams);\n directoryUrl.pathname += directoryIndex;\n urlsToAttempt.push(directoryUrl);\n }\n\n // Test the URL with a '.html' extension\n if (cleanUrls) {\n const cleanUrl = new URL(urlWithoutIgnoredParams);\n cleanUrl.pathname += '.html';\n urlsToAttempt.push(cleanUrl);\n }\n\n if (urlManipulation) {\n const additionalUrls = urlManipulation({ url: urlObject });\n urlsToAttempt = urlsToAttempt.concat(additionalUrls);\n }\n\n const cachedUrls = precacheController.getCachedUrls();\n for (const possibleUrl of urlsToAttempt) {\n if (cachedUrls.indexOf(possibleUrl.href) !== -1) {\n // It's a perfect match\n {\n logger_mjs.logger.debug(`Precaching found a match for ` + getFriendlyURL_mjs.getFriendlyURL(possibleUrl.toString()));\n }\n return possibleUrl.href;\n }\n }\n\n return null;\n };\n\n const moduleExports = {};\n\n /**\n * Add items to the precache list, removing any duplicates and\n * store the files in the\n * [\"precache cache\"]{@link module:workbox-core.cacheNames} when the service\n * worker installs.\n *\n * This method can be called multiple times.\n *\n * Please note: This method **will not** serve any of the cached files for you,\n * it only precaches files. To respond to a network request you call\n * [addRoute()]{@link module:workbox-precaching.addRoute}.\n *\n * If you have a single array of files to precache, you can just call\n * [precacheAndRoute()]{@link module:workbox-precaching.precacheAndRoute}.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n *\n * @alias workbox.precaching.precache\n */\n moduleExports.precache = entries => {\n precacheController.addToCacheList(entries);\n\n if (installActivateListenersAdded || entries.length <= 0) {\n return;\n }\n\n installActivateListenersAdded = true;\n self.addEventListener('install', event => {\n event.waitUntil(precacheController.install({\n suppressWarnings,\n plugins\n }));\n });\n self.addEventListener('activate', event => {\n event.waitUntil(precacheController.activate({\n plugins\n }));\n });\n };\n\n /**\n * Add a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * @param {Object} options\n * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n * check cache entries for a URLs ending with '/' to see if there is a hit when\n * appending the `directoryIndex` value.\n * @param {Array<RegExp>} [options.ignoreUrlParametersMatching=[/^utm_/]] An\n * array of regex's to remove search params when looking for a cache match.\n * @param {boolean} [options.cleanUrls=true] The `cleanUrls` option will\n * check the cache for the URL with a `.html` added to the end of the end.\n * @param {workbox.precaching~urlManipulation} [options.urlManipulation]\n * This is a function that should take a URL and return an array of\n * alternative URL's that should be checked for precache matches.\n *\n * @alias workbox.precaching.addRoute\n */\n moduleExports.addRoute = options => {\n if (fetchListenersAdded) {\n // TODO: Throw error here.\n return;\n }\n\n fetchListenersAdded = true;\n self.addEventListener('fetch', event => {\n const precachedUrl = _getPrecachedUrl(event.request.url, options);\n if (!precachedUrl) {\n {\n logger_mjs.logger.debug(`Precaching found no match for ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));\n }\n return;\n }\n\n let responsePromise = caches.open(cacheName).then(cache => {\n return cache.match(precachedUrl);\n }).then(cachedResponse => {\n if (cachedResponse) {\n return cachedResponse;\n }\n\n // Fall back to the network if we don't have a cached response (perhaps\n // due to manual cache cleanup).\n {\n logger_mjs.logger.debug(`The precached response for ` + `${getFriendlyURL_mjs.getFriendlyURL(precachedUrl)} in ${cacheName} was not found. ` + `Falling back to the network instead.`);\n }\n\n return fetch(precachedUrl);\n });\n\n {\n responsePromise = responsePromise.then(response => {\n // Workbox is going to handle the route.\n // print the routing details to the console.\n logger_mjs.logger.groupCollapsed(`Precaching is responding to: ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));\n logger_mjs.logger.log(`Serving the precached url: ${precachedUrl}`);\n\n // The Request and Response objects contains a great deal of\n // information, hide it under a group in case developers want to see it.\n logger_mjs.logger.groupCollapsed(`View request details here.`);\n logger_mjs.logger.unprefixed.log(event.request);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupCollapsed(`View response details here.`);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n return response;\n });\n }\n event.respondWith(responsePromise);\n });\n };\n\n /**\n * This method will add entries to the precache list and add a route to\n * respond to fetch events.\n *\n * This is a convenience method that will call\n * [precache()]{@link module:workbox-precaching.precache} and\n * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n * @param {Object} options See\n * [addRoute() options]{@link module:workbox-precaching.addRoute}.\n *\n * @alias workbox.precaching.precacheAndRoute\n */\n moduleExports.precacheAndRoute = (entries, options) => {\n moduleExports.precache(entries);\n moduleExports.addRoute(options);\n };\n\n /**\n * Warnings will be logged if any of the precached assets are entered without\n * a `revision` property. This is extremely dangerous if the URL's aren't\n * revisioned. However, the warnings can be supressed with this method.\n *\n * @param {boolean} suppress\n *\n * @alias workbox.precaching.suppressWarnings\n */\n moduleExports.suppressWarnings = suppress => {\n suppressWarnings = suppress;\n };\n\n /**\n * Add plugins to precaching.\n *\n * @param {Array<Object>} newPlugins\n *\n * @alias workbox.precaching.addPlugins\n */\n moduleExports.addPlugins = newPlugins => {\n plugins = plugins.concat(newPlugins);\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(moduleExports, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-precaching.dev.js"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){"use strict";try{self.workbox.v["workbox:precaching:3.4.1"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t,{credentials:"same-origin"});this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={credentials:"same-origin"};if("cache"in Request.prototype)n.cache="reload";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?"&":"")+n("_workbox-cache-bust")+"="+n(this.n),t=e.toString()}return new Request(t,n)}}const c="revision",o="url",l="precached-details-models";class a{constructor(t){const n=t.replace(/[^\w-]/g,"_");this.c=new e.DBWrapper(n,2,{onupgradeneeded:this.o})}o(e){const t=e.target.result;e.oldVersion<2&&(t.objectStoreNames.contains("workbox-precaching")&&t.deleteObjectStore("workbox-precaching"),t.objectStoreNames.contains(l)&&t.deleteObjectStore(l)),t.createObjectStore(l)}l(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return(yield n.a(t.t))===t.n&&!!(yield(yield caches.open(e)).match(t.r))})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.c.getAllMatching(l,{includeKeys:!0})})()}a(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.c.get(l,e);return n?n[c]:null})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.put(l,{[c]:e.n,[o]:e.r.url},e.t)})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.delete(l,e)})()}}const u=(d=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield"body"in t?Promise.resolve(t.body):t.blob();return new Response(n,["headers","status","statusText"].map(function(e){return t[e]}))}),function(e){return d.apply(this,arguments)});var d;class h{constructor(e){this.f=t.cacheNames.getPrecacheName(e),this.y=new Map,this.p=new a(this.f)}addToCacheList(e){e.map(e=>{this.b(this.w(e))})}w(e){switch(typeof e){case"string":return new i(e,e,e);case"object":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new n.WorkboxError("add-to-cache-list-unexpected-type",{entry:e})}}b(e){const t=this.y.get(e.t);if(t){if(t.n!==e.n)throw new n.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:t.e,secondEntry:e.e})}else this.y.set(e.t,e)}install(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();yield Promise.all(r.map(function(e){return n.delete(e)}));const s=[],i=[];for(const e of t.y.values())(yield t.p.l(t.f,e))?i.push(e):s.push(e);return yield Promise.all(s.map(function(n){return t.R(n,e.plugins)})),{updatedEntries:s,notUpdatedEntries:i}})()}activate(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();for(const i of r){const r=yield n.match(i);yield s.cacheWrapper.put(t.f,i,r,e.plugins),yield n.delete(i)}return t.m()})()}g(){return`${this.f}-temp`}R(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){let i=yield r.fetchWrapper.fetch(e.s,null,t);return i.redirected&&(i=yield u(i)),yield s.cacheWrapper.put(n.g(),e.r,i,t),yield n.p.d(e),!0})()}m(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.y.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e._(t),e.U(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.f)))return[];const n=yield caches.open(t.f),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}U(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=(yield t.p.u()).filter(function(t){const n=new URL(t.value.url,location).toString();return!e.includes(n)});return yield Promise.all(n.map(function(e){return t.p.h(e.primaryKey)})),n.map(function(e){return e.value.url})})()}getCachedUrls(){return Array.from(this.y.keys()).map(e=>new URL(e,location).href)}}var f=Object.freeze({PrecacheController:h});let y=!1,p=!1,b=!1,w=[];const g=t.cacheNames.getPrecacheName(),R=new h(g),m=(e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n="index.html",cleanUrls:r=!0,urlManipulation:s=null}={})=>{const i=new URL(e,location);i.hash="";const c=((e,t)=>{const n=e.search.slice(1).split("&").map(e=>e.split("=")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join("=")),r=new URL(e);return r.search=n.join("&"),r})(i,t);let o=[i,c];if(n&&c.pathname.endsWith("/")){const e=new URL(c);e.pathname+=n,o.push(e)}if(r){const e=new URL(c);e.pathname+=".html",o.push(e)}if(s){const e=s({url:i});o=o.concat(e)}const l=R.getCachedUrls();for(const e of o)if(-1!==l.indexOf(e.href))return e.href;return null},v={precache:e=>{R.addToCacheList(e),y||e.length<=0||(y=!0,self.addEventListener("install",e=>{e.waitUntil(R.install({suppressWarnings:b,plugins:w}))}),self.addEventListener("activate",e=>{e.waitUntil(R.activate({plugins:w}))}))},addRoute:e=>{p||(p=!0,self.addEventListener("fetch",t=>{const n=m(t.request.url,e);if(!n)return;let r=caches.open(g).then(e=>e.match(n)).then(e=>e||fetch(n));t.respondWith(r)}))},precacheAndRoute:(e,t)=>{v.precache(e),v.addRoute(t)},suppressWarnings:e=>{b=e},addPlugins:e=>{w=w.concat(e)}};return Object.assign(v,f)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
2
-
3
- //# sourceMappingURL=workbox-precaching.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-precaching/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){\"use strict\";try{self.workbox.v[\"workbox:precaching:3.4.1\"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t,{credentials:\"same-origin\"});this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={credentials:\"same-origin\"};if(\"cache\"in Request.prototype)n.cache=\"reload\";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?\"&\":\"\")+n(\"_workbox-cache-bust\")+\"=\"+n(this.n),t=e.toString()}return new Request(t,n)}}const c=\"revision\",o=\"url\",l=\"precached-details-models\";class a{constructor(t){const n=t.replace(/[^\\w-]/g,\"_\");this.c=new e.DBWrapper(n,2,{onupgradeneeded:this.o})}o(e){const t=e.target.result;e.oldVersion<2&&(t.objectStoreNames.contains(\"workbox-precaching\")&&t.deleteObjectStore(\"workbox-precaching\"),t.objectStoreNames.contains(l)&&t.deleteObjectStore(l)),t.createObjectStore(l)}l(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return(yield n.a(t.t))===t.n&&!!(yield(yield caches.open(e)).match(t.r))})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.c.getAllMatching(l,{includeKeys:!0})})()}a(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.c.get(l,e);return n?n[c]:null})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.put(l,{[c]:e.n,[o]:e.r.url},e.t)})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.delete(l,e)})()}}const u=(d=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield\"body\"in t?Promise.resolve(t.body):t.blob();return new Response(n,[\"headers\",\"status\",\"statusText\"].map(function(e){return t[e]}))}),function(e){return d.apply(this,arguments)});var d;class h{constructor(e){this.f=t.cacheNames.getPrecacheName(e),this.y=new Map,this.p=new a(this.f)}addToCacheList(e){e.map(e=>{this.b(this.w(e))})}w(e){switch(typeof e){case\"string\":return new i(e,e,e);case\"object\":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new n.WorkboxError(\"add-to-cache-list-unexpected-type\",{entry:e})}}b(e){const t=this.y.get(e.t);if(t){if(t.n!==e.n)throw new n.WorkboxError(\"add-to-cache-list-conflicting-entries\",{firstEntry:t.e,secondEntry:e.e})}else this.y.set(e.t,e)}install(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();yield Promise.all(r.map(function(e){return n.delete(e)}));const s=[],i=[];for(const e of t.y.values())(yield t.p.l(t.f,e))?i.push(e):s.push(e);return yield Promise.all(s.map(function(n){return t.R(n,e.plugins)})),{updatedEntries:s,notUpdatedEntries:i}})()}activate(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();for(const i of r){const r=yield n.match(i);yield s.cacheWrapper.put(t.f,i,r,e.plugins),yield n.delete(i)}return t.m()})()}g(){return`${this.f}-temp`}R(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){let i=yield r.fetchWrapper.fetch(e.s,null,t);return i.redirected&&(i=yield u(i)),yield s.cacheWrapper.put(n.g(),e.r,i,t),yield n.p.d(e),!0})()}m(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.y.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e._(t),e.U(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.f)))return[];const n=yield caches.open(t.f),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}U(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=(yield t.p.u()).filter(function(t){const n=new URL(t.value.url,location).toString();return!e.includes(n)});return yield Promise.all(n.map(function(e){return t.p.h(e.primaryKey)})),n.map(function(e){return e.value.url})})()}getCachedUrls(){return Array.from(this.y.keys()).map(e=>new URL(e,location).href)}}var f=Object.freeze({PrecacheController:h});let y=!1,p=!1,b=!1,w=[];const g=t.cacheNames.getPrecacheName(),R=new h(g),m=(e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n=\"index.html\",cleanUrls:r=!0,urlManipulation:s=null}={})=>{const i=new URL(e,location);i.hash=\"\";const c=((e,t)=>{const n=e.search.slice(1).split(\"&\").map(e=>e.split(\"=\")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join(\"=\")),r=new URL(e);return r.search=n.join(\"&\"),r})(i,t);let o=[i,c];if(n&&c.pathname.endsWith(\"/\")){const e=new URL(c);e.pathname+=n,o.push(e)}if(r){const e=new URL(c);e.pathname+=\".html\",o.push(e)}if(s){const e=s({url:i});o=o.concat(e)}const l=R.getCachedUrls();for(const e of o)if(-1!==l.indexOf(e.href))return e.href;return null},v={precache:e=>{R.addToCacheList(e),y||e.length<=0||(y=!0,self.addEventListener(\"install\",e=>{e.waitUntil(R.install({suppressWarnings:b,plugins:w}))}),self.addEventListener(\"activate\",e=>{e.waitUntil(R.activate({plugins:w}))}))},addRoute:e=>{p||(p=!0,self.addEventListener(\"fetch\",t=>{const n=m(t.request.url,e);if(!n)return;let r=caches.open(g).then(e=>e.match(n)).then(e=>e||fetch(n));t.respondWith(r)}))},precacheAndRoute:(e,t)=>{v.precache(e),v.addRoute(t)},suppressWarnings:e=>{b=e},addPlugins:e=>{w=w.concat(e)}};return Object.assign(v,f)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);\n"],"file":"workbox-precaching.prod.js"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFriendlyURL_mjs,cacheNames_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:routing:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The default HTTP method, 'GET', used when there's no specific method\n * configured for a route.\n *\n * @type {string}\n *\n * @private\n */\n const defaultMethod = 'GET';\n\n /**\n * The list of valid HTTP methods associated with requests that could be routed.\n *\n * @type {Array<string>}\n *\n * @private\n */\n const validMethods = ['DELETE', 'GET', 'HEAD', 'POST', 'PUT'];\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {function()|Object} handler Either a function, or an object with a\n * 'handle' method.\n * @return {Object} An object with a handle method.\n *\n * @private\n */\n var normalizeHandler = (handler => {\n if (handler && typeof handler === 'object') {\n {\n assert_mjs.assert.hasMethod(handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return handler;\n } else {\n {\n assert_mjs.assert.isType(handler, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return { handle: handler };\n }\n });\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A `Route` consists of a pair of callback functions, \"match\" and \"handler\".\n * The \"match\" callback determine if a route should be used to \"handle\" a\n * request by returning a non-falsy value if it can. The \"handler\" callback\n * is called when there is a match and should return a Promise that resolves\n * to a `Response`.\n *\n * @memberof workbox.routing\n */\n class Route {\n /**\n * Constructor for Route class.\n *\n * @param {workbox.routing.Route~matchCallback} match\n * A callback function that determines whether the route matches a given\n * `fetch` event by returning a non-falsy value.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resolving to a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(match, handler, method) {\n {\n assert_mjs.assert.isType(match, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'match'\n });\n\n if (method) {\n assert_mjs.assert.isOneOf(method, validMethods, { paramName: 'method' });\n }\n }\n\n // These values are referenced directly by Router so cannot be\n // altered by minifification.\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method || defaultMethod;\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * RegExpRoute makes it easy to create a regular expression based\n * [Route]{@link workbox.routing.Route}.\n *\n * For same-origin requests the RegExp only needs to match part of the URL. For\n * requests against third-party servers, you must define a RegExp that matches\n * the start of the URL.\n *\n * [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class RegExpRoute extends Route {\n /**\n * If the regulard expression contains\n * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},\n * th ecaptured values will be passed to the\n * [handler's]{@link workbox.routing.Route~handlerCallback} `params`\n * argument.\n *\n * @param {RegExp} regExp The regular expression to match against URLs.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(regExp, handler, method) {\n {\n assert_mjs.assert.isInstance(regExp, RegExp, {\n moduleName: 'workbox-routing',\n className: 'RegExpRoute',\n funcName: 'constructor',\n paramName: 'pattern'\n });\n }\n\n const match = ({ url }) => {\n const result = regExp.exec(url.href);\n\n // Return null immediately if there's no match.\n if (!result) {\n return null;\n }\n\n // Require that the match start at the first character in the URL string\n // if it's a cross-origin request.\n // See https://github.com/GoogleChrome/workbox/issues/281 for the context\n // behind this behavior.\n if (url.origin !== location.origin && result.index !== 0) {\n {\n logger_mjs.logger.debug(`The regular expression '${regExp}' only partially matched ` + `against the cross-origin URL '${url}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);\n }\n\n return null;\n }\n\n // If the route matches, but there aren't any capture groups defined, then\n // this will return [], which is truthy and therefore sufficient to\n // indicate a match.\n // If there are capture groups, then it will return their values.\n return result.slice(1);\n };\n\n super(match, handler, method);\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The Router can be used to process a FetchEvent through one or more\n * [Routes]{@link workbox.routing.Route} responding with a Request if\n * a matching route exists.\n *\n * If no route matches a given a request, the Router will use a \"default\"\n * handler if one is defined.\n *\n * Should the matching Route throw an error, the Router will use a \"catch\"\n * handler if one is defined to gracefully deal with issues and respond with a\n * Request.\n *\n * If a request matches multiple routes, the **earliest** registered route will\n * be used to respond to the request.\n *\n * @memberof workbox.routing\n */\n class Router {\n /**\n * Initializes a new Router.\n */\n constructor() {\n // _routes will contain a mapping of HTTP method name ('GET', etc.) to an\n // array of all the corresponding Route instances that are registered.\n this._routes = new Map();\n }\n\n /**\n * Apply the routing rules to a FetchEvent object to get a Response from an\n * appropriate Route's handler.\n *\n * @param {FetchEvent} event The event from a service worker's 'fetch' event\n * listener.\n * @return {Promise<Response>|undefined} A promise is returned if a\n * registered route can handle the FetchEvent's request. If there is no\n * matching route and there's no `defaultHandler`, `undefined` is returned.\n */\n handleRequest(event) {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'handleRequest',\n paramName: 'event'\n });\n }\n\n const url = new URL(event.request.url);\n if (!url.protocol.startsWith('http')) {\n {\n logger_mjs.logger.debug(`Workbox Router only supports URLs that start with 'http'.`);\n }\n return;\n }\n\n let route = null;\n let handler = null;\n let params = null;\n let debugMessages = [];\n\n const result = this._findHandlerAndParams(event, url);\n handler = result.handler;\n params = result.params;\n route = result.route;\n {\n if (handler) {\n debugMessages.push([`Found a route to handle this request:`, route]);\n\n if (params) {\n debugMessages.push([`Passing the following params to the route's handler:`, params]);\n }\n }\n }\n\n // If we don't have a handler because there was no matching route, then\n // fall back to defaultHandler if that's defined.\n if (!handler && this._defaultHandler) {\n {\n debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler.`);\n\n // This is used for debugging in logs in the case of an error.\n route = '[Default Handler]';\n }\n handler = this._defaultHandler;\n }\n\n if (!handler) {\n {\n // No handler so Workbox will do nothing. If logs is set of debug\n // i.e. verbose, we should print out this information.\n logger_mjs.logger.debug(`No route found for: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n }\n return;\n }\n\n {\n // We have a handler, meaning Workbox is going to handle the route.\n // print the routing details to the console.\n logger_mjs.logger.groupCollapsed(`Router is responding to: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n debugMessages.forEach(msg => {\n if (Array.isArray(msg)) {\n logger_mjs.logger.log(...msg);\n } else {\n logger_mjs.logger.log(msg);\n }\n });\n\n // The Request and Response objects contains a great deal of information,\n // hide it under a group in case developers want to see it.\n logger_mjs.logger.groupCollapsed(`View request details here.`);\n logger_mjs.logger.unprefixed.log(event.request);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n }\n\n // Wrap in try and catch in case the handle method throws a synchronous\n // error. It should still callback to the catch handler.\n let responsePromise;\n try {\n responsePromise = handler.handle({ url, event, params });\n } catch (err) {\n responsePromise = Promise.reject(err);\n }\n\n if (responsePromise && this._catchHandler) {\n responsePromise = responsePromise.catch(err => {\n {\n // Still include URL here as it will be async from the console group\n // and may not make sense without the URL\n logger_mjs.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_mjs.getFriendlyURL(url)}. Falling back to Catch Handler.`);\n logger_mjs.logger.unprefixed.error(`Error thrown by:`, route);\n logger_mjs.logger.unprefixed.error(err);\n logger_mjs.logger.groupEnd();\n }\n return this._catchHandler.handle({ url, event, err });\n });\n }\n\n return responsePromise;\n }\n\n /**\n * Checks the incoming `event.request` against the registered routes, and if\n * there's a match, returns the corresponding handler along with any params\n * generated by the match.\n *\n * @param {FetchEvent} event\n * @param {URL} url\n * @return {Object} Returns an object with `handler` and `params` properties.\n * They are populated if a matching route was found or `undefined` otherwise.\n *\n * @private\n */\n _findHandlerAndParams(event, url) {\n const routes = this._routes.get(event.request.method) || [];\n for (const route of routes) {\n let matchResult = route.match({ url, event });\n if (matchResult) {\n if (Array.isArray(matchResult) && matchResult.length === 0) {\n // Instead of passing an empty array in as params, use undefined.\n matchResult = undefined;\n } else if (matchResult.constructor === Object && Object.keys(matchResult).length === 0 || matchResult === true) {\n // Instead of passing an empty object in as params, use undefined.\n matchResult = undefined;\n }\n\n // Break out of the loop and return the appropriate values as soon as\n // we have a match.\n return {\n route,\n params: matchResult,\n handler: route.handler\n };\n }\n }\n\n // If we didn't have a match, then return undefined values.\n return { handler: undefined, params: undefined };\n }\n\n /**\n * Define a default `handler` that's called when no routes explicitly\n * match the incoming request.\n *\n * Without a default handler, unmatched requests will go against the\n * network as if there were no service worker present.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setDefaultHandler(handler) {\n this._defaultHandler = normalizeHandler(handler);\n }\n\n /**\n * If a Route throws an error while handling a request, this `handler`\n * will be called and given a chance to provide a response.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setCatchHandler(handler) {\n this._catchHandler = normalizeHandler(handler);\n }\n\n /**\n * Registers a route with the router.\n *\n * @param {workbox.routing.Route} route The route to register.\n */\n registerRoute(route) {\n {\n assert_mjs.assert.isType(route, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route, 'match', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.isType(route.handler, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route.handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.handler'\n });\n\n assert_mjs.assert.isType(route.method, 'string', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.method'\n });\n }\n\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\n }\n\n // Give precedence to all of the earlier routes by adding this additional\n // route to the end of the array.\n this._routes.get(route.method).push(route);\n }\n\n /**\n * Unregisters a route with the router.\n *\n * @param {workbox.routing.Route} route The route to unregister.\n */\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-but-not-found-with-method', {\n method: route.method\n });\n }\n\n const routeIndex = this._routes.get(route.method).indexOf(route);\n if (routeIndex > -1) {\n this._routes.get(route.method).splice(routeIndex, 1);\n } else {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-route-not-registered');\n }\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * NavigationRoute makes it easy to create a [Route]{@link\n * workbox.routing.Route} that matches for browser\n * [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.\n *\n * It will only match incoming Requests whose\n * [`mode`]{@link https://fetch.spec.whatwg.org/#concept-request-mode}\n * is set to `navigate`.\n *\n * You can optionally only apply this route to a subset of navigation requests\n * by using one or both of the `blacklist` and `whitelist` parameters.\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class NavigationRoute extends Route {\n /**\n * If both `blacklist` and `whiltelist` are provided, the `blacklist` will\n * take precedence and the request will not match this route.\n *\n * The regular expressions in `whitelist` and `blacklist`\n * are matched against the concatenated\n * [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}\n * and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}\n * portions of the requested URL.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {Object} options\n * @param {Array<RegExp>} [options.blacklist] If any of these patterns match,\n * the route will not handle the request (even if a whitelist RegExp matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n */\n constructor(handler, { whitelist = [/./], blacklist = [] } = {}) {\n {\n assert_mjs.assert.isArrayOfClass(whitelist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.whitelist'\n });\n assert_mjs.assert.isArrayOfClass(blacklist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.blacklist'\n });\n }\n\n super((...args) => this._match(...args), handler);\n\n this._whitelist = whitelist;\n this._blacklist = blacklist;\n }\n\n /**\n * Routes match handler.\n *\n * @param {Object} input\n * @param {FetchEvent} input.event\n * @param {URL} input.url\n * @return {boolean}\n *\n * @private\n */\n _match({ event, url }) {\n if (event.request.mode !== 'navigate') {\n return false;\n }\n\n const pathnameAndSearch = url.pathname + url.search;\n\n if (this._blacklist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `request URL matches both the whitelist and blacklist.`);\n }\n return false;\n }\n\n if (this._whitelist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is being used.`);\n }\n return true;\n } else {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `URL being navigated to doesn't match the whitelist.`);\n }\n }\n\n return false;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n RegExpRoute: RegExpRoute,\n Route: Route,\n Router: Router,\n NavigationRoute: NavigationRoute\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n {\n assert_mjs.assert.isSwEnv('workbox-routing');\n }\n\n /**\n * @private\n */\n class DefaultRouter extends Router {\n /**\n * Easily register a RegExp, string, or function with a caching\n * strategy to the Router.\n *\n * This method will generate a Route for you if needed and\n * call [Router.registerRoute()]{@link\n * workbox.routing.Router#registerRoute}.\n *\n * @param {\n * RegExp|\n * string|\n * workbox.routing.Route~matchCallback|\n * workbox.routing.Route\n * } capture\n * If the capture param is a `Route`, all other arguments will be ignored.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n * @return {workbox.routing.Route} The generated `Route`(Useful for\n * unregistering).\n *\n * @alias workbox.routing.registerRoute\n */\n registerRoute(capture, handler, method = 'GET') {\n let route;\n\n if (typeof capture === 'string') {\n const captureUrl = new URL(capture, location);\n\n {\n if (!(capture.startsWith('/') || capture.startsWith('http'))) {\n throw new WorkboxError_mjs.WorkboxError('invalid-string', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n // We want to check if Express-style wildcards are in the pathname only.\n // TODO: Remove this log message in v4.\n const valueToCheck = capture.startsWith('http') ? captureUrl.pathname : capture;\n // See https://github.com/pillarjs/path-to-regexp#parameters\n const wildcards = '[*:?+]';\n if (valueToCheck.match(new RegExp(`${wildcards}`))) {\n logger_mjs.logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n\n const matchCallback = ({ url }) => {\n {\n if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {\n logger_mjs.logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);\n }\n }\n\n return url.href === captureUrl.href;\n };\n\n route = new Route(matchCallback, handler, method);\n } else if (capture instanceof RegExp) {\n route = new RegExpRoute(capture, handler, method);\n } else if (typeof capture === 'function') {\n route = new Route(capture, handler, method);\n } else if (capture instanceof Route) {\n route = capture;\n } else {\n throw new WorkboxError_mjs.WorkboxError('unsupported-route-type', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n super.registerRoute(route);\n return route;\n }\n\n /**\n * Register a route that will return a precached file for a navigation\n * request. This is useful for the\n * [application shell pattern]{@link https://developers.google.com/web/fundamentals/architecture/app-shell}.\n *\n * This method will generate a\n * [NavigationRoute]{@link workbox.routing.NavigationRoute}\n * and call\n * [Router.registerRoute()]{@link workbox.routing.Router#registerRoute}\n * .\n *\n * @param {string} cachedAssetUrl\n * @param {Object} [options]\n * @param {string} [options.cacheName] Cache name to store and retrieve\n * requests. Defaults to precache cache name provided by\n * [workbox-core.cacheNames]{@link workbox.core.cacheNames}.\n * @param {Array<RegExp>} [options.blacklist=[]] If any of these patterns\n * match, the route will not handle the request (even if a whitelist entry\n * matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n * @return {workbox.routing.NavigationRoute} Returns the generated\n * Route.\n *\n * @alias workbox.routing.registerNavigationRoute\n */\n registerNavigationRoute(cachedAssetUrl, options = {}) {\n {\n assert_mjs.assert.isType(cachedAssetUrl, 'string', {\n moduleName: 'workbox-routing',\n className: '[default export]',\n funcName: 'registerNavigationRoute',\n paramName: 'cachedAssetUrl'\n });\n }\n\n const cacheName = cacheNames_mjs.cacheNames.getPrecacheName(options.cacheName);\n const handler = () => caches.match(cachedAssetUrl, { cacheName }).then(response => {\n if (response) {\n return response;\n }\n // This shouldn't normally happen, but there are edge cases:\n // https://github.com/GoogleChrome/workbox/issues/1441\n throw new Error(`The cache ${cacheName} did not have an entry for ` + `${cachedAssetUrl}.`);\n }).catch(error => {\n // If there's either a cache miss, or the caches.match() call threw\n // an exception, then attempt to fulfill the navigation request with\n // a response from the network rather than leaving the user with a\n // failed navigation.\n {\n logger_mjs.logger.debug(`Unable to respond to navigation request with cached ` + `response: ${error.message}. Falling back to network.`);\n }\n\n // This might still fail if the browser is offline...\n return fetch(cachedAssetUrl);\n });\n\n const route = new NavigationRoute(handler, {\n whitelist: options.whitelist,\n blacklist: options.blacklist\n });\n super.registerRoute(route);\n\n return route;\n }\n }\n\n const router = new DefaultRouter();\n\n // By default, register a fetch event listener that will respond to a request\n // only if there's a matching route.\n self.addEventListener('fetch', event => {\n const responsePromise = router.handleRequest(event);\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(router, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-routing.dev.js"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheWrapper_mjs,fetchWrapper_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:strategies:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n var messages = {\n strategyStart: (strategyName, request) => `Using ${strategyName} to ` + `respond to '${getFriendlyURL(request.url)}'`,\n printFinalResponse: response => {\n if (response) {\n logger_mjs.logger.groupCollapsed(`View the final response here.`);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n }\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a [cache-first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network}\n * request strategy.\n *\n * A cache first strategy is useful for assets that have been revisioned,\n * such as URLs like `/styles/example.a8f5f1.css`, since they\n * can be cached for long periods of time.\n *\n * @memberof workbox.strategies\n */\n class CacheFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} input\n * @param {FetchEvent} input.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} input\n * @param {Request|string} input.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be\n * called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);\n\n let error;\n if (!response) {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will respond with a network request.`);\n }\n try {\n response = yield _this2._getFromNetwork(request, event);\n } catch (err) {\n error = err;\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network.`);\n }\n }\n } else {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}' cache.`);\n }\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n if (error) {\n // Don't swallow error as we'll want it to throw and enable catch\n // handlers in router.\n throw error;\n }\n\n return response;\n })();\n }\n\n /**\n * Handles the network and cache part of CacheFirst.\n *\n * @param {Request} request\n * @param {FetchEvent} [event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork(request, event) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins, event ? event.preloadResponse : undefined);\n\n // Keep the service worker while we put the request to the cache\n const responseClone = response.clone();\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put(_this3._cacheName, request, responseClone, _this3._plugins);\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [cache-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class CacheOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} input\n * @param {FetchEvent} input.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} input\n * @param {Request|string} input.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be\n * called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'makeRequest',\n paramName: 'request'\n });\n }\n\n const response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheOnly', request));\n if (response) {\n logger_mjs.logger.log(`Found a cached response in the '${_this2._cacheName}'` + ` cache.`);\n messages.printFinalResponse(response);\n } else {\n logger_mjs.logger.log(`No response found in the '${_this2._cacheName}' cache.`);\n }\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var cacheOkAndOpaquePlugin = {\n /**\n * Return return a response (i.e. allow caching) if the\n * response is ok (i.e. 200) or is opaque.\n *\n * @param {Object} input\n * @param {Response} input.response\n * @return {Response|null}\n *\n * @private\n */\n cacheWillUpdate: ({ response }) => {\n if (response.ok || response.status === 0) {\n return response;\n }\n return null;\n }\n };\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-falling-back-to-cache}\n * request strategy.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class NetworkFirst {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n * @param {number} options.networkTimeoutSeconds If set, any network requests\n * that fail to respond within the timeout will fallback to the cache.\n *\n * This option can be used to combat\n * \"[lie-fi]{@link https://developers.google.com/web/fundamentals/performance/poor-connectivity/#lie-fi}\"\n * scenarios.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._networkTimeoutSeconds = options.networkTimeoutSeconds;\n {\n if (this._networkTimeoutSeconds) {\n assert_mjs.assert.isType(this._networkTimeoutSeconds, 'number', {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'constructor',\n paramName: 'networkTimeoutSeconds'\n });\n }\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} input\n * @param {FetchEvent} input.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} input\n * @param {Request|string} input.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be\n * called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'makeRequest'\n });\n }\n\n const promises = [];\n let timeoutId;\n\n if (_this2._networkTimeoutSeconds) {\n const { id, promise } = _this2._getTimeoutPromise(request, logs);\n timeoutId = id;\n promises.push(promise);\n }\n\n const networkPromise = _this2._getNetworkPromise(timeoutId, event, request, logs);\n promises.push(networkPromise);\n\n // Promise.race() will resolve as soon as the first promise resolves.\n let response = yield Promise.race(promises);\n // If Promise.race() resolved with null, it might be due to a network\n // timeout + a cache miss. If that were to happen, we'd rather wait until\n // the networkPromise resolves instead of returning null.\n // Note that it's fine to await an already-resolved promise, so we don't\n // have to check to see if it's still \"in flight\".\n if (!response) {\n response = yield networkPromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkFirst', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Request} request\n * @param {Array} logs A reference to the logs array\n * @return {Promise<Response>}\n *\n * @private\n */\n _getTimeoutPromise(request, logs) {\n var _this3 = this;\n\n let timeoutId;\n const timeoutPromise = new Promise(resolve => {\n const onNetworkTimeout = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n logs.push(`Timing out the network response at ` + `${_this3._networkTimeoutSeconds} seconds.`);\n }\n\n resolve((yield _this3._respondFromCache(request)));\n });\n\n return function onNetworkTimeout() {\n return _ref.apply(this, arguments);\n };\n })();\n\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n\n return {\n promise: timeoutPromise,\n id: timeoutId\n };\n }\n\n /**\n * @param {number} timeoutId\n * @param {FetchEvent|null} event\n * @param {Request} request\n * @param {Array} logs A reference to the logs Array.\n * @return {Promise<Response>}\n *\n * @private\n */\n _getNetworkPromise(timeoutId, event, request, logs) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this4._fetchOptions, _this4._plugins, event ? event.preloadResponse : undefined);\n } catch (err) {\n error = err;\n }\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n {\n if (response) {\n logs.push(`Got response from network.`);\n } else {\n logs.push(`Unable to get a response from the network. Will respond ` + `with a cached response.`);\n }\n }\n\n if (error || !response) {\n response = yield _this4._respondFromCache(request);\n {\n if (response) {\n logs.push(`Found a cached response in the '${_this4._cacheName}'` + ` cache.`);\n } else {\n logs.push(`No response found in the '${_this4._cacheName}' cache.`);\n }\n }\n } else {\n // Keep the service worker alive while we put the request in the cache\n const responseClone = response.clone();\n const cachePut = cacheWrapper_mjs.cacheWrapper.put(_this4._cacheName, request, responseClone, _this4._plugins);\n\n if (event) {\n try {\n // The event has been responded to so we can keep the SW alive to\n // respond to the request\n event.waitUntil(cachePut);\n } catch (err) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n }\n\n return response;\n })();\n }\n\n /**\n * Used if the network timeouts or fails to make the request.\n *\n * @param {Request} request The fetchEvent request to match in the cache\n * @return {Promise<Object>}\n *\n * @private\n */\n _respondFromCache(request) {\n return cacheWrapper_mjs.cacheWrapper.match(this._cacheName, request, this._matchOptions, this._plugins);\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [network-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-only}\n * request strategy.\n *\n * This class is useful if you want to take advantage of any [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * @memberof workbox.strategies\n */\n class NetworkOnly {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} input\n * @param {FetchEvent} input.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} input\n * @param {Request|string} input.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be\n * called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n let error;\n let response;\n try {\n response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this2._fetchOptions, _this2._plugins, event ? event.preloadResponse : undefined);\n } catch (err) {\n error = err;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('NetworkOnly', request));\n if (response) {\n logger_mjs.logger.log(`Got response from network.`);\n } else {\n logger_mjs.logger.log(`Unable to get a response from the network.`);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n // If there was an error thrown, re-throw it to ensure the Routers\n // catch handler is triggered.\n if (error) {\n throw error;\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * An implementation of a\n * [stale-while-revalidate]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#stale-while-revalidate}\n * request strategy.\n *\n * Resources are requested from both the cache and the network in parallel.\n * The strategy will respond with the cached version if available, otherwise\n * wait for the network response. The cache is updated with the network response\n * with each successful request.\n *\n * By default, this strategy will cache responses with a 200 status code as\n * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.\n * Opaque responses are are cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * @memberof workbox.strategies\n */\n class StaleWhileRevalidate {\n /**\n * @param {Object} options\n * @param {string} options.cacheName Cache name to store and retrieve\n * requests. Defaults to cache names provided by\n * [workbox-core]{@link workbox.core.cacheNames}.\n * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n * to use in conjunction with this caching strategy.\n * @param {Object} options.fetchOptions Values passed along to the\n * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n * of all fetch() requests made by this strategy.\n * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)\n */\n constructor(options = {}) {\n this._cacheName = cacheNames_mjs.cacheNames.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some(plugin => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ? options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n } else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n\n this._fetchOptions = options.fetchOptions || null;\n this._matchOptions = options.matchOptions || null;\n }\n\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link workbox.routing.Router}.\n *\n * @param {Object} input\n * @param {FetchEvent} input.event The fetch event to run this strategy\n * against.\n * @return {Promise<Response>}\n */\n handle({ event }) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'event'\n });\n }\n\n return _this.makeRequest({\n event,\n request: event.request\n });\n })();\n }\n\n /**\n * This method can be used to perform a make a standalone request outside the\n * context of the [Workbox Router]{@link workbox.routing.Router}.\n *\n * See \"[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)\"\n * for more usage information.\n *\n * @param {Object} input\n * @param {Request|string} input.request Either a\n * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}\n * object, or a string URL, corresponding to the request to be made.\n * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be\n * called automatically to extend the service worker's lifetime.\n * @return {Promise<Response>}\n */\n makeRequest({ event, request }) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const logs = [];\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'request'\n });\n }\n\n const fetchAndCachePromise = _this2._getFromNetwork(request, event);\n\n let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);\n\n if (response) {\n {\n logs.push(`Found a cached response in the '${_this2._cacheName}'` + ` cache. Will update with the network response in the background.`);\n }\n\n if (event) {\n try {\n event.waitUntil(fetchAndCachePromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n } else {\n {\n logs.push(`No response found in the '${_this2._cacheName}' cache. ` + `Will wait for the network response.`);\n }\n response = yield fetchAndCachePromise;\n }\n\n {\n logger_mjs.logger.groupCollapsed(messages.strategyStart('StaleWhileRevalidate', request));\n for (let log of logs) {\n logger_mjs.logger.log(log);\n }\n messages.printFinalResponse(response);\n logger_mjs.logger.groupEnd();\n }\n\n return response;\n })();\n }\n\n /**\n * @param {Request} request\n * @param {FetchEvent} [event]\n * @return {Promise<Response>}\n *\n * @private\n */\n _getFromNetwork(request, event) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins, event ? event.preloadResponse : undefined);\n\n const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put(_this3._cacheName, request, response.clone(), _this3._plugins);\n\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to ensure service worker stays alive when ` + `updating cache for '${getFriendlyURL_mjs.getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n\n return response;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n CacheFirst: CacheFirst,\n CacheOnly: CacheOnly,\n NetworkFirst: NetworkFirst,\n NetworkOnly: NetworkOnly,\n StaleWhileRevalidate: StaleWhileRevalidate\n });\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @function workbox.strategies.cacheFirst\n * @param {workbox.strategies.StrategyOptions} options\n */\n\n /**\n * @function workbox.strategies.cacheOnly\n * @param {workbox.strategies.StrategyOptions} options\n */\n\n /**\n * @function workbox.strategies.networkFirst\n * @param {workbox.strategies.StrategyOptions} options\n */\n\n /**\n * @function workbox.strategies.networkOnly\n * @param {workbox.strategies.StrategyOptions} options\n */\n\n /**\n * @function workbox.strategies.staleWhileRevalidate\n * @param {workbox.strategies.StrategyOptions} options\n */\n\n const mapping = {\n cacheFirst: CacheFirst,\n cacheOnly: CacheOnly,\n networkFirst: NetworkFirst,\n networkOnly: NetworkOnly,\n staleWhileRevalidate: StaleWhileRevalidate\n };\n\n const defaultExport = {};\n Object.keys(mapping).forEach(keyName => {\n defaultExport[keyName] = (options = {}) => {\n const StrategyClass = mapping[keyName];\n return new StrategyClass(Object.assign(options));\n };\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(defaultExport, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-strategies.dev.js"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){"use strict";try{self.workbox.v["workbox:strategies:3.4.1"]=1}catch(e){}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));let n,i=yield t.cacheWrapper.match(s.e,r,s.s,s.t);if(!i)try{i=yield s.n(r,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,s){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,n.r,n.t,s?s.preloadResponse:void 0),l=i.clone(),u=t.cacheWrapper.put(n.e,e,l,n.t);if(s)try{s.waitUntil(u)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){return"string"==typeof r&&(r=new Request(r)),yield t.cacheWrapper.match(s.e,r,s.s,s.t)})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class l{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const s=[];"string"==typeof t&&(t=new Request(t));const n=[];let i;if(r.i){const{id:e,promise:l}=r.l(t,s);i=e,n.push(l)}const l=r.u(i,e,t,s);n.push(l);let u=yield Promise.race(n);return u||(u=yield l),u})()}l(e,t){var r=this;let s;var n;return{promise:new Promise(t=>{const i=(n=babelHelpers.asyncToGenerator(function*(){t(yield r.o(e))}),function(){return n.apply(this,arguments)});s=setTimeout(i,1e3*this.i)}),id:s}}u(e,s,n,i){var l=this;return babelHelpers.asyncToGenerator(function*(){let i,u;try{u=yield r.fetchWrapper.fetch(n,l.r,l.t,s?s.preloadResponse:void 0)}catch(e){i=e}if(e&&clearTimeout(e),i||!u)u=yield l.o(n);else{const e=u.clone(),r=t.cacheWrapper.put(l.e,n,e,l.t);if(s)try{s.waitUntil(r)}catch(e){}}return u})()}o(e){return t.cacheWrapper.match(this.e,e,this.s,this.t)}}class u{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){let n,i;"string"==typeof t&&(t=new Request(t));try{i=yield r.fetchWrapper.fetch(t,s.r,s.t,e?e.preloadResponse:void 0)}catch(e){n=e}if(n)throw n;return i})()}}class o{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){"string"==typeof r&&(r=new Request(r));const n=s.n(r,e);let i=yield t.cacheWrapper.match(s.e,r,s.s,s.t);if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n(e,s){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,n.r,n.t,s?s.preloadResponse:void 0),l=t.cacheWrapper.put(n.e,e,i.clone(),n.t);if(s)try{s.waitUntil(l)}catch(e){}return i})()}}var c=Object.freeze({CacheFirst:s,CacheOnly:n,NetworkFirst:l,NetworkOnly:u,StaleWhileRevalidate:o});const a={cacheFirst:s,cacheOnly:n,networkFirst:l,networkOnly:u,staleWhileRevalidate:o},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,c)}(workbox.core._private,workbox.core._private,workbox.core._private);
2
-
3
- //# sourceMappingURL=workbox-strategies.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-strategies/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,r){\"use strict\";try{self.workbox.v[\"workbox:strategies:3.4.1\"]=1}catch(e){}class s{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof r&&(r=new Request(r));let n,i=yield t.cacheWrapper.match(s.e,r,s.s,s.t);if(!i)try{i=yield s.n(r,e)}catch(e){n=e}if(n)throw n;return i})()}n(e,s){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,n.r,n.t,s?s.preloadResponse:void 0),l=i.clone(),u=t.cacheWrapper.put(n.e,e,l,n.t);if(s)try{s.waitUntil(u)}catch(e){}return i})()}}class n{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){return\"string\"==typeof r&&(r=new Request(r)),yield t.cacheWrapper.match(s.e,r,s.s,s.t)})()}}var i={cacheWillUpdate:({response:e})=>e.ok||0===e.status?e:null};class l{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.i=t.networkTimeoutSeconds,this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const s=[];\"string\"==typeof t&&(t=new Request(t));const n=[];let i;if(r.i){const{id:e,promise:l}=r.l(t,s);i=e,n.push(l)}const l=r.u(i,e,t,s);n.push(l);let u=yield Promise.race(n);return u||(u=yield l),u})()}l(e,t){var r=this;let s;var n;return{promise:new Promise(t=>{const i=(n=babelHelpers.asyncToGenerator(function*(){t(yield r.o(e))}),function(){return n.apply(this,arguments)});s=setTimeout(i,1e3*this.i)}),id:s}}u(e,s,n,i){var l=this;return babelHelpers.asyncToGenerator(function*(){let i,u;try{u=yield r.fetchWrapper.fetch(n,l.r,l.t,s?s.preloadResponse:void 0)}catch(e){i=e}if(e&&clearTimeout(e),i||!u)u=yield l.o(n);else{const e=u.clone(),r=t.cacheWrapper.put(l.e,n,e,l.t);if(s)try{s.waitUntil(r)}catch(e){}}return u})()}o(e){return t.cacheWrapper.match(this.e,e,this.s,this.t)}}class u{constructor(t={}){this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],this.r=t.fetchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:t}){var s=this;return babelHelpers.asyncToGenerator(function*(){let n,i;\"string\"==typeof t&&(t=new Request(t));try{i=yield r.fetchWrapper.fetch(t,s.r,s.t,e?e.preloadResponse:void 0)}catch(e){n=e}if(n)throw n;return i})()}}class o{constructor(t={}){if(this.e=e.cacheNames.getRuntimeName(t.cacheName),this.t=t.plugins||[],t.plugins){let e=t.plugins.some(e=>!!e.cacheWillUpdate);this.t=e?t.plugins:[i,...t.plugins]}else this.t=[i];this.r=t.fetchOptions||null,this.s=t.matchOptions||null}handle({event:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){return t.makeRequest({event:e,request:e.request})})()}makeRequest({event:e,request:r}){var s=this;return babelHelpers.asyncToGenerator(function*(){\"string\"==typeof r&&(r=new Request(r));const n=s.n(r,e);let i=yield t.cacheWrapper.match(s.e,r,s.s,s.t);if(i){if(e)try{e.waitUntil(n)}catch(e){}}else i=yield n;return i})()}n(e,s){var n=this;return babelHelpers.asyncToGenerator(function*(){const i=yield r.fetchWrapper.fetch(e,n.r,n.t,s?s.preloadResponse:void 0),l=t.cacheWrapper.put(n.e,e,i.clone(),n.t);if(s)try{s.waitUntil(l)}catch(e){}return i})()}}var c=Object.freeze({CacheFirst:s,CacheOnly:n,NetworkFirst:l,NetworkOnly:u,StaleWhileRevalidate:o});const a={cacheFirst:s,cacheOnly:n,networkFirst:l,networkOnly:u,staleWhileRevalidate:o},h={};return Object.keys(a).forEach(e=>{h[e]=((t={})=>{return new(0,a[e])(Object.assign(t))})}),Object.assign(h,c)}(workbox.core._private,workbox.core._private,workbox.core._private);\n"],"file":"workbox-strategies.prod.js"}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.streams = (function (logger_mjs,assert_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:streams:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes either a Response, a ReadableStream, or a\n * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the\n * ReadableStreamReader object associated with it.\n *\n * @param {workbox.streams.StreamSource} source\n * @return {ReadableStreamReader}\n * @private\n */\n function _getReaderFromSource(source) {\n if (source.body && source.body.getReader) {\n return source.body.getReader();\n }\n\n if (source.getReader) {\n return source.getReader();\n }\n\n // TODO: This should be possible to do by constructing a ReadableStream, but\n // I can't get it to work. As a hack, construct a new Response, and use the\n // reader associated with its body.\n return new Response(source).body.getReader();\n }\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).\n *\n * Returns an object exposing a ReadableStream with each individual stream's\n * data returned in sequence, along with a Promise which signals when the\n * stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @return {Object<{done: Promise, stream: ReadableStream}>}\n *\n * @memberof workbox.streams\n */\n function concatenate(sourcePromises) {\n {\n assert_mjs.assert.isArray(sourcePromises, {\n moduleName: 'workbox-streams',\n funcName: 'concatenate',\n paramName: 'sourcePromises'\n });\n }\n\n const readerPromises = sourcePromises.map(sourcePromise => {\n return Promise.resolve(sourcePromise).then(source => {\n return _getReaderFromSource(source);\n });\n });\n\n let fullyStreamedResolve;\n let fullyStreamedReject;\n const done = new Promise((resolve, reject) => {\n fullyStreamedResolve = resolve;\n fullyStreamedReject = reject;\n });\n\n let i = 0;\n const logMessages = [];\n const stream = new ReadableStream({\n pull(controller) {\n return readerPromises[i].then(reader => reader.read()).then(result => {\n if (result.done) {\n {\n logMessages.push(['Reached the end of source:', sourcePromises[i]]);\n }\n\n i++;\n if (i >= readerPromises.length) {\n // Log all the messages in the group at once in a single group.\n {\n logger_mjs.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);\n for (const message of logMessages) {\n if (Array.isArray(message)) {\n logger_mjs.logger.log(...message);\n } else {\n logger_mjs.logger.log(message);\n }\n }\n logger_mjs.logger.log('Finished reading all sources.');\n logger_mjs.logger.groupEnd();\n }\n\n controller.close();\n fullyStreamedResolve();\n return;\n }\n\n return this.pull(controller);\n } else {\n controller.enqueue(result.value);\n }\n }).catch(error => {\n {\n logger_mjs.logger.error('An error occurred:', error);\n }\n fullyStreamedReject(error);\n throw error;\n });\n },\n\n cancel() {\n {\n logger_mjs.logger.warn('The ReadableStream was cancelled.');\n }\n\n fullyStreamedResolve();\n }\n });\n\n return { done, stream };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * is available.\n *\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function createHeaders(headersInit = {}) {\n // See https://github.com/GoogleChrome/workbox/issues/1461\n const headers = new Headers(headersInit);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'text/html');\n }\n return headers;\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Takes multiple source Promises, each of which could resolve to a Response, a\n * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),\n * along with a\n * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).\n *\n * Returns an object exposing a Response whose body consists of each individual\n * stream's data returned in sequence, along with a Promise which signals when\n * the stream is finished (useful for passing to a FetchEvent's waitUntil()).\n *\n * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {Object<{done: Promise, response: Response}>}\n *\n * @memberof workbox.streams\n */\n function concatenateToResponse(sourcePromises, headersInit) {\n const { done, stream } = concatenate(sourcePromises);\n\n const headers = createHeaders(headersInit);\n const response = new Response(stream, { headers });\n\n return { done, response };\n }\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n let cachedIsSupported = undefined;\n\n /**\n * This is a utility method that determines whether the current browser supports\n * the features required to create streamed responses. Currently, it checks if\n * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * can be created.\n *\n * @return {boolean} `true`, if the current browser meets the requirements for\n * streaming responses, and `false` otherwise.\n *\n * @memberof workbox.streams\n */\n function isSupported() {\n if (cachedIsSupported === undefined) {\n // See https://github.com/GoogleChrome/workbox/issues/1473\n try {\n new ReadableStream({ start() {} });\n cachedIsSupported = true;\n } catch (error) {\n cachedIsSupported = false;\n }\n }\n\n return cachedIsSupported;\n }\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n concatenate: concatenate,\n concatenateToResponse: concatenateToResponse,\n isSupported: isSupported\n });\n\n /*\n Copyright 2018 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A shortcut to create a strategy that could be dropped-in to Workbox's router.\n *\n * On browsers that do not support constructing new `ReadableStream`s, this\n * strategy will automatically wait for all the `sourceFunctions` to complete,\n * and create a final response that concatenates their values together.\n *\n * @param {\n * Array<function(workbox.routing.Route~handlerCallback)>} sourceFunctions\n * Each function should return a {@link workbox.streams.StreamSource} (or a\n * Promise which resolves to one).\n * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,\n * `'text/html'` will be used by default.\n * @return {workbox.routing.Route~handlerCallback}\n *\n * @memberof workbox.streams\n */\n function strategy(sourceFunctions, headersInit) {\n return (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({ event, url, params }) {\n if (isSupported()) {\n const { done, response } = concatenateToResponse(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }), headersInit);\n event.waitUntil(done);\n return response;\n }\n\n {\n logger_mjs.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`);\n }\n\n // Fallback to waiting for everything to finish, and concatenating the\n // responses.\n const parts = yield Promise.all(sourceFunctions.map(function (sourceFunction) {\n return sourceFunction({ event, url, params });\n }).map((() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (responsePromise) {\n const response = yield responsePromise;\n if (response instanceof Response) {\n return response.blob();\n }\n\n // Otherwise, assume it's something like a string which can be used\n // as-is when constructing the final composite blob.\n return response;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })()));\n\n const headers = createHeaders(headersInit);\n // Constructing a new Response from a Blob source is well-supported.\n // So is constructing a new Blob from multiple source Blobs or strings.\n return new Response(new Blob(parts), { headers });\n });\n\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n })();\n }\n\n var defaultExport = {\n concatenate,\n concatenateToResponse,\n isSupported,\n strategy\n };\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(defaultExport, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private));\n"],"file":"workbox-streams.dev.js"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.streams=function(){"use strict";try{self.workbox.v["workbox:streams:3.4.1"]=1}catch(e){}function e(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,o;let s=0;return{done:new Promise((e,n)=>{r=e,o=n}),stream:new ReadableStream({pull(e){return n[s].then(e=>e.read()).then(t=>{if(t.done)return++s>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw o(e),e})},cancel(){r()}})}}function n(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function t(t,r){const{done:o,stream:s}=e(t),c=n(r);return{done:o,response:new Response(s,{headers:c})}}let r=void 0;function o(){if(void 0===r)try{new ReadableStream({start(){}}),r=!0}catch(e){r=!1}return r}var s=Object.freeze({concatenate:e,concatenateToResponse:t,isSupported:o});var c={concatenate:e,concatenateToResponse:t,isSupported:o,strategy:function(e,r){return s=babelHelpers.asyncToGenerator(function*({event:s,url:c,params:a}){if(o()){const{done:n,response:o}=t(e.map(function(e){return e({event:s,url:c,params:a})}),r);return s.waitUntil(n),o}const u=yield Promise.all(e.map(function(e){return e({event:s,url:c,params:a})}).map((i=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return i.apply(this,arguments)})));var i;const l=n(r);return new Response(new Blob(u),{headers:l})}),function(e){return s.apply(this,arguments)};var s}};return Object.assign(c,s)}();
2
-
3
- //# sourceMappingURL=workbox-streams.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.streams=function(){\"use strict\";try{self.workbox.v[\"workbox:streams:3.4.1\"]=1}catch(e){}function e(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,o;let s=0;return{done:new Promise((e,n)=>{r=e,o=n}),stream:new ReadableStream({pull(e){return n[s].then(e=>e.read()).then(t=>{if(t.done)return++s>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw o(e),e})},cancel(){r()}})}}function n(e={}){const n=new Headers(e);return n.has(\"content-type\")||n.set(\"content-type\",\"text/html\"),n}function t(t,r){const{done:o,stream:s}=e(t),c=n(r);return{done:o,response:new Response(s,{headers:c})}}let r=void 0;function o(){if(void 0===r)try{new ReadableStream({start(){}}),r=!0}catch(e){r=!1}return r}var s=Object.freeze({concatenate:e,concatenateToResponse:t,isSupported:o});var c={concatenate:e,concatenateToResponse:t,isSupported:o,strategy:function(e,r){return s=babelHelpers.asyncToGenerator(function*({event:s,url:c,params:a}){if(o()){const{done:n,response:o}=t(e.map(function(e){return e({event:s,url:c,params:a})}),r);return s.waitUntil(n),o}const u=yield Promise.all(e.map(function(e){return e({event:s,url:c,params:a})}).map((i=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return i.apply(this,arguments)})));var i;const l=n(r);return new Response(new Blob(u),{headers:l})}),function(e){return s.apply(this,arguments)};var s}};return Object.assign(c,s)}();\n"],"file":"workbox-streams.prod.js"}