jekyll-pwa-workbox 0.0.7.alpha → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-workbox.rb +1 -1
  3. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-background-sync.dev.js +12 -13
  4. data/lib/vendor/workbox-v5.0.0/workbox-background-sync.dev.js.map +1 -0
  5. data/lib/vendor/workbox-v5.0.0/workbox-background-sync.prod.js +2 -0
  6. data/lib/vendor/workbox-v5.0.0/workbox-background-sync.prod.js.map +1 -0
  7. data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.dev.js +288 -0
  8. data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.dev.js.map +1 -0
  9. data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.prod.js +2 -0
  10. data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.prod.js.map +1 -0
  11. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-cacheable-response.dev.js +6 -7
  12. data/lib/vendor/workbox-v5.0.0/workbox-cacheable-response.dev.js.map +1 -0
  13. data/lib/vendor/workbox-v5.0.0/workbox-cacheable-response.prod.js +2 -0
  14. data/lib/vendor/workbox-v5.0.0/workbox-cacheable-response.prod.js.map +1 -0
  15. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-core.dev.js +306 -67
  16. data/lib/vendor/workbox-v5.0.0/workbox-core.dev.js.map +1 -0
  17. data/lib/vendor/workbox-v5.0.0/workbox-core.prod.js +2 -0
  18. data/lib/vendor/workbox-v5.0.0/workbox-core.prod.js.map +1 -0
  19. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-expiration.dev.js +13 -14
  20. data/lib/vendor/workbox-v5.0.0/workbox-expiration.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v5.0.0/workbox-expiration.prod.js +2 -0
  22. data/lib/vendor/workbox-v5.0.0/workbox-expiration.prod.js.map +1 -0
  23. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-navigation-preload.dev.js +4 -5
  24. data/lib/vendor/workbox-v5.0.0/workbox-navigation-preload.dev.js.map +1 -0
  25. data/lib/vendor/workbox-v5.0.0/workbox-navigation-preload.prod.js +2 -0
  26. data/lib/vendor/workbox-v5.0.0/workbox-navigation-preload.prod.js.map +1 -0
  27. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-offline-ga.dev.js +12 -13
  28. data/lib/vendor/workbox-v5.0.0/workbox-offline-ga.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v5.0.0/workbox-offline-ga.prod.js +2 -0
  30. data/lib/vendor/workbox-v5.0.0/workbox-offline-ga.prod.js.map +1 -0
  31. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-precaching.dev.js +314 -86
  32. data/lib/vendor/workbox-v5.0.0/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v5.0.0/workbox-precaching.prod.js +2 -0
  34. data/lib/vendor/workbox-v5.0.0/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-range-requests.dev.js +8 -9
  36. data/lib/vendor/workbox-v5.0.0/workbox-range-requests.dev.js.map +1 -0
  37. data/lib/vendor/workbox-v5.0.0/workbox-range-requests.prod.js +2 -0
  38. data/lib/vendor/workbox-v5.0.0/workbox-range-requests.prod.js.map +1 -0
  39. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-routing.dev.js +79 -182
  40. data/lib/vendor/workbox-v5.0.0/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/workbox-v5.0.0/workbox-routing.prod.js +2 -0
  42. data/lib/vendor/workbox-v5.0.0/workbox-routing.prod.js.map +1 -0
  43. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-strategies.dev.js +23 -227
  44. data/lib/vendor/workbox-v5.0.0/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v5.0.0/workbox-strategies.prod.js +2 -0
  46. data/lib/vendor/workbox-v5.0.0/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-streams.dev.js +16 -31
  48. data/lib/vendor/workbox-v5.0.0/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v5.0.0/workbox-streams.prod.js +2 -0
  50. data/lib/vendor/workbox-v5.0.0/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/workbox-v5.0.0/workbox-sw.js +2 -0
  52. data/lib/vendor/workbox-v5.0.0/workbox-sw.js.map +1 -0
  53. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-window.dev.es5.mjs +317 -113
  54. data/lib/vendor/workbox-v5.0.0/workbox-window.dev.es5.mjs.map +1 -0
  55. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-window.dev.mjs +244 -44
  56. data/lib/vendor/workbox-v5.0.0/workbox-window.dev.mjs.map +1 -0
  57. data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-window.dev.umd.js +317 -113
  58. data/lib/vendor/workbox-v5.0.0/workbox-window.dev.umd.js.map +1 -0
  59. data/lib/vendor/workbox-v5.0.0/workbox-window.prod.es5.mjs +2 -0
  60. data/lib/vendor/workbox-v5.0.0/workbox-window.prod.es5.mjs.map +1 -0
  61. data/lib/vendor/workbox-v5.0.0/workbox-window.prod.mjs +2 -0
  62. data/lib/vendor/workbox-v5.0.0/workbox-window.prod.mjs.map +1 -0
  63. data/lib/vendor/workbox-v5.0.0/workbox-window.prod.umd.js +2 -0
  64. data/lib/vendor/workbox-v5.0.0/workbox-window.prod.umd.js.map +1 -0
  65. metadata +70 -69
  66. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.dev.js.map +0 -1
  67. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js +0 -2
  68. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js.map +0 -1
  69. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js +0 -486
  70. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js.map +0 -1
  71. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js +0 -2
  72. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js.map +0 -1
  73. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.dev.js.map +0 -1
  74. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js +0 -2
  75. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js.map +0 -1
  76. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.dev.js.map +0 -1
  77. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js +0 -2
  78. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js.map +0 -1
  79. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.dev.js.map +0 -1
  80. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js +0 -2
  81. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js.map +0 -1
  82. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.dev.js.map +0 -1
  83. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js +0 -2
  84. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js.map +0 -1
  85. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.dev.js.map +0 -1
  86. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js +0 -2
  87. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js.map +0 -1
  88. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.dev.js.map +0 -1
  89. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js +0 -2
  90. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js.map +0 -1
  91. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.dev.js.map +0 -1
  92. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js +0 -2
  93. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js.map +0 -1
  94. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.dev.js.map +0 -1
  95. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js +0 -2
  96. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js.map +0 -1
  97. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.dev.js.map +0 -1
  98. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js +0 -2
  99. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js.map +0 -1
  100. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.dev.js.map +0 -1
  101. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js +0 -2
  102. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js.map +0 -1
  103. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js +0 -2
  104. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js.map +0 -1
  105. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.es5.mjs.map +0 -1
  106. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.mjs.map +0 -1
  107. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.umd.js.map +0 -1
  108. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs +0 -2
  109. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs.map +0 -1
  110. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs +0 -2
  111. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs.map +0 -1
  112. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js +0 -2
  113. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-routing.dev.js","sources":["../_version.js","../utils/constants.js","../utils/normalizeHandler.js","../Route.js","../NavigationRoute.js","../RegExpRoute.js","../Router.js","../utils/getOrCreateDefaultRouter.js","../registerRoute.js","../setCatchHandler.js","../setDefaultHandler.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:routing:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\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 */\nexport const defaultMethod = 'GET';\n/**\n * The list of valid HTTP methods associated with requests that could be routed.\n *\n * @type {Array<string>}\n *\n * @private\n */\nexport const validMethods = [\n 'DELETE',\n 'GET',\n 'HEAD',\n 'PATCH',\n 'POST',\n 'PUT',\n];\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport '../_version.js';\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 */\nexport const normalizeHandler = (handler) => {\n if (handler && typeof handler === 'object') {\n if (process.env.NODE_ENV !== 'production') {\n assert.hasMethod(handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler',\n });\n }\n return handler;\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n 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 Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { defaultMethod, validMethods } from './utils/constants.js';\nimport { normalizeHandler } from './utils/normalizeHandler.js';\nimport './_version.js';\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 module:workbox-routing\n */\nclass Route {\n /**\n * Constructor for Route class.\n *\n * @param {module:workbox-routing~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 {module:workbox-routing~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 = defaultMethod) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(match, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'match',\n });\n if (method) {\n assert.isOneOf(method, validMethods, { paramName: 'method' });\n }\n }\n // These values are referenced directly by Router so cannot be\n // altered by minificaton.\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method;\n }\n}\nexport { Route };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { Route } from './Route.js';\nimport './_version.js';\n/**\n * NavigationRoute makes it easy to create a\n * [Route]{@link module: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 `denylist` and `allowlist` parameters.\n *\n * @memberof module:workbox-routing\n * @extends module:workbox-routing.Route\n */\nclass NavigationRoute extends Route {\n /**\n * If both `denylist` and `allowlist` are provided, the `denylist` will\n * take precedence and the request will not match this route.\n *\n * The regular expressions in `allowlist` and `denylist`\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 {module:workbox-routing~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {Object} options\n * @param {Array<RegExp>} [options.denylist] If any of these patterns match,\n * the route will not handle the request (even if a allowlist RegExp matches).\n * @param {Array<RegExp>} [options.allowlist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the denylist doesn't match).\n */\n constructor(handler, { allowlist = [/./], denylist = [] } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isArrayOfClass(allowlist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.allowlist',\n });\n assert.isArrayOfClass(denylist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.denylist',\n });\n }\n super((options) => this._match(options), handler);\n this._allowlist = allowlist;\n this._denylist = denylist;\n }\n /**\n * Routes match handler.\n *\n * @param {Object} options\n * @param {URL} options.url\n * @param {Request} options.request\n * @return {boolean}\n *\n * @private\n */\n _match({ url, request }) {\n if (request && request.mode !== 'navigate') {\n return false;\n }\n const pathnameAndSearch = url.pathname + url.search;\n for (const regExp of this._denylist) {\n if (regExp.test(pathnameAndSearch)) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`The navigation route ${pathnameAndSearch} is not ` +\n `being used, since the URL matches this denylist pattern: ` +\n `${regExp}`);\n }\n return false;\n }\n }\n if (this._allowlist.some((regExp) => regExp.test(pathnameAndSearch))) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`The navigation route ${pathnameAndSearch} ` +\n `is being used.`);\n }\n return true;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`The navigation route ${pathnameAndSearch} is not ` +\n `being used, since the URL being navigated to doesn't ` +\n `match the allowlist.`);\n }\n return false;\n }\n}\nexport { NavigationRoute };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { Route } from './Route.js';\nimport './_version.js';\n/**\n * RegExpRoute makes it easy to create a regular expression based\n * [Route]{@link module: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 module:workbox-routing\n * @extends module:workbox-routing.Route\n */\nclass RegExpRoute extends Route {\n /**\n * If the regular expression contains\n * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},\n * the captured values will be passed to the\n * [handler's]{@link module:workbox-routing~handlerCallback} `params`\n * argument.\n *\n * @param {RegExp} regExp The regular expression to match against URLs.\n * @param {module:workbox-routing~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 if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(regExp, RegExp, {\n moduleName: 'workbox-routing',\n className: 'RegExpRoute',\n funcName: 'constructor',\n paramName: 'pattern',\n });\n }\n const match = ({ url }) => {\n const result = regExp.exec(url.href);\n // Return immediately if there's no match.\n if (!result) {\n return;\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 if (process.env.NODE_ENV !== 'production') {\n logger.debug(`The regular expression '${regExp}' only partially matched ` +\n `against the cross-origin URL '${url}'. RegExpRoute's will only ` +\n `handle cross-origin requests if they match the entire URL.`);\n }\n return;\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 super(match, handler, method);\n }\n}\nexport { RegExpRoute };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { normalizeHandler } from './utils/normalizeHandler.js';\nimport './_version.js';\n/**\n * The Router can be used to process a FetchEvent through one or more\n * [Routes]{@link module: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 module:workbox-routing\n */\nclass Router {\n /**\n * Initializes a new Router.\n */\n constructor() {\n this._routes = new Map();\n }\n /**\n * @return {Map<string, Array<module:workbox-routing.Route>>} routes A `Map` of HTTP\n * method name ('GET', etc.) to an array of all the corresponding `Route`\n * instances that are registered.\n */\n get routes() {\n return this._routes;\n }\n /**\n * Adds a fetch event listener to respond to events when a route matches\n * the event's request.\n */\n addFetchListener() {\n // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705\n self.addEventListener('fetch', ((event) => {\n const { request } = event;\n const responsePromise = this.handleRequest({ request, event });\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n }));\n }\n /**\n * Adds a message event listener for URLs to cache from the window.\n * This is useful to cache resources loaded on the page prior to when the\n * service worker started controlling it.\n *\n * The format of the message data sent from the window should be as follows.\n * Where the `urlsToCache` array may consist of URL strings or an array of\n * URL string + `requestInit` object (the same as you'd pass to `fetch()`).\n *\n * ```\n * {\n * type: 'CACHE_URLS',\n * payload: {\n * urlsToCache: [\n * './script1.js',\n * './script2.js',\n * ['./script3.js', {mode: 'no-cors'}],\n * ],\n * },\n * }\n * ```\n */\n addCacheListener() {\n // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705\n self.addEventListener('message', ((event) => {\n if (event.data && event.data.type === 'CACHE_URLS') {\n const { payload } = event.data;\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Caching URLs from the window`, payload.urlsToCache);\n }\n const requestPromises = Promise.all(payload.urlsToCache.map((entry) => {\n if (typeof entry === 'string') {\n entry = [entry];\n }\n const request = new Request(...entry);\n return this.handleRequest({ request });\n // TODO(philipwalton): TypeScript errors without this typecast for\n // some reason (probably a bug). The real type here should work but\n // doesn't: `Array<Promise<Response> | undefined>`.\n })); // TypeScript\n event.waitUntil(requestPromises);\n // If a MessageChannel was used, reply to the message on success.\n if (event.ports && event.ports[0]) {\n requestPromises.then(() => event.ports[0].postMessage(true));\n }\n }\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 {Object} options\n * @param {Request} options.request The request to handle (this is usually\n * from a fetch event, but it does not have to be).\n * @param {FetchEvent} [options.event] The event that triggered the request,\n * if applicable.\n * @return {Promise<Response>|undefined} A promise is returned if a\n * registered route can handle the request. If there is no matching\n * route and there's no `defaultHandler`, `undefined` is returned.\n */\n handleRequest({ request, event }) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'handleRequest',\n paramName: 'options.request',\n });\n }\n const url = new URL(request.url, location.href);\n if (!url.protocol.startsWith('http')) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Workbox Router only supports URLs that start with 'http'.`);\n }\n return;\n }\n let { params, route } = this.findMatchingRoute({ url, request, event });\n let handler = route && route.handler;\n let debugMessages = [];\n if (process.env.NODE_ENV !== 'production') {\n if (handler) {\n debugMessages.push([\n `Found a route to handle this request:`, route,\n ]);\n if (params) {\n debugMessages.push([\n `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 if (process.env.NODE_ENV !== 'production') {\n debugMessages.push(`Failed to find a matching route. Falling ` +\n `back to the default handler.`);\n }\n handler = this._defaultHandler;\n }\n if (!handler) {\n if (process.env.NODE_ENV !== 'production') {\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.debug(`No route found for: ${getFriendlyURL(url)}`);\n }\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n // We have a handler, meaning Workbox is going to handle the route.\n // print the routing details to the console.\n logger.groupCollapsed(`Router is responding to: ${getFriendlyURL(url)}`);\n debugMessages.forEach((msg) => {\n if (Array.isArray(msg)) {\n logger.log(...msg);\n }\n else {\n logger.log(msg);\n }\n });\n logger.groupEnd();\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, request, event, params });\n }\n catch (err) {\n responsePromise = Promise.reject(err);\n }\n if (responsePromise instanceof Promise && this._catchHandler) {\n responsePromise = responsePromise.catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\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.groupCollapsed(`Error thrown when responding to: ` +\n ` ${getFriendlyURL(url)}. Falling back to Catch Handler.`);\n logger.error(`Error thrown by:`, route);\n logger.error(err);\n logger.groupEnd();\n }\n return this._catchHandler.handle({ url, request, event });\n });\n }\n return responsePromise;\n }\n /**\n * Checks a request and URL (and optionally an event) against the list of\n * registered routes, and if there's a match, returns the corresponding\n * route along with any params generated by the match.\n *\n * @param {Object} options\n * @param {URL} options.url\n * @param {Request} options.request The request to match.\n * @param {Event} [options.event] The corresponding event (unless N/A).\n * @return {Object} An object with `route` and `params` properties.\n * They are populated if a matching route was found or `undefined`\n * otherwise.\n */\n findMatchingRoute({ url, request, event }) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(url, URL, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'findMatchingRoute',\n paramName: 'options.url',\n });\n assert.isInstance(request, Request, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'findMatchingRoute',\n paramName: 'options.request',\n });\n }\n const routes = this._routes.get(request.method) || [];\n for (const route of routes) {\n let params;\n let matchResult = route.match({ url, request, event });\n if (matchResult) {\n // See https://github.com/GoogleChrome/workbox/issues/2079\n params = matchResult;\n if (Array.isArray(matchResult) && matchResult.length === 0) {\n // Instead of passing an empty array in as params, use undefined.\n params = undefined;\n }\n else if ((matchResult.constructor === Object &&\n Object.keys(matchResult).length === 0)) {\n // Instead of passing an empty object in as params, use undefined.\n params = undefined;\n }\n else if (typeof matchResult === 'boolean') {\n // For the boolean value true (rather than just something truth-y),\n // don't set params.\n // See https://github.com/GoogleChrome/workbox/pull/2134#issuecomment-513924353\n params = undefined;\n }\n // Return early if have a match.\n return { route, params };\n }\n }\n // If no match was found above, return and empty object.\n return {};\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 {module:workbox-routing~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 * 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 {module:workbox-routing~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 * Registers a route with the router.\n *\n * @param {module:workbox-routing.Route} route The route to register.\n */\n registerRoute(route) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(route, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route',\n });\n assert.hasMethod(route, 'match', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route',\n });\n assert.isType(route.handler, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route',\n });\n assert.hasMethod(route.handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.handler',\n });\n assert.isType(route.method, 'string', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.method',\n });\n }\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\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 * Unregisters a route with the router.\n *\n * @param {module:workbox-routing.Route} route The route to unregister.\n */\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new WorkboxError('unregister-route-but-not-found-with-method', {\n method: route.method,\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 }\n else {\n throw new WorkboxError('unregister-route-route-not-registered');\n }\n }\n}\nexport { Router };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Router } from '../Router.js';\nimport '../_version.js';\nlet defaultRouter;\n/**\n * Creates a new, singleton Router instance if one does not exist. If one\n * does already exist, that instance is returned.\n *\n * @private\n * @return {Router}\n */\nexport const getOrCreateDefaultRouter = () => {\n if (!defaultRouter) {\n defaultRouter = new Router();\n // The helpers that use the default Router assume these listeners exist.\n defaultRouter.addFetchListener();\n defaultRouter.addCacheListener();\n }\n return defaultRouter;\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { Route } from './Route.js';\nimport { RegExpRoute } from './RegExpRoute.js';\nimport { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter.js';\nimport './_version.js';\n/**\n * Easily register a RegExp, string, or function with a caching\n * strategy to a singleton Router instance.\n *\n * This method will generate a Route for you if needed and\n * call [registerRoute()]{@link module:workbox-routing.Router#registerRoute}.\n *\n * @param {RegExp|string|module:workbox-routing.Route~matchCallback|module:workbox-routing.Route} capture\n * If the capture param is a `Route`, all other arguments will be ignored.\n * @param {module:workbox-routing~handlerCallback} [handler] A callback\n * function that returns a Promise resulting in a Response. This parameter\n * is required if `capture` is not a `Route` object.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n * @return {module:workbox-routing.Route} The generated `Route`(Useful for\n * unregistering).\n *\n * @memberof module:workbox-routing\n */\nfunction registerRoute(capture, handler, method) {\n let route;\n if (typeof capture === 'string') {\n const captureUrl = new URL(capture, location.href);\n if (process.env.NODE_ENV !== 'production') {\n if (!(capture.startsWith('/') || capture.startsWith('http'))) {\n throw new WorkboxError('invalid-string', {\n moduleName: 'workbox-routing',\n funcName: 'registerRoute',\n paramName: 'capture',\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') ?\n 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.debug(`The '$capture' parameter contains an Express-style wildcard ` +\n `character (${wildcards}). Strings are now always interpreted as ` +\n `exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n const matchCallback = ({ url }) => {\n if (process.env.NODE_ENV !== 'production') {\n if ((url.pathname === captureUrl.pathname) &&\n (url.origin !== captureUrl.origin)) {\n logger.debug(`${capture} only partially matches the cross-origin URL ` +\n `${url}. This route will only handle cross-origin requests ` +\n `if they match the entire URL.`);\n }\n }\n return url.href === captureUrl.href;\n };\n // If `capture` is a string then `handler` and `method` must be present.\n route = new Route(matchCallback, handler, method);\n }\n else if (capture instanceof RegExp) {\n // If `capture` is a `RegExp` then `handler` and `method` must be present.\n route = new RegExpRoute(capture, handler, method);\n }\n else if (typeof capture === 'function') {\n // If `capture` is a function then `handler` and `method` must be present.\n route = new Route(capture, handler, method);\n }\n else if (capture instanceof Route) {\n route = capture;\n }\n else {\n throw new WorkboxError('unsupported-route-type', {\n moduleName: 'workbox-routing',\n funcName: 'registerRoute',\n paramName: 'capture',\n });\n }\n const defaultRouter = getOrCreateDefaultRouter();\n defaultRouter.registerRoute(route);\n return route;\n}\n;\nexport { registerRoute };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter.js';\nimport './_version.js';\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 {module:workbox-routing~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n *\n * @memberof module:workbox-routing\n */\nfunction setCatchHandler(handler) {\n const defaultRouter = getOrCreateDefaultRouter();\n defaultRouter.setCatchHandler(handler);\n}\n;\nexport { setCatchHandler };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter.js';\nimport './_version.js';\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 {module:workbox-routing~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n *\n * @memberof module:workbox-routing\n */\nfunction setDefaultHandler(handler) {\n const defaultRouter = getOrCreateDefaultRouter();\n defaultRouter.setDefaultHandler(handler);\n}\n;\nexport { setDefaultHandler };\n"],"names":["self","_","e","defaultMethod","validMethods","normalizeHandler","handler","assert","hasMethod","moduleName","className","funcName","paramName","isType","handle","Route","constructor","match","method","isOneOf","NavigationRoute","allowlist","denylist","isArrayOfClass","RegExp","options","_match","_allowlist","_denylist","url","request","mode","pathnameAndSearch","pathname","search","regExp","test","logger","log","some","debug","RegExpRoute","isInstance","result","exec","href","origin","location","index","slice","Router","_routes","Map","routes","addFetchListener","addEventListener","event","responsePromise","handleRequest","respondWith","addCacheListener","data","type","payload","urlsToCache","requestPromises","Promise","all","map","entry","Request","waitUntil","ports","then","postMessage","URL","protocol","startsWith","params","route","findMatchingRoute","debugMessages","push","_defaultHandler","getFriendlyURL","groupCollapsed","forEach","msg","Array","isArray","groupEnd","err","reject","_catchHandler","catch","error","get","matchResult","length","undefined","Object","keys","setDefaultHandler","setCatchHandler","registerRoute","has","set","unregisterRoute","WorkboxError","routeIndex","indexOf","splice","defaultRouter","getOrCreateDefaultRouter","capture","captureUrl","valueToCheck","wildcards","matchCallback"],"mappings":";;;;IAEA,IAAI;IACAA,EAAAA,IAAI,CAAC,uBAAD,CAAJ,IAAiCC,CAAC,EAAlC;IACH,CAFD,CAGA,OAAOC,CAAP,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CAAR;IACH,GAHI,MAIA,IAAIgG,OAAO,YAAYnG,KAAvB,EAA8B;IAC/BgE,IAAAA,KAAK,GAAGmC,OAAR;IACH,GAFI,MAGA;IACD,UAAM,IAAIN,4BAAJ,CAAiB,wBAAjB,EAA2C;IAC7CnG,MAAAA,UAAU,EAAE,iBADiC;IAE7CE,MAAAA,QAAQ,EAAE,eAFmC;IAG7CC,MAAAA,SAAS,EAAE;IAHkC,KAA3C,CAAN;IAKH;;IACD,QAAMoG,aAAa,GAAGC,wBAAwB,EAA9C;IACAD,EAAAA,aAAa,CAACR,aAAd,CAA4BzB,KAA5B;IACA,SAAOA,KAAP;IACH;;IC3FD;;;;;;;AAOA,IAEA;;;;;;;;;;IASA,SAASwB,eAAT,CAAyBjG,OAAzB,EAAkC;IAC9B,QAAM0G,aAAa,GAAGC,wBAAwB,EAA9C;IACAD,EAAAA,aAAa,CAACT,eAAd,CAA8BjG,OAA9B;IACH;;ICrBD;;;;;;;AAOA,IAEA;;;;;;;;;;;;;IAYA,SAASgG,iBAAT,CAA2BhG,OAA3B,EAAoC;IAChC,QAAM0G,aAAa,GAAGC,wBAAwB,EAA9C;IACAD,EAAAA,aAAa,CAACV,iBAAd,CAAgChG,OAAhC;IACH;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self["workbox:routing:5.0.0"]&&_()}catch(t){}const s="GET",r=t=>t&&"object"==typeof t?t:{handle:t};class n{constructor(t,e,n=s){this.handler=r(e),this.match=t,this.method=n}}class o extends n{constructor(t,e,s){super(({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)},e,s)}}class i{constructor(){this.t=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)})}addCacheListener(){self.addEventListener("message",t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map(t=>{"string"==typeof t&&(t=[t]);const e=new Request(...t);return this.handleRequest({request:e})}));t.waitUntil(s),t.ports&&t.ports[0]&&s.then(()=>t.ports[0].postMessage(!0))}})}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;let r,{params:n,route:o}=this.findMatchingRoute({url:s,request:t,event:e}),i=o&&o.handler;if(!i&&this.s&&(i=this.s),i){try{r=i.handle({url:s,request:t,event:e,params:n})}catch(t){r=Promise.reject(t)}return r instanceof Promise&&this.o&&(r=r.catch(r=>this.o.handle({url:s,request:t,event:e}))),r}}findMatchingRoute({url:t,request:e,event:s}){const r=this.t.get(e.method)||[];for(const n of r){let r,o=n.match({url:t,request:e,event:s});if(o)return r=o,Array.isArray(o)&&0===o.length?r=void 0:o.constructor===Object&&0===Object.keys(o).length?r=void 0:"boolean"==typeof o&&(r=void 0),{route:n,params:r}}return{}}setDefaultHandler(t){this.s=r(t)}setCatchHandler(t){this.o=r(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new e.WorkboxError("unregister-route-but-not-found-with-method",{method:t.method});const s=this.t.get(t.method).indexOf(t);if(!(s>-1))throw new e.WorkboxError("unregister-route-route-not-registered");this.t.get(t.method).splice(s,1)}}let u;const c=()=>(u||((u=new i).addFetchListener(),u.addCacheListener()),u);return t.NavigationRoute=class extends n{constructor(t,{allowlist:e=[/./],denylist:s=[]}={}){super(t=>this.i(t),t),this.u=e,this.h=s}i({url:t,request:e}){if(e&&"navigate"!==e.mode)return!1;const s=t.pathname+t.search;for(const t of this.h)if(t.test(s))return!1;return!!this.u.some(t=>t.test(s))}},t.RegExpRoute=o,t.Route=n,t.Router=i,t.registerRoute=function(t,s,r){let i;if("string"==typeof t){const e=new URL(t,location.href);i=new n(({url:t})=>t.href===e.href,s,r)}else if(t instanceof RegExp)i=new o(t,s,r);else if("function"==typeof t)i=new n(t,s,r);else{if(!(t instanceof n))throw new e.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});i=t}return c().registerRoute(i),i},t.setCatchHandler=function(t){c().setCatchHandler(t)},t.setDefaultHandler=function(t){c().setDefaultHandler(t)},t}({},workbox.core._private);
2
+ //# sourceMappingURL=workbox-routing.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-routing.prod.js","sources":["../_version.js","../utils/constants.js","../utils/normalizeHandler.js","../Route.js","../RegExpRoute.js","../Router.js","../utils/getOrCreateDefaultRouter.js","../NavigationRoute.js","../registerRoute.js","../setCatchHandler.js","../setDefaultHandler.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:routing:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\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 */\nexport const defaultMethod = 'GET';\n/**\n * The list of valid HTTP methods associated with requests that could be routed.\n *\n * @type {Array<string>}\n *\n * @private\n */\nexport const validMethods = [\n 'DELETE',\n 'GET',\n 'HEAD',\n 'PATCH',\n 'POST',\n 'PUT',\n];\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport '../_version.js';\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 */\nexport const normalizeHandler = (handler) => {\n if (handler && typeof handler === 'object') {\n if (process.env.NODE_ENV !== 'production') {\n assert.hasMethod(handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler',\n });\n }\n return handler;\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n 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 Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { defaultMethod, validMethods } from './utils/constants.js';\nimport { normalizeHandler } from './utils/normalizeHandler.js';\nimport './_version.js';\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 module:workbox-routing\n */\nclass Route {\n /**\n * Constructor for Route class.\n *\n * @param {module:workbox-routing~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 {module:workbox-routing~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 = defaultMethod) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(match, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'match',\n });\n if (method) {\n assert.isOneOf(method, validMethods, { paramName: 'method' });\n }\n }\n // These values are referenced directly by Router so cannot be\n // altered by minificaton.\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method;\n }\n}\nexport { Route };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { Route } from './Route.js';\nimport './_version.js';\n/**\n * RegExpRoute makes it easy to create a regular expression based\n * [Route]{@link module: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 module:workbox-routing\n * @extends module:workbox-routing.Route\n */\nclass RegExpRoute extends Route {\n /**\n * If the regular expression contains\n * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},\n * the captured values will be passed to the\n * [handler's]{@link module:workbox-routing~handlerCallback} `params`\n * argument.\n *\n * @param {RegExp} regExp The regular expression to match against URLs.\n * @param {module:workbox-routing~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 if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(regExp, RegExp, {\n moduleName: 'workbox-routing',\n className: 'RegExpRoute',\n funcName: 'constructor',\n paramName: 'pattern',\n });\n }\n const match = ({ url }) => {\n const result = regExp.exec(url.href);\n // Return immediately if there's no match.\n if (!result) {\n return;\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 if (process.env.NODE_ENV !== 'production') {\n logger.debug(`The regular expression '${regExp}' only partially matched ` +\n `against the cross-origin URL '${url}'. RegExpRoute's will only ` +\n `handle cross-origin requests if they match the entire URL.`);\n }\n return;\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 super(match, handler, method);\n }\n}\nexport { RegExpRoute };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { normalizeHandler } from './utils/normalizeHandler.js';\nimport './_version.js';\n/**\n * The Router can be used to process a FetchEvent through one or more\n * [Routes]{@link module: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 module:workbox-routing\n */\nclass Router {\n /**\n * Initializes a new Router.\n */\n constructor() {\n this._routes = new Map();\n }\n /**\n * @return {Map<string, Array<module:workbox-routing.Route>>} routes A `Map` of HTTP\n * method name ('GET', etc.) to an array of all the corresponding `Route`\n * instances that are registered.\n */\n get routes() {\n return this._routes;\n }\n /**\n * Adds a fetch event listener to respond to events when a route matches\n * the event's request.\n */\n addFetchListener() {\n // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705\n self.addEventListener('fetch', ((event) => {\n const { request } = event;\n const responsePromise = this.handleRequest({ request, event });\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n }));\n }\n /**\n * Adds a message event listener for URLs to cache from the window.\n * This is useful to cache resources loaded on the page prior to when the\n * service worker started controlling it.\n *\n * The format of the message data sent from the window should be as follows.\n * Where the `urlsToCache` array may consist of URL strings or an array of\n * URL string + `requestInit` object (the same as you'd pass to `fetch()`).\n *\n * ```\n * {\n * type: 'CACHE_URLS',\n * payload: {\n * urlsToCache: [\n * './script1.js',\n * './script2.js',\n * ['./script3.js', {mode: 'no-cors'}],\n * ],\n * },\n * }\n * ```\n */\n addCacheListener() {\n // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705\n self.addEventListener('message', ((event) => {\n if (event.data && event.data.type === 'CACHE_URLS') {\n const { payload } = event.data;\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Caching URLs from the window`, payload.urlsToCache);\n }\n const requestPromises = Promise.all(payload.urlsToCache.map((entry) => {\n if (typeof entry === 'string') {\n entry = [entry];\n }\n const request = new Request(...entry);\n return this.handleRequest({ request });\n // TODO(philipwalton): TypeScript errors without this typecast for\n // some reason (probably a bug). The real type here should work but\n // doesn't: `Array<Promise<Response> | undefined>`.\n })); // TypeScript\n event.waitUntil(requestPromises);\n // If a MessageChannel was used, reply to the message on success.\n if (event.ports && event.ports[0]) {\n requestPromises.then(() => event.ports[0].postMessage(true));\n }\n }\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 {Object} options\n * @param {Request} options.request The request to handle (this is usually\n * from a fetch event, but it does not have to be).\n * @param {FetchEvent} [options.event] The event that triggered the request,\n * if applicable.\n * @return {Promise<Response>|undefined} A promise is returned if a\n * registered route can handle the request. If there is no matching\n * route and there's no `defaultHandler`, `undefined` is returned.\n */\n handleRequest({ request, event }) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'handleRequest',\n paramName: 'options.request',\n });\n }\n const url = new URL(request.url, location.href);\n if (!url.protocol.startsWith('http')) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Workbox Router only supports URLs that start with 'http'.`);\n }\n return;\n }\n let { params, route } = this.findMatchingRoute({ url, request, event });\n let handler = route && route.handler;\n let debugMessages = [];\n if (process.env.NODE_ENV !== 'production') {\n if (handler) {\n debugMessages.push([\n `Found a route to handle this request:`, route,\n ]);\n if (params) {\n debugMessages.push([\n `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 if (process.env.NODE_ENV !== 'production') {\n debugMessages.push(`Failed to find a matching route. Falling ` +\n `back to the default handler.`);\n }\n handler = this._defaultHandler;\n }\n if (!handler) {\n if (process.env.NODE_ENV !== 'production') {\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.debug(`No route found for: ${getFriendlyURL(url)}`);\n }\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n // We have a handler, meaning Workbox is going to handle the route.\n // print the routing details to the console.\n logger.groupCollapsed(`Router is responding to: ${getFriendlyURL(url)}`);\n debugMessages.forEach((msg) => {\n if (Array.isArray(msg)) {\n logger.log(...msg);\n }\n else {\n logger.log(msg);\n }\n });\n logger.groupEnd();\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, request, event, params });\n }\n catch (err) {\n responsePromise = Promise.reject(err);\n }\n if (responsePromise instanceof Promise && this._catchHandler) {\n responsePromise = responsePromise.catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\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.groupCollapsed(`Error thrown when responding to: ` +\n ` ${getFriendlyURL(url)}. Falling back to Catch Handler.`);\n logger.error(`Error thrown by:`, route);\n logger.error(err);\n logger.groupEnd();\n }\n return this._catchHandler.handle({ url, request, event });\n });\n }\n return responsePromise;\n }\n /**\n * Checks a request and URL (and optionally an event) against the list of\n * registered routes, and if there's a match, returns the corresponding\n * route along with any params generated by the match.\n *\n * @param {Object} options\n * @param {URL} options.url\n * @param {Request} options.request The request to match.\n * @param {Event} [options.event] The corresponding event (unless N/A).\n * @return {Object} An object with `route` and `params` properties.\n * They are populated if a matching route was found or `undefined`\n * otherwise.\n */\n findMatchingRoute({ url, request, event }) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(url, URL, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'findMatchingRoute',\n paramName: 'options.url',\n });\n assert.isInstance(request, Request, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'findMatchingRoute',\n paramName: 'options.request',\n });\n }\n const routes = this._routes.get(request.method) || [];\n for (const route of routes) {\n let params;\n let matchResult = route.match({ url, request, event });\n if (matchResult) {\n // See https://github.com/GoogleChrome/workbox/issues/2079\n params = matchResult;\n if (Array.isArray(matchResult) && matchResult.length === 0) {\n // Instead of passing an empty array in as params, use undefined.\n params = undefined;\n }\n else if ((matchResult.constructor === Object &&\n Object.keys(matchResult).length === 0)) {\n // Instead of passing an empty object in as params, use undefined.\n params = undefined;\n }\n else if (typeof matchResult === 'boolean') {\n // For the boolean value true (rather than just something truth-y),\n // don't set params.\n // See https://github.com/GoogleChrome/workbox/pull/2134#issuecomment-513924353\n params = undefined;\n }\n // Return early if have a match.\n return { route, params };\n }\n }\n // If no match was found above, return and empty object.\n return {};\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 {module:workbox-routing~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 * 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 {module:workbox-routing~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 * Registers a route with the router.\n *\n * @param {module:workbox-routing.Route} route The route to register.\n */\n registerRoute(route) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(route, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route',\n });\n assert.hasMethod(route, 'match', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route',\n });\n assert.isType(route.handler, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route',\n });\n assert.hasMethod(route.handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.handler',\n });\n assert.isType(route.method, 'string', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.method',\n });\n }\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\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 * Unregisters a route with the router.\n *\n * @param {module:workbox-routing.Route} route The route to unregister.\n */\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new WorkboxError('unregister-route-but-not-found-with-method', {\n method: route.method,\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 }\n else {\n throw new WorkboxError('unregister-route-route-not-registered');\n }\n }\n}\nexport { Router };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { Router } from '../Router.js';\nimport '../_version.js';\nlet defaultRouter;\n/**\n * Creates a new, singleton Router instance if one does not exist. If one\n * does already exist, that instance is returned.\n *\n * @private\n * @return {Router}\n */\nexport const getOrCreateDefaultRouter = () => {\n if (!defaultRouter) {\n defaultRouter = new Router();\n // The helpers that use the default Router assume these listeners exist.\n defaultRouter.addFetchListener();\n defaultRouter.addCacheListener();\n }\n return defaultRouter;\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { Route } from './Route.js';\nimport './_version.js';\n/**\n * NavigationRoute makes it easy to create a\n * [Route]{@link module: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 `denylist` and `allowlist` parameters.\n *\n * @memberof module:workbox-routing\n * @extends module:workbox-routing.Route\n */\nclass NavigationRoute extends Route {\n /**\n * If both `denylist` and `allowlist` are provided, the `denylist` will\n * take precedence and the request will not match this route.\n *\n * The regular expressions in `allowlist` and `denylist`\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 {module:workbox-routing~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {Object} options\n * @param {Array<RegExp>} [options.denylist] If any of these patterns match,\n * the route will not handle the request (even if a allowlist RegExp matches).\n * @param {Array<RegExp>} [options.allowlist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the denylist doesn't match).\n */\n constructor(handler, { allowlist = [/./], denylist = [] } = {}) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isArrayOfClass(allowlist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.allowlist',\n });\n assert.isArrayOfClass(denylist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.denylist',\n });\n }\n super((options) => this._match(options), handler);\n this._allowlist = allowlist;\n this._denylist = denylist;\n }\n /**\n * Routes match handler.\n *\n * @param {Object} options\n * @param {URL} options.url\n * @param {Request} options.request\n * @return {boolean}\n *\n * @private\n */\n _match({ url, request }) {\n if (request && request.mode !== 'navigate') {\n return false;\n }\n const pathnameAndSearch = url.pathname + url.search;\n for (const regExp of this._denylist) {\n if (regExp.test(pathnameAndSearch)) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`The navigation route ${pathnameAndSearch} is not ` +\n `being used, since the URL matches this denylist pattern: ` +\n `${regExp}`);\n }\n return false;\n }\n }\n if (this._allowlist.some((regExp) => regExp.test(pathnameAndSearch))) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`The navigation route ${pathnameAndSearch} ` +\n `is being used.`);\n }\n return true;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`The navigation route ${pathnameAndSearch} is not ` +\n `being used, since the URL being navigated to doesn't ` +\n `match the allowlist.`);\n }\n return false;\n }\n}\nexport { NavigationRoute };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { Route } from './Route.js';\nimport { RegExpRoute } from './RegExpRoute.js';\nimport { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter.js';\nimport './_version.js';\n/**\n * Easily register a RegExp, string, or function with a caching\n * strategy to a singleton Router instance.\n *\n * This method will generate a Route for you if needed and\n * call [registerRoute()]{@link module:workbox-routing.Router#registerRoute}.\n *\n * @param {RegExp|string|module:workbox-routing.Route~matchCallback|module:workbox-routing.Route} capture\n * If the capture param is a `Route`, all other arguments will be ignored.\n * @param {module:workbox-routing~handlerCallback} [handler] A callback\n * function that returns a Promise resulting in a Response. This parameter\n * is required if `capture` is not a `Route` object.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n * @return {module:workbox-routing.Route} The generated `Route`(Useful for\n * unregistering).\n *\n * @memberof module:workbox-routing\n */\nfunction registerRoute(capture, handler, method) {\n let route;\n if (typeof capture === 'string') {\n const captureUrl = new URL(capture, location.href);\n if (process.env.NODE_ENV !== 'production') {\n if (!(capture.startsWith('/') || capture.startsWith('http'))) {\n throw new WorkboxError('invalid-string', {\n moduleName: 'workbox-routing',\n funcName: 'registerRoute',\n paramName: 'capture',\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') ?\n 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.debug(`The '$capture' parameter contains an Express-style wildcard ` +\n `character (${wildcards}). Strings are now always interpreted as ` +\n `exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n const matchCallback = ({ url }) => {\n if (process.env.NODE_ENV !== 'production') {\n if ((url.pathname === captureUrl.pathname) &&\n (url.origin !== captureUrl.origin)) {\n logger.debug(`${capture} only partially matches the cross-origin URL ` +\n `${url}. This route will only handle cross-origin requests ` +\n `if they match the entire URL.`);\n }\n }\n return url.href === captureUrl.href;\n };\n // If `capture` is a string then `handler` and `method` must be present.\n route = new Route(matchCallback, handler, method);\n }\n else if (capture instanceof RegExp) {\n // If `capture` is a `RegExp` then `handler` and `method` must be present.\n route = new RegExpRoute(capture, handler, method);\n }\n else if (typeof capture === 'function') {\n // If `capture` is a function then `handler` and `method` must be present.\n route = new Route(capture, handler, method);\n }\n else if (capture instanceof Route) {\n route = capture;\n }\n else {\n throw new WorkboxError('unsupported-route-type', {\n moduleName: 'workbox-routing',\n funcName: 'registerRoute',\n paramName: 'capture',\n });\n }\n const defaultRouter = getOrCreateDefaultRouter();\n defaultRouter.registerRoute(route);\n return route;\n}\n;\nexport { registerRoute };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter.js';\nimport './_version.js';\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 {module:workbox-routing~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n *\n * @memberof module:workbox-routing\n */\nfunction setCatchHandler(handler) {\n const defaultRouter = getOrCreateDefaultRouter();\n defaultRouter.setCatchHandler(handler);\n}\n;\nexport { setCatchHandler };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter.js';\nimport './_version.js';\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 {module:workbox-routing~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n *\n * @memberof module:workbox-routing\n */\nfunction setDefaultHandler(handler) {\n const defaultRouter = getOrCreateDefaultRouter();\n defaultRouter.setDefaultHandler(handler);\n}\n;\nexport { setDefaultHandler };\n"],"names":["self","_","e","defaultMethod","normalizeHandler","handler","handle","Route","constructor","match","method","RegExpRoute","regExp","url","result","exec","href","origin","location","index","slice","Router","_routes","Map","this","addFetchListener","addEventListener","event","request","responsePromise","handleRequest","respondWith","addCacheListener","data","type","payload","requestPromises","Promise","all","urlsToCache","map","entry","Request","waitUntil","ports","then","postMessage","URL","protocol","startsWith","params","route","findMatchingRoute","_defaultHandler","err","reject","_catchHandler","catch","routes","get","matchResult","Array","isArray","length","undefined","Object","keys","setDefaultHandler","setCatchHandler","registerRoute","has","set","push","unregisterRoute","WorkboxError","routeIndex","indexOf","splice","defaultRouter","getOrCreateDefaultRouter","allowlist","denylist","options","_match","_allowlist","_denylist","mode","pathnameAndSearch","pathname","search","test","some","capture","captureUrl","RegExp","moduleName","funcName","paramName"],"mappings":"8EAEA,IACIA,KAAK,0BAA4BC,IAErC,MAAOC,ICWA,MAAMC,EAAgB,MCAhBC,EAAoBC,GACzBA,GAA8B,iBAAZA,EASXA,EAWA,CAAEC,OAAQD,GCjBzB,MAAME,EAYFC,YAAYC,EAAOJ,EAASK,EAASP,QAc5BE,QAAUD,EAAiBC,QAC3BI,MAAQA,OACRC,OAASA,GCxBtB,MAAMC,UAAoBJ,EActBC,Y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,UAAEA,EAAY,CAAC,KAAfC,SAAqBA,EAAW,IAAO,UAejDC,GAAY1D,KAAK2D,EAAOD,GAAU7E,QACpC+E,EAAaJ,OACbK,EAAYJ,EAYrBE,GAAOtE,IAAEA,EAAFe,QAAOA,OACNA,GAA4B,aAAjBA,EAAQ0D,YACZ,QAELC,EAAoB1E,EAAI2E,SAAW3E,EAAI4E,WACxC,MAAM7E,KAAUY,KAAK6D,KAClBzE,EAAO8E,KAAKH,UAML,UAGX/D,KAAK4D,EAAWO,KAAM/E,GAAWA,EAAO8E,KAAKH,2DC1DzD,SAAuBK,EAASvF,EAASK,OACjCyC,KACmB,iBAAZyC,EAAsB,OACvBC,EAAa,IAAI9C,IAAI6C,EAAS1E,SAASF,MAiC7CmC,EAAQ,IAAI5C,EAZU,EAAGM,IAAAA,KASdA,EAAIG,OAAS6E,EAAW7E,KAGFX,EAASK,QAEzC,GAAIkF,aAAmBE,OAExB3C,EAAQ,IAAIxC,EAAYiF,EAASvF,EAASK,QAEzC,GAAuB,mBAAZkF,EAEZzC,EAAQ,IAAI5C,EAAMqF,EAASvF,EAASK,OAEnC,CAAA,KAAIkF,aAAmBrF,SAIlB,IAAImE,eAAa,yBAA0B,CAC7CqB,WAAY,kBACZC,SAAU,gBACVC,UAAW,YANf9C,EAAQyC,SASUb,IACRV,cAAclB,GACrBA,qBCxEX,SAAyB9C,GACC0E,IACRX,gBAAgB/D,wBCClC,SAA2BA,GACD0E,IACRZ,kBAAkB9D"}
@@ -1,10 +1,9 @@
1
1
  this.workbox = this.workbox || {};
2
- this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_js, cacheWrapper_js, fetchWrapper_js, getFriendlyURL_js, WorkboxError_js) {
2
+ this.workbox.strategies = (function (exports, assert_js, cacheNames_js, cacheWrapper_js, fetchWrapper_js, getFriendlyURL_js, logger_js, WorkboxError_js) {
3
3
  'use strict';
4
4
 
5
- // @ts-ignore
6
5
  try {
7
- self['workbox:strategies:5.0.0-alpha.0'] && _();
6
+ self['workbox:strategies:5.0.0'] && _();
8
7
  } catch (e) {}
9
8
 
10
9
  /*
@@ -43,7 +42,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
43
42
  * If the network request fails, and there is no cache match, this will throw
44
43
  * a `WorkboxError` exception.
45
44
  *
46
- * @memberof workbox.strategies
45
+ * @memberof module:workbox-strategies
47
46
  */
48
47
 
49
48
  class CacheFirst {
@@ -51,7 +50,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
51
50
  * @param {Object} options
52
51
  * @param {string} options.cacheName Cache name to store and retrieve
53
52
  * requests. Defaults to cache names provided by
54
- * [workbox-core]{@link workbox.core.cacheNames}.
53
+ * [workbox-core]{@link module:workbox-core.cacheNames}.
55
54
  * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
56
55
  * to use in conjunction with this caching strategy.
57
56
  * @param {Object} options.fetchOptions Values passed along to the
@@ -68,10 +67,10 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
68
67
  /**
69
68
  * This method will perform a request strategy and follows an API that
70
69
  * will work with the
71
- * [Workbox Router]{@link workbox.routing.Router}.
70
+ * [Workbox Router]{@link module:workbox-routing.Router}.
72
71
  *
73
72
  * @param {Object} options
74
- * @param {Request} options.request The request to run this strategy for.
73
+ * @param {Request|string} options.request A request to run this strategy for.
75
74
  * @param {Event} [options.event] The event that triggered the request.
76
75
  * @return {Promise<Response>}
77
76
  */
@@ -80,32 +79,6 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
80
79
  async handle({
81
80
  event,
82
81
  request
83
- }) {
84
- return this.makeRequest({
85
- event,
86
- request: request || event.request
87
- });
88
- }
89
- /**
90
- * This method can be used to perform a make a standalone request outside the
91
- * context of the [Workbox Router]{@link workbox.routing.Router}.
92
- *
93
- * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
94
- * for more usage information.
95
- *
96
- * @param {Object} options
97
- * @param {Request|string} options.request Either a
98
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
99
- * object, or a string URL, corresponding to the request to be made.
100
- * @param {Event} [options.event] If provided, `event.waitUntil()` will
101
- be called automatically to extend the service worker's lifetime.
102
- * @return {Promise<Response>}
103
- */
104
-
105
-
106
- async makeRequest({
107
- event,
108
- request
109
82
  }) {
110
83
  const logs = [];
111
84
 
@@ -235,7 +208,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
235
208
  *
236
209
  * If there is no cache match, this will throw a `WorkboxError` exception.
237
210
  *
238
- * @memberof workbox.strategies
211
+ * @memberof module:workbox-strategies
239
212
  */
240
213
 
241
214
  class CacheOnly {
@@ -243,7 +216,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
243
216
  * @param {Object} options
244
217
  * @param {string} options.cacheName Cache name to store and retrieve
245
218
  * requests. Defaults to cache names provided by
246
- * [workbox-core]{@link workbox.core.cacheNames}.
219
+ * [workbox-core]{@link module:workbox-core.cacheNames}.
247
220
  * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
248
221
  * to use in conjunction with this caching strategy.
249
222
  * @param {Object} options.matchOptions [`CacheQueryOptions`](https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions)
@@ -256,10 +229,10 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
256
229
  /**
257
230
  * This method will perform a request strategy and follows an API that
258
231
  * will work with the
259
- * [Workbox Router]{@link workbox.routing.Router}.
232
+ * [Workbox Router]{@link module:workbox-routing.Router}.
260
233
  *
261
234
  * @param {Object} options
262
- * @param {Request} options.request The request to run this strategy for.
235
+ * @param {Request|string} options.request A request to run this strategy for.
263
236
  * @param {Event} [options.event] The event that triggered the request.
264
237
  * @return {Promise<Response>}
265
238
  */
@@ -268,32 +241,6 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
268
241
  async handle({
269
242
  event,
270
243
  request
271
- }) {
272
- return this.makeRequest({
273
- event,
274
- request: request || event.request
275
- });
276
- }
277
- /**
278
- * This method can be used to perform a make a standalone request outside the
279
- * context of the [Workbox Router]{@link workbox.routing.Router}.
280
- *
281
- * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
282
- * for more usage information.
283
- *
284
- * @param {Object} options
285
- * @param {Request|string} options.request Either a
286
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
287
- * object, or a string URL, corresponding to the request to be made.
288
- * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
289
- * be called automatically to extend the service worker's lifetime.
290
- * @return {Promise<Response>}
291
- */
292
-
293
-
294
- async makeRequest({
295
- event,
296
- request
297
244
  }) {
298
245
  if (typeof request === 'string') {
299
246
  request = new Request(request);
@@ -389,7 +336,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
389
336
  * If the network request fails, and there is no cache match, this will throw
390
337
  * a `WorkboxError` exception.
391
338
  *
392
- * @memberof workbox.strategies
339
+ * @memberof module:workbox-strategies
393
340
  */
394
341
 
395
342
  class NetworkFirst {
@@ -397,7 +344,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
397
344
  * @param {Object} options
398
345
  * @param {string} options.cacheName Cache name to store and retrieve
399
346
  * requests. Defaults to cache names provided by
400
- * [workbox-core]{@link workbox.core.cacheNames}.
347
+ * [workbox-core]{@link module:workbox-core.cacheNames}.
401
348
  * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
402
349
  * to use in conjunction with this caching strategy.
403
350
  * @param {Object} options.fetchOptions Values passed along to the
@@ -441,10 +388,10 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
441
388
  /**
442
389
  * This method will perform a request strategy and follows an API that
443
390
  * will work with the
444
- * [Workbox Router]{@link workbox.routing.Router}.
391
+ * [Workbox Router]{@link module:workbox-routing.Router}.
445
392
  *
446
393
  * @param {Object} options
447
- * @param {Request} options.request The request to run this strategy for.
394
+ * @param {Request|string} options.request A request to run this strategy for.
448
395
  * @param {Event} [options.event] The event that triggered the request.
449
396
  * @return {Promise<Response>}
450
397
  */
@@ -453,32 +400,6 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
453
400
  async handle({
454
401
  event,
455
402
  request
456
- }) {
457
- return this.makeRequest({
458
- event,
459
- request: request || event.request
460
- });
461
- }
462
- /**
463
- * This method can be used to perform a make a standalone request outside the
464
- * context of the [Workbox Router]{@link workbox.routing.Router}.
465
- *
466
- * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
467
- * for more usage information.
468
- *
469
- * @param {Object} options
470
- * @param {Request|string} options.request Either a
471
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
472
- * object, or a string URL, corresponding to the request to be made.
473
- * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
474
- * be called automatically to extend the service worker's lifetime.
475
- * @return {Promise<Response>}
476
- */
477
-
478
-
479
- async makeRequest({
480
- event,
481
- request
482
403
  }) {
483
404
  const logs = [];
484
405
 
@@ -713,7 +634,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
713
634
  *
714
635
  * If the network request fails, this will throw a `WorkboxError` exception.
715
636
  *
716
- * @memberof workbox.strategies
637
+ * @memberof module:workbox-strategies
717
638
  */
718
639
 
719
640
  class NetworkOnly {
@@ -721,7 +642,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
721
642
  * @param {Object} options
722
643
  * @param {string} options.cacheName Cache name to store and retrieve
723
644
  * requests. Defaults to cache names provided by
724
- * [workbox-core]{@link workbox.core.cacheNames}.
645
+ * [workbox-core]{@link module:workbox-core.cacheNames}.
725
646
  * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
726
647
  * to use in conjunction with this caching strategy.
727
648
  * @param {Object} options.fetchOptions Values passed along to the
@@ -735,10 +656,10 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
735
656
  /**
736
657
  * This method will perform a request strategy and follows an API that
737
658
  * will work with the
738
- * [Workbox Router]{@link workbox.routing.Router}.
659
+ * [Workbox Router]{@link module:workbox-routing.Router}.
739
660
  *
740
661
  * @param {Object} options
741
- * @param {Request} options.request The request to run this strategy for.
662
+ * @param {Request|string} options.request The request to run this strategy for.
742
663
  * @param {Event} [options.event] The event that triggered the request.
743
664
  * @return {Promise<Response>}
744
665
  */
@@ -747,32 +668,6 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
747
668
  async handle({
748
669
  event,
749
670
  request
750
- }) {
751
- return this.makeRequest({
752
- event,
753
- request: request || event.request
754
- });
755
- }
756
- /**
757
- * This method can be used to perform a make a standalone request outside the
758
- * context of the [Workbox Router]{@link workbox.routing.Router}.
759
- *
760
- * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
761
- * for more usage information.
762
- *
763
- * @param {Object} options
764
- * @param {Request|string} options.request Either a
765
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
766
- * object, or a string URL, corresponding to the request to be made.
767
- * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
768
- * be called automatically to extend the service worker's lifetime.
769
- * @return {Promise<Response>}
770
- */
771
-
772
-
773
- async makeRequest({
774
- event,
775
- request
776
671
  }) {
777
672
  if (typeof request === 'string') {
778
673
  request = new Request(request);
@@ -845,13 +740,13 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
845
740
  *
846
741
  * By default, this strategy will cache responses with a 200 status code as
847
742
  * well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.
848
- * Opaque responses are are cross-origin requests where the response doesn't
743
+ * Opaque responses are cross-origin requests where the response doesn't
849
744
  * support [CORS]{@link https://enable-cors.org/}.
850
745
  *
851
746
  * If the network request fails, and there is no cache match, this will throw
852
747
  * a `WorkboxError` exception.
853
748
  *
854
- * @memberof workbox.strategies
749
+ * @memberof module:workbox-strategies
855
750
  */
856
751
 
857
752
  class StaleWhileRevalidate {
@@ -859,7 +754,7 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
859
754
  * @param {Object} options
860
755
  * @param {string} options.cacheName Cache name to store and retrieve
861
756
  * requests. Defaults to cache names provided by
862
- * [workbox-core]{@link workbox.core.cacheNames}.
757
+ * [workbox-core]{@link module:workbox-core.cacheNames}.
863
758
  * @param {Array<Object>} options.plugins [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}
864
759
  * to use in conjunction with this caching strategy.
865
760
  * @param {Object} options.fetchOptions Values passed along to the
@@ -885,10 +780,10 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
885
780
  /**
886
781
  * This method will perform a request strategy and follows an API that
887
782
  * will work with the
888
- * [Workbox Router]{@link workbox.routing.Router}.
783
+ * [Workbox Router]{@link module:workbox-routing.Router}.
889
784
  *
890
785
  * @param {Object} options
891
- * @param {Request} options.request The request to run this strategy for.
786
+ * @param {Request|string} options.request A request to run this strategy for.
892
787
  * @param {Event} [options.event] The event that triggered the request.
893
788
  * @return {Promise<Response>}
894
789
  */
@@ -897,32 +792,6 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
897
792
  async handle({
898
793
  event,
899
794
  request
900
- }) {
901
- return this.makeRequest({
902
- event,
903
- request: request || event.request
904
- });
905
- }
906
- /**
907
- * This method can be used to perform a make a standalone request outside the
908
- * context of the [Workbox Router]{@link workbox.routing.Router}.
909
- *
910
- * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
911
- * for more usage information.
912
- *
913
- * @param {Object} options
914
- * @param {Request|string} options.request Either a
915
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
916
- * object, or a string URL, corresponding to the request to be made.
917
- * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
918
- * be called automatically to extend the service worker's lifetime.
919
- * @return {Promise<Response>}
920
- */
921
-
922
-
923
- async makeRequest({
924
- event,
925
- request
926
795
  }) {
927
796
  const logs = [];
928
797
 
@@ -1042,84 +911,11 @@ this.workbox.strategies = (function (exports, logger_js, assert_js, cacheNames_j
1042
911
 
1043
912
  }
1044
913
 
1045
- /*
1046
- Copyright 2018 Google LLC
1047
-
1048
- Use of this source code is governed by an MIT-style
1049
- license that can be found in the LICENSE file or at
1050
- https://opensource.org/licenses/MIT.
1051
- */
1052
- const mapping = {
1053
- cacheFirst: CacheFirst,
1054
- cacheOnly: CacheOnly,
1055
- networkFirst: NetworkFirst,
1056
- networkOnly: NetworkOnly,
1057
- staleWhileRevalidate: StaleWhileRevalidate
1058
- };
1059
-
1060
- const deprecate = strategy => {
1061
- const StrategyCtr = mapping[strategy];
1062
- return options => {
1063
- {
1064
- const strategyCtrName = strategy[0].toUpperCase() + strategy.slice(1);
1065
- logger_js.logger.warn(`The 'workbox.strategies.${strategy}()' function has been ` + `deprecated and will be removed in a future version of Workbox.\n` + `Please use 'new workbox.strategies.${strategyCtrName}()' instead.`);
1066
- }
1067
-
1068
- return new StrategyCtr(options);
1069
- };
1070
- };
1071
- /**
1072
- * @function workbox.strategies.cacheFirst
1073
- * @param {Object} options See the {@link workbox.strategies.CacheFirst}
1074
- * constructor for more info.
1075
- * @deprecated since v4.0.0
1076
- */
1077
-
1078
-
1079
- const cacheFirst = deprecate('cacheFirst');
1080
- /**
1081
- * @function workbox.strategies.cacheOnly
1082
- * @param {Object} options See the {@link workbox.strategies.CacheOnly}
1083
- * constructor for more info.
1084
- * @deprecated since v4.0.0
1085
- */
1086
-
1087
- const cacheOnly = deprecate('cacheOnly');
1088
- /**
1089
- * @function workbox.strategies.networkFirst
1090
- * @param {Object} options See the {@link workbox.strategies.NetworkFirst}
1091
- * constructor for more info.
1092
- * @deprecated since v4.0.0
1093
- */
1094
-
1095
- const networkFirst = deprecate('networkFirst');
1096
- /**
1097
- * @function workbox.strategies.networkOnly
1098
- * @param {Object} options See the {@link workbox.strategies.NetworkOnly}
1099
- * constructor for more info.
1100
- * @deprecated since v4.0.0
1101
- */
1102
-
1103
- const networkOnly = deprecate('networkOnly');
1104
- /**
1105
- * @function workbox.strategies.staleWhileRevalidate
1106
- * @param {Object} options See the
1107
- * {@link workbox.strategies.StaleWhileRevalidate} constructor for more info.
1108
- * @deprecated since v4.0.0
1109
- */
1110
-
1111
- const staleWhileRevalidate = deprecate('staleWhileRevalidate');
1112
-
1113
914
  exports.CacheFirst = CacheFirst;
1114
915
  exports.CacheOnly = CacheOnly;
1115
916
  exports.NetworkFirst = NetworkFirst;
1116
917
  exports.NetworkOnly = NetworkOnly;
1117
918
  exports.StaleWhileRevalidate = StaleWhileRevalidate;
1118
- exports.cacheFirst = cacheFirst;
1119
- exports.cacheOnly = cacheOnly;
1120
- exports.networkFirst = networkFirst;
1121
- exports.networkOnly = networkOnly;
1122
- exports.staleWhileRevalidate = staleWhileRevalidate;
1123
919
 
1124
920
  return exports;
1125
921
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-strategies.dev.js","sources":["../_version.js","../utils/messages.js","../CacheFirst.js","../CacheOnly.js","../plugins/cacheOkAndOpaquePlugin.js","../NetworkFirst.js","../NetworkOnly.js","../StaleWhileRevalidate.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:strategies:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport '../_version.js';\nexport const messages = {\n strategyStart: (strategyName, request) => `Using ${strategyName} to respond to '${getFriendlyURL(request.url)}'`,\n printFinalResponse: (response) => {\n if (response) {\n logger.groupCollapsed(`View the final response here.`);\n logger.log(response || '[No response returned]');\n logger.groupEnd();\n }\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport './_version.js';\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 * If the network request fails, and there is no cache match, this will throw\n * a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions;\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n const logs = [];\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'makeRequest',\n paramName: 'request',\n });\n }\n let response = await cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n let error;\n if (!response) {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`No response found in the '${this._cacheName}' cache. ` +\n `Will respond with a network request.`);\n }\n try {\n response = await this._getFromNetwork(request, event);\n }\n catch (err) {\n error = err;\n }\n if (process.env.NODE_ENV !== 'production') {\n if (response) {\n logs.push(`Got response from network.`);\n }\n else {\n logs.push(`Unable to get a response from the network.`);\n }\n }\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`Found a cached response in the '${this._cacheName}' cache.`);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('CacheFirst', request));\n for (let log of logs) {\n logger.log(log);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url, error });\n }\n return response;\n }\n /**\n * Handles the network and cache part of CacheFirst.\n *\n * @param {Request} request\n * @param {Event} [event]\n * @return {Promise<Response>}\n *\n * @private\n */\n async _getFromNetwork(request, event) {\n const response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n // Keep the service worker while we put the request to the cache\n const responseClone = response.clone();\n const cachePutPromise = cacheWrapper.put({\n cacheName: this._cacheName,\n request,\n response: responseClone,\n event,\n plugins: this._plugins,\n });\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n return response;\n }\n}\nexport { CacheFirst };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport './_version.js';\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\n * [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * If there is no cache match, this will throw a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'makeRequest',\n paramName: 'request',\n });\n }\n const response = await cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('CacheOnly', request));\n if (response) {\n logger.log(`Found a cached response in the '${this._cacheName}'` +\n ` cache.`);\n messages.printFinalResponse(response);\n }\n else {\n logger.log(`No response found in the '${this._cacheName}' cache.`);\n }\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url });\n }\n return response;\n }\n}\nexport { CacheOnly };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nexport const cacheOkAndOpaquePlugin = {\n /**\n * Returns a valid response (to allow caching) if the status is 200 (OK) or\n * 0 (opaque).\n *\n * @param {Object} options\n * @param {Response} options.response\n * @return {Response|null}\n *\n * @private\n */\n cacheWillUpdate: async ({ response }) => {\n if (response.status === 200 || response.status === 0) {\n return response;\n }\n return null;\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport { cacheOkAndOpaquePlugin } from './plugins/cacheOkAndOpaquePlugin.js';\nimport './_version.js';\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 * If the network request fails, and there is no cache match, this will throw\n * a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some((plugin) => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ?\n options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n }\n else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n this._networkTimeoutSeconds = options.networkTimeoutSeconds || 0;\n if (process.env.NODE_ENV !== 'production') {\n if (this._networkTimeoutSeconds) {\n assert.isType(this._networkTimeoutSeconds, 'number', {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'constructor',\n paramName: 'networkTimeoutSeconds',\n });\n }\n }\n this._fetchOptions = options.fetchOptions;\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n const logs = [];\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'makeRequest',\n });\n }\n const promises = [];\n let timeoutId;\n if (this._networkTimeoutSeconds) {\n const { id, promise } = this._getTimeoutPromise({ request, event, logs });\n timeoutId = id;\n promises.push(promise);\n }\n const networkPromise = this._getNetworkPromise({ timeoutId, request, event, logs });\n promises.push(networkPromise);\n // Promise.race() will resolve as soon as the first promise resolves.\n let response = await 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 = await networkPromise;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('NetworkFirst', request));\n for (let log of logs) {\n logger.log(log);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url });\n }\n return response;\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 let timeoutId;\n const timeoutPromise = new Promise((resolve) => {\n const onNetworkTimeout = async () => {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`Timing out the network response at ` +\n `${this._networkTimeoutSeconds} seconds.`);\n }\n resolve(await this._respondFromCache({ request, event }));\n };\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n return {\n promise: timeoutPromise,\n id: timeoutId,\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 async _getNetworkPromise({ timeoutId, request, logs, event }) {\n let error;\n let response;\n try {\n response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n }\n catch (err) {\n error = err;\n }\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (response) {\n logs.push(`Got response from network.`);\n }\n else {\n logs.push(`Unable to get a response from the network. Will respond ` +\n `with a cached response.`);\n }\n }\n if (error || !response) {\n response = await this._respondFromCache({ request, event });\n if (process.env.NODE_ENV !== 'production') {\n if (response) {\n logs.push(`Found a cached response in the '${this._cacheName}'` +\n ` cache.`);\n }\n else {\n logs.push(`No response found in the '${this._cacheName}' cache.`);\n }\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.put({\n cacheName: this._cacheName,\n request,\n response: responseClone,\n event,\n plugins: this._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 }\n catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n }\n return response;\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.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n }\n}\nexport { NetworkFirst };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport './_version.js';\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\n * [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * If the network request fails, this will throw a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request The request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'request',\n });\n }\n let error;\n let response;\n try {\n response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n }\n catch (err) {\n error = err;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('NetworkOnly', request));\n if (response) {\n logger.log(`Got response from network.`);\n }\n else {\n logger.log(`Unable to get a response from the network.`);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url, error });\n }\n return response;\n }\n}\nexport { NetworkOnly };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport { cacheOkAndOpaquePlugin } from './plugins/cacheOkAndOpaquePlugin.js';\nimport './_version.js';\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 cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * If the network request fails, and there is no cache match, this will throw\n * a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some((plugin) => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ?\n options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n }\n else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n this._fetchOptions = options.fetchOptions;\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n const logs = [];\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'request',\n });\n }\n const fetchAndCachePromise = this._getFromNetwork({ request, event });\n let response = await cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n let error;\n if (response) {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`Found a cached response in the '${this._cacheName}'` +\n ` cache. Will update with the network response in the background.`);\n }\n if (event) {\n try {\n event.waitUntil(fetchAndCachePromise);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`No response found in the '${this._cacheName}' cache. ` +\n `Will wait for the network response.`);\n }\n try {\n response = await fetchAndCachePromise;\n }\n catch (err) {\n error = err;\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('StaleWhileRevalidate', request));\n for (let log of logs) {\n logger.log(log);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url, error });\n }\n return response;\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 async _getFromNetwork({ request, event }) {\n const response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n const cachePutPromise = cacheWrapper.put({\n cacheName: this._cacheName,\n request,\n response: response.clone(),\n event,\n plugins: this._plugins,\n });\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n return response;\n }\n}\nexport { StaleWhileRevalidate };\n"],"names":["self","_","e","messages","strategyStart","strategyName","request","getFriendlyURL","url","printFinalResponse","response","logger","groupCollapsed","log","groupEnd","CacheFirst","constructor","options","_cacheName","cacheNames","getRuntimeName","cacheName","_plugins","plugins","_fetchOptions","fetchOptions","_matchOptions","matchOptions","handle","event","logs","Request","assert","isInstance","moduleName","className","funcName","paramName","cacheWrapper","match","error","push","_getFromNetwork","err","WorkboxError","fetchWrapper","fetch","responseClone","clone","cachePutPromise","put","waitUntil","warn","CacheOnly","cacheOkAndOpaquePlugin","cacheWillUpdate","status","NetworkFirst","isUsingCacheWillUpdate","some","plugin","_networkTimeoutSeconds","networkTimeoutSeconds","isType","promises","timeoutId","id","promise","_getTimeoutPromise","networkPromise","_getNetworkPromise","Promise","race","timeoutPromise","resolve","onNetworkTimeout","_respondFromCache","setTimeout","clearTimeout","cachePut","NetworkOnly","StaleWhileRevalidate","fetchAndCachePromise"],"mappings":";;;;IAEA,IAAI;IACAA,EAAAA,IAAI,CAAC,0BAAD,CAAJ,IAAoCC,CAAC,EAArC;IACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ICLV;;;;;;;AAOA,IAGO,MAAMC,QAAQ,GAAG;IACpBC,EAAAA,aAAa,EAAE,CAACC,YAAD,EAAeC,OAAf,KAA4B,SAAQD,YAAa,mBAAkBE,gCAAc,CAACD,OAAO,CAACE,GAAT,CAAc,GAD1F;IAEpBC,EAAAA,kBAAkB,EAAGC,QAAD,IAAc;IAC9B,QAAIA,QAAJ,EAAc;IACVC,MAAAA,gBAAM,CAACC,cAAP,CAAuB,+BAAvB;IACAD,MAAAA,gBAAM,CAACE,GAAP,CAAWH,QAAQ,IAAI,wBAAvB;IACAC,MAAAA,gBAAM,CAACG,QAAP;IACH;IACJ;IARmB,CAAjB;;ICVP;;;;;;;AAOA,IASA;;;;;;;;;;;;;;IAaA,MAAMC,UAAN,CAAiB;IACb;;;;;;;;;;;;IAYAC,EAAAA,WAAW,CAACC,OAAO,GAAG,EAAX,EAAe;IACtB,SAAKC,UAAL,GAAkBC,wBAAU,CAACC,cAAX,CAA0BH,OAAO,CAACI,SAAlC,CAAlB;IACA,SAAKC,QAAL,GAAgBL,OAAO,CAACM,OAAR,IAAmB,EAAnC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AAAA,OAAO,EAAE,KAAKD;IAJwB,KAAnB,CAAvB;IAMA,UAAM2B,eAAe,GAAGX,4BAAY,CAACY,GAAb,CAAiB;IACrC7B,MAAAA,SAAS,EAAE,KAAKH,UADqB;IAErCZ,MAAAA,OAFqC;IAGrCI,MAAAA,QAAQ,EAAEA,QAAQ,CAACsC,KAAT,EAH2B;IAIrCnB,MAAAA,KAJqC;IAKrCN,MAAAA,OAAO,EAAE,KAAKD;IALuB,KAAjB,CAAxB;;IAOA,QAAIO,KAAJ,EAAW;IACP,UAAI;IACAA,QAAAA,KAAK,CAACsB,SAAN,CAAgBF,eAAhB;IACH,OAFD,CAGA,OAAOT,KAAP,EAAc;IACV,QAA2C;IACvC7B,UAAAA,gBAAM,CAACyC,IAAP,CAAa,mDAAD,GACP,uBAAsB7C,gCAAc,CAACD,OAAO,CAACE,GAAT,CAAc,IADvD;IAEH;IACJ;IACJ;;IACD,WAAOE,QAAP;IACH;;IAxIsB;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ this.workbox=this.workbox||{},this.workbox.strategies=function(t,e,s,i,n){"use strict";try{self["workbox:strategies:5.0.0"]&&_()}catch(t){}const r={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null};return t.CacheFirst=class{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){"string"==typeof e&&(e=new Request(e));let i,r=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!r)try{r=await this.o(e,t)}catch(t){i=t}if(!r)throw new n.WorkboxError("no-response",{url:e.url,error:i});return r}async o(t,e){const n=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),r=n.clone(),h=s.cacheWrapper.put({cacheName:this.t,request:t,response:r,event:e,plugins:this.s});if(e)try{e.waitUntil(h)}catch(t){}return n}},t.CacheOnly=class{constructor(t={}){this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],this.h=t.matchOptions}async handle({event:t,request:e}){"string"==typeof e&&(e=new Request(e));const i=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(!i)throw new n.WorkboxError("no-response",{url:e.url});return i}},t.NetworkFirst=class{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[r,...t.plugins]}else this.s=[r];this.u=t.networkTimeoutSeconds||0,this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){const s=[];"string"==typeof e&&(e=new Request(e));const i=[];let r;if(this.u){const{id:n,promise:h}=this.l({request:e,event:t,logs:s});r=n,i.push(h)}const h=this.p({timeoutId:r,request:e,event:t,logs:s});i.push(h);let o=await Promise.race(i);if(o||(o=await h),!o)throw new n.WorkboxError("no-response",{url:e.url});return o}l({request:t,logs:e,event:s}){let i;return{promise:new Promise(e=>{i=setTimeout(async()=>{e(await this.q({request:t,event:s}))},1e3*this.u)}),id:i}}async p({timeoutId:t,request:e,logs:n,event:r}){let h,o;try{o=await i.fetchWrapper.fetch({request:e,event:r,fetchOptions:this.i,plugins:this.s})}catch(t){h=t}if(t&&clearTimeout(t),h||!o)o=await this.q({request:e,event:r});else{const t=o.clone(),i=s.cacheWrapper.put({cacheName:this.t,request:e,response:t,event:r,plugins:this.s});if(r)try{r.waitUntil(i)}catch(t){}}return o}q({event:t,request:e}){return s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s})}},t.NetworkOnly=class{constructor(t={}){this.s=t.plugins||[],this.i=t.fetchOptions}async handle({event:t,request:e}){let s,r;"string"==typeof e&&(e=new Request(e));try{r=await i.fetchWrapper.fetch({request:e,event:t,fetchOptions:this.i,plugins:this.s})}catch(t){s=t}if(!r)throw new n.WorkboxError("no-response",{url:e.url,error:s});return r}},t.StaleWhileRevalidate=class{constructor(t={}){if(this.t=e.cacheNames.getRuntimeName(t.cacheName),this.s=t.plugins||[],t.plugins){let e=t.plugins.some(t=>!!t.cacheWillUpdate);this.s=e?t.plugins:[r,...t.plugins]}else this.s=[r];this.i=t.fetchOptions,this.h=t.matchOptions}async handle({event:t,request:e}){"string"==typeof e&&(e=new Request(e));const i=this.o({request:e,event:t});let r,h=await s.cacheWrapper.match({cacheName:this.t,request:e,event:t,matchOptions:this.h,plugins:this.s});if(h){if(t)try{t.waitUntil(i)}catch(r){}}else try{h=await i}catch(t){r=t}if(!h)throw new n.WorkboxError("no-response",{url:e.url,error:r});return h}async o({request:t,event:e}){const n=await i.fetchWrapper.fetch({request:t,event:e,fetchOptions:this.i,plugins:this.s}),r=s.cacheWrapper.put({cacheName:this.t,request:t,response:n.clone(),event:e,plugins:this.s});if(e)try{e.waitUntil(r)}catch(t){}return n}},t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
2
+ //# sourceMappingURL=workbox-strategies.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbox-strategies.prod.js","sources":["../_version.js","../plugins/cacheOkAndOpaquePlugin.js","../CacheFirst.js","../CacheOnly.js","../NetworkFirst.js","../NetworkOnly.js","../StaleWhileRevalidate.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:strategies:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nexport const cacheOkAndOpaquePlugin = {\n /**\n * Returns a valid response (to allow caching) if the status is 200 (OK) or\n * 0 (opaque).\n *\n * @param {Object} options\n * @param {Response} options.response\n * @return {Response|null}\n *\n * @private\n */\n cacheWillUpdate: async ({ response }) => {\n if (response.status === 200 || response.status === 0) {\n return response;\n }\n return null;\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport './_version.js';\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 * If the network request fails, and there is no cache match, this will throw\n * a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions;\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n const logs = [];\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheFirst',\n funcName: 'makeRequest',\n paramName: 'request',\n });\n }\n let response = await cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n let error;\n if (!response) {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`No response found in the '${this._cacheName}' cache. ` +\n `Will respond with a network request.`);\n }\n try {\n response = await this._getFromNetwork(request, event);\n }\n catch (err) {\n error = err;\n }\n if (process.env.NODE_ENV !== 'production') {\n if (response) {\n logs.push(`Got response from network.`);\n }\n else {\n logs.push(`Unable to get a response from the network.`);\n }\n }\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`Found a cached response in the '${this._cacheName}' cache.`);\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('CacheFirst', request));\n for (let log of logs) {\n logger.log(log);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url, error });\n }\n return response;\n }\n /**\n * Handles the network and cache part of CacheFirst.\n *\n * @param {Request} request\n * @param {Event} [event]\n * @return {Promise<Response>}\n *\n * @private\n */\n async _getFromNetwork(request, event) {\n const response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n // Keep the service worker while we put the request to the cache\n const responseClone = response.clone();\n const cachePutPromise = cacheWrapper.put({\n cacheName: this._cacheName,\n request,\n response: responseClone,\n event,\n plugins: this._plugins,\n });\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n return response;\n }\n}\nexport { CacheFirst };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport './_version.js';\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\n * [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * If there is no cache match, this will throw a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'CacheOnly',\n funcName: 'makeRequest',\n paramName: 'request',\n });\n }\n const response = await cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('CacheOnly', request));\n if (response) {\n logger.log(`Found a cached response in the '${this._cacheName}'` +\n ` cache.`);\n messages.printFinalResponse(response);\n }\n else {\n logger.log(`No response found in the '${this._cacheName}' cache.`);\n }\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url });\n }\n return response;\n }\n}\nexport { CacheOnly };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport { cacheOkAndOpaquePlugin } from './plugins/cacheOkAndOpaquePlugin.js';\nimport './_version.js';\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 * If the network request fails, and there is no cache match, this will throw\n * a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some((plugin) => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ?\n options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n }\n else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n this._networkTimeoutSeconds = options.networkTimeoutSeconds || 0;\n if (process.env.NODE_ENV !== 'production') {\n if (this._networkTimeoutSeconds) {\n assert.isType(this._networkTimeoutSeconds, 'number', {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'constructor',\n paramName: 'networkTimeoutSeconds',\n });\n }\n }\n this._fetchOptions = options.fetchOptions;\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n const logs = [];\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkFirst',\n funcName: 'handle',\n paramName: 'makeRequest',\n });\n }\n const promises = [];\n let timeoutId;\n if (this._networkTimeoutSeconds) {\n const { id, promise } = this._getTimeoutPromise({ request, event, logs });\n timeoutId = id;\n promises.push(promise);\n }\n const networkPromise = this._getNetworkPromise({ timeoutId, request, event, logs });\n promises.push(networkPromise);\n // Promise.race() will resolve as soon as the first promise resolves.\n let response = await 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 = await networkPromise;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('NetworkFirst', request));\n for (let log of logs) {\n logger.log(log);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url });\n }\n return response;\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 let timeoutId;\n const timeoutPromise = new Promise((resolve) => {\n const onNetworkTimeout = async () => {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`Timing out the network response at ` +\n `${this._networkTimeoutSeconds} seconds.`);\n }\n resolve(await this._respondFromCache({ request, event }));\n };\n timeoutId = setTimeout(onNetworkTimeout, this._networkTimeoutSeconds * 1000);\n });\n return {\n promise: timeoutPromise,\n id: timeoutId,\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 async _getNetworkPromise({ timeoutId, request, logs, event }) {\n let error;\n let response;\n try {\n response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n }\n catch (err) {\n error = err;\n }\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (response) {\n logs.push(`Got response from network.`);\n }\n else {\n logs.push(`Unable to get a response from the network. Will respond ` +\n `with a cached response.`);\n }\n }\n if (error || !response) {\n response = await this._respondFromCache({ request, event });\n if (process.env.NODE_ENV !== 'production') {\n if (response) {\n logs.push(`Found a cached response in the '${this._cacheName}'` +\n ` cache.`);\n }\n else {\n logs.push(`No response found in the '${this._cacheName}' cache.`);\n }\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.put({\n cacheName: this._cacheName,\n request,\n response: responseClone,\n event,\n plugins: this._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 }\n catch (err) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n }\n return response;\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.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n }\n}\nexport { NetworkFirst };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport './_version.js';\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\n * [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.\n *\n * If the network request fails, this will throw a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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._plugins = options.plugins || [];\n this._fetchOptions = options.fetchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request The request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'NetworkOnly',\n funcName: 'handle',\n paramName: 'request',\n });\n }\n let error;\n let response;\n try {\n response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n }\n catch (err) {\n error = err;\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('NetworkOnly', request));\n if (response) {\n logger.log(`Got response from network.`);\n }\n else {\n logger.log(`Unable to get a response from the network.`);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url, error });\n }\n return response;\n }\n}\nexport { NetworkOnly };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { cacheWrapper } from 'workbox-core/_private/cacheWrapper.js';\nimport { fetchWrapper } from 'workbox-core/_private/fetchWrapper.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { messages } from './utils/messages.js';\nimport { cacheOkAndOpaquePlugin } from './plugins/cacheOkAndOpaquePlugin.js';\nimport './_version.js';\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 cross-origin requests where the response doesn't\n * support [CORS]{@link https://enable-cors.org/}.\n *\n * If the network request fails, and there is no cache match, this will throw\n * a `WorkboxError` exception.\n *\n * @memberof module:workbox-strategies\n */\nclass 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 module: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.getRuntimeName(options.cacheName);\n this._plugins = options.plugins || [];\n if (options.plugins) {\n let isUsingCacheWillUpdate = options.plugins.some((plugin) => !!plugin.cacheWillUpdate);\n this._plugins = isUsingCacheWillUpdate ?\n options.plugins : [cacheOkAndOpaquePlugin, ...options.plugins];\n }\n else {\n // No plugins passed in, use the default plugin.\n this._plugins = [cacheOkAndOpaquePlugin];\n }\n this._fetchOptions = options.fetchOptions;\n this._matchOptions = options.matchOptions;\n }\n /**\n * This method will perform a request strategy and follows an API that\n * will work with the\n * [Workbox Router]{@link module:workbox-routing.Router}.\n *\n * @param {Object} options\n * @param {Request|string} options.request A request to run this strategy for.\n * @param {Event} [options.event] The event that triggered the request.\n * @return {Promise<Response>}\n */\n async handle({ event, request }) {\n const logs = [];\n if (typeof request === 'string') {\n request = new Request(request);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-strategies',\n className: 'StaleWhileRevalidate',\n funcName: 'handle',\n paramName: 'request',\n });\n }\n const fetchAndCachePromise = this._getFromNetwork({ request, event });\n let response = await cacheWrapper.match({\n cacheName: this._cacheName,\n request,\n event,\n matchOptions: this._matchOptions,\n plugins: this._plugins,\n });\n let error;\n if (response) {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`Found a cached response in the '${this._cacheName}'` +\n ` cache. Will update with the network response in the background.`);\n }\n if (event) {\n try {\n event.waitUntil(fetchAndCachePromise);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logs.push(`No response found in the '${this._cacheName}' cache. ` +\n `Will wait for the network response.`);\n }\n try {\n response = await fetchAndCachePromise;\n }\n catch (err) {\n error = err;\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.groupCollapsed(messages.strategyStart('StaleWhileRevalidate', request));\n for (let log of logs) {\n logger.log(log);\n }\n messages.printFinalResponse(response);\n logger.groupEnd();\n }\n if (!response) {\n throw new WorkboxError('no-response', { url: request.url, error });\n }\n return response;\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 async _getFromNetwork({ request, event }) {\n const response = await fetchWrapper.fetch({\n request,\n event,\n fetchOptions: this._fetchOptions,\n plugins: this._plugins,\n });\n const cachePutPromise = cacheWrapper.put({\n cacheName: this._cacheName,\n request,\n response: response.clone(),\n event,\n plugins: this._plugins,\n });\n if (event) {\n try {\n event.waitUntil(cachePutPromise);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache for '${getFriendlyURL(request.url)}'.`);\n }\n }\n }\n return response;\n }\n}\nexport { StaleWhileRevalidate };\n"],"names":["self","_","e","cacheOkAndOpaquePlugin","cacheWillUpdate","async","response","status","constructor","options","_cacheName","cacheNames","getRuntimeName","cacheName","_plugins","plugins","_fetchOptions","fetchOptions","_matchOptions","matchOptions","event","request","Request","error","cacheWrapper","match","this","_getFromNetwork","err","WorkboxError","url","fetchWrapper","fetch","responseClone","clone","cachePutPromise","put","waitUntil","isUsingCacheWillUpdate","some","plugin","_networkTimeoutSeconds","networkTimeoutSeconds","logs","promises","timeoutId","id","promise","_getTimeoutPromise","push","networkPromise","_getNetworkPromise","Promise","race","resolve","setTimeout","_respondFromCache","clearTimeout","cachePut","fetchAndCachePromise"],"mappings":"uFAEA,IACIA,KAAK,6BAA+BC,IAExC,MAAOC,ICGA,MAAMC,EAAyB,CAWlCC,gBAAiBC,OAASC,SAAAA,KACE,MAApBA,EAASC,QAAsC,IAApBD,EAASC,OAC7BD,EAEJ,0BCMf,MAaIE,YAAYC,EAAU,SACbC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,CACpCZ,UAAWa,KAAKhB,EAChBW,QAAAA,EACAD,MAAAA,EACAD,aAAcO,KAAKR,EACnBH,QAASW,KAAKZ,OAGdR,MAKIc,MAEIA,EAAMiB,UAAUsB,GAEpB,MAAOpC,cAcPjB,QAAiBqD,EAErB,MAAO/B,GACHL,EAAQK,MAWXtB,QACK,IAAIuB,eAAa,cAAe,CAAEC,IAAKT,EAAQS,IAAKP,MAAAA,WAEvDjB,WAUWe,QAAEA,EAAFD,MAAWA,UACvBd,QAAiByB,eAAaC,MAAM,CACtCX,QAAAA,EACAD,MAAAA,EACAH,aAAcS,KAAKV,EACnBD,QAASW,KAAKZ,IAEZqB,EAAkBX,eAAaY,IAAI,CACrCvB,UAAWa,KAAKhB,EAChBW,QAAAA,EACAf,SAAUA,EAAS4B,QACnBd,MAAAA,EACAL,QAASW,KAAKZ,OAEdM,MAEIA,EAAMiB,UAAUF,GAEpB,MAAOZ,WAOJjB"}
@@ -1,10 +1,9 @@
1
1
  this.workbox = this.workbox || {};
2
- this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
2
+ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js, canConstructReadableStream_js) {
3
3
  'use strict';
4
4
 
5
- // @ts-ignore
6
5
  try {
7
- self['workbox:streams:5.0.0-alpha.0'] && _();
6
+ self['workbox:streams:5.0.0'] && _();
8
7
  } catch (e) {}
9
8
 
10
9
  /*
@@ -19,7 +18,7 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
19
18
  * [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the
20
19
  * ReadableStreamReader object associated with it.
21
20
  *
22
- * @param {workbox.streams.StreamSource} source
21
+ * @param {module:workbox-streams.StreamSource} source
23
22
  * @return {ReadableStreamReader}
24
23
  * @private
25
24
  */
@@ -43,10 +42,10 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
43
42
  * data returned in sequence, along with a Promise which signals when the
44
43
  * stream is finished (useful for passing to a FetchEvent's waitUntil()).
45
44
  *
46
- * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
45
+ * @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
47
46
  * @return {Object<{done: Promise, stream: ReadableStream}>}
48
47
  *
49
- * @memberof workbox.streams
48
+ * @memberof module:workbox-streams
50
49
  */
51
50
 
52
51
 
@@ -142,12 +141,13 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
142
141
  * [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
143
142
  * is available.
144
143
  *
144
+ * @private
145
145
  * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
146
146
  * `'text/html'` will be used by default.
147
147
  * @return {boolean} `true`, if the current browser meets the requirements for
148
148
  * streaming responses, and `false` otherwise.
149
149
  *
150
- * @memberof workbox.streams
150
+ * @memberof module:workbox-streams
151
151
  */
152
152
 
153
153
  function createHeaders(headersInit = {}) {
@@ -178,12 +178,12 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
178
178
  * stream's data returned in sequence, along with a Promise which signals when
179
179
  * the stream is finished (useful for passing to a FetchEvent's waitUntil()).
180
180
  *
181
- * @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
181
+ * @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
182
182
  * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
183
183
  * `'text/html'` will be used by default.
184
184
  * @return {Object<{done: Promise, response: Response}>}
185
185
  *
186
- * @memberof workbox.streams
186
+ * @memberof module:workbox-streams
187
187
  */
188
188
 
189
189
  function concatenateToResponse(sourcePromises, headersInit) {
@@ -208,7 +208,6 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
208
208
  license that can be found in the LICENSE file or at
209
209
  https://opensource.org/licenses/MIT.
210
210
  */
211
- let cachedIsSupported;
212
211
  /**
213
212
  * This is a utility method that determines whether the current browser supports
214
213
  * the features required to create streamed responses. Currently, it checks if
@@ -218,24 +217,11 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
218
217
  * @return {boolean} `true`, if the current browser meets the requirements for
219
218
  * streaming responses, and `false` otherwise.
220
219
  *
221
- * @memberof workbox.streams
220
+ * @memberof module:workbox-streams
222
221
  */
223
222
 
224
223
  function isSupported() {
225
- if (cachedIsSupported === undefined) {
226
- // See https://github.com/GoogleChrome/workbox/issues/1473
227
- try {
228
- new ReadableStream({
229
- start() {}
230
-
231
- });
232
- cachedIsSupported = true;
233
- } catch (error) {
234
- cachedIsSupported = false;
235
- }
236
- }
237
-
238
- return cachedIsSupported;
224
+ return canConstructReadableStream_js.canConstructReadableStream();
239
225
  }
240
226
 
241
227
  /*
@@ -253,14 +239,13 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
253
239
  * and create a final response that concatenates their values together.
254
240
  *
255
241
  * @param {Array<function({event, request, url, params})>} sourceFunctions
256
- * An array of functions similar to {@link workbox.routing.Route~handlerCallback}
257
- * but that instead return a {@link workbox.streams.StreamSource} (or a
242
+ * An array of functions similar to {@link module:workbox-routing~handlerCallback}
243
+ * but that instead return a {@link module:workbox-streams.StreamSource} (or a
258
244
  * Promise which resolves to one).
259
245
  * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
260
246
  * `'text/html'` will be used by default.
261
- * @return {workbox.routing.Route~handlerCallback}
262
- *
263
- * @memberof workbox.streams
247
+ * @return {module:workbox-routing~handlerCallback}
248
+ * @memberof module:workbox-streams
264
249
  */
265
250
 
266
251
  function strategy(sourceFunctions, headersInit) {
@@ -329,5 +314,5 @@ this.workbox.streams = (function (exports, logger_js, assert_js, Deferred_js) {
329
314
 
330
315
  return exports;
331
316
 
332
- }({}, workbox.core._private, workbox.core._private, workbox.core._private));
317
+ }({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private));
333
318
  //# sourceMappingURL=workbox-streams.dev.js.map