jekyll-pwa-plugin 2.2.3 → 5.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/lib/jekyll-pwa-plugin.rb +11 -3
  3. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.dev.js +818 -0
  4. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.dev.js.map +1 -0
  5. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.prod.js +2 -0
  6. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.prod.js.map +1 -0
  7. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.dev.js +288 -0
  8. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.dev.js.map +1 -0
  9. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.prod.js +2 -0
  10. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.prod.js.map +1 -0
  11. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.dev.js +191 -0
  12. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.dev.js.map +1 -0
  13. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.prod.js +2 -0
  14. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.prod.js.map +1 -0
  15. data/lib/vendor/workbox-v5.1.4/workbox-core.dev.js +1858 -0
  16. data/lib/vendor/workbox-v5.1.4/workbox-core.dev.js.map +1 -0
  17. data/lib/vendor/workbox-v5.1.4/workbox-core.prod.js +2 -0
  18. data/lib/vendor/workbox-v5.1.4/workbox-core.prod.js.map +1 -0
  19. data/lib/vendor/workbox-v5.1.4/workbox-expiration.dev.js +649 -0
  20. data/lib/vendor/workbox-v5.1.4/workbox-expiration.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v5.1.4/workbox-expiration.prod.js +2 -0
  22. data/lib/vendor/workbox-v5.1.4/workbox-expiration.prod.js.map +1 -0
  23. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.dev.js +102 -0
  24. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.dev.js.map +1 -0
  25. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.prod.js +2 -0
  26. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.prod.js.map +1 -0
  27. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.dev.js +235 -0
  28. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.prod.js +2 -0
  30. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.prod.js.map +1 -0
  31. data/lib/vendor/workbox-v5.1.4/workbox-precaching.dev.js +1210 -0
  32. data/lib/vendor/workbox-v5.1.4/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v5.1.4/workbox-precaching.prod.js +2 -0
  34. data/lib/vendor/workbox-v5.1.4/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.dev.js +262 -0
  36. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.dev.js.map +1 -0
  37. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.prod.js +2 -0
  38. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.prod.js.map +1 -0
  39. data/lib/vendor/workbox-v5.1.4/workbox-routing.dev.js +923 -0
  40. data/lib/vendor/workbox-v5.1.4/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/workbox-v5.1.4/workbox-routing.prod.js +2 -0
  42. data/lib/vendor/workbox-v5.1.4/workbox-routing.prod.js.map +1 -0
  43. data/lib/vendor/workbox-v5.1.4/workbox-strategies.dev.js +923 -0
  44. data/lib/vendor/workbox-v5.1.4/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v5.1.4/workbox-strategies.prod.js +2 -0
  46. data/lib/vendor/workbox-v5.1.4/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/workbox-v5.1.4/workbox-streams.dev.js +318 -0
  48. data/lib/vendor/workbox-v5.1.4/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v5.1.4/workbox-streams.prod.js +2 -0
  50. data/lib/vendor/workbox-v5.1.4/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/workbox-v5.1.4/workbox-sw.js +2 -0
  52. data/lib/vendor/workbox-v5.1.4/workbox-sw.js.map +1 -0
  53. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.es5.mjs +1125 -0
  54. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.es5.mjs.map +1 -0
  55. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.mjs +943 -0
  56. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.mjs.map +1 -0
  57. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.umd.js +1136 -0
  58. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.umd.js.map +1 -0
  59. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.es5.mjs +2 -0
  60. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.es5.mjs.map +1 -0
  61. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.mjs +2 -0
  62. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.mjs.map +1 -0
  63. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.umd.js +2 -0
  64. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.umd.js.map +1 -0
  65. metadata +65 -55
  66. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.dev.js +0 -593
  67. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.prod.js +0 -3
  69. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.prod.js.map +0 -1
  70. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.dev.js +0 -395
  71. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.dev.js.map +0 -1
  72. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.prod.js +0 -3
  73. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.prod.js.map +0 -1
  74. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.dev.js +0 -740
  75. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.dev.js.map +0 -1
  76. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.prod.js +0 -3
  77. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.prod.js.map +0 -1
  78. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.dev.js +0 -236
  79. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.dev.js.map +0 -1
  80. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.prod.js +0 -3
  81. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.prod.js.map +0 -1
  82. data/lib/vendor/workbox-v3.6.3/workbox-core.dev.js +0 -1736
  83. data/lib/vendor/workbox-v3.6.3/workbox-core.dev.js.map +0 -1
  84. data/lib/vendor/workbox-v3.6.3/workbox-core.prod.js +0 -3
  85. data/lib/vendor/workbox-v3.6.3/workbox-core.prod.js.map +0 -1
  86. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.dev.js +0 -255
  87. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.dev.js.map +0 -1
  88. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.prod.js +0 -3
  89. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.prod.js.map +0 -1
  90. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.dev.js +0 -159
  91. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.dev.js.map +0 -1
  92. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.prod.js +0 -3
  93. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.prod.js.map +0 -1
  94. data/lib/vendor/workbox-v3.6.3/workbox-precaching.dev.js +0 -1171
  95. data/lib/vendor/workbox-v3.6.3/workbox-precaching.dev.js.map +0 -1
  96. data/lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js +0 -3
  97. data/lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js.map +0 -1
  98. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.dev.js +0 -299
  99. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.dev.js.map +0 -1
  100. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.prod.js +0 -3
  101. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.prod.js.map +0 -1
  102. data/lib/vendor/workbox-v3.6.3/workbox-routing.dev.js +0 -863
  103. data/lib/vendor/workbox-v3.6.3/workbox-routing.dev.js.map +0 -1
  104. data/lib/vendor/workbox-v3.6.3/workbox-routing.prod.js +0 -3
  105. data/lib/vendor/workbox-v3.6.3/workbox-routing.prod.js.map +0 -1
  106. data/lib/vendor/workbox-v3.6.3/workbox-strategies.dev.js +0 -1172
  107. data/lib/vendor/workbox-v3.6.3/workbox-strategies.dev.js.map +0 -1
  108. data/lib/vendor/workbox-v3.6.3/workbox-strategies.prod.js +0 -3
  109. data/lib/vendor/workbox-v3.6.3/workbox-strategies.prod.js.map +0 -1
  110. data/lib/vendor/workbox-v3.6.3/workbox-streams.dev.js +0 -380
  111. data/lib/vendor/workbox-v3.6.3/workbox-streams.dev.js.map +0 -1
  112. data/lib/vendor/workbox-v3.6.3/workbox-streams.prod.js +0 -3
  113. data/lib/vendor/workbox-v3.6.3/workbox-streams.prod.js.map +0 -1
  114. data/lib/vendor/workbox-v3.6.3/workbox-sw.js +0 -3
  115. data/lib/vendor/workbox-v3.6.3/workbox-sw.js.map +0 -1
@@ -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.6.3'] = 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"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.strategies=function(e,t,s){"use strict";try{self.workbox.v["workbox:strategies:3.6.3"]=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
@@ -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,s){\"use strict\";try{self.workbox.v[\"workbox:strategies:3.6.3\"]=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,380 +0,0 @@
1
- this.workbox = this.workbox || {};
2
- this.workbox.streams = (function (exports,logger_mjs,assert_mjs) {
3
- 'use strict';
4
-
5
- try {
6
- self.workbox.v['workbox:streams:3.6.3'] = 1;
7
- } catch (e) {} // eslint-disable-line
8
-
9
- /*
10
- Copyright 2018 Google Inc. All Rights Reserved.
11
- Licensed under the Apache License, Version 2.0 (the "License");
12
- you may not use this file except in compliance with the License.
13
- You may obtain a copy of the License at
14
-
15
- http://www.apache.org/licenses/LICENSE-2.0
16
-
17
- Unless required by applicable law or agreed to in writing, software
18
- distributed under the License is distributed on an "AS IS" BASIS,
19
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- See the License for the specific language governing permissions and
21
- limitations under the License.
22
- */
23
-
24
- /**
25
- * Takes either a Response, a ReadableStream, or a
26
- * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the
27
- * ReadableStreamReader object associated with it.
28
- *
29
- * @param {workbox.streams.StreamSource} source
30
- * @return {ReadableStreamReader}
31
- * @private
32
- */
33
- function _getReaderFromSource(source) {
34
- if (source.body && source.body.getReader) {
35
- return source.body.getReader();
36
- }
37
-
38
- if (source.getReader) {
39
- return source.getReader();
40
- }
41
-
42
- // TODO: This should be possible to do by constructing a ReadableStream, but
43
- // I can't get it to work. As a hack, construct a new Response, and use the
44
- // reader associated with its body.
45
- return new Response(source).body.getReader();
46
- }
47
-
48
- /**
49
- * Takes multiple source Promises, each of which could resolve to a Response, a
50
- * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).
51
- *
52
- * Returns an object exposing a ReadableStream with each individual stream's
53
- * data returned in sequence, along with a Promise which signals when the
54
- * stream is finished (useful for passing to a FetchEvent's waitUntil()).
55
- *
56
- * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
57
- * @return {Object<{done: Promise, stream: ReadableStream}>}
58
- *
59
- * @memberof workbox.streams
60
- */
61
- function concatenate(sourcePromises) {
62
- {
63
- assert_mjs.assert.isArray(sourcePromises, {
64
- moduleName: 'workbox-streams',
65
- funcName: 'concatenate',
66
- paramName: 'sourcePromises'
67
- });
68
- }
69
-
70
- const readerPromises = sourcePromises.map(sourcePromise => {
71
- return Promise.resolve(sourcePromise).then(source => {
72
- return _getReaderFromSource(source);
73
- });
74
- });
75
-
76
- let fullyStreamedResolve;
77
- let fullyStreamedReject;
78
- const done = new Promise((resolve, reject) => {
79
- fullyStreamedResolve = resolve;
80
- fullyStreamedReject = reject;
81
- });
82
-
83
- let i = 0;
84
- const logMessages = [];
85
- const stream = new ReadableStream({
86
- pull(controller) {
87
- return readerPromises[i].then(reader => reader.read()).then(result => {
88
- if (result.done) {
89
- {
90
- logMessages.push(['Reached the end of source:', sourcePromises[i]]);
91
- }
92
-
93
- i++;
94
- if (i >= readerPromises.length) {
95
- // Log all the messages in the group at once in a single group.
96
- {
97
- logger_mjs.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);
98
- for (const message of logMessages) {
99
- if (Array.isArray(message)) {
100
- logger_mjs.logger.log(...message);
101
- } else {
102
- logger_mjs.logger.log(message);
103
- }
104
- }
105
- logger_mjs.logger.log('Finished reading all sources.');
106
- logger_mjs.logger.groupEnd();
107
- }
108
-
109
- controller.close();
110
- fullyStreamedResolve();
111
- return;
112
- }
113
-
114
- return this.pull(controller);
115
- } else {
116
- controller.enqueue(result.value);
117
- }
118
- }).catch(error => {
119
- {
120
- logger_mjs.logger.error('An error occurred:', error);
121
- }
122
- fullyStreamedReject(error);
123
- throw error;
124
- });
125
- },
126
-
127
- cancel() {
128
- {
129
- logger_mjs.logger.warn('The ReadableStream was cancelled.');
130
- }
131
-
132
- fullyStreamedResolve();
133
- }
134
- });
135
-
136
- return { done, stream };
137
- }
138
-
139
- /*
140
- Copyright 2018 Google Inc. All Rights Reserved.
141
- Licensed under the Apache License, Version 2.0 (the "License");
142
- you may not use this file except in compliance with the License.
143
- You may obtain a copy of the License at
144
-
145
- http://www.apache.org/licenses/LICENSE-2.0
146
-
147
- Unless required by applicable law or agreed to in writing, software
148
- distributed under the License is distributed on an "AS IS" BASIS,
149
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
150
- See the License for the specific language governing permissions and
151
- limitations under the License.
152
- */
153
-
154
- /**
155
- * This is a utility method that determines whether the current browser supports
156
- * the features required to create streamed responses. Currently, it checks if
157
- * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
158
- * is available.
159
- *
160
- * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
161
- * `'text/html'` will be used by default.
162
- * @return {boolean} `true`, if the current browser meets the requirements for
163
- * streaming responses, and `false` otherwise.
164
- *
165
- * @memberof workbox.streams
166
- */
167
- function createHeaders(headersInit = {}) {
168
- // See https://github.com/GoogleChrome/workbox/issues/1461
169
- const headers = new Headers(headersInit);
170
- if (!headers.has('content-type')) {
171
- headers.set('content-type', 'text/html');
172
- }
173
- return headers;
174
- }
175
-
176
- /*
177
- Copyright 2018 Google Inc. All Rights Reserved.
178
- Licensed under the Apache License, Version 2.0 (the "License");
179
- you may not use this file except in compliance with the License.
180
- You may obtain a copy of the License at
181
-
182
- http://www.apache.org/licenses/LICENSE-2.0
183
-
184
- Unless required by applicable law or agreed to in writing, software
185
- distributed under the License is distributed on an "AS IS" BASIS,
186
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187
- See the License for the specific language governing permissions and
188
- limitations under the License.
189
- */
190
-
191
- /**
192
- * Takes multiple source Promises, each of which could resolve to a Response, a
193
- * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
194
- * along with a
195
- * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).
196
- *
197
- * Returns an object exposing a Response whose body consists of each individual
198
- * stream's data returned in sequence, along with a Promise which signals when
199
- * the stream is finished (useful for passing to a FetchEvent's waitUntil()).
200
- *
201
- * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
202
- * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
203
- * `'text/html'` will be used by default.
204
- * @return {Object<{done: Promise, response: Response}>}
205
- *
206
- * @memberof workbox.streams
207
- */
208
- function concatenateToResponse(sourcePromises, headersInit) {
209
- const { done, stream } = concatenate(sourcePromises);
210
-
211
- const headers = createHeaders(headersInit);
212
- const response = new Response(stream, { headers });
213
-
214
- return { done, response };
215
- }
216
-
217
- /*
218
- Copyright 2018 Google Inc. All Rights Reserved.
219
- Licensed under the Apache License, Version 2.0 (the "License");
220
- you may not use this file except in compliance with the License.
221
- You may obtain a copy of the License at
222
-
223
- http://www.apache.org/licenses/LICENSE-2.0
224
-
225
- Unless required by applicable law or agreed to in writing, software
226
- distributed under the License is distributed on an "AS IS" BASIS,
227
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228
- See the License for the specific language governing permissions and
229
- limitations under the License.
230
- */
231
-
232
- let cachedIsSupported = undefined;
233
-
234
- /**
235
- * This is a utility method that determines whether the current browser supports
236
- * the features required to create streamed responses. Currently, it checks if
237
- * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
238
- * can be created.
239
- *
240
- * @return {boolean} `true`, if the current browser meets the requirements for
241
- * streaming responses, and `false` otherwise.
242
- *
243
- * @memberof workbox.streams
244
- */
245
- function isSupported() {
246
- if (cachedIsSupported === undefined) {
247
- // See https://github.com/GoogleChrome/workbox/issues/1473
248
- try {
249
- new ReadableStream({ start() {} });
250
- cachedIsSupported = true;
251
- } catch (error) {
252
- cachedIsSupported = false;
253
- }
254
- }
255
-
256
- return cachedIsSupported;
257
- }
258
-
259
- /*
260
- Copyright 2018 Google Inc. All Rights Reserved.
261
- Licensed under the Apache License, Version 2.0 (the "License");
262
- you may not use this file except in compliance with the License.
263
- You may obtain a copy of the License at
264
-
265
- http://www.apache.org/licenses/LICENSE-2.0
266
-
267
- Unless required by applicable law or agreed to in writing, software
268
- distributed under the License is distributed on an "AS IS" BASIS,
269
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
270
- See the License for the specific language governing permissions and
271
- limitations under the License.
272
- */
273
-
274
- /**
275
- * A shortcut to create a strategy that could be dropped-in to Workbox's router.
276
- *
277
- * On browsers that do not support constructing new `ReadableStream`s, this
278
- * strategy will automatically wait for all the `sourceFunctions` to complete,
279
- * and create a final response that concatenates their values together.
280
- *
281
- * @param {
282
- * Array<function(workbox.routing.Route~handlerCallback)>} sourceFunctions
283
- * Each function should return a {@link workbox.streams.StreamSource} (or a
284
- * Promise which resolves to one).
285
- * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
286
- * `'text/html'` will be used by default.
287
- * @return {workbox.routing.Route~handlerCallback}
288
- *
289
- * @memberof workbox.streams
290
- */
291
- function strategy(sourceFunctions, headersInit) {
292
- return (() => {
293
- var _ref = babelHelpers.asyncToGenerator(function* ({ event, url, params }) {
294
- if (isSupported()) {
295
- const { done, response } = concatenateToResponse(sourceFunctions.map(function (sourceFunction) {
296
- return sourceFunction({ event, url, params });
297
- }), headersInit);
298
- event.waitUntil(done);
299
- return response;
300
- }
301
-
302
- {
303
- logger_mjs.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`);
304
- }
305
-
306
- // Fallback to waiting for everything to finish, and concatenating the
307
- // responses.
308
- const parts = yield Promise.all(sourceFunctions.map(function (sourceFunction) {
309
- return sourceFunction({ event, url, params });
310
- }).map((() => {
311
- var _ref2 = babelHelpers.asyncToGenerator(function* (responsePromise) {
312
- const response = yield responsePromise;
313
- if (response instanceof Response) {
314
- return response.blob();
315
- }
316
-
317
- // Otherwise, assume it's something like a string which can be used
318
- // as-is when constructing the final composite blob.
319
- return response;
320
- });
321
-
322
- return function (_x2) {
323
- return _ref2.apply(this, arguments);
324
- };
325
- })()));
326
-
327
- const headers = createHeaders(headersInit);
328
- // Constructing a new Response from a Blob source is well-supported.
329
- // So is constructing a new Blob from multiple source Blobs or strings.
330
- return new Response(new Blob(parts), { headers });
331
- });
332
-
333
- return function (_x) {
334
- return _ref.apply(this, arguments);
335
- };
336
- })();
337
- }
338
-
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
- */
354
-
355
- /*
356
- Copyright 2018 Google Inc.
357
-
358
- Licensed under the Apache License, Version 2.0 (the "License");
359
- you may not use this file except in compliance with the License.
360
- You may obtain a copy of the License at
361
-
362
- https://www.apache.org/licenses/LICENSE-2.0
363
-
364
- Unless required by applicable law or agreed to in writing, software
365
- distributed under the License is distributed on an "AS IS" BASIS,
366
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
367
- See the License for the specific language governing permissions and
368
- limitations under the License.
369
- */
370
-
371
- exports.concatenate = concatenate;
372
- exports.concatenateToResponse = concatenateToResponse;
373
- exports.isSupported = isSupported;
374
- exports.strategy = strategy;
375
-
376
- return exports;
377
-
378
- }({},workbox.core._private,workbox.core._private));
379
-
380
- //# sourceMappingURL=workbox-streams.dev.js.map
@@ -1 +0,0 @@
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.3'] = 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"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.streams=function(e){"use strict";try{self.workbox.v["workbox:streams:3.6.3"]=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
@@ -1 +0,0 @@
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.3\"]=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 +0,0 @@
1
- var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.3"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.3",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
-
3
- //# sourceMappingURL=workbox-sw.js.map
@@ -1 +0,0 @@
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.3\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.6.3\",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"}