jekyll-pwa-plugin 2.1.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-plugin.rb +1 -1
  3. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.dev.js +1 -1
  4. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.dev.js.map +1 -1
  5. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.prod.js +1 -1
  6. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-background-sync.prod.js.map +1 -1
  7. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.dev.js +5 -5
  8. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.dev.js.map +1 -1
  9. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.prod.js +1 -1
  10. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-broadcast-cache-update.prod.js.map +1 -1
  11. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.dev.js +12 -12
  12. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.dev.js.map +1 -1
  13. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.prod.js +1 -1
  14. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cache-expiration.prod.js.map +1 -1
  15. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.dev.js +1 -1
  16. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.dev.js.map +1 -1
  17. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.prod.js +1 -1
  18. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-cacheable-response.prod.js.map +1 -1
  19. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-core.dev.js +542 -515
  20. data/lib/vendor/workbox-v3.6.2/workbox-core.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v3.6.2/workbox-core.prod.js +3 -0
  22. data/lib/vendor/workbox-v3.6.2/workbox-core.prod.js.map +1 -0
  23. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.dev.js +1 -1
  24. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.dev.js.map +1 -1
  25. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.prod.js +1 -1
  26. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-google-analytics.prod.js.map +1 -1
  27. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-navigation-preload.dev.js +39 -1
  28. data/lib/vendor/workbox-v3.6.2/workbox-navigation-preload.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js +3 -0
  30. data/lib/vendor/workbox-v3.6.2/workbox-navigation-preload.prod.js.map +1 -0
  31. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-precaching.dev.js +43 -23
  32. data/lib/vendor/workbox-v3.6.2/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js +3 -0
  34. data/lib/vendor/workbox-v3.6.2/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.dev.js +1 -1
  36. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.dev.js.map +1 -1
  37. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.prod.js +1 -1
  38. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-range-requests.prod.js.map +1 -1
  39. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-routing.dev.js +5 -5
  40. data/lib/vendor/workbox-v3.6.2/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-routing.prod.js +1 -1
  42. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-routing.prod.js.map +1 -1
  43. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-strategies.dev.js +150 -77
  44. data/lib/vendor/workbox-v3.6.2/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js +3 -0
  46. data/lib/vendor/workbox-v3.6.2/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-streams.dev.js +23 -33
  48. data/lib/vendor/workbox-v3.6.2/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v3.6.2/workbox-streams.prod.js +3 -0
  50. data/lib/vendor/workbox-v3.6.2/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-sw.js +1 -1
  52. data/lib/vendor/{workbox-v3.4.1 → workbox-v3.6.2}/workbox-sw.js.map +1 -1
  53. metadata +54 -53
  54. data/lib/vendor/workbox-v3.4.1/workbox-core.dev.js.map +0 -1
  55. data/lib/vendor/workbox-v3.4.1/workbox-core.prod.js +0 -3
  56. data/lib/vendor/workbox-v3.4.1/workbox-core.prod.js.map +0 -1
  57. data/lib/vendor/workbox-v3.4.1/workbox-navigation-preload.dev.js.map +0 -1
  58. data/lib/vendor/workbox-v3.4.1/workbox-navigation-preload.prod.js +0 -3
  59. data/lib/vendor/workbox-v3.4.1/workbox-navigation-preload.prod.js.map +0 -1
  60. data/lib/vendor/workbox-v3.4.1/workbox-precaching.dev.js.map +0 -1
  61. data/lib/vendor/workbox-v3.4.1/workbox-precaching.prod.js +0 -3
  62. data/lib/vendor/workbox-v3.4.1/workbox-precaching.prod.js.map +0 -1
  63. data/lib/vendor/workbox-v3.4.1/workbox-routing.dev.js.map +0 -1
  64. data/lib/vendor/workbox-v3.4.1/workbox-strategies.dev.js.map +0 -1
  65. data/lib/vendor/workbox-v3.4.1/workbox-strategies.prod.js +0 -3
  66. data/lib/vendor/workbox-v3.4.1/workbox-strategies.prod.js.map +0 -1
  67. data/lib/vendor/workbox-v3.4.1/workbox-streams.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v3.4.1/workbox-streams.prod.js +0 -3
  69. data/lib/vendor/workbox-v3.4.1/workbox-streams.prod.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["/* eslint-disable */\n// This is extracted from the Babel runtime (original source: https://github.com/babel/babel/blob/9e0f5235b1ca5167c368a576ad7c5af62d20b0e3/packages/babel-helpers/src/helpers.js#L240).\n// As part of the Rollup bundling process, it's injected once into workbox-core\n// and reused throughout all of the other modules, avoiding code duplication.\n// See https://github.com/GoogleChrome/workbox/pull/1048#issuecomment-344698046\n// for further background.\nself.babelHelpers = {\n asyncToGenerator: function(fn) {\n return function() {\n var gen = fn.apply(this, arguments);\n return new Promise(function(resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function(value) {\n step('next', value);\n }, function(err) {\n step('throw', err);\n });\n }\n }\n\n return step('next');\n });\n };\n },\n};\n\nthis.workbox = this.workbox || {};\nthis.workbox.core = (function () {\n 'use strict';\n\n try {\n self.workbox.v['workbox:core:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The available log levels in Workbox: debug, log, warn, error and silent.\n *\n * @property {int} debug Prints all logs from Workbox. Useful for debugging.\n * @property {int} log Prints console log, warn, error and groups. Default for\n * debug builds.\n * @property {int} warn Prints console warn, error and groups. Default for\n * non-debug builds.\n * @property {int} error Print console error and groups.\n * @property {int} silent Force no logging from Workbox.\n *\n * @alias workbox.core.LOG_LEVELS\n */\n\n var LOG_LEVELS = {\n debug: 0,\n log: 1,\n warn: 2,\n error: 3,\n silent: 4\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Safari doesn't print all console.groupCollapsed() arguments.\n // Related bug: https://bugs.webkit.org/show_bug.cgi?id=182754\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n const GREY = `#7f8c8d`;\n const GREEN = `#2ecc71`;\n const YELLOW = `#f39c12`;\n const RED = `#c0392b`;\n const BLUE = `#3498db`;\n\n const getDefaultLogLevel = () => LOG_LEVELS.log;\n\n let logLevel = getDefaultLogLevel();\n const shouldPrint = minLevel => logLevel <= minLevel;\n const setLoggerLevel = newLogLevel => logLevel = newLogLevel;\n const getLoggerLevel = () => logLevel;\n\n // We always want groups to be logged unless logLevel is silent.\n const groupLevel = LOG_LEVELS.error;\n\n const _print = function (keyName, logArgs, levelColor) {\n const logLevel = keyName.indexOf('group') === 0 ? groupLevel : LOG_LEVELS[keyName];\n if (!shouldPrint(logLevel)) {\n return;\n }\n\n if (!levelColor || keyName === 'groupCollapsed' && isSafari) {\n console[keyName](...logArgs);\n return;\n }\n\n const logPrefix = ['%cworkbox', `background: ${levelColor}; color: white; padding: 2px 0.5em; ` + `border-radius: 0.5em;`];\n console[keyName](...logPrefix, ...logArgs);\n };\n\n const groupEnd = () => {\n if (shouldPrint(groupLevel)) {\n console.groupEnd();\n }\n };\n\n const defaultExport = {\n groupEnd,\n unprefixed: {\n groupEnd\n }\n };\n\n const setupLogs = (keyName, color) => {\n defaultExport[keyName] = (...args) => _print(keyName, args, color);\n defaultExport.unprefixed[keyName] = (...args) => _print(keyName, args);\n };\n\n const levelToColor = {\n debug: GREY,\n log: GREEN,\n warn: YELLOW,\n error: RED,\n groupCollapsed: BLUE\n };\n Object.keys(levelToColor).forEach(keyName => setupLogs(keyName, levelToColor[keyName]));\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var messages = {\n 'invalid-value': ({ paramName, validValueDescription, value }) => {\n if (!paramName || !validValueDescription) {\n throw new Error(`Unexpected input to 'invalid-value' error.`);\n }\n return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;\n },\n\n 'not-in-sw': ({ moduleName }) => {\n if (!moduleName) {\n throw new Error(`Unexpected input to 'not-in-sw' error.`);\n }\n return `The '${moduleName}' must be used in a service worker.`;\n },\n\n 'not-an-array': ({ moduleName, className, funcName, paramName }) => {\n if (!moduleName || !className || !funcName || !paramName) {\n throw new Error(`Unexpected input to 'not-an-array' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n\n 'incorrect-type': ({ expectedType, paramName, moduleName, className,\n funcName }) => {\n if (!expectedType || !paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-type' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}` + `${funcName}()' must be of type ${expectedType}.`;\n },\n\n 'incorrect-class': ({ expectedClass, paramName, moduleName, className,\n funcName, isReturnValueProblem }) => {\n if (!expectedClass || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n\n if (isReturnValueProblem) {\n return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n }\n\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n },\n\n 'missing-a-method': ({ expectedMethod, paramName, moduleName, className,\n funcName }) => {\n if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n\n 'add-to-cache-list-unexpected-type': ({ entry }) => {\n return `An unexpected entry was passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` + `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` + `strings with one or more characters, objects with a url property or ` + `Request objects.`;\n },\n\n 'add-to-cache-list-conflicting-entries': ({ firstEntry, secondEntry }) => {\n if (!firstEntry || !secondEntry) {\n throw new Error(`Unexpected input to ` + `'add-to-cache-list-duplicate-entries' error.`);\n }\n\n return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had matching ` + `URLs but different revision details. This means workbox-precaching ` + `is unable to determine cache the asset correctly. Please remove one ` + `of the entries.`;\n },\n\n 'plugin-error-request-will-fetch': ({ thrownError }) => {\n if (!thrownError) {\n throw new Error(`Unexpected input to ` + `'plugin-error-request-will-fetch', error.`);\n }\n\n return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownError.message}'.`;\n },\n\n 'invalid-cache-name': ({ cacheNameId, value }) => {\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n\n return `You must provide a name containing at least one character for ` + `setCacheDeatils({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;\n },\n\n 'unregister-route-but-not-found-with-method': ({ method }) => {\n if (!method) {\n throw new Error(`Unexpected input to ` + `'unregister-route-but-not-found-with-method' error.`);\n }\n\n return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;\n },\n\n 'unregister-route-route-not-registered': () => {\n return `The route you're trying to unregister was not previously ` + `registered.`;\n },\n\n 'queue-replay-failed': ({ name, count }) => {\n return `${count} requests failed, while trying to replay Queue: ${name}.`;\n },\n\n 'duplicate-queue-name': ({ name }) => {\n return `The Queue name '${name}' is already being used. ` + `All instances of backgroundSync.Queue must be given unique names.`;\n },\n\n 'expired-test-without-max-age': ({ methodName, paramName }) => {\n return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;\n },\n\n 'unsupported-route-type': ({ moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter was an unsupported type. ` + `Please check the docs for ${moduleName}.${className}.${funcName} for ` + `valid input types.`;\n },\n\n 'not-array-of-class': ({ value, expectedClass,\n moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter must be an array of ` + `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` + `Please check the call to ${moduleName}.${className}.${funcName}() ` + `to fix the issue.`;\n },\n\n 'max-entries-or-age-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.maxEntries or config.maxAgeSeconds` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'statuses-or-headers-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.statuses or config.headers` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'invalid-string': ({ moduleName, className, funcName, paramName }) => {\n if (!paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${className}.${funcName}() for ` + `more info.`;\n },\n 'channel-name-required': () => {\n return `You must provide a channelName to construct a ` + `BroadcastCacheUpdate instance.`;\n },\n 'invalid-responses-are-same-args': () => {\n return `The arguments passed into responsesAreSame() appear to be ` + `invalid. Please ensure valid Responses are used.`;\n },\n 'expire-custom-caches-only': () => {\n return `You must provide a 'cacheName' property when using the ` + `expiration plugin with a runtime caching strategy.`;\n },\n 'unit-must-be-bytes': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);\n }\n return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n 'single-range-only': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'single-range-only' error.`);\n }\n return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'invalid-range-values': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'invalid-range-values' error.`);\n }\n return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'no-range-header': () => {\n return `No Range header was found in the Request provided.`;\n },\n 'range-not-satisfiable': ({ size, start, end }) => {\n return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;\n },\n 'attempt-to-cache-non-get-request': ({ url, method }) => {\n return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;\n },\n 'cache-put-with-no-response': ({ url }) => {\n return `There was an attempt to cache '${url}' but the response was not ` + `defined.`;\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const generatorFunction = (code, ...args) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n\n return message(...args);\n };\n\n const exportedValue = generatorFunction;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Workbox errors should be thrown with this class.\n * This allows use to ensure the type easily in tests,\n * helps developers identify errors from workbox\n * easily and allows use to optimise error\n * messages correctly.\n *\n * @private\n */\n class WorkboxError extends Error {\n /**\n *\n * @param {string} errorCode The error code that\n * identifies this particular error.\n * @param {Object=} details Any relevant arguments\n * that will help developers identify issues should\n * be added as a key on the context object.\n */\n constructor(errorCode, details) {\n let message = exportedValue(errorCode, details);\n\n super(message);\n\n this.name = errorCode;\n this.details = details;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n * This method returns true if the current context is a service worker.\n */\n const isSwEnv = moduleName => {\n if (!('ServiceWorkerGlobalScope' in self)) {\n throw new WorkboxError('not-in-sw', { moduleName });\n }\n };\n\n /*\n * This method throws if the supplied value is not an array.\n * The destructed values are required to produce a meaningful error for users.\n * The destructed and restructured object is so it's clear what is\n * needed.\n */\n const isArray = (value, { moduleName, className, funcName, paramName }) => {\n if (!Array.isArray(value)) {\n throw new WorkboxError('not-an-array', {\n moduleName,\n className,\n funcName,\n paramName\n });\n }\n };\n\n const hasMethod = (object, expectedMethod, { moduleName, className, funcName, paramName }) => {\n const type = typeof object[expectedMethod];\n if (type !== 'function') {\n throw new WorkboxError('missing-a-method', { paramName, expectedMethod,\n moduleName, className, funcName });\n }\n };\n\n const isType = (object, expectedType, { moduleName, className, funcName, paramName }) => {\n if (typeof object !== expectedType) {\n throw new WorkboxError('incorrect-type', { paramName, expectedType,\n moduleName, className, funcName });\n }\n };\n\n const isInstance = (object, expectedClass, { moduleName, className, funcName,\n paramName, isReturnValueProblem }) => {\n if (!(object instanceof expectedClass)) {\n throw new WorkboxError('incorrect-class', { paramName, expectedClass,\n moduleName, className, funcName, isReturnValueProblem });\n }\n };\n\n const isOneOf = (value, validValues, { paramName }) => {\n if (!validValues.includes(value)) {\n throw new WorkboxError('invalid-value', {\n paramName,\n value,\n validValueDescription: `Valid values are ${JSON.stringify(validValues)}.`\n });\n }\n };\n\n const isArrayOfClass = (value, expectedClass, { moduleName, className, funcName, paramName }) => {\n const error = new WorkboxError('not-array-of-class', {\n value, expectedClass,\n moduleName, className, funcName, paramName\n });\n if (!Array.isArray(value)) {\n throw error;\n }\n\n for (let item of value) {\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n };\n\n const finalAssertExports = {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isSwEnv,\n isType,\n isArrayOfClass\n };\n\n /**\n * Runs all of the callback functions, one at a time sequentially, in the order\n * in which they were registered.\n *\n * @memberof workbox.core\n * @private\n */\n let executeQuotaErrorCallbacks = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n defaultExport.log(`About to run ${callbacks.size} callbacks to clean up caches.`);\n }\n\n for (const callback of callbacks) {\n yield callback();\n {\n defaultExport.log(callback, 'is complete.');\n }\n }\n\n {\n defaultExport.log('Finished running callbacks.');\n }\n });\n\n return function executeQuotaErrorCallbacks() {\n return _ref.apply(this, arguments);\n };\n })();\n\n const callbacks = new Set();\n\n /**\n * Adds a function to the set of callbacks that will be executed when there's\n * a quota error.\n *\n * @param {Function} callback\n * @memberof workbox.core\n */\n function registerQuotaErrorCallback(callback) {\n {\n finalAssertExports.isType(callback, 'function', {\n moduleName: 'workbox-core',\n funcName: 'register',\n paramName: 'callback'\n });\n }\n\n callbacks.add(callback);\n\n {\n defaultExport.log('Registered a callback to respond to quota errors.', callback);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class that wraps common IndexedDB functionality in a promise-based API.\n * It exposes all the underlying power and functionality of IndexedDB, but\n * wraps the most commonly used features in a way that's much simpler to use.\n *\n * @private\n */\n class DBWrapper {\n /**\n * @param {string} name\n * @param {number} version\n * @param {Object=} [callback]\n * @param {function(this:DBWrapper, Event)} [callbacks.onupgradeneeded]\n * @param {function(this:DBWrapper, Event)} [callbacks.onversionchange]\n * Defaults to DBWrapper.prototype._onversionchange when not specified.\n */\n constructor(name, version, {\n onupgradeneeded,\n onversionchange = this._onversionchange\n } = {}) {\n this._name = name;\n this._version = version;\n this._onupgradeneeded = onupgradeneeded;\n this._onversionchange = onversionchange;\n\n // If this is null, it means the database isn't open.\n this._db = null;\n }\n\n /**\n * Opens a connected to an IDBDatabase, invokes any onupgradedneeded\n * callback, and added an onversionchange callback to the database.\n *\n * @return {IDBDatabase}\n *\n * @private\n */\n open() {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (_this._db) return;\n\n _this._db = yield new Promise(function (resolve, reject) {\n // This flag is flipped to true if the timeout callback runs prior\n // to the request failing or succeeding. Note: we use a timeout instead\n // of an onblocked handler since there are cases where onblocked will\n // never never run. A timeout better handles all possible scenarios:\n // https://github.com/w3c/IndexedDB/issues/223\n let openRequestTimedOut = false;\n setTimeout(function () {\n openRequestTimedOut = true;\n reject(new Error('The open request was blocked and timed out'));\n }, _this.OPEN_TIMEOUT);\n\n const openRequest = indexedDB.open(_this._name, _this._version);\n openRequest.onerror = function (evt) {\n return reject(openRequest.error);\n };\n openRequest.onupgradeneeded = function (evt) {\n if (openRequestTimedOut) {\n openRequest.transaction.abort();\n evt.target.result.close();\n } else if (_this._onupgradeneeded) {\n _this._onupgradeneeded(evt);\n }\n };\n openRequest.onsuccess = function (evt) {\n const db = evt.target.result;\n if (openRequestTimedOut) {\n db.close();\n } else {\n db.onversionchange = _this._onversionchange;\n resolve(db);\n }\n };\n });\n\n return _this;\n })();\n }\n\n /**\n * Delegates to the native `get()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n get(storeName, ...args) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._call('get', storeName, 'readonly', ...args);\n })();\n }\n\n /**\n * Delegates to the native `add()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n add(storeName, ...args) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this3._call('add', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `put()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n put(storeName, ...args) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this4._call('put', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `delete()` method for the object store.\n *\n * @param {string} storeName\n * @param {...*} args The values passed to the delegated method.\n *\n * @private\n */\n delete(storeName, ...args) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._call('delete', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Deletes the underlying database, ensuring that any open connections are\n * closed first.\n *\n * @private\n */\n deleteDatabase() {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n _this6.close();\n _this6._db = null;\n yield new Promise(function (resolve, reject) {\n const request = indexedDB.deleteDatabase(_this6._name);\n request.onerror = function (evt) {\n return reject(evt.target.error);\n };\n request.onblocked = function () {\n return reject(new Error('Deletion was blocked.'));\n };\n request.onsuccess = function () {\n return resolve();\n };\n });\n })();\n }\n\n /**\n * Delegates to the native `getAll()` or polyfills it via the `find()`\n * method in older browsers.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n *\n * @private\n */\n getAll(storeName, query, count) {\n var _this7 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if ('getAll' in IDBObjectStore.prototype) {\n return yield _this7._call('getAll', storeName, 'readonly', query, count);\n } else {\n return yield _this7.getAllMatching(storeName, { query, count });\n }\n })();\n }\n\n /**\n * Supports flexible lookup in an object store by specifying an index,\n * query, direction, and count. This method returns an array of objects\n * with the signature .\n *\n * @param {string} storeName\n * @param {Object} [opts]\n * @param {IDBCursorDirection} [opts.direction]\n * @param {*} [opts.query]\n * @param {string} [opts.index] The index to use (if specified).\n * @param {number} [opts.count] The max number of results to return.\n * @param {boolean} [opts.includeKeys] When true, the structure of the\n * returned objects is changed from an array of values to an array of\n * objects in the form {key, primaryKey, value}.\n * @return {Array}\n *\n * @private\n */\n getAllMatching(storeName, opts = {}) {\n var _this8 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this8.transaction([storeName], 'readonly', function (stores, done) {\n const store = stores[storeName];\n const target = opts.index ? store.index(opts.index) : store;\n const results = [];\n\n // Passing `undefined` arguments to Edge's `openCursor(...)` causes\n // 'DOMException: DataError'\n // Details in issue: https://github.com/GoogleChrome/workbox/issues/1509\n const query = opts.query || null;\n const direction = opts.direction || 'next';\n target.openCursor(query, direction).onsuccess = function (evt) {\n const cursor = evt.target.result;\n if (cursor) {\n const { primaryKey, key, value } = cursor;\n results.push(opts.includeKeys ? { primaryKey, key, value } : value);\n if (opts.count && results.length >= opts.count) {\n done(results);\n } else {\n cursor.continue();\n }\n } else {\n done(results);\n }\n };\n });\n })();\n }\n\n /**\n * Accepts a list of stores, a transaction type, and a callback and\n * performs a transaction. A promise is returned that resolves to whatever\n * value the callback chooses. The callback holds all the transaction logic\n * and is invoked with three arguments:\n * 1. An object mapping object store names to IDBObjectStore values.\n * 2. A `done` function, that's used to resolve the promise when\n * when the transaction is done.\n * 3. An `abort` function that can be called to abort the transaction\n * at any time.\n *\n * @param {Array<string>} storeNames An array of object store names\n * involved in the transaction.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {function(Object, function(), function(*)):?IDBRequest} callback\n * @return {*} The result of the transaction ran by the callback.\n *\n * @private\n */\n transaction(storeNames, type, callback) {\n var _this9 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this9.open();\n const result = yield new Promise(function (resolve, reject) {\n const txn = _this9._db.transaction(storeNames, type);\n const done = function (value) {\n return resolve(value);\n };\n const abort = function () {\n reject(new Error('The transaction was manually aborted'));\n txn.abort();\n };\n txn.onerror = function (evt) {\n return reject(evt.target.error);\n };\n txn.onabort = function (evt) {\n return reject(evt.target.error);\n };\n txn.oncomplete = function () {\n return resolve();\n };\n\n const stores = {};\n for (const storeName of storeNames) {\n stores[storeName] = txn.objectStore(storeName);\n }\n callback(stores, done, abort);\n });\n return result;\n })();\n }\n\n /**\n * Delegates async to a native IDBObjectStore method.\n *\n * @param {string} method The method name.\n * @param {string} storeName The object store name.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {...*} args The list of args to pass to the native method.\n * @return {*} The result of the transaction.\n *\n * @private\n */\n _call(method, storeName, type, ...args) {\n var _this10 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this10.open();\n const callback = function (stores, done) {\n stores[storeName][method](...args).onsuccess = function (evt) {\n done(evt.target.result);\n };\n };\n\n return yield _this10.transaction([storeName], type, callback);\n })();\n }\n\n /**\n * The default onversionchange handler, which closes the database so other\n * connections can open without being blocked.\n *\n * @param {Event} evt\n *\n * @private\n */\n _onversionchange(evt) {\n this.close();\n }\n\n /**\n * Closes the connection opened by `DBWrapper.open()`. Generally this method\n * doesn't need to be called since:\n * 1. It's usually better to keep a connection open since opening\n * a new connection is somewhat slow.\n * 2. Connections are automatically closed when the reference is\n * garbage collected.\n * The primary use case for needing to close a connection is when another\n * reference (typically in another tab) needs to upgrade it and would be\n * blocked by the current, open connection.\n *\n * @private\n */\n close() {\n if (this._db) this._db.close();\n }\n }\n\n // Exposed to let users modify the default timeout on a per-instance\n // or global basis.\n DBWrapper.prototype.OPEN_TIMEOUT = 2000;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const _cacheNameDetails = {\n prefix: 'workbox',\n suffix: self.registration.scope,\n googleAnalytics: 'googleAnalytics',\n precache: 'precache',\n runtime: 'runtime'\n };\n\n const _createCacheName = cacheName => {\n return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value.length > 0).join('-');\n };\n\n const cacheNames = {\n updateDetails: details => {\n Object.keys(_cacheNameDetails).forEach(key => {\n if (typeof details[key] !== 'undefined') {\n _cacheNameDetails[key] = details[key];\n }\n });\n },\n getGoogleAnalyticsName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);\n },\n getPrecacheName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.precache);\n },\n getRuntimeName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginEvents = {\n CACHE_DID_UPDATE: 'cacheDidUpdate',\n CACHE_WILL_UPDATE: 'cacheWillUpdate',\n CACHED_RESPONSE_WILL_BE_USED: 'cachedResponseWillBeUsed',\n FETCH_DID_FAIL: 'fetchDidFail',\n REQUEST_WILL_FETCH: 'requestWillFetch'\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginUtils = {\n filter: (plugins, callbackname) => {\n return plugins.filter(plugin => callbackname in plugin);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around cache.put().\n *\n * Will call `cacheDidUpdate` on plugins if the cache was updated.\n *\n * @param {Object} options\n * @param {string} options.cacheName\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n *\n * @private\n * @memberof module:workbox-core\n */\n const putWrapper = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n response,\n event,\n plugins = []\n } = {}) {\n if (!response) {\n {\n defaultExport.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(request.url)}'.`);\n }\n\n throw new WorkboxError('cache-put-with-no-response', {\n url: getFriendlyURL(request.url)\n });\n }\n\n let responseToCache = yield _isResponseSafeToCache({ request, response, event, plugins });\n\n if (!responseToCache) {\n {\n defaultExport.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache);\n }\n return;\n }\n\n {\n if (responseToCache.method && responseToCache.method !== 'GET') {\n throw new WorkboxError('attempt-to-cache-non-get-request', {\n url: getFriendlyURL(request.url),\n method: responseToCache.method\n });\n }\n }\n\n const cache = yield caches.open(cacheName);\n\n const updatePlugins = pluginUtils.filter(plugins, pluginEvents.CACHE_DID_UPDATE);\n\n let oldResponse = updatePlugins.length > 0 ? yield matchWrapper({ cacheName, request }) : null;\n\n {\n defaultExport.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(request.url)}.`);\n }\n\n try {\n yield cache.put(request, responseToCache);\n } catch (error) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n if (error.name === 'QuotaExceededError') {\n yield executeQuotaErrorCallbacks();\n }\n throw error;\n }\n\n for (let plugin of updatePlugins) {\n yield plugin[pluginEvents.CACHE_DID_UPDATE].call(plugin, {\n cacheName,\n request,\n event,\n oldResponse,\n newResponse: responseToCache\n });\n }\n });\n\n return function putWrapper() {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * This is a wrapper around cache.match().\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache to match against.\n * @param {Request} options.request The Request that will be used to look up\n *. cache entries.\n * @param {Event} [options.event] The event that propted the action.\n * @param {Object} [options.matchOptions] Options passed to cache.match().\n * @param {Array<Object>} [options.plugins=[]] Array of plugins.\n * @return {Response} A cached response if available.\n *\n * @private\n * @memberof module:workbox-core\n */\n const matchWrapper = (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n event,\n matchOptions,\n plugins = [] }) {\n const cache = yield caches.open(cacheName);\n let cachedResponse = yield cache.match(request, matchOptions);\n {\n if (cachedResponse) {\n defaultExport.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n defaultExport.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (let plugin of plugins) {\n if (pluginEvents.CACHED_RESPONSE_WILL_BE_USED in plugin) {\n cachedResponse = yield plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED].call(plugin, {\n cacheName,\n request,\n event,\n matchOptions,\n cachedResponse\n });\n {\n if (cachedResponse) {\n finalAssertExports.isInstance(cachedResponse, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n return cachedResponse;\n });\n\n return function matchWrapper(_x) {\n return _ref2.apply(this, arguments);\n };\n })();\n\n /**\n * This method will call cacheWillUpdate on the available plugins (or use\n * response.ok) to determine if the Response is safe and valid to cache.\n *\n * @param {Object} options\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const _isResponseSafeToCache = (() => {\n var _ref3 = babelHelpers.asyncToGenerator(function* ({ request, response, event, plugins }) {\n let responseToCache = response;\n let pluginsUsed = false;\n for (let plugin of plugins) {\n if (pluginEvents.CACHE_WILL_UPDATE in plugin) {\n pluginsUsed = true;\n responseToCache = yield plugin[pluginEvents.CACHE_WILL_UPDATE].call(plugin, {\n request,\n response: responseToCache,\n event\n });\n\n {\n if (responseToCache) {\n finalAssertExports.isInstance(responseToCache, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHE_WILL_UPDATE,\n isReturnValueProblem: true\n });\n }\n }\n\n if (!responseToCache) {\n break;\n }\n }\n }\n\n if (!pluginsUsed) {\n {\n if (!responseToCache.ok) {\n if (responseToCache.status === 0) {\n defaultExport.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);\n } else {\n defaultExport.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);\n }\n }\n }\n responseToCache = responseToCache.ok ? responseToCache : null;\n }\n\n return responseToCache ? responseToCache : null;\n });\n\n return function _isResponseSafeToCache(_x2) {\n return _ref3.apply(this, arguments);\n };\n })();\n\n const cacheWrapper = {\n put: putWrapper,\n match: matchWrapper\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around the fetch API.\n *\n * Will call requestWillFetch on available plugins.\n *\n * @param {Object} options\n * @param {Request|string} options.request\n * @param {Object} [options.fetchOptions]\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const wrappedFetch = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n request,\n fetchOptions,\n event,\n plugins = [] }) {\n // We *should* be able to call `await event.preloadResponse` even if it's\n // undefined, but for some reason, doing so leads to errors in our Node unit\n // tests. To work around that, explicitly check preloadResponse's value first.\n if (event && event.preloadResponse) {\n const possiblePreloadResponse = yield event.preloadResponse;\n if (possiblePreloadResponse) {\n {\n defaultExport.log(`Using a preloaded navigation response for ` + `'${getFriendlyURL(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n finalAssertExports.isInstance(request, Request, {\n paramName: request,\n expectedClass: 'Request',\n moduleName: 'workbox-core',\n className: 'fetchWrapper',\n funcName: 'wrappedFetch'\n });\n }\n\n const failedFetchPlugins = pluginUtils.filter(plugins, pluginEvents.FETCH_DID_FAIL);\n\n // If there is a fetchDidFail plugin, we need to save a clone of the\n // original request before it's either modified by a requestWillFetch\n // plugin or before the original request's body is consumed via fetch().\n const originalRequest = failedFetchPlugins.length > 0 ? request.clone() : null;\n\n try {\n for (let plugin of plugins) {\n if (pluginEvents.REQUEST_WILL_FETCH in plugin) {\n request = yield plugin[pluginEvents.REQUEST_WILL_FETCH].call(plugin, {\n request: request.clone(),\n event\n });\n\n {\n if (request) {\n finalAssertExports.isInstance(request, Request, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n } catch (err) {\n throw new WorkboxError('plugin-error-request-will-fetch', {\n thrownError: err\n });\n }\n\n // The request can be altered by plugins with `requestWillFetch` making\n // the original request (Most likely from a `fetch` event) to be different\n // to the Request we make. Pass both to `fetchDidFail` to aid debugging.\n const pluginFilteredRequest = request.clone();\n\n try {\n const fetchResponse = yield fetch(request, fetchOptions);\n {\n defaultExport.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${fetchResponse.status}'.`);\n }\n return fetchResponse;\n } catch (error) {\n {\n defaultExport.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, error);\n }\n\n for (let plugin of failedFetchPlugins) {\n yield plugin[pluginEvents.FETCH_DID_FAIL].call(plugin, {\n error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone()\n });\n }\n\n throw error;\n }\n });\n\n return function wrappedFetch(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n const fetchWrapper = {\n fetch: wrappedFetch\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var _private = /*#__PURE__*/Object.freeze({\n DBWrapper: DBWrapper,\n WorkboxError: WorkboxError,\n assert: finalAssertExports,\n cacheNames: cacheNames,\n cacheWrapper: cacheWrapper,\n fetchWrapper: fetchWrapper,\n getFriendlyURL: getFriendlyURL,\n logger: defaultExport\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Logs a warning to the user recommending changing\n * to max-age=0 or no-cache.\n *\n * @param {string} cacheControlHeader\n *\n * @private\n */\n function showWarning(cacheControlHeader) {\n const docsUrl = 'https://developers.google.com/web/tools/workbox/guides/service-worker-checklist#cache-control_of_your_service_worker_file';\n defaultExport.warn(`You are setting a 'cache-control' header of ` + `'${cacheControlHeader}' on your service worker file. This should be ` + `set to 'max-age=0' or 'no-cache' to ensure the latest service worker ` + `is served to your users. Learn more here: ${docsUrl}`);\n }\n\n /**\n * Checks for cache-control header on SW file and\n * warns the developer if it exists with a value\n * other than max-age=0 or no-cache.\n *\n * @return {Promise}\n * @private\n */\n function checkSWFileCacheHeaders() {\n // This is wrapped as an iife to allow async/await while making\n // rollup exclude it in builds.\n return babelHelpers.asyncToGenerator(function* () {\n try {\n const swFile = self.location.href;\n const response = yield fetch(swFile);\n if (!response.ok) {\n // Response failed so nothing we can check;\n return;\n }\n\n if (!response.headers.has('cache-control')) {\n // No cache control header.\n return;\n }\n\n const cacheControlHeader = response.headers.get('cache-control');\n const maxAgeResult = /max-age\\s*=\\s*(\\d*)/g.exec(cacheControlHeader);\n if (maxAgeResult) {\n if (parseInt(maxAgeResult[1], 10) === 0) {\n return;\n }\n }\n\n if (cacheControlHeader.indexOf('no-cache') !== -1) {\n return;\n }\n\n if (cacheControlHeader.indexOf('no-store') !== -1) {\n return;\n }\n\n showWarning(cacheControlHeader);\n } catch (err) {\n // NOOP\n }\n })();\n }\n\n const finalCheckSWFileCacheHeaders = checkSWFileCacheHeaders;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This class is never exposed publicly. Inidividual methods are exposed\n * using jsdoc alias commands.\n *\n * @memberof workbox.core\n * @private\n */\n class WorkboxCore {\n /**\n * You should not instantiate this object directly.\n *\n * @private\n */\n constructor() {\n // Give our version strings something to hang off of.\n try {\n self.workbox.v = self.workbox.v || {};\n } catch (err) {}\n // NOOP\n\n\n // A WorkboxCore instance must be exported before we can use the logger.\n // This is so it can get the current log level.\n {\n const padding = ' ';\n defaultExport.groupCollapsed('Welcome to Workbox!');\n defaultExport.unprefixed.log(`You are currently using a development build. ` + `By default this will switch to prod builds when not on localhost. ` + `You can force this with workbox.setConfig({debug: true|false}).`);\n defaultExport.unprefixed.log(`📖 Read the guides and documentation\\n` + `${padding}https://developers.google.com/web/tools/workbox/`);\n defaultExport.unprefixed.log(`❓ Use the [workbox] tag on Stack Overflow to ask questions\\n` + `${padding}https://stackoverflow.com/questions/ask?tags=workbox`);\n defaultExport.unprefixed.log(`🐛 Found a bug? Report it on GitHub\\n` + `${padding}https://github.com/GoogleChrome/workbox/issues/new`);\n defaultExport.groupEnd();\n\n if (typeof finalCheckSWFileCacheHeaders === 'function') {\n finalCheckSWFileCacheHeaders();\n }\n }\n }\n\n /**\n * Get the current cache names used by Workbox.\n *\n * `cacheNames.precache` is used for precached assets,\n * `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to\n * store `analytics.js`,\n * and `cacheNames.runtime` is used for everything else.\n *\n * @return {Object} An object with `precache` and `runtime` cache names.\n *\n * @alias workbox.core.cacheNames\n */\n get cacheNames() {\n return {\n googleAnalytics: cacheNames.getGoogleAnalyticsName(),\n precache: cacheNames.getPrecacheName(),\n runtime: cacheNames.getRuntimeName()\n };\n }\n\n /**\n * You can alter the default cache names used by the Workbox modules by\n * changing the cache name details.\n *\n * Cache names are generated as `<prefix>-<Cache Name>-<suffix>`.\n *\n * @param {Object} details\n * @param {Object} details.prefix The string to add to the beginning of\n * the precache and runtime cache names.\n * @param {Object} details.suffix The string to add to the end of\n * the precache and runtime cache names.\n * @param {Object} details.precache The cache name to use for precache\n * caching.\n * @param {Object} details.runtime The cache name to use for runtime caching.\n * @param {Object} details.googleAnalytics The cache name to use for\n * `workbox-google-analytics` caching.\n *\n * @alias workbox.core.setCacheNameDetails\n */\n setCacheNameDetails(details) {\n {\n Object.keys(details).forEach(key => {\n finalAssertExports.isType(details[key], 'string', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'setCacheNameDetails',\n paramName: `details.${key}`\n });\n });\n\n if ('precache' in details && details.precache.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'precache',\n value: details.precache\n });\n }\n\n if ('runtime' in details && details.runtime.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'runtime',\n value: details.runtime\n });\n }\n\n if ('googleAnalytics' in details && details.googleAnalytics.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'googleAnalytics',\n value: details.googleAnalytics\n });\n }\n }\n\n cacheNames.updateDetails(details);\n }\n\n /**\n * Get the current log level.\n *\n * @return {number}.\n *\n * @alias workbox.core.logLevel\n */\n get logLevel() {\n return getLoggerLevel();\n }\n\n /**\n * Set the current log level passing in one of the values from\n * [LOG_LEVELS]{@link module:workbox-core.LOG_LEVELS}.\n *\n * @param {number} newLevel The new log level to use.\n *\n * @alias workbox.core.setLogLevel\n */\n setLogLevel(newLevel) {\n {\n finalAssertExports.isType(newLevel, 'number', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'logLevel [setter]',\n paramName: `logLevel`\n });\n }\n\n if (newLevel > LOG_LEVELS.silent || newLevel < LOG_LEVELS.debug) {\n throw new WorkboxError('invalid-value', {\n paramName: 'logLevel',\n validValueDescription: `Please use a value from LOG_LEVELS, i.e ` + `'logLevel = workbox.core.LOG_LEVELS.debug'.`,\n value: newLevel\n });\n }\n\n setLoggerLevel(newLevel);\n }\n }\n\n var defaultExport$1 = new WorkboxCore();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExports = Object.assign(defaultExport$1, {\n _private,\n LOG_LEVELS,\n registerQuotaErrorCallback\n });\n\n return finalExports;\n\n}());\n"],"file":"workbox-core.dev.js"}
@@ -0,0 +1,3 @@
1
+ self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n("next",e)},function(e){n("throw",e)});e(l)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.6.2"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf("group")?c:e[r];if(!n(l))return;if(!i||"groupCollapsed"===r&&t)return void console[r](...o);const s=["%cworkbox",`background: ${i}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("get",e,"readonly",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("add",e,"readwrite",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("put",e,"readwrite",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i("delete",e,"readwrite",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error("Deletion was blocked."))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],"readonly",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||"next";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join("-"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E="cacheDidUpdate",L="cacheWillUpdate",x="cachedResponseWillBeUsed",H="fetchDidFail",N="requestWillFetch",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p("cache-put-with-no-response",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw"QuotaExceededError"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}"string"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p("plugin-error-request-will-fetch",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();
2
+
3
+ //# sourceMappingURL=workbox-core.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n(\"next\",e)},function(e){n(\"throw\",e)});e(l)}(\"next\")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){\"use strict\";try{self.workbox.v[\"workbox:core:3.6.2\"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf(\"group\")?c:e[r];if(!n(l))return;if(!i||\"groupCollapsed\"===r&&t)return void console[r](...o);const s=[\"%cworkbox\",`background: ${i}; color: white; padding: 2px 0.5em; `+\"border-radius: 0.5em;\"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:\"#7f8c8d\",log:\"#2ecc71\",warn:\"#f39c12\",error:\"#c0392b\",groupCollapsed:\"#3498db\"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error(\"The open request was blocked and timed out\"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"get\",e,\"readonly\",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"add\",e,\"readwrite\",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"put\",e,\"readwrite\",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i(\"delete\",e,\"readwrite\",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error(\"Deletion was blocked.\"))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return\"getAll\"in IDBObjectStore.prototype?yield n.i(\"getAll\",e,\"readonly\",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],\"readonly\",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||\"next\";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error(\"The transaction was manually aborted\")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:\"workbox\",suffix:self.registration.scope,googleAnalytics:\"googleAnalytics\",precache:\"precache\",runtime:\"runtime\"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join(\"-\"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E=\"cacheDidUpdate\",L=\"cacheWillUpdate\",x=\"cachedResponseWillBeUsed\",H=\"fetchDidFail\",N=\"requestWillFetch\",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p(\"cache-put-with-no-response\",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw\"QuotaExceededError\"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}\"string\"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p(\"plugin-error-request-will-fetch\",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p(\"invalid-value\",{paramName:\"logLevel\",validValueDescription:\"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.\",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();\n"],"file":"workbox-core.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Rout
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:google-analytics:3.4.1'] = 1;
6
+ self.workbox.v['workbox:google-analytics:3.6.2'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Route_mjs,Router_mjs,NetworkFirst_mjs,NetworkOnly_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:google-analytics:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const QUEUE_NAME = 'workbox-google-analytics';\n const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes\n const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';\n const GTM_HOST = 'www.googletagmanager.com';\n const ANALYTICS_JS_PATH = '/analytics.js';\n const GTAG_JS_PATH = '/gtag/js';\n\n // This RegExp matches all known Measurement Protocol single-hit collect\n // endpoints. Most of the time the default path (/collect) is used, but\n // occasionally an experimental endpoint is used when testing new features,\n // (e.g. /r/collect or /j/collect)\n const COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Promisifies the FileReader API to await a text response from a Blob.\n *\n * @param {Blob} blob\n * @return {Promise<string>}\n *\n * @private\n */\n const getTextFromBlob = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (blob) {\n // This usage of `return await new Promise...` is intentional to work around\n // a bug in the transpiled/minified output.\n // See https://github.com/GoogleChrome/workbox/issues/1186\n return yield new Promise(function (resolve, reject) {\n const reader = new FileReader();\n reader.onloadend = function () {\n return resolve(reader.result);\n };\n reader.onerror = function () {\n return reject(reader.error);\n };\n reader.readAsText(blob);\n });\n });\n\n return function getTextFromBlob(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * Creates the requestWillDequeue callback to be used with the background\n * sync queue plugin. The callback takes the failed request and adds the\n * `qt` param based on the current time, as well as applies any other\n * user-defined hit modifications.\n *\n * @param {Object} config See workbox.googleAnalytics.initialize.\n * @return {Function} The requestWillDequeu callback function.\n *\n * @private\n */\n const createRequestWillReplayCallback = config => {\n return (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (storableRequest) {\n let { url, requestInit, timestamp } = storableRequest;\n url = new URL(url);\n\n // Measurement protocol requests can set their payload parameters in either\n // the URL query string (for GET requests) or the POST body.\n let params;\n if (requestInit.body) {\n const payload = requestInit.body instanceof Blob ? yield getTextFromBlob(requestInit.body) : requestInit.body;\n\n params = new URLSearchParams(payload);\n } else {\n params = url.searchParams;\n }\n\n // Calculate the qt param, accounting for the fact that an existing\n // qt param may be present and should be updated rather than replaced.\n const originalHitTime = timestamp - (Number(params.get('qt')) || 0);\n const queueTime = Date.now() - originalHitTime;\n\n // Set the qt param prior to applying the hitFilter or parameterOverrides.\n params.set('qt', queueTime);\n\n if (config.parameterOverrides) {\n for (const param of Object.keys(config.parameterOverrides)) {\n const value = config.parameterOverrides[param];\n params.set(param, value);\n }\n }\n\n if (typeof config.hitFilter === 'function') {\n config.hitFilter.call(null, params);\n }\n\n requestInit.body = params.toString();\n requestInit.method = 'POST';\n requestInit.mode = 'cors';\n requestInit.credentials = 'omit';\n requestInit.headers = { 'Content-Type': 'text/plain' };\n\n // Ignore URL search params as they're now in the post body.\n storableRequest.url = `${url.origin}${url.pathname}`;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })();\n };\n\n /**\n * Creates GET and POST routes to catch failed Measurement Protocol hits.\n *\n * @param {Plugin} queuePlugin\n * @return {Array<Route>} The created routes.\n *\n * @private\n */\n const createCollectRoutes = queuePlugin => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);\n\n const handler = new NetworkOnly_mjs.NetworkOnly({\n plugins: [queuePlugin]\n });\n\n return [new Route_mjs.Route(match, handler, 'GET'), new Route_mjs.Route(match, handler, 'POST')];\n };\n\n /**\n * Creates a route with a network first strategy for the analytics.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createAnalyticsJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * Creates a route with a network first strategy for the gtag.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createGtagJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * @param {Object=} [options]\n * @param {Object} [options.cacheName] The cache name to store and retrieve\n * analytics.js. Defaults to the cache names provided by `workbox-core`.\n * @param {Object} [options.parameterOverrides]\n * [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),\n * expressed as key/value pairs, to be added to replayed Google Analytics\n * requests. This can be used to, e.g., set a custom dimension indicating\n * that the request was replayed.\n * @param {Function} [options.hitFilter] A function that allows you to modify\n * the hit parameters prior to replaying\n * the hit. The function is invoked with the original hit's URLSearchParams\n * object as its only argument.\n *\n * @memberof workbox.googleAnalytics\n */\n const initialize = (options = {}) => {\n const cacheName = cacheNames_mjs.cacheNames.getGoogleAnalyticsName(options.cacheName);\n\n const queuePlugin = new Plugin_mjs.Plugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n callbacks: {\n requestWillReplay: createRequestWillReplayCallback(options)\n }\n });\n\n const routes = [createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];\n\n const router = new Router_mjs.Router();\n for (const route of routes) {\n router.registerRoute(route);\n }\n\n self.addEventListener('fetch', evt => {\n const responsePromise = router.handleRequest(evt);\n if (responsePromise) {\n evt.respondWith(responsePromise);\n }\n });\n };\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.initialize = initialize;\n\n return exports;\n\n}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies));\n"],"file":"workbox-google-analytics.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Route_mjs,Router_mjs,NetworkFirst_mjs,NetworkOnly_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:google-analytics:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const QUEUE_NAME = 'workbox-google-analytics';\n const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes\n const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';\n const GTM_HOST = 'www.googletagmanager.com';\n const ANALYTICS_JS_PATH = '/analytics.js';\n const GTAG_JS_PATH = '/gtag/js';\n\n // This RegExp matches all known Measurement Protocol single-hit collect\n // endpoints. Most of the time the default path (/collect) is used, but\n // occasionally an experimental endpoint is used when testing new features,\n // (e.g. /r/collect or /j/collect)\n const COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Promisifies the FileReader API to await a text response from a Blob.\n *\n * @param {Blob} blob\n * @return {Promise<string>}\n *\n * @private\n */\n const getTextFromBlob = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (blob) {\n // This usage of `return await new Promise...` is intentional to work around\n // a bug in the transpiled/minified output.\n // See https://github.com/GoogleChrome/workbox/issues/1186\n return yield new Promise(function (resolve, reject) {\n const reader = new FileReader();\n reader.onloadend = function () {\n return resolve(reader.result);\n };\n reader.onerror = function () {\n return reject(reader.error);\n };\n reader.readAsText(blob);\n });\n });\n\n return function getTextFromBlob(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * Creates the requestWillDequeue callback to be used with the background\n * sync queue plugin. The callback takes the failed request and adds the\n * `qt` param based on the current time, as well as applies any other\n * user-defined hit modifications.\n *\n * @param {Object} config See workbox.googleAnalytics.initialize.\n * @return {Function} The requestWillDequeu callback function.\n *\n * @private\n */\n const createRequestWillReplayCallback = config => {\n return (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (storableRequest) {\n let { url, requestInit, timestamp } = storableRequest;\n url = new URL(url);\n\n // Measurement protocol requests can set their payload parameters in either\n // the URL query string (for GET requests) or the POST body.\n let params;\n if (requestInit.body) {\n const payload = requestInit.body instanceof Blob ? yield getTextFromBlob(requestInit.body) : requestInit.body;\n\n params = new URLSearchParams(payload);\n } else {\n params = url.searchParams;\n }\n\n // Calculate the qt param, accounting for the fact that an existing\n // qt param may be present and should be updated rather than replaced.\n const originalHitTime = timestamp - (Number(params.get('qt')) || 0);\n const queueTime = Date.now() - originalHitTime;\n\n // Set the qt param prior to applying the hitFilter or parameterOverrides.\n params.set('qt', queueTime);\n\n if (config.parameterOverrides) {\n for (const param of Object.keys(config.parameterOverrides)) {\n const value = config.parameterOverrides[param];\n params.set(param, value);\n }\n }\n\n if (typeof config.hitFilter === 'function') {\n config.hitFilter.call(null, params);\n }\n\n requestInit.body = params.toString();\n requestInit.method = 'POST';\n requestInit.mode = 'cors';\n requestInit.credentials = 'omit';\n requestInit.headers = { 'Content-Type': 'text/plain' };\n\n // Ignore URL search params as they're now in the post body.\n storableRequest.url = `${url.origin}${url.pathname}`;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })();\n };\n\n /**\n * Creates GET and POST routes to catch failed Measurement Protocol hits.\n *\n * @param {Plugin} queuePlugin\n * @return {Array<Route>} The created routes.\n *\n * @private\n */\n const createCollectRoutes = queuePlugin => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);\n\n const handler = new NetworkOnly_mjs.NetworkOnly({\n plugins: [queuePlugin]\n });\n\n return [new Route_mjs.Route(match, handler, 'GET'), new Route_mjs.Route(match, handler, 'POST')];\n };\n\n /**\n * Creates a route with a network first strategy for the analytics.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createAnalyticsJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * Creates a route with a network first strategy for the gtag.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createGtagJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * @param {Object=} [options]\n * @param {Object} [options.cacheName] The cache name to store and retrieve\n * analytics.js. Defaults to the cache names provided by `workbox-core`.\n * @param {Object} [options.parameterOverrides]\n * [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),\n * expressed as key/value pairs, to be added to replayed Google Analytics\n * requests. This can be used to, e.g., set a custom dimension indicating\n * that the request was replayed.\n * @param {Function} [options.hitFilter] A function that allows you to modify\n * the hit parameters prior to replaying\n * the hit. The function is invoked with the original hit's URLSearchParams\n * object as its only argument.\n *\n * @memberof workbox.googleAnalytics\n */\n const initialize = (options = {}) => {\n const cacheName = cacheNames_mjs.cacheNames.getGoogleAnalyticsName(options.cacheName);\n\n const queuePlugin = new Plugin_mjs.Plugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n callbacks: {\n requestWillReplay: createRequestWillReplayCallback(options)\n }\n });\n\n const routes = [createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];\n\n const router = new Router_mjs.Router();\n for (const route of routes) {\n router.registerRoute(route);\n }\n\n self.addEventListener('fetch', evt => {\n const responsePromise = router.handleRequest(evt);\n if (responsePromise) {\n evt.respondWith(responsePromise);\n }\n });\n };\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.initialize = initialize;\n\n return exports;\n\n}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies));\n"],"file":"workbox-google-analytics.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.4.1"]=1}catch(e){}const l=/^\/(\w+\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get("qt"))||0),l=Date.now()-s;if(t.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method="POST",r.mode="cors",r.credentials="omit",r.headers={"Content-Type":"text/plain"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.google-analytics.com"===e.hostname&&"/analytics.js"===e.pathname,n,"GET")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(i),...(e=>{const n=({url:e})=>"www.google-analytics.com"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener("fetch",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
1
+ this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.6.2"]=1}catch(e){}const l=/^\/(\w+\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get("qt"))||0),l=Date.now()-s;if(t.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method="POST",r.mode="cors",r.credentials="omit",r.headers={"Content-Type":"text/plain"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.google-analytics.com"===e.hostname&&"/analytics.js"===e.pathname,n,"GET")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(i),...(e=>{const n=({url:e})=>"www.google-analytics.com"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener("fetch",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
2
2
 
3
3
  //# sourceMappingURL=workbox-google-analytics.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){\"use strict\";try{self.workbox.v[\"workbox:google-analytics:3.4.1\"]=1}catch(e){}const l=/^\\/(\\w+\\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get(\"qt\"))||0),l=Date.now()-s;if(t.set(\"qt\",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}\"function\"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method=\"POST\",r.mode=\"cors\",r.credentials=\"omit\",r.headers={\"Content-Type\":\"text/plain\"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin(\"workbox-google-analytics\",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.google-analytics.com\"===e.hostname&&\"/analytics.js\"===e.pathname,n,\"GET\")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.googletagmanager.com\"===e.hostname&&\"/gtag/js\"===e.pathname,n,\"GET\")})(i),...(e=>{const n=({url:e})=>\"www.google-analytics.com\"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,\"GET\"),new o.Route(n,t,\"POST\")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener(\"fetch\",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);\n"],"file":"workbox-google-analytics.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){\"use strict\";try{self.workbox.v[\"workbox:google-analytics:3.6.2\"]=1}catch(e){}const l=/^\\/(\\w+\\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get(\"qt\"))||0),l=Date.now()-s;if(t.set(\"qt\",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}\"function\"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method=\"POST\",r.mode=\"cors\",r.credentials=\"omit\",r.headers={\"Content-Type\":\"text/plain\"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin(\"workbox-google-analytics\",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.google-analytics.com\"===e.hostname&&\"/analytics.js\"===e.pathname,n,\"GET\")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.googletagmanager.com\"===e.hostname&&\"/gtag/js\"===e.pathname,n,\"GET\")})(i),...(e=>{const n=({url:e})=>\"www.google-analytics.com\"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,\"GET\"),new o.Route(n,t,\"POST\")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener(\"fetch\",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);\n"],"file":"workbox-google-analytics.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.navigationPreload = (function (exports,logger_mjs) {
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:navigation-preload:3.4.1'] = 1;
6
+ self.workbox.v['workbox:navigation-preload:3.6.2'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -48,6 +48,43 @@ this.workbox.navigationPreload = (function (exports,logger_mjs) {
48
48
  limitations under the License.
49
49
  */
50
50
 
51
+ /**
52
+ * If the browser supports Navigation Preload, then this will disable it.
53
+ *
54
+ * @memberof workbox.navigationPreload
55
+ */
56
+ function disable() {
57
+ if (isSupported()) {
58
+ self.addEventListener('activate', event => {
59
+ event.waitUntil(self.registration.navigationPreload.disable().then(() => {
60
+ {
61
+ logger_mjs.logger.log(`Navigation preload is disabled.`);
62
+ }
63
+ }));
64
+ });
65
+ } else {
66
+ {
67
+ logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
68
+ }
69
+ }
70
+ }
71
+
72
+ /*
73
+ Copyright 2017 Google Inc.
74
+
75
+ Licensed under the Apache License, Version 2.0 (the "License");
76
+ you may not use this file except in compliance with the License.
77
+ You may obtain a copy of the License at
78
+
79
+ https://www.apache.org/licenses/LICENSE-2.0
80
+
81
+ Unless required by applicable law or agreed to in writing, software
82
+ distributed under the License is distributed on an "AS IS" BASIS,
83
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84
+ See the License for the specific language governing permissions and
85
+ limitations under the License.
86
+ */
87
+
51
88
  /**
52
89
  * If the browser supports Navigation Preload, then this will enable it.
53
90
  *
@@ -111,6 +148,7 @@ this.workbox.navigationPreload = (function (exports,logger_mjs) {
111
148
  limitations under the License.
112
149
  */
113
150
 
151
+ exports.disable = disable;
114
152
  exports.enable = enable;
115
153
  exports.isSupported = isSupported;
116
154
 
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.navigationPreload = (function (exports,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:navigation-preload:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @return {boolean} Whether or not the current browser supports enabling\n * navigation preload.\n *\n * @memberof workbox.navigationPreload\n */\n function isSupported() {\n return Boolean(self.registration && self.registration.navigationPreload);\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will disable it.\n *\n * @memberof workbox.navigationPreload\n */\n function disable() {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.disable().then(() => {\n {\n logger_mjs.logger.log(`Navigation preload is disabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will enable it.\n *\n * @param {string} [headerValue] Optionally, allows developers to\n * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)\n * the value of the `Service-Worker-Navigation-Preload` header which will be\n * sent to the server when making the navigation request.\n *\n * @memberof workbox.navigationPreload\n */\n function enable(headerValue) {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.enable().then(() => {\n // Defaults to Service-Worker-Navigation-Preload: true if not set.\n if (headerValue) {\n self.registration.navigationPreload.setHeaderValue(headerValue);\n }\n\n {\n logger_mjs.logger.log(`Navigation preload is enabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.disable = disable;\n exports.enable = enable;\n exports.isSupported = isSupported;\n\n return exports;\n\n}({},workbox.core._private));\n"],"file":"workbox-navigation-preload.dev.js"}
@@ -0,0 +1,3 @@
1
+ this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){"use strict";try{self.workbox.v["workbox:navigation-preload:3.6.2"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});
2
+
3
+ //# sourceMappingURL=workbox-navigation-preload.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){\"use strict\";try{self.workbox.v[\"workbox:navigation-preload:3.6.2\"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener(\"activate\",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener(\"activate\",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});\n"],"file":"workbox-navigation-preload.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:precaching:3.4.1'] = 1;
6
+ self.workbox.v['workbox:precaching:3.6.2'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -573,23 +573,23 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
573
573
  * precaching assets.
574
574
  *
575
575
  * @param {Object} options
576
- * @param {boolean} options.suppressWarnings Suppress warning messages.
577
- * @param {Array<Object>} options.plugins Plugins to be used for fetching
578
- * and caching during install.
579
- * @return {
580
- * Promise<workbox.precaching.InstallResult>}
576
+ * @param {boolean} [options.suppressWarnings] Suppress warning messages.
577
+ * @param {Event} [options.event] The install event (if needed).
578
+ * @param {Array<Object>} [options.plugins] Plugins to be used for fetching
579
+ * and caching during install.
580
+ * @return {Promise<workbox.precaching.InstallResult>}
581
581
  */
582
- install(options = {}) {
582
+ install({ suppressWarnings = false, event, plugins } = {}) {
583
583
  var _this = this;
584
584
 
585
585
  return babelHelpers.asyncToGenerator(function* () {
586
586
  {
587
- if (options.suppressWarnings !== true) {
587
+ if (suppressWarnings !== true) {
588
588
  showWarningsIfNeeded(_this._entriesToCacheMap);
589
589
  }
590
590
 
591
- if (options.plugins) {
592
- assert_mjs.assert.isArray(options.plugins, {
591
+ if (plugins) {
592
+ assert_mjs.assert.isArray(plugins, {
593
593
  moduleName: 'workbox-precaching',
594
594
  className: 'PrecacheController',
595
595
  funcName: 'install',
@@ -623,7 +623,7 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
623
623
 
624
624
  // Wait for all requests to be cached.
625
625
  yield Promise.all(entriesToPrecache.map(function (precacheEntry) {
626
- return _this._cacheEntryInTemp(precacheEntry, options.plugins);
626
+ return _this._cacheEntryInTemp({ event, plugins, precacheEntry });
627
627
  }));
628
628
 
629
629
  {
@@ -660,7 +660,12 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
660
660
  // when done, to help avoid triggering quota errors.
661
661
  for (const request of requests) {
662
662
  const response = yield tempCache.match(request);
663
- yield cacheWrapper_mjs.cacheWrapper.put(_this2._cacheName, request, response, options.plugins);
663
+ yield cacheWrapper_mjs.cacheWrapper.put({
664
+ cacheName: _this2._cacheName,
665
+ request,
666
+ response,
667
+ plugins: options.plugins
668
+ });
664
669
  yield tempCache.delete(request);
665
670
  }
666
671
 
@@ -684,25 +689,38 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
684
689
  * is valid.
685
690
  *
686
691
  * @private
687
- * @param {BaseCacheEntry} precacheEntry The entry to fetch and cache.
688
- * @param {Array<Object>} plugins Array of plugins to apply to fetch and
689
- * caching.
692
+ * @param {Object} options
693
+ * @param {BaseCacheEntry} options.precacheEntry The entry to fetch and cache.
694
+ * @param {Event} [options.event] The install event (if passed).
695
+ * @param {Array<Object>} [options.plugins] An array of plugins to apply to
696
+ * fetch and caching.
690
697
  * @return {Promise<boolean>} Returns a promise that resolves once the entry
691
- * has been fetched and cached or skipped if no update is needed. The
692
- * promise resolves with true if the entry was cached / updated and
693
- * false if the entry is already cached and up-to-date.
698
+ * has been fetched and cached or skipped if no update is needed. The
699
+ * promise resolves with true if the entry was cached / updated and
700
+ * false if the entry is already cached and up-to-date.
694
701
  */
695
- _cacheEntryInTemp(precacheEntry, plugins) {
702
+ _cacheEntryInTemp({ precacheEntry, event, plugins }) {
696
703
  var _this3 = this;
697
704
 
698
705
  return babelHelpers.asyncToGenerator(function* () {
699
- let response = yield fetchWrapper_mjs.fetchWrapper.fetch(precacheEntry._networkRequest, null, plugins);
706
+ let response = yield fetchWrapper_mjs.fetchWrapper.fetch({
707
+ request: precacheEntry._networkRequest,
708
+ event,
709
+ fetchOptions: null,
710
+ plugins
711
+ });
700
712
 
701
713
  if (response.redirected) {
702
714
  response = yield cleanRedirect(response);
703
715
  }
704
716
 
705
- yield cacheWrapper_mjs.cacheWrapper.put(_this3._getTempCacheName(), precacheEntry._cacheRequest, response, plugins);
717
+ yield cacheWrapper_mjs.cacheWrapper.put({
718
+ cacheName: _this3._getTempCacheName(),
719
+ request: precacheEntry._cacheRequest,
720
+ response,
721
+ event,
722
+ plugins
723
+ });
706
724
 
707
725
  yield _this3._precacheDetailsModel._addEntry(precacheEntry);
708
726
 
@@ -989,12 +1007,14 @@ this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,Wor
989
1007
  installActivateListenersAdded = true;
990
1008
  self.addEventListener('install', event => {
991
1009
  event.waitUntil(precacheController.install({
992
- suppressWarnings,
993
- plugins
1010
+ event,
1011
+ plugins,
1012
+ suppressWarnings
994
1013
  }));
995
1014
  });
996
1015
  self.addEventListener('activate', event => {
997
1016
  event.waitUntil(precacheController.activate({
1017
+ event,
998
1018
  plugins
999
1019
  }));
1000
1020
  });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-precaching/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,WorkboxError_mjs,fetchWrapper_mjs,cacheWrapper_mjs,assert_mjs,getFriendlyURL_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:precaching:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Used as a consistent way of referencing a URL to precache.\n *\n * @private\n * @memberof module:workbox-precaching\n */\n class PrecacheEntry {\n /**\n * This class ensures all cache list entries are consistent and\n * adds cache busting if required.\n *\n * @param {*} originalInput\n * @param {string} url\n * @param {string} revision\n * @param {boolean} shouldCacheBust\n */\n constructor(originalInput, url, revision, shouldCacheBust) {\n this._originalInput = originalInput;\n this._entryId = url;\n this._revision = revision;\n const requestAsCacheKey = new Request(url, { credentials: 'same-origin' });\n this._cacheRequest = requestAsCacheKey;\n this._networkRequest = shouldCacheBust ? this._cacheBustRequest(requestAsCacheKey) : requestAsCacheKey;\n }\n\n /**\n * This method will either use Request.cache option OR append a cache\n * busting parameter to the URL.\n *\n * @param {Request} request The request to cache bust\n * @return {Request} A cachebusted Request\n *\n * @private\n */\n _cacheBustRequest(request) {\n let url = request.url;\n const requestOptions = {\n credentials: 'same-origin'\n };\n if ('cache' in Request.prototype) {\n // Make use of the Request cache mode where we can.\n // Reload skips the HTTP cache for outgoing requests and updates\n // the cache with the returned response.\n requestOptions.cache = 'reload';\n } else {\n const parsedURL = new URL(url, location);\n\n // This is done so the minifier can mangle 'global.encodeURIComponent'\n const _encodeURIComponent = encodeURIComponent;\n\n parsedURL.search += (parsedURL.search ? '&' : '') + _encodeURIComponent(`_workbox-cache-bust`) + '=' + _encodeURIComponent(this._revision);\n url = parsedURL.toString();\n }\n\n return new Request(url, requestOptions);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Allows minifier to mangle this name\n const REVISON_IDB_FIELD = 'revision';\n const URL_IDB_FIELD = 'url';\n const DB_STORE_NAME = 'precached-details-models';\n /**\n * This model will track the relevant information of entries that\n * are cached and their matching revision details.\n *\n * @private\n */\n class PrecachedDetailsModel {\n /**\n * Construct a new model for a specific cache.\n *\n * @param {string} dbName\n * @private\n */\n constructor(dbName) {\n // This ensures the db name contains only letters, numbers, '-', '_' and '$'\n const filteredDBName = dbName.replace(/[^\\w-]/g, '_');\n this._db = new DBWrapper_mjs.DBWrapper(filteredDBName, 2, {\n onupgradeneeded: this._handleUpgrade\n });\n }\n\n /**\n * Should perform an upgrade of indexedDB.\n *\n * @param {Event} evt\n *\n * @private\n */\n _handleUpgrade(evt) {\n const db = evt.target.result;\n if (evt.oldVersion < 2) {\n // IndexedDB version 1 used both 'workbox-precaching' and\n // 'precached-details-model' before upgrading to version 2.\n // Delete them and create a new store with latest schema.\n if (db.objectStoreNames.contains('workbox-precaching')) {\n db.deleteObjectStore('workbox-precaching');\n }\n if (db.objectStoreNames.contains(DB_STORE_NAME)) {\n db.deleteObjectStore(DB_STORE_NAME);\n }\n }\n db.createObjectStore(DB_STORE_NAME);\n }\n\n /**\n * Check if an entry is already cached. Returns false if\n * the entry isn't cached or the revision has changed.\n *\n * @param {string} cacheName\n * @param {PrecacheEntry} precacheEntry\n * @return {boolean}\n *\n * @private\n */\n _isEntryCached(cacheName, precacheEntry) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const revisionDetails = yield _this._getRevision(precacheEntry._entryId);\n if (revisionDetails !== precacheEntry._revision) {\n return false;\n }\n\n const openCache = yield caches.open(cacheName);\n const cachedResponse = yield openCache.match(precacheEntry._cacheRequest);\n return !!cachedResponse;\n })();\n }\n\n /**\n * @return {Promise<Array>}\n *\n * @private\n */\n _getAllEntries() {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._db.getAllMatching(DB_STORE_NAME, {\n includeKeys: true\n });\n })();\n }\n\n /**\n * Get the current revision details.\n *\n * @param {Object} entryId\n * @return {Promise<string|null>}\n *\n * @private\n */\n _getRevision(entryId) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const data = yield _this3._db.get(DB_STORE_NAME, entryId);\n return data ? data[REVISON_IDB_FIELD] : null;\n })();\n }\n\n /**\n * Add an entry to the details model.\n *\n * @param {PrecacheEntry} precacheEntry\n *\n * @private\n */\n _addEntry(precacheEntry) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this4._db.put(DB_STORE_NAME, {\n [REVISON_IDB_FIELD]: precacheEntry._revision,\n [URL_IDB_FIELD]: precacheEntry._cacheRequest.url\n }, precacheEntry._entryId);\n })();\n }\n\n /**\n * Delete entry from details model.\n *\n * @param {string} entryId\n *\n * @private\n */\n _deleteEntry(entryId) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._db.delete(DB_STORE_NAME, entryId);\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This method will print out a warning if a precache entry doesn't have\n * a `revision` value.\n *\n * This is common if the asset if revisioned in the url like `index.1234.css`.\n *\n * @param {Map} entriesMap\n *\n * @private\n * @memberof module:workbox-preaching\n */\n var showWarningsIfNeeded = (entriesMap => {\n const urlOnlyEntries = [];\n entriesMap.forEach(entry => {\n if (typeof entry === 'string' || !entry._originalInput.revision) {\n urlOnlyEntries.push(entry._originalInput);\n }\n });\n\n if (urlOnlyEntries.length === 0) {\n // No warnings needed.\n return;\n }\n\n logger_mjs.logger.groupCollapsed('Are your precached assets revisioned?');\n\n const urlsList = urlOnlyEntries.map(urlOnlyEntry => {\n return ` - ${JSON.stringify(urlOnlyEntry)}`;\n }).join(`\\n`);\n\n logger_mjs.logger.warn(`The following precache entries might not be revisioned:` + `\\n\\n` + urlsList + `\\n\\n`);\n\n logger_mjs.logger.unprefixed.warn(`You can learn more about why this might be a ` + `problem here: https://developers.google.com/web/tools/workbox/modules/workbox-precaching`);\n\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {string} groupTitle\n * @param {Array<PrecacheEntry>} entries\n *\n * @private\n */\n const _nestedGroup = (groupTitle, entries) => {\n if (entries.length === 0) {\n return;\n }\n\n logger_mjs.logger.groupCollapsed(groupTitle);\n\n entries.forEach(entry => {\n logger_mjs.logger.log(entry._originalInput);\n });\n\n logger_mjs.logger.groupEnd();\n };\n\n /**\n * @param {Array<Object>} entriesToPrecache\n * @param {Array<Object>} alreadyPrecachedEntries\n *\n * @private\n * @memberof module:workbox-precachig\n */\n var printInstallDetails = ((entriesToPrecache, alreadyPrecachedEntries) => {\n // Goal is to print the message:\n // Precaching X files.\n // Or:\n // Precaching X files. Y files were cached and up-to-date.\n\n const precachedCount = entriesToPrecache.length;\n const alreadyPrecachedCount = alreadyPrecachedEntries.length;\n let printText = `Precaching ${precachedCount} file${precachedCount === 1 ? '' : 's'}.`;\n if (alreadyPrecachedCount > 0) {\n printText += ` ${alreadyPrecachedCount} ` + `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;\n }\n\n logger_mjs.logger.groupCollapsed(printText);\n\n _nestedGroup(`View precached URLs.`, entriesToPrecache);\n _nestedGroup(`View URLs that were already precached.`, alreadyPrecachedEntries);\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const logGroup = (groupTitle, urls) => {\n logger_mjs.logger.groupCollapsed(groupTitle);\n\n urls.forEach(url => {\n logger_mjs.logger.log(url);\n });\n\n logger_mjs.logger.groupEnd();\n };\n\n /**\n * @param {Array<string>} deletedCacheRequests\n * @param {Array<string>} deletedRevisionDetails\n *\n * @private\n * @memberof module:workbox-precachig\n */\n var printCleanupDetails = ((deletedCacheRequests, deletedRevisionDetails) => {\n if (deletedCacheRequests.length === 0 && deletedRevisionDetails.length === 0) {\n return;\n }\n\n const cacheDeleteCount = deletedCacheRequests.length;\n const revisionDeleteCount = deletedRevisionDetails.length;\n\n const cacheDeleteText = `${cacheDeleteCount} cached ` + `request${cacheDeleteCount === 1 ? ' was' : 's were'} deleted`;\n const revisionDeleteText = `${revisionDeleteCount} ` + `${revisionDeleteCount === 1 ? 'entry' : 'entries'} ` + `${revisionDeleteCount === 1 ? 'was' : 'were'} deleted from IndexedDB.`;\n\n logger_mjs.logger.groupCollapsed(`During precaching cleanup, ${cacheDeleteText} and ${revisionDeleteText}`);\n\n logGroup('Deleted Cache Requests', deletedCacheRequests);\n logGroup('Revision Details Deleted from DB', deletedRevisionDetails);\n\n logger_mjs.logger.groupEnd();\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {Response} response\n * @return {Response}\n *\n * @private\n * @memberof module:workbox-precachig\n */\n const cleanRedirect = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (response) {\n const clonedResponse = response.clone();\n\n // Not all browsers support the Response.body stream, so fall back\n // to reading the entire body into memory as a blob.\n const bodyPromise = 'body' in clonedResponse ? Promise.resolve(clonedResponse.body) : clonedResponse.blob();\n\n const body = yield bodyPromise;\n\n // new Response() is happy when passed either a stream or a Blob.\n return new Response(body, ['headers', 'status', 'statusText'].map(function (key) {\n return clonedResponse[key];\n }));\n });\n\n return function cleanRedirect(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Performs efficient precaching of assets.\n *\n * @memberof workbox.precaching\n */\n class PrecacheController {\n /**\n * Create a new PrecacheController.\n *\n * @param {string} cacheName\n */\n constructor(cacheName) {\n this._cacheName = cacheNames_mjs.cacheNames.getPrecacheName(cacheName);\n this._entriesToCacheMap = new Map();\n this._precacheDetailsModel = new PrecachedDetailsModel(this._cacheName);\n }\n\n /**\n * This method will add items to the precache list, removing duplicates\n * and ensuring the information is valid.\n *\n * @param {\n * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>\n * } entries Array of entries to\n * precache.\n */\n addToCacheList(entries) {\n {\n assert_mjs.assert.isArray(entries, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'addToCacheList',\n paramName: 'entries'\n });\n }\n\n entries.map(userEntry => {\n this._addEntryToCacheList(this._parseEntry(userEntry));\n });\n }\n\n /**\n * This method returns a precache entry.\n *\n * @private\n * @param {string|Object} input\n * @return {PrecacheEntry}\n */\n _parseEntry(input) {\n switch (typeof input) {\n case 'string':\n {\n {\n if (input.length === 0) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n return new PrecacheEntry(input, input, input);\n }\n case 'object':\n {\n {\n if (!input || !input.url) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n return new PrecacheEntry(input, input.url, input.revision || input.url, !!input.revision);\n }\n default:\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {\n entry: input\n });\n }\n }\n\n /**\n * Adds an entry to the precache list, accounting for possible duplicates.\n *\n * @private\n * @param {PrecacheEntry} entryToAdd\n */\n _addEntryToCacheList(entryToAdd) {\n // Check if the entry is already part of the map\n const existingEntry = this._entriesToCacheMap.get(entryToAdd._entryId);\n if (!existingEntry) {\n this._entriesToCacheMap.set(entryToAdd._entryId, entryToAdd);\n return;\n }\n\n // Duplicates are fine, but make sure the revision information\n // is the same.\n if (existingEntry._revision !== entryToAdd._revision) {\n throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-conflicting-entries', {\n firstEntry: existingEntry._originalInput,\n secondEntry: entryToAdd._originalInput\n });\n }\n }\n\n /**\n * Call this method from a service work install event to start\n * precaching assets.\n *\n * @param {Object} options\n * @param {boolean} [options.suppressWarnings] Suppress warning messages.\n * @param {Event} [options.event] The install event (if needed).\n * @param {Array<Object>} [options.plugins] Plugins to be used for fetching\n * and caching during install.\n * @return {Promise<workbox.precaching.InstallResult>}\n */\n install({ suppressWarnings = false, event, plugins } = {}) {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n {\n if (suppressWarnings !== true) {\n showWarningsIfNeeded(_this._entriesToCacheMap);\n }\n\n if (plugins) {\n assert_mjs.assert.isArray(plugins, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'install',\n paramName: 'plugins'\n });\n }\n }\n\n // Empty the temporary cache.\n // NOTE: We remove all entries instead of deleting the cache as the cache\n // may be marked for deletion but still exist until a later stage\n // resulting in unexpected behavior of being deletect when all references\n // are dropped.\n // https://github.com/GoogleChrome/workbox/issues/1368\n const tempCache = yield caches.open(_this._getTempCacheName());\n const requests = yield tempCache.keys();\n yield Promise.all(requests.map(function (request) {\n return tempCache.delete(request);\n }));\n\n const entriesToPrecache = [];\n const entriesAlreadyPrecached = [];\n\n for (const precacheEntry of _this._entriesToCacheMap.values()) {\n if (yield _this._precacheDetailsModel._isEntryCached(_this._cacheName, precacheEntry)) {\n entriesAlreadyPrecached.push(precacheEntry);\n } else {\n entriesToPrecache.push(precacheEntry);\n }\n }\n\n // Wait for all requests to be cached.\n yield Promise.all(entriesToPrecache.map(function (precacheEntry) {\n return _this._cacheEntryInTemp({ event, plugins, precacheEntry });\n }));\n\n {\n printInstallDetails(entriesToPrecache, entriesAlreadyPrecached);\n }\n\n return {\n updatedEntries: entriesToPrecache,\n notUpdatedEntries: entriesAlreadyPrecached\n };\n })();\n }\n\n /**\n * Takes the current set of temporary files and moves them to the final\n * cache, deleting the temporary cache once copying is complete.\n *\n * @param {Object} options\n * @param {Array<Object>} options.plugins Plugins to be used for fetching\n * and caching during install.\n * @return {\n * Promise<workbox.precaching.CleanupResult>}\n * Resolves with an object containing details of the deleted cache requests\n * and precache revision details.\n */\n activate(options = {}) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const tempCache = yield caches.open(_this2._getTempCacheName());\n\n const requests = yield tempCache.keys();\n // Process each request/response one at a time, deleting the temporary entry\n // when done, to help avoid triggering quota errors.\n for (const request of requests) {\n const response = yield tempCache.match(request);\n yield cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this2._cacheName,\n request,\n response,\n plugins: options.plugins\n });\n yield tempCache.delete(request);\n }\n\n return _this2._cleanup();\n })();\n }\n\n /**\n * Returns the name of the temporary cache.\n *\n * @return {string}\n *\n * @private\n */\n _getTempCacheName() {\n return `${this._cacheName}-temp`;\n }\n\n /**\n * Requests the entry and saves it to the cache if the response\n * is valid.\n *\n * @private\n * @param {Object} options\n * @param {BaseCacheEntry} options.precacheEntry The entry to fetch and cache.\n * @param {Event} [options.event] The install event (if passed).\n * @param {Array<Object>} [options.plugins] An array of plugins to apply to\n * fetch and caching.\n * @return {Promise<boolean>} Returns a promise that resolves once the entry\n * has been fetched and cached or skipped if no update is needed. The\n * promise resolves with true if the entry was cached / updated and\n * false if the entry is already cached and up-to-date.\n */\n _cacheEntryInTemp({ precacheEntry, event, plugins }) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n let response = yield fetchWrapper_mjs.fetchWrapper.fetch({\n request: precacheEntry._networkRequest,\n event,\n fetchOptions: null,\n plugins\n });\n\n if (response.redirected) {\n response = yield cleanRedirect(response);\n }\n\n yield cacheWrapper_mjs.cacheWrapper.put({\n cacheName: _this3._getTempCacheName(),\n request: precacheEntry._cacheRequest,\n response,\n event,\n plugins\n });\n\n yield _this3._precacheDetailsModel._addEntry(precacheEntry);\n\n return true;\n })();\n }\n\n /**\n * Compare the URLs and determines which assets are no longer required\n * in the cache.\n *\n * This should be called in the service worker activate event.\n *\n * @return {\n * Promise<workbox.precaching.CleanupResult>}\n * Resolves with an object containing details of the deleted cache requests\n * and precache revision details.\n *\n * @private\n */\n _cleanup() {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const expectedCacheUrls = [];\n _this4._entriesToCacheMap.forEach(function (entry) {\n const fullUrl = new URL(entry._cacheRequest.url, location).toString();\n expectedCacheUrls.push(fullUrl);\n });\n\n const [deletedCacheRequests, deletedRevisionDetails] = yield Promise.all([_this4._cleanupCache(expectedCacheUrls), _this4._cleanupDetailsModel(expectedCacheUrls)]);\n\n {\n printCleanupDetails(deletedCacheRequests, deletedRevisionDetails);\n }\n\n return {\n deletedCacheRequests,\n deletedRevisionDetails\n };\n })();\n }\n\n /**\n * Goes through all the cache entries and removes any that are\n * outdated.\n *\n * @private\n * @param {Array<string>} expectedCacheUrls Array of URLs that are\n * expected to be cached.\n * @return {Promise<Array<string>>} Resolves to an array of URLs\n * of cached requests that were deleted.\n */\n _cleanupCache(expectedCacheUrls) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (!(yield caches.has(_this5._cacheName))) {\n // Cache doesn't exist, so nothing to delete\n return [];\n }\n\n const cache = yield caches.open(_this5._cacheName);\n const cachedRequests = yield cache.keys();\n const cachedRequestsToDelete = cachedRequests.filter(function (cachedRequest) {\n return !expectedCacheUrls.includes(new URL(cachedRequest.url, location).toString());\n });\n\n yield Promise.all(cachedRequestsToDelete.map(function (cacheUrl) {\n return cache.delete(cacheUrl);\n }));\n\n return cachedRequestsToDelete.map(function (request) {\n return request.url;\n });\n })();\n }\n\n /**\n * Goes through all entries in indexedDB and removes any that are outdated.\n *\n * @private\n * @param {Array<string>} expectedCacheUrls Array of URLs that are\n * expected to be cached.\n * @return {Promise<Array<string>>} Resolves to an array of URLs removed\n * from indexedDB.\n */\n _cleanupDetailsModel(expectedCacheUrls) {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n const revisionedEntries = yield _this6._precacheDetailsModel._getAllEntries();\n const detailsToDelete = revisionedEntries.filter(function (entry) {\n const fullUrl = new URL(entry.value.url, location).toString();\n return !expectedCacheUrls.includes(fullUrl);\n });\n\n yield Promise.all(detailsToDelete.map(function (entry) {\n return _this6._precacheDetailsModel._deleteEntry(entry.primaryKey);\n }));\n return detailsToDelete.map(function (entry) {\n return entry.value.url;\n });\n })();\n }\n\n /**\n * Returns an array of fully qualified URL's that will be precached.\n *\n * @return {Array<string>} An array of URLs.\n */\n getCachedUrls() {\n return Array.from(this._entriesToCacheMap.keys()).map(url => new URL(url, location).href);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n PrecacheController: PrecacheController\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n {\n assert_mjs.assert.isSwEnv('workbox-precaching');\n }\n\n let installActivateListenersAdded = false;\n let fetchListenersAdded = false;\n let suppressWarnings = false;\n let plugins = [];\n\n const cacheName = cacheNames_mjs.cacheNames.getPrecacheName();\n const precacheController = new PrecacheController(cacheName);\n\n const _removeIgnoreUrlParams = (origUrlObject, ignoreUrlParametersMatching) => {\n // Exclude initial '?'\n const searchString = origUrlObject.search.slice(1);\n\n // Split into an array of 'key=value' strings\n const keyValueStrings = searchString.split('&');\n const keyValuePairs = keyValueStrings.map(keyValueString => {\n // Split each 'key=value' string into a [key, value] array\n return keyValueString.split('=');\n });\n const filteredKeyValuesPairs = keyValuePairs.filter(keyValuePair => {\n return ignoreUrlParametersMatching.every(ignoredRegex => {\n // Return true iff the key doesn't match any of the regexes.\n return !ignoredRegex.test(keyValuePair[0]);\n });\n });\n const filteredStrings = filteredKeyValuesPairs.map(keyValuePair => {\n // Join each [key, value] array into a 'key=value' string\n return keyValuePair.join('=');\n });\n\n // Join the array of 'key=value' strings into a string with '&' in\n // between each\n const urlClone = new URL(origUrlObject);\n urlClone.search = filteredStrings.join('&');\n return urlClone;\n };\n\n /**\n * This function will take the request URL and manipulate it based on the\n * configuration options.\n *\n * @param {string} url\n * @param {Object} options\n * @return {string|null} Returns the URL in the cache that matches the request\n * if available, other null.\n *\n * @private\n */\n const _getPrecachedUrl = (url, {\n ignoreUrlParametersMatching = [/^utm_/],\n directoryIndex = 'index.html',\n cleanUrls = true,\n urlManipulation = null\n } = {}) => {\n const urlObject = new URL(url, location);\n\n // Change '/some-url#123' => '/some-url'\n urlObject.hash = '';\n\n const urlWithoutIgnoredParams = _removeIgnoreUrlParams(urlObject, ignoreUrlParametersMatching);\n\n let urlsToAttempt = [\n // Test the URL that was fetched\n urlObject,\n // Test the URL without search params\n urlWithoutIgnoredParams];\n\n // Test the URL with a directory index\n if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {\n const directoryUrl = new URL(urlWithoutIgnoredParams);\n directoryUrl.pathname += directoryIndex;\n urlsToAttempt.push(directoryUrl);\n }\n\n // Test the URL with a '.html' extension\n if (cleanUrls) {\n const cleanUrl = new URL(urlWithoutIgnoredParams);\n cleanUrl.pathname += '.html';\n urlsToAttempt.push(cleanUrl);\n }\n\n if (urlManipulation) {\n const additionalUrls = urlManipulation({ url: urlObject });\n urlsToAttempt = urlsToAttempt.concat(additionalUrls);\n }\n\n const cachedUrls = precacheController.getCachedUrls();\n for (const possibleUrl of urlsToAttempt) {\n if (cachedUrls.indexOf(possibleUrl.href) !== -1) {\n // It's a perfect match\n {\n logger_mjs.logger.debug(`Precaching found a match for ` + getFriendlyURL_mjs.getFriendlyURL(possibleUrl.toString()));\n }\n return possibleUrl.href;\n }\n }\n\n return null;\n };\n\n const moduleExports = {};\n\n /**\n * Add items to the precache list, removing any duplicates and\n * store the files in the\n * [\"precache cache\"]{@link module:workbox-core.cacheNames} when the service\n * worker installs.\n *\n * This method can be called multiple times.\n *\n * Please note: This method **will not** serve any of the cached files for you,\n * it only precaches files. To respond to a network request you call\n * [addRoute()]{@link module:workbox-precaching.addRoute}.\n *\n * If you have a single array of files to precache, you can just call\n * [precacheAndRoute()]{@link module:workbox-precaching.precacheAndRoute}.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n *\n * @alias workbox.precaching.precache\n */\n moduleExports.precache = entries => {\n precacheController.addToCacheList(entries);\n\n if (installActivateListenersAdded || entries.length <= 0) {\n return;\n }\n\n installActivateListenersAdded = true;\n self.addEventListener('install', event => {\n event.waitUntil(precacheController.install({\n event,\n plugins,\n suppressWarnings\n }));\n });\n self.addEventListener('activate', event => {\n event.waitUntil(precacheController.activate({\n event,\n plugins\n }));\n });\n };\n\n /**\n * Add a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * @param {Object} options\n * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n * check cache entries for a URLs ending with '/' to see if there is a hit when\n * appending the `directoryIndex` value.\n * @param {Array<RegExp>} [options.ignoreUrlParametersMatching=[/^utm_/]] An\n * array of regex's to remove search params when looking for a cache match.\n * @param {boolean} [options.cleanUrls=true] The `cleanUrls` option will\n * check the cache for the URL with a `.html` added to the end of the end.\n * @param {workbox.precaching~urlManipulation} [options.urlManipulation]\n * This is a function that should take a URL and return an array of\n * alternative URL's that should be checked for precache matches.\n *\n * @alias workbox.precaching.addRoute\n */\n moduleExports.addRoute = options => {\n if (fetchListenersAdded) {\n // TODO: Throw error here.\n return;\n }\n\n fetchListenersAdded = true;\n self.addEventListener('fetch', event => {\n const precachedUrl = _getPrecachedUrl(event.request.url, options);\n if (!precachedUrl) {\n {\n logger_mjs.logger.debug(`Precaching found no match for ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));\n }\n return;\n }\n\n let responsePromise = caches.open(cacheName).then(cache => {\n return cache.match(precachedUrl);\n }).then(cachedResponse => {\n if (cachedResponse) {\n return cachedResponse;\n }\n\n // Fall back to the network if we don't have a cached response (perhaps\n // due to manual cache cleanup).\n {\n logger_mjs.logger.debug(`The precached response for ` + `${getFriendlyURL_mjs.getFriendlyURL(precachedUrl)} in ${cacheName} was not found. ` + `Falling back to the network instead.`);\n }\n\n return fetch(precachedUrl);\n });\n\n {\n responsePromise = responsePromise.then(response => {\n // Workbox is going to handle the route.\n // print the routing details to the console.\n logger_mjs.logger.groupCollapsed(`Precaching is responding to: ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));\n logger_mjs.logger.log(`Serving the precached url: ${precachedUrl}`);\n\n // The Request and Response objects contains a great deal of\n // information, hide it under a group in case developers want to see it.\n logger_mjs.logger.groupCollapsed(`View request details here.`);\n logger_mjs.logger.unprefixed.log(event.request);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupCollapsed(`View response details here.`);\n logger_mjs.logger.unprefixed.log(response);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n return response;\n });\n }\n event.respondWith(responsePromise);\n });\n };\n\n /**\n * This method will add entries to the precache list and add a route to\n * respond to fetch events.\n *\n * This is a convenience method that will call\n * [precache()]{@link module:workbox-precaching.precache} and\n * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n * @param {Object} options See\n * [addRoute() options]{@link module:workbox-precaching.addRoute}.\n *\n * @alias workbox.precaching.precacheAndRoute\n */\n moduleExports.precacheAndRoute = (entries, options) => {\n moduleExports.precache(entries);\n moduleExports.addRoute(options);\n };\n\n /**\n * Warnings will be logged if any of the precached assets are entered without\n * a `revision` property. This is extremely dangerous if the URL's aren't\n * revisioned. However, the warnings can be supressed with this method.\n *\n * @param {boolean} suppress\n *\n * @alias workbox.precaching.suppressWarnings\n */\n moduleExports.suppressWarnings = suppress => {\n suppressWarnings = suppress;\n };\n\n /**\n * Add plugins to precaching.\n *\n * @param {Array<Object>} newPlugins\n *\n * @alias workbox.precaching.addPlugins\n */\n moduleExports.addPlugins = newPlugins => {\n plugins = plugins.concat(newPlugins);\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(moduleExports, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-precaching.dev.js"}
@@ -0,0 +1,3 @@
1
+ this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){"use strict";try{self.workbox.v["workbox:precaching:3.6.2"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t,{credentials:"same-origin"});this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={credentials:"same-origin"};if("cache"in Request.prototype)n.cache="reload";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?"&":"")+n("_workbox-cache-bust")+"="+n(this.n),t=e.toString()}return new Request(t,n)}}const c="revision",o="url",l="precached-details-models";class a{constructor(t){const n=t.replace(/[^\w-]/g,"_");this.c=new e.DBWrapper(n,2,{onupgradeneeded:this.o})}o(e){const t=e.target.result;e.oldVersion<2&&(t.objectStoreNames.contains("workbox-precaching")&&t.deleteObjectStore("workbox-precaching"),t.objectStoreNames.contains(l)&&t.deleteObjectStore(l)),t.createObjectStore(l)}l(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return(yield n.a(t.t))===t.n&&!!(yield(yield caches.open(e)).match(t.r))})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.c.getAllMatching(l,{includeKeys:!0})})()}a(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.c.get(l,e);return n?n[c]:null})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.put(l,{[c]:e.n,[o]:e.r.url},e.t)})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.delete(l,e)})()}}const u=(d=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield"body"in t?Promise.resolve(t.body):t.blob();return new Response(n,["headers","status","statusText"].map(function(e){return t[e]}))}),function(e){return d.apply(this,arguments)});var d;class h{constructor(e){this.p=t.cacheNames.getPrecacheName(e),this.f=new Map,this.y=new a(this.p)}addToCacheList(e){e.map(e=>{this.b(this.w(e))})}w(e){switch(typeof e){case"string":return new i(e,e,e);case"object":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new n.WorkboxError("add-to-cache-list-unexpected-type",{entry:e})}}b(e){const t=this.f.get(e.t);if(t){if(t.n!==e.n)throw new n.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:t.e,secondEntry:e.e})}else this.f.set(e.t,e)}install({suppressWarnings:e=!1,event:t,plugins:n}={}){var r=this;return babelHelpers.asyncToGenerator(function*(){const e=yield caches.open(r.g()),s=yield e.keys();yield Promise.all(s.map(function(t){return e.delete(t)}));const i=[],c=[];for(const e of r.f.values())(yield r.y.l(r.p,e))?c.push(e):i.push(e);return yield Promise.all(i.map(function(e){return r.m({event:t,plugins:n,precacheEntry:e})})),{updatedEntries:i,notUpdatedEntries:c}})()}activate(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();for(const i of r){const r=yield n.match(i);yield s.cacheWrapper.put({cacheName:t.p,request:i,response:r,plugins:e.plugins}),yield n.delete(i)}return t.R()})()}g(){return`${this.p}-temp`}m({precacheEntry:e,event:t,plugins:n}){var i=this;return babelHelpers.asyncToGenerator(function*(){let c=yield r.fetchWrapper.fetch({request:e.s,event:t,fetchOptions:null,plugins:n});return c.redirected&&(c=yield u(c)),yield s.cacheWrapper.put({cacheName:i.g(),request:e.r,response:c,event:t,plugins:n}),yield i.y.d(e),!0})()}R(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.f.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e._(t),e.U(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.p)))return[];const n=yield caches.open(t.p),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}U(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=(yield t.y.u()).filter(function(t){const n=new URL(t.value.url,location).toString();return!e.includes(n)});return yield Promise.all(n.map(function(e){return t.y.h(e.primaryKey)})),n.map(function(e){return e.value.url})})()}getCachedUrls(){return Array.from(this.f.keys()).map(e=>new URL(e,location).href)}}var p=Object.freeze({PrecacheController:h});let f=!1,y=!1,b=!1,w=[];const g=t.cacheNames.getPrecacheName(),v=new h(g),m=(e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n="index.html",cleanUrls:r=!0,urlManipulation:s=null}={})=>{const i=new URL(e,location);i.hash="";const c=((e,t)=>{const n=e.search.slice(1).split("&").map(e=>e.split("=")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join("=")),r=new URL(e);return r.search=n.join("&"),r})(i,t);let o=[i,c];if(n&&c.pathname.endsWith("/")){const e=new URL(c);e.pathname+=n,o.push(e)}if(r){const e=new URL(c);e.pathname+=".html",o.push(e)}if(s){const e=s({url:i});o=o.concat(e)}const l=v.getCachedUrls();for(const e of o)if(-1!==l.indexOf(e.href))return e.href;return null},R={precache:e=>{v.addToCacheList(e),f||e.length<=0||(f=!0,self.addEventListener("install",e=>{e.waitUntil(v.install({event:e,plugins:w,suppressWarnings:b}))}),self.addEventListener("activate",e=>{e.waitUntil(v.activate({event:e,plugins:w}))}))},addRoute:e=>{y||(y=!0,self.addEventListener("fetch",t=>{const n=m(t.request.url,e);if(!n)return;let r=caches.open(g).then(e=>e.match(n)).then(e=>e||fetch(n));t.respondWith(r)}))},precacheAndRoute:(e,t)=>{R.precache(e),R.addRoute(t)},suppressWarnings:e=>{b=e},addPlugins:e=>{w=w.concat(e)}};return Object.assign(R,p)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
2
+
3
+ //# sourceMappingURL=workbox-precaching.prod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-precaching/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.precaching=function(e,t,n,r,s){\"use strict\";try{self.workbox.v[\"workbox:precaching:3.6.2\"]=1}catch(e){}class i{constructor(e,t,n,r){this.e=e,this.t=t,this.n=n;const s=new Request(t,{credentials:\"same-origin\"});this.r=s,this.s=r?this.i(s):s}i(e){let t=e.url;const n={credentials:\"same-origin\"};if(\"cache\"in Request.prototype)n.cache=\"reload\";else{const e=new URL(t,location),n=encodeURIComponent;e.search+=(e.search?\"&\":\"\")+n(\"_workbox-cache-bust\")+\"=\"+n(this.n),t=e.toString()}return new Request(t,n)}}const c=\"revision\",o=\"url\",l=\"precached-details-models\";class a{constructor(t){const n=t.replace(/[^\\w-]/g,\"_\");this.c=new e.DBWrapper(n,2,{onupgradeneeded:this.o})}o(e){const t=e.target.result;e.oldVersion<2&&(t.objectStoreNames.contains(\"workbox-precaching\")&&t.deleteObjectStore(\"workbox-precaching\"),t.objectStoreNames.contains(l)&&t.deleteObjectStore(l)),t.createObjectStore(l)}l(e,t){var n=this;return babelHelpers.asyncToGenerator(function*(){return(yield n.a(t.t))===t.n&&!!(yield(yield caches.open(e)).match(t.r))})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.c.getAllMatching(l,{includeKeys:!0})})()}a(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield t.c.get(l,e);return n?n[c]:null})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.put(l,{[c]:e.n,[o]:e.r.url},e.t)})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.c.delete(l,e)})()}}const u=(d=babelHelpers.asyncToGenerator(function*(e){const t=e.clone(),n=yield\"body\"in t?Promise.resolve(t.body):t.blob();return new Response(n,[\"headers\",\"status\",\"statusText\"].map(function(e){return t[e]}))}),function(e){return d.apply(this,arguments)});var d;class h{constructor(e){this.p=t.cacheNames.getPrecacheName(e),this.f=new Map,this.y=new a(this.p)}addToCacheList(e){e.map(e=>{this.b(this.w(e))})}w(e){switch(typeof e){case\"string\":return new i(e,e,e);case\"object\":return new i(e,e.url,e.revision||e.url,!!e.revision);default:throw new n.WorkboxError(\"add-to-cache-list-unexpected-type\",{entry:e})}}b(e){const t=this.f.get(e.t);if(t){if(t.n!==e.n)throw new n.WorkboxError(\"add-to-cache-list-conflicting-entries\",{firstEntry:t.e,secondEntry:e.e})}else this.f.set(e.t,e)}install({suppressWarnings:e=!1,event:t,plugins:n}={}){var r=this;return babelHelpers.asyncToGenerator(function*(){const e=yield caches.open(r.g()),s=yield e.keys();yield Promise.all(s.map(function(t){return e.delete(t)}));const i=[],c=[];for(const e of r.f.values())(yield r.y.l(r.p,e))?c.push(e):i.push(e);return yield Promise.all(i.map(function(e){return r.m({event:t,plugins:n,precacheEntry:e})})),{updatedEntries:i,notUpdatedEntries:c}})()}activate(e={}){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=yield caches.open(t.g()),r=yield n.keys();for(const i of r){const r=yield n.match(i);yield s.cacheWrapper.put({cacheName:t.p,request:i,response:r,plugins:e.plugins}),yield n.delete(i)}return t.R()})()}g(){return`${this.p}-temp`}m({precacheEntry:e,event:t,plugins:n}){var i=this;return babelHelpers.asyncToGenerator(function*(){let c=yield r.fetchWrapper.fetch({request:e.s,event:t,fetchOptions:null,plugins:n});return c.redirected&&(c=yield u(c)),yield s.cacheWrapper.put({cacheName:i.g(),request:e.r,response:c,event:t,plugins:n}),yield i.y.d(e),!0})()}R(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];e.f.forEach(function(e){const n=new URL(e.r.url,location).toString();t.push(n)});const[n,r]=yield Promise.all([e._(t),e.U(t)]);return{deletedCacheRequests:n,deletedRevisionDetails:r}})()}_(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!(yield caches.has(t.p)))return[];const n=yield caches.open(t.p),r=(yield n.keys()).filter(function(t){return!e.includes(new URL(t.url,location).toString())});return yield Promise.all(r.map(function(e){return n.delete(e)})),r.map(function(e){return e.url})})()}U(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const n=(yield t.y.u()).filter(function(t){const n=new URL(t.value.url,location).toString();return!e.includes(n)});return yield Promise.all(n.map(function(e){return t.y.h(e.primaryKey)})),n.map(function(e){return e.value.url})})()}getCachedUrls(){return Array.from(this.f.keys()).map(e=>new URL(e,location).href)}}var p=Object.freeze({PrecacheController:h});let f=!1,y=!1,b=!1,w=[];const g=t.cacheNames.getPrecacheName(),v=new h(g),m=(e,{ignoreUrlParametersMatching:t=[/^utm_/],directoryIndex:n=\"index.html\",cleanUrls:r=!0,urlManipulation:s=null}={})=>{const i=new URL(e,location);i.hash=\"\";const c=((e,t)=>{const n=e.search.slice(1).split(\"&\").map(e=>e.split(\"=\")).filter(e=>t.every(t=>!t.test(e[0]))).map(e=>e.join(\"=\")),r=new URL(e);return r.search=n.join(\"&\"),r})(i,t);let o=[i,c];if(n&&c.pathname.endsWith(\"/\")){const e=new URL(c);e.pathname+=n,o.push(e)}if(r){const e=new URL(c);e.pathname+=\".html\",o.push(e)}if(s){const e=s({url:i});o=o.concat(e)}const l=v.getCachedUrls();for(const e of o)if(-1!==l.indexOf(e.href))return e.href;return null},R={precache:e=>{v.addToCacheList(e),f||e.length<=0||(f=!0,self.addEventListener(\"install\",e=>{e.waitUntil(v.install({event:e,plugins:w,suppressWarnings:b}))}),self.addEventListener(\"activate\",e=>{e.waitUntil(v.activate({event:e,plugins:w}))}))},addRoute:e=>{y||(y=!0,self.addEventListener(\"fetch\",t=>{const n=m(t.request.url,e);if(!n)return;let r=caches.open(g).then(e=>e.match(n)).then(e=>e||fetch(n));t.respondWith(r)}))},precacheAndRoute:(e,t)=>{R.precache(e),R.addRoute(t)},suppressWarnings:e=>{b=e},addPlugins:e=>{w=w.concat(e)}};return Object.assign(R,p)}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);\n"],"file":"workbox-precaching.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.rangeRequests = (function (exports,WorkboxError_mjs,assert_mjs,logg
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:range-requests:3.4.1'] = 1;
6
+ self.workbox.v['workbox:range-requests:3.6.2'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.rangeRequests = (function (exports,WorkboxError_mjs,assert_mjs,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:range-requests:3.4.1'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {Blob} blob A source blob.\n * @param {number|null} start The offset to use as the start of the\n * slice.\n * @param {number|null} end The offset to use as the end of the slice.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the effective boundaries to use given the size of the blob.\n *\n * @private\n */\n function calculateEffectiveBoundaries(blob, start, end) {\n {\n assert_mjs.assert.isInstance(blob, Blob, {\n moduleName: 'workbox-range-requests',\n funcName: 'calculateEffectiveBoundaries',\n paramName: 'blob'\n });\n }\n\n const blobSize = blob.size;\n\n if (end > blobSize || start < 0) {\n throw new WorkboxError_mjs.WorkboxError('range-not-satisfiable', {\n size: blobSize,\n end,\n start\n });\n }\n\n let effectiveStart;\n let effectiveEnd;\n\n if (start === null) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n } else if (end === null) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n } else {\n effectiveStart = start;\n // Range values are inclusive, so add 1 to the value.\n effectiveEnd = end + 1;\n }\n\n return {\n start: effectiveStart,\n end: effectiveEnd\n };\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {string} rangeHeader A Range: header value.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the parsed value of the Range: header. If either the `start` or `end` are\n * omitted, then `null` will be returned.\n *\n * @private\n */\n function parseRangeHeader(rangeHeader) {\n {\n assert_mjs.assert.isType(rangeHeader, 'string', {\n moduleName: 'workbox-range-requests',\n funcName: 'parseRangeHeader',\n paramName: 'rangeHeader'\n });\n }\n\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith('bytes=')) {\n throw new WorkboxError_mjs.WorkboxError('unit-must-be-bytes', { normalizedRangeHeader });\n }\n\n // Specifying multiple ranges separate by commas is valid syntax, but this\n // library only attempts to handle a single, contiguous sequence of bytes.\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax\n if (normalizedRangeHeader.includes(',')) {\n throw new WorkboxError_mjs.WorkboxError('single-range-only', { normalizedRangeHeader });\n }\n\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n // We need either at least one of the start or end values.\n if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {\n throw new WorkboxError_mjs.WorkboxError('invalid-range-values', { normalizedRangeHeader });\n }\n\n return {\n start: rangeParts[1] === '' ? null : Number(rangeParts[1]),\n end: rangeParts[2] === '' ? null : Number(rangeParts[2])\n };\n }\n\n /**\n * Given a `Request` and `Response` objects as input, this will return a\n * promise for a new `Response`.\n *\n * @param {Request} request A request, which should contain a Range:\n * header.\n * @param {Response} originalResponse An original response containing the full\n * content.\n * @return {Promise<Response>} Either a `206 Partial Content` response, with\n * the response body set to the slice of content specified by the request's\n * `Range:` header, or a `416 Range Not Satisfiable` response if the\n * conditions of the `Range:` header can't be met.\n *\n * @memberof workbox.rangeRequests\n */\n let createPartialResponse = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (request, originalResponse) {\n try {\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'request'\n });\n\n assert_mjs.assert.isInstance(originalResponse, Response, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'originalResponse'\n });\n }\n\n const rangeHeader = request.headers.get('range');\n if (!rangeHeader) {\n throw new WorkboxError_mjs.WorkboxError('no-range-header');\n }\n\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = yield originalResponse.blob();\n\n const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);\n\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n\n const slicedResponse = new Response(slicedBlob, {\n // Status code 206 is for a Partial Content response.\n // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206\n status: 206,\n statusText: 'Partial Content',\n headers: originalResponse.headers\n });\n\n slicedResponse.headers.set('Content-Length', slicedBlobSize);\n slicedResponse.headers.set('Content-Range', `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` + originalBlob.size);\n\n return slicedResponse;\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to construct a partial response; returning a ` + `416 Range Not Satisfiable response instead.`);\n logger_mjs.logger.groupCollapsed(`View details here.`);\n logger_mjs.logger.unprefixed.log(error);\n logger_mjs.logger.unprefixed.log(request);\n logger_mjs.logger.unprefixed.log(originalResponse);\n logger_mjs.logger.groupEnd();\n }\n\n return new Response('', {\n status: 416,\n statusText: 'Range Not Satisfiable'\n });\n }\n });\n\n return function createPartialResponse(_x, _x2) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The range request plugin makes it easy for a request with a 'Range' header to\n * be fulfilled by a cached response.\n *\n * It does this by intercepting the `cachedResponseWillBeUsed` plugin callback\n * and returning the appropriate subset of the cached response body.\n *\n * @memberof workbox.rangeRequests\n */\n class Plugin {\n /**\n * @param {Object} options\n * @param {Request} options.request The original request, which may or may not\n * contain a Range: header.\n * @param {Response} options.cachedResponse The complete cached response.\n * @return {Promise<Response>} If request contains a 'Range' header, then a\n * new response with status 206 whose body is a subset of `cachedResponse` is\n * returned. Otherwise, `cachedResponse` is returned as-is.\n *\n * @private\n */\n cachedResponseWillBeUsed({ request, cachedResponse }) {\n return babelHelpers.asyncToGenerator(function* () {\n // Only return a sliced response if there's something valid in the cache,\n // and there's a Range: header in the request.\n if (cachedResponse && request.headers.has('range')) {\n return yield createPartialResponse(request, cachedResponse);\n }\n\n // If there was no Range: header, or if cachedResponse wasn't valid, just\n // pass it through as-is.\n return cachedResponse;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.createPartialResponse = createPartialResponse;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-range-requests.dev.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.rangeRequests = (function (exports,WorkboxError_mjs,assert_mjs,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:range-requests:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {Blob} blob A source blob.\n * @param {number|null} start The offset to use as the start of the\n * slice.\n * @param {number|null} end The offset to use as the end of the slice.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the effective boundaries to use given the size of the blob.\n *\n * @private\n */\n function calculateEffectiveBoundaries(blob, start, end) {\n {\n assert_mjs.assert.isInstance(blob, Blob, {\n moduleName: 'workbox-range-requests',\n funcName: 'calculateEffectiveBoundaries',\n paramName: 'blob'\n });\n }\n\n const blobSize = blob.size;\n\n if (end > blobSize || start < 0) {\n throw new WorkboxError_mjs.WorkboxError('range-not-satisfiable', {\n size: blobSize,\n end,\n start\n });\n }\n\n let effectiveStart;\n let effectiveEnd;\n\n if (start === null) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n } else if (end === null) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n } else {\n effectiveStart = start;\n // Range values are inclusive, so add 1 to the value.\n effectiveEnd = end + 1;\n }\n\n return {\n start: effectiveStart,\n end: effectiveEnd\n };\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {string} rangeHeader A Range: header value.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the parsed value of the Range: header. If either the `start` or `end` are\n * omitted, then `null` will be returned.\n *\n * @private\n */\n function parseRangeHeader(rangeHeader) {\n {\n assert_mjs.assert.isType(rangeHeader, 'string', {\n moduleName: 'workbox-range-requests',\n funcName: 'parseRangeHeader',\n paramName: 'rangeHeader'\n });\n }\n\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith('bytes=')) {\n throw new WorkboxError_mjs.WorkboxError('unit-must-be-bytes', { normalizedRangeHeader });\n }\n\n // Specifying multiple ranges separate by commas is valid syntax, but this\n // library only attempts to handle a single, contiguous sequence of bytes.\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax\n if (normalizedRangeHeader.includes(',')) {\n throw new WorkboxError_mjs.WorkboxError('single-range-only', { normalizedRangeHeader });\n }\n\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n // We need either at least one of the start or end values.\n if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {\n throw new WorkboxError_mjs.WorkboxError('invalid-range-values', { normalizedRangeHeader });\n }\n\n return {\n start: rangeParts[1] === '' ? null : Number(rangeParts[1]),\n end: rangeParts[2] === '' ? null : Number(rangeParts[2])\n };\n }\n\n /**\n * Given a `Request` and `Response` objects as input, this will return a\n * promise for a new `Response`.\n *\n * @param {Request} request A request, which should contain a Range:\n * header.\n * @param {Response} originalResponse An original response containing the full\n * content.\n * @return {Promise<Response>} Either a `206 Partial Content` response, with\n * the response body set to the slice of content specified by the request's\n * `Range:` header, or a `416 Range Not Satisfiable` response if the\n * conditions of the `Range:` header can't be met.\n *\n * @memberof workbox.rangeRequests\n */\n let createPartialResponse = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (request, originalResponse) {\n try {\n {\n assert_mjs.assert.isInstance(request, Request, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'request'\n });\n\n assert_mjs.assert.isInstance(originalResponse, Response, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'originalResponse'\n });\n }\n\n const rangeHeader = request.headers.get('range');\n if (!rangeHeader) {\n throw new WorkboxError_mjs.WorkboxError('no-range-header');\n }\n\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = yield originalResponse.blob();\n\n const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);\n\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n\n const slicedResponse = new Response(slicedBlob, {\n // Status code 206 is for a Partial Content response.\n // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206\n status: 206,\n statusText: 'Partial Content',\n headers: originalResponse.headers\n });\n\n slicedResponse.headers.set('Content-Length', slicedBlobSize);\n slicedResponse.headers.set('Content-Range', `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` + originalBlob.size);\n\n return slicedResponse;\n } catch (error) {\n {\n logger_mjs.logger.warn(`Unable to construct a partial response; returning a ` + `416 Range Not Satisfiable response instead.`);\n logger_mjs.logger.groupCollapsed(`View details here.`);\n logger_mjs.logger.unprefixed.log(error);\n logger_mjs.logger.unprefixed.log(request);\n logger_mjs.logger.unprefixed.log(originalResponse);\n logger_mjs.logger.groupEnd();\n }\n\n return new Response('', {\n status: 416,\n statusText: 'Range Not Satisfiable'\n });\n }\n });\n\n return function createPartialResponse(_x, _x2) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The range request plugin makes it easy for a request with a 'Range' header to\n * be fulfilled by a cached response.\n *\n * It does this by intercepting the `cachedResponseWillBeUsed` plugin callback\n * and returning the appropriate subset of the cached response body.\n *\n * @memberof workbox.rangeRequests\n */\n class Plugin {\n /**\n * @param {Object} options\n * @param {Request} options.request The original request, which may or may not\n * contain a Range: header.\n * @param {Response} options.cachedResponse The complete cached response.\n * @return {Promise<Response>} If request contains a 'Range' header, then a\n * new response with status 206 whose body is a subset of `cachedResponse` is\n * returned. Otherwise, `cachedResponse` is returned as-is.\n *\n * @private\n */\n cachedResponseWillBeUsed({ request, cachedResponse }) {\n return babelHelpers.asyncToGenerator(function* () {\n // Only return a sliced response if there's something valid in the cache,\n // and there's a Range: header in the request.\n if (cachedResponse && request.headers.has('range')) {\n return yield createPartialResponse(request, cachedResponse);\n }\n\n // If there was no Range: header, or if cachedResponse wasn't valid, just\n // pass it through as-is.\n return cachedResponse;\n })();\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.createPartialResponse = createPartialResponse;\n exports.Plugin = Plugin;\n\n return exports;\n\n}({},workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-range-requests.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){"use strict";try{self.workbox.v["workbox:range-requests:3.4.1"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get("range");if(!r)throw new n.WorkboxError("no-range-header");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new n.WorkboxError("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new n.WorkboxError("single-range-only",{normalizedRangeHeader:t});const r=/(\d*)-(\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError("invalid-range-values",{normalizedRangeHeader:t});return{start:""===r[1]?null:Number(r[1]),end:""===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError("range-not-satisfiable",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:"Partial Content",headers:t.headers});return u.headers.set("Content-Length",o),u.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has("range")?yield t(e,n):n})()}},e}({},workbox.core._private);
1
+ this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){"use strict";try{self.workbox.v["workbox:range-requests:3.6.2"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get("range");if(!r)throw new n.WorkboxError("no-range-header");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new n.WorkboxError("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new n.WorkboxError("single-range-only",{normalizedRangeHeader:t});const r=/(\d*)-(\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError("invalid-range-values",{normalizedRangeHeader:t});return{start:""===r[1]?null:Number(r[1]),end:""===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError("range-not-satisfiable",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:"Partial Content",headers:t.headers});return u.headers.set("Content-Length",o),u.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has("range")?yield t(e,n):n})()}},e}({},workbox.core._private);
2
2
 
3
3
  //# sourceMappingURL=workbox-range-requests.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){\"use strict\";try{self.workbox.v[\"workbox:range-requests:3.4.1\"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get(\"range\");if(!r)throw new n.WorkboxError(\"no-range-header\");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith(\"bytes=\"))throw new n.WorkboxError(\"unit-must-be-bytes\",{normalizedRangeHeader:t});if(t.includes(\",\"))throw new n.WorkboxError(\"single-range-only\",{normalizedRangeHeader:t});const r=/(\\d*)-(\\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError(\"invalid-range-values\",{normalizedRangeHeader:t});return{start:\"\"===r[1]?null:Number(r[1]),end:\"\"===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError(\"range-not-satisfiable\",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:\"Partial Content\",headers:t.headers});return u.headers.set(\"Content-Length\",o),u.headers.set(\"Content-Range\",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response(\"\",{status:416,statusText:\"Range Not Satisfiable\"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has(\"range\")?yield t(e,n):n})()}},e}({},workbox.core._private);\n"],"file":"workbox-range-requests.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){\"use strict\";try{self.workbox.v[\"workbox:range-requests:3.6.2\"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get(\"range\");if(!r)throw new n.WorkboxError(\"no-range-header\");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith(\"bytes=\"))throw new n.WorkboxError(\"unit-must-be-bytes\",{normalizedRangeHeader:t});if(t.includes(\",\"))throw new n.WorkboxError(\"single-range-only\",{normalizedRangeHeader:t});const r=/(\\d*)-(\\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError(\"invalid-range-values\",{normalizedRangeHeader:t});return{start:\"\"===r[1]?null:Number(r[1]),end:\"\"===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError(\"range-not-satisfiable\",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:\"Partial Content\",headers:t.headers});return u.headers.set(\"Content-Length\",o),u.headers.set(\"Content-Range\",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response(\"\",{status:416,statusText:\"Range Not Satisfiable\"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has(\"range\")?yield t(e,n):n})()}},e}({},workbox.core._private);\n"],"file":"workbox-range-requests.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFrie
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:routing:3.4.1'] = 1;
6
+ self.workbox.v['workbox:routing:3.6.2'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -38,7 +38,7 @@ this.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFrie
38
38
  *
39
39
  * @private
40
40
  */
41
- const validMethods = ['DELETE', 'GET', 'HEAD', 'POST', 'PUT'];
41
+ const validMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
42
42
 
43
43
  /*
44
44
  Copyright 2017 Google Inc. All Rights Reserved.
@@ -596,9 +596,9 @@ this.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFrie
596
596
  /**
597
597
  * Routes match handler.
598
598
  *
599
- * @param {Object} input
600
- * @param {FetchEvent} input.event
601
- * @param {URL} input.url
599
+ * @param {Object} options
600
+ * @param {FetchEvent} options.event
601
+ * @param {URL} options.url
602
602
  * @return {boolean}
603
603
  *
604
604
  * @private
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFriendlyURL_mjs,cacheNames_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:routing:3.6.2'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The default HTTP method, 'GET', used when there's no specific method\n * configured for a route.\n *\n * @type {string}\n *\n * @private\n */\n const defaultMethod = 'GET';\n\n /**\n * The list of valid HTTP methods associated with requests that could be routed.\n *\n * @type {Array<string>}\n *\n * @private\n */\n const validMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @param {function()|Object} handler Either a function, or an object with a\n * 'handle' method.\n * @return {Object} An object with a handle method.\n *\n * @private\n */\n var normalizeHandler = (handler => {\n if (handler && typeof handler === 'object') {\n {\n assert_mjs.assert.hasMethod(handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return handler;\n } else {\n {\n assert_mjs.assert.isType(handler, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'handler'\n });\n }\n return { handle: handler };\n }\n });\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A `Route` consists of a pair of callback functions, \"match\" and \"handler\".\n * The \"match\" callback determine if a route should be used to \"handle\" a\n * request by returning a non-falsy value if it can. The \"handler\" callback\n * is called when there is a match and should return a Promise that resolves\n * to a `Response`.\n *\n * @memberof workbox.routing\n */\n class Route {\n /**\n * Constructor for Route class.\n *\n * @param {workbox.routing.Route~matchCallback} match\n * A callback function that determines whether the route matches a given\n * `fetch` event by returning a non-falsy value.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resolving to a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(match, handler, method) {\n {\n assert_mjs.assert.isType(match, 'function', {\n moduleName: 'workbox-routing',\n className: 'Route',\n funcName: 'constructor',\n paramName: 'match'\n });\n\n if (method) {\n assert_mjs.assert.isOneOf(method, validMethods, { paramName: 'method' });\n }\n }\n\n // These values are referenced directly by Router so cannot be\n // altered by minifification.\n this.handler = normalizeHandler(handler);\n this.match = match;\n this.method = method || defaultMethod;\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * RegExpRoute makes it easy to create a regular expression based\n * [Route]{@link workbox.routing.Route}.\n *\n * For same-origin requests the RegExp only needs to match part of the URL. For\n * requests against third-party servers, you must define a RegExp that matches\n * the start of the URL.\n *\n * [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class RegExpRoute extends Route {\n /**\n * If the regulard expression contains\n * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},\n * th ecaptured values will be passed to the\n * [handler's]{@link workbox.routing.Route~handlerCallback} `params`\n * argument.\n *\n * @param {RegExp} regExp The regular expression to match against URLs.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n */\n constructor(regExp, handler, method) {\n {\n assert_mjs.assert.isInstance(regExp, RegExp, {\n moduleName: 'workbox-routing',\n className: 'RegExpRoute',\n funcName: 'constructor',\n paramName: 'pattern'\n });\n }\n\n const match = ({ url }) => {\n const result = regExp.exec(url.href);\n\n // Return null immediately if there's no match.\n if (!result) {\n return null;\n }\n\n // Require that the match start at the first character in the URL string\n // if it's a cross-origin request.\n // See https://github.com/GoogleChrome/workbox/issues/281 for the context\n // behind this behavior.\n if (url.origin !== location.origin && result.index !== 0) {\n {\n logger_mjs.logger.debug(`The regular expression '${regExp}' only partially matched ` + `against the cross-origin URL '${url}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);\n }\n\n return null;\n }\n\n // If the route matches, but there aren't any capture groups defined, then\n // this will return [], which is truthy and therefore sufficient to\n // indicate a match.\n // If there are capture groups, then it will return their values.\n return result.slice(1);\n };\n\n super(match, handler, method);\n }\n }\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The Router can be used to process a FetchEvent through one or more\n * [Routes]{@link workbox.routing.Route} responding with a Request if\n * a matching route exists.\n *\n * If no route matches a given a request, the Router will use a \"default\"\n * handler if one is defined.\n *\n * Should the matching Route throw an error, the Router will use a \"catch\"\n * handler if one is defined to gracefully deal with issues and respond with a\n * Request.\n *\n * If a request matches multiple routes, the **earliest** registered route will\n * be used to respond to the request.\n *\n * @memberof workbox.routing\n */\n class Router {\n /**\n * Initializes a new Router.\n */\n constructor() {\n // _routes will contain a mapping of HTTP method name ('GET', etc.) to an\n // array of all the corresponding Route instances that are registered.\n this._routes = new Map();\n }\n\n /**\n * Apply the routing rules to a FetchEvent object to get a Response from an\n * appropriate Route's handler.\n *\n * @param {FetchEvent} event The event from a service worker's 'fetch' event\n * listener.\n * @return {Promise<Response>|undefined} A promise is returned if a\n * registered route can handle the FetchEvent's request. If there is no\n * matching route and there's no `defaultHandler`, `undefined` is returned.\n */\n handleRequest(event) {\n {\n assert_mjs.assert.isInstance(event, FetchEvent, {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'handleRequest',\n paramName: 'event'\n });\n }\n\n const url = new URL(event.request.url);\n if (!url.protocol.startsWith('http')) {\n {\n logger_mjs.logger.debug(`Workbox Router only supports URLs that start with 'http'.`);\n }\n return;\n }\n\n let route = null;\n let handler = null;\n let params = null;\n let debugMessages = [];\n\n const result = this._findHandlerAndParams(event, url);\n handler = result.handler;\n params = result.params;\n route = result.route;\n {\n if (handler) {\n debugMessages.push([`Found a route to handle this request:`, route]);\n\n if (params) {\n debugMessages.push([`Passing the following params to the route's handler:`, params]);\n }\n }\n }\n\n // If we don't have a handler because there was no matching route, then\n // fall back to defaultHandler if that's defined.\n if (!handler && this._defaultHandler) {\n {\n debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler.`);\n\n // This is used for debugging in logs in the case of an error.\n route = '[Default Handler]';\n }\n handler = this._defaultHandler;\n }\n\n if (!handler) {\n {\n // No handler so Workbox will do nothing. If logs is set of debug\n // i.e. verbose, we should print out this information.\n logger_mjs.logger.debug(`No route found for: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n }\n return;\n }\n\n {\n // We have a handler, meaning Workbox is going to handle the route.\n // print the routing details to the console.\n logger_mjs.logger.groupCollapsed(`Router is responding to: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);\n debugMessages.forEach(msg => {\n if (Array.isArray(msg)) {\n logger_mjs.logger.log(...msg);\n } else {\n logger_mjs.logger.log(msg);\n }\n });\n\n // The Request and Response objects contains a great deal of information,\n // hide it under a group in case developers want to see it.\n logger_mjs.logger.groupCollapsed(`View request details here.`);\n logger_mjs.logger.unprefixed.log(event.request);\n logger_mjs.logger.groupEnd();\n\n logger_mjs.logger.groupEnd();\n }\n\n // Wrap in try and catch in case the handle method throws a synchronous\n // error. It should still callback to the catch handler.\n let responsePromise;\n try {\n responsePromise = handler.handle({ url, event, params });\n } catch (err) {\n responsePromise = Promise.reject(err);\n }\n\n if (responsePromise && this._catchHandler) {\n responsePromise = responsePromise.catch(err => {\n {\n // Still include URL here as it will be async from the console group\n // and may not make sense without the URL\n logger_mjs.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_mjs.getFriendlyURL(url)}. Falling back to Catch Handler.`);\n logger_mjs.logger.unprefixed.error(`Error thrown by:`, route);\n logger_mjs.logger.unprefixed.error(err);\n logger_mjs.logger.groupEnd();\n }\n return this._catchHandler.handle({ url, event, err });\n });\n }\n\n return responsePromise;\n }\n\n /**\n * Checks the incoming `event.request` against the registered routes, and if\n * there's a match, returns the corresponding handler along with any params\n * generated by the match.\n *\n * @param {FetchEvent} event\n * @param {URL} url\n * @return {Object} Returns an object with `handler` and `params` properties.\n * They are populated if a matching route was found or `undefined` otherwise.\n *\n * @private\n */\n _findHandlerAndParams(event, url) {\n const routes = this._routes.get(event.request.method) || [];\n for (const route of routes) {\n let matchResult = route.match({ url, event });\n if (matchResult) {\n if (Array.isArray(matchResult) && matchResult.length === 0) {\n // Instead of passing an empty array in as params, use undefined.\n matchResult = undefined;\n } else if (matchResult.constructor === Object && Object.keys(matchResult).length === 0 || matchResult === true) {\n // Instead of passing an empty object in as params, use undefined.\n matchResult = undefined;\n }\n\n // Break out of the loop and return the appropriate values as soon as\n // we have a match.\n return {\n route,\n params: matchResult,\n handler: route.handler\n };\n }\n }\n\n // If we didn't have a match, then return undefined values.\n return { handler: undefined, params: undefined };\n }\n\n /**\n * Define a default `handler` that's called when no routes explicitly\n * match the incoming request.\n *\n * Without a default handler, unmatched requests will go against the\n * network as if there were no service worker present.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setDefaultHandler(handler) {\n this._defaultHandler = normalizeHandler(handler);\n }\n\n /**\n * If a Route throws an error while handling a request, this `handler`\n * will be called and given a chance to provide a response.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n */\n setCatchHandler(handler) {\n this._catchHandler = normalizeHandler(handler);\n }\n\n /**\n * Registers a route with the router.\n *\n * @param {workbox.routing.Route} route The route to register.\n */\n registerRoute(route) {\n {\n assert_mjs.assert.isType(route, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route, 'match', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.isType(route.handler, 'object', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route'\n });\n\n assert_mjs.assert.hasMethod(route.handler, 'handle', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.handler'\n });\n\n assert_mjs.assert.isType(route.method, 'string', {\n moduleName: 'workbox-routing',\n className: 'Router',\n funcName: 'registerRoute',\n paramName: 'route.method'\n });\n }\n\n if (!this._routes.has(route.method)) {\n this._routes.set(route.method, []);\n }\n\n // Give precedence to all of the earlier routes by adding this additional\n // route to the end of the array.\n this._routes.get(route.method).push(route);\n }\n\n /**\n * Unregisters a route with the router.\n *\n * @param {workbox.routing.Route} route The route to unregister.\n */\n unregisterRoute(route) {\n if (!this._routes.has(route.method)) {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-but-not-found-with-method', {\n method: route.method\n });\n }\n\n const routeIndex = this._routes.get(route.method).indexOf(route);\n if (routeIndex > -1) {\n this._routes.get(route.method).splice(routeIndex, 1);\n } else {\n throw new WorkboxError_mjs.WorkboxError('unregister-route-route-not-registered');\n }\n }\n }\n\n /*\n Copyright 2016 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * NavigationRoute makes it easy to create a [Route]{@link\n * workbox.routing.Route} that matches for browser\n * [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.\n *\n * It will only match incoming Requests whose\n * [`mode`]{@link https://fetch.spec.whatwg.org/#concept-request-mode}\n * is set to `navigate`.\n *\n * You can optionally only apply this route to a subset of navigation requests\n * by using one or both of the `blacklist` and `whitelist` parameters.\n *\n * @memberof workbox.routing\n * @extends workbox.routing.Route\n */\n class NavigationRoute extends Route {\n /**\n * If both `blacklist` and `whiltelist` are provided, the `blacklist` will\n * take precedence and the request will not match this route.\n *\n * The regular expressions in `whitelist` and `blacklist`\n * are matched against the concatenated\n * [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}\n * and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}\n * portions of the requested URL.\n *\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {Object} options\n * @param {Array<RegExp>} [options.blacklist] If any of these patterns match,\n * the route will not handle the request (even if a whitelist RegExp matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n */\n constructor(handler, { whitelist = [/./], blacklist = [] } = {}) {\n {\n assert_mjs.assert.isArrayOfClass(whitelist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.whitelist'\n });\n assert_mjs.assert.isArrayOfClass(blacklist, RegExp, {\n moduleName: 'workbox-routing',\n className: 'NavigationRoute',\n funcName: 'constructor',\n paramName: 'options.blacklist'\n });\n }\n\n super((...args) => this._match(...args), handler);\n\n this._whitelist = whitelist;\n this._blacklist = blacklist;\n }\n\n /**\n * Routes match handler.\n *\n * @param {Object} options\n * @param {FetchEvent} options.event\n * @param {URL} options.url\n * @return {boolean}\n *\n * @private\n */\n _match({ event, url }) {\n if (event.request.mode !== 'navigate') {\n return false;\n }\n\n const pathnameAndSearch = url.pathname + url.search;\n\n if (this._blacklist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `request URL matches both the whitelist and blacklist.`);\n }\n return false;\n }\n\n if (this._whitelist.some(regExp => regExp.test(pathnameAndSearch))) {\n {\n logger_mjs.logger.debug(`The navigation route is being used.`);\n }\n return true;\n } else {\n {\n logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `URL being navigated to doesn't match the whitelist.`);\n }\n }\n\n return false;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var publicAPI = /*#__PURE__*/Object.freeze({\n RegExpRoute: RegExpRoute,\n Route: Route,\n Router: Router,\n NavigationRoute: NavigationRoute\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n {\n assert_mjs.assert.isSwEnv('workbox-routing');\n }\n\n /**\n * @private\n */\n class DefaultRouter extends Router {\n /**\n * Easily register a RegExp, string, or function with a caching\n * strategy to the Router.\n *\n * This method will generate a Route for you if needed and\n * call [Router.registerRoute()]{@link\n * workbox.routing.Router#registerRoute}.\n *\n * @param {\n * RegExp|\n * string|\n * workbox.routing.Route~matchCallback|\n * workbox.routing.Route\n * } capture\n * If the capture param is a `Route`, all other arguments will be ignored.\n * @param {workbox.routing.Route~handlerCallback} handler A callback\n * function that returns a Promise resulting in a Response.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n * @return {workbox.routing.Route} The generated `Route`(Useful for\n * unregistering).\n *\n * @alias workbox.routing.registerRoute\n */\n registerRoute(capture, handler, method = 'GET') {\n let route;\n\n if (typeof capture === 'string') {\n const captureUrl = new URL(capture, location);\n\n {\n if (!(capture.startsWith('/') || capture.startsWith('http'))) {\n throw new WorkboxError_mjs.WorkboxError('invalid-string', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n // We want to check if Express-style wildcards are in the pathname only.\n // TODO: Remove this log message in v4.\n const valueToCheck = capture.startsWith('http') ? captureUrl.pathname : capture;\n // See https://github.com/pillarjs/path-to-regexp#parameters\n const wildcards = '[*:?+]';\n if (valueToCheck.match(new RegExp(`${wildcards}`))) {\n logger_mjs.logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);\n }\n }\n\n const matchCallback = ({ url }) => {\n {\n if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {\n logger_mjs.logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);\n }\n }\n\n return url.href === captureUrl.href;\n };\n\n route = new Route(matchCallback, handler, method);\n } else if (capture instanceof RegExp) {\n route = new RegExpRoute(capture, handler, method);\n } else if (typeof capture === 'function') {\n route = new Route(capture, handler, method);\n } else if (capture instanceof Route) {\n route = capture;\n } else {\n throw new WorkboxError_mjs.WorkboxError('unsupported-route-type', {\n moduleName: 'workbox-routing',\n className: 'DefaultRouter',\n funcName: 'registerRoute',\n paramName: 'capture'\n });\n }\n\n super.registerRoute(route);\n return route;\n }\n\n /**\n * Register a route that will return a precached file for a navigation\n * request. This is useful for the\n * [application shell pattern]{@link https://developers.google.com/web/fundamentals/architecture/app-shell}.\n *\n * This method will generate a\n * [NavigationRoute]{@link workbox.routing.NavigationRoute}\n * and call\n * [Router.registerRoute()]{@link workbox.routing.Router#registerRoute}\n * .\n *\n * @param {string} cachedAssetUrl\n * @param {Object} [options]\n * @param {string} [options.cacheName] Cache name to store and retrieve\n * requests. Defaults to precache cache name provided by\n * [workbox-core.cacheNames]{@link workbox.core.cacheNames}.\n * @param {Array<RegExp>} [options.blacklist=[]] If any of these patterns\n * match, the route will not handle the request (even if a whitelist entry\n * matches).\n * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns\n * match the URL's pathname and search parameter, the route will handle the\n * request (assuming the blacklist doesn't match).\n * @return {workbox.routing.NavigationRoute} Returns the generated\n * Route.\n *\n * @alias workbox.routing.registerNavigationRoute\n */\n registerNavigationRoute(cachedAssetUrl, options = {}) {\n {\n assert_mjs.assert.isType(cachedAssetUrl, 'string', {\n moduleName: 'workbox-routing',\n className: '[default export]',\n funcName: 'registerNavigationRoute',\n paramName: 'cachedAssetUrl'\n });\n }\n\n const cacheName = cacheNames_mjs.cacheNames.getPrecacheName(options.cacheName);\n const handler = () => caches.match(cachedAssetUrl, { cacheName }).then(response => {\n if (response) {\n return response;\n }\n // This shouldn't normally happen, but there are edge cases:\n // https://github.com/GoogleChrome/workbox/issues/1441\n throw new Error(`The cache ${cacheName} did not have an entry for ` + `${cachedAssetUrl}.`);\n }).catch(error => {\n // If there's either a cache miss, or the caches.match() call threw\n // an exception, then attempt to fulfill the navigation request with\n // a response from the network rather than leaving the user with a\n // failed navigation.\n {\n logger_mjs.logger.debug(`Unable to respond to navigation request with cached ` + `response: ${error.message}. Falling back to network.`);\n }\n\n // This might still fail if the browser is offline...\n return fetch(cachedAssetUrl);\n });\n\n const route = new NavigationRoute(handler, {\n whitelist: options.whitelist,\n blacklist: options.blacklist\n });\n super.registerRoute(route);\n\n return route;\n }\n }\n\n const router = new DefaultRouter();\n\n // By default, register a fetch event listener that will respond to a request\n // only if there's a matching route.\n self.addEventListener('fetch', event => {\n const responsePromise = router.handleRequest(event);\n if (responsePromise) {\n event.respondWith(responsePromise);\n }\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExport = Object.assign(router, publicAPI);\n\n return finalExport;\n\n}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));\n"],"file":"workbox-routing.dev.js"}
@@ -1,3 +1,3 @@
1
- this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self.workbox.v["workbox:routing:3.4.1"]=1}catch(t){}const r="GET";var s=t=>t&&"object"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith("http"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError("unregister-route-but-not-found-with-method",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError("unregister-route-route-not-registered");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if("navigate"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s="GET"){let i;if("string"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if("function"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",className:"DefaultRouter",funcName:"registerRoute",paramName:"capture"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener("fetch",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);
1
+ this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self.workbox.v["workbox:routing:3.6.2"]=1}catch(t){}const r="GET";var s=t=>t&&"object"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith("http"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError("unregister-route-but-not-found-with-method",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError("unregister-route-route-not-registered");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if("navigate"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s="GET"){let i;if("string"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if("function"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",className:"DefaultRouter",funcName:"registerRoute",paramName:"capture"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener("fetch",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);
2
2
 
3
3
  //# sourceMappingURL=workbox-routing.prod.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.routing=function(t,e){\"use strict\";try{self.workbox.v[\"workbox:routing:3.4.1\"]=1}catch(t){}const r=\"GET\";var s=t=>t&&\"object\"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith(\"http\"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError(\"unregister-route-but-not-found-with-method\",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError(\"unregister-route-route-not-registered\");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if(\"navigate\"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s=\"GET\"){let i;if(\"string\"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if(\"function\"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError(\"unsupported-route-type\",{moduleName:\"workbox-routing\",className:\"DefaultRouter\",funcName:\"registerRoute\",paramName:\"capture\"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener(\"fetch\",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-routing.prod.js"}
1
+ {"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.routing=function(t,e){\"use strict\";try{self.workbox.v[\"workbox:routing:3.6.2\"]=1}catch(t){}const r=\"GET\";var s=t=>t&&\"object\"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith(\"http\"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError(\"unregister-route-but-not-found-with-method\",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError(\"unregister-route-route-not-registered\");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if(\"navigate\"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s=\"GET\"){let i;if(\"string\"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if(\"function\"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError(\"unsupported-route-type\",{moduleName:\"workbox-routing\",className:\"DefaultRouter\",funcName:\"registerRoute\",paramName:\"capture\"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener(\"fetch\",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-routing.prod.js"}
@@ -3,7 +3,7 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
3
3
  'use strict';
4
4
 
5
5
  try {
6
- self.workbox.v['workbox:strategies:3.4.1'] = 1;
6
+ self.workbox.v['workbox:strategies:3.6.2'] = 1;
7
7
  } catch (e) {} // eslint-disable-line
8
8
 
9
9
  /*
@@ -90,8 +90,8 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
90
90
  * will work with the
91
91
  * [Workbox Router]{@link workbox.routing.Router}.
92
92
  *
93
- * @param {Object} input
94
- * @param {FetchEvent} input.event The fetch event to run this strategy
93
+ * @param {Object} options
94
+ * @param {FetchEvent} options.event The fetch event to run this strategy
95
95
  * against.
96
96
  * @return {Promise<Response>}
97
97
  */
@@ -122,12 +122,12 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
122
122
  * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
123
123
  * for more usage information.
124
124
  *
125
- * @param {Object} input
126
- * @param {Request|string} input.request Either a
127
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
128
- * object, or a string URL, corresponding to the request to be made.
129
- * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be
130
- * called automatically to extend the service worker's lifetime.
125
+ * @param {Object} options
126
+ * @param {Request|string} options.request Either a
127
+ * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
128
+ * object, or a string URL, corresponding to the request to be made.
129
+ * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
130
+ be called automatically to extend the service worker's lifetime.
131
131
  * @return {Promise<Response>}
132
132
  */
133
133
  makeRequest({ event, request }) {
@@ -149,7 +149,13 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
149
149
  });
150
150
  }
151
151
 
152
- let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);
152
+ let response = yield cacheWrapper_mjs.cacheWrapper.match({
153
+ cacheName: _this2._cacheName,
154
+ request,
155
+ event,
156
+ matchOptions: _this2._matchOptions,
157
+ plugins: _this2._plugins
158
+ });
153
159
 
154
160
  let error;
155
161
  if (!response) {
@@ -207,11 +213,22 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
207
213
  var _this3 = this;
208
214
 
209
215
  return babelHelpers.asyncToGenerator(function* () {
210
- const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins, event ? event.preloadResponse : undefined);
216
+ const response = yield fetchWrapper_mjs.fetchWrapper.fetch({
217
+ request,
218
+ event,
219
+ fetchOptions: _this3._fetchOptions,
220
+ plugins: _this3._plugins
221
+ });
211
222
 
212
223
  // Keep the service worker while we put the request to the cache
213
224
  const responseClone = response.clone();
214
- const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put(_this3._cacheName, request, responseClone, _this3._plugins);
225
+ const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({
226
+ cacheName: _this3._cacheName,
227
+ request,
228
+ response: responseClone,
229
+ event,
230
+ plugins: _this3._plugins
231
+ });
215
232
 
216
233
  if (event) {
217
234
  try {
@@ -273,8 +290,8 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
273
290
  * will work with the
274
291
  * [Workbox Router]{@link workbox.routing.Router}.
275
292
  *
276
- * @param {Object} input
277
- * @param {FetchEvent} input.event The fetch event to run this strategy
293
+ * @param {Object} options
294
+ * @param {FetchEvent} options.event The fetch event to run this strategy
278
295
  * against.
279
296
  * @return {Promise<Response>}
280
297
  */
@@ -305,12 +322,12 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
305
322
  * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
306
323
  * for more usage information.
307
324
  *
308
- * @param {Object} input
309
- * @param {Request|string} input.request Either a
310
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
311
- * object, or a string URL, corresponding to the request to be made.
312
- * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be
313
- * called automatically to extend the service worker's lifetime.
325
+ * @param {Object} options
326
+ * @param {Request|string} options.request Either a
327
+ * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
328
+ * object, or a string URL, corresponding to the request to be made.
329
+ * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
330
+ * be called automatically to extend the service worker's lifetime.
314
331
  * @return {Promise<Response>}
315
332
  */
316
333
  makeRequest({ event, request }) {
@@ -330,7 +347,13 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
330
347
  });
331
348
  }
332
349
 
333
- const response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);
350
+ const response = yield cacheWrapper_mjs.cacheWrapper.match({
351
+ cacheName: _this2._cacheName,
352
+ request,
353
+ event,
354
+ matchOptions: _this2._matchOptions,
355
+ plugins: _this2._plugins
356
+ });
334
357
 
335
358
  {
336
359
  logger_mjs.logger.groupCollapsed(messages.strategyStart('CacheOnly', request));
@@ -368,8 +391,8 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
368
391
  * Return return a response (i.e. allow caching) if the
369
392
  * response is ok (i.e. 200) or is opaque.
370
393
  *
371
- * @param {Object} input
372
- * @param {Response} input.response
394
+ * @param {Object} options
395
+ * @param {Response} options.response
373
396
  * @return {Response|null}
374
397
  *
375
398
  * @private
@@ -460,8 +483,8 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
460
483
  * will work with the
461
484
  * [Workbox Router]{@link workbox.routing.Router}.
462
485
  *
463
- * @param {Object} input
464
- * @param {FetchEvent} input.event The fetch event to run this strategy
486
+ * @param {Object} options
487
+ * @param {FetchEvent} options.event The fetch event to run this strategy
465
488
  * against.
466
489
  * @return {Promise<Response>}
467
490
  */
@@ -492,12 +515,12 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
492
515
  * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
493
516
  * for more usage information.
494
517
  *
495
- * @param {Object} input
496
- * @param {Request|string} input.request Either a
497
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
498
- * object, or a string URL, corresponding to the request to be made.
499
- * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be
500
- * called automatically to extend the service worker's lifetime.
518
+ * @param {Object} options
519
+ * @param {Request|string} options.request Either a
520
+ * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
521
+ * object, or a string URL, corresponding to the request to be made.
522
+ * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
523
+ * be called automatically to extend the service worker's lifetime.
501
524
  * @return {Promise<Response>}
502
525
  */
503
526
  makeRequest({ event, request }) {
@@ -523,12 +546,12 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
523
546
  let timeoutId;
524
547
 
525
548
  if (_this2._networkTimeoutSeconds) {
526
- const { id, promise } = _this2._getTimeoutPromise(request, logs);
549
+ const { id, promise } = _this2._getTimeoutPromise({ request, event, logs });
527
550
  timeoutId = id;
528
551
  promises.push(promise);
529
552
  }
530
553
 
531
- const networkPromise = _this2._getNetworkPromise(timeoutId, event, request, logs);
554
+ const networkPromise = _this2._getNetworkPromise({ timeoutId, request, event, logs });
532
555
  promises.push(networkPromise);
533
556
 
534
557
  // Promise.race() will resolve as soon as the first promise resolves.
@@ -556,13 +579,15 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
556
579
  }
557
580
 
558
581
  /**
559
- * @param {Request} request
560
- * @param {Array} logs A reference to the logs array
582
+ * @param {Object} options
583
+ * @param {Request} options.request
584
+ * @param {Array} options.logs A reference to the logs array
585
+ * @param {Event} [options.event]
561
586
  * @return {Promise<Response>}
562
587
  *
563
588
  * @private
564
589
  */
565
- _getTimeoutPromise(request, logs) {
590
+ _getTimeoutPromise({ request, logs, event }) {
566
591
  var _this3 = this;
567
592
 
568
593
  let timeoutId;
@@ -573,7 +598,7 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
573
598
  logs.push(`Timing out the network response at ` + `${_this3._networkTimeoutSeconds} seconds.`);
574
599
  }
575
600
 
576
- resolve((yield _this3._respondFromCache(request)));
601
+ resolve((yield _this3._respondFromCache({ request, event })));
577
602
  });
578
603
 
579
604
  return function onNetworkTimeout() {
@@ -591,22 +616,28 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
591
616
  }
592
617
 
593
618
  /**
594
- * @param {number} timeoutId
595
- * @param {FetchEvent|null} event
596
- * @param {Request} request
597
- * @param {Array} logs A reference to the logs Array.
619
+ * @param {Object} options
620
+ * @param {number|undefined} options.timeoutId
621
+ * @param {Request} options.request
622
+ * @param {Array} options.logs A reference to the logs Array.
623
+ * @param {Event} [options.event]
598
624
  * @return {Promise<Response>}
599
625
  *
600
626
  * @private
601
627
  */
602
- _getNetworkPromise(timeoutId, event, request, logs) {
628
+ _getNetworkPromise({ timeoutId, request, logs, event }) {
603
629
  var _this4 = this;
604
630
 
605
631
  return babelHelpers.asyncToGenerator(function* () {
606
632
  let error;
607
633
  let response;
608
634
  try {
609
- response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this4._fetchOptions, _this4._plugins, event ? event.preloadResponse : undefined);
635
+ response = yield fetchWrapper_mjs.fetchWrapper.fetch({
636
+ request,
637
+ event,
638
+ fetchOptions: _this4._fetchOptions,
639
+ plugins: _this4._plugins
640
+ });
610
641
  } catch (err) {
611
642
  error = err;
612
643
  }
@@ -624,7 +655,7 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
624
655
  }
625
656
 
626
657
  if (error || !response) {
627
- response = yield _this4._respondFromCache(request);
658
+ response = yield _this4._respondFromCache({ request, event });
628
659
  {
629
660
  if (response) {
630
661
  logs.push(`Found a cached response in the '${_this4._cacheName}'` + ` cache.`);
@@ -635,7 +666,13 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
635
666
  } else {
636
667
  // Keep the service worker alive while we put the request in the cache
637
668
  const responseClone = response.clone();
638
- const cachePut = cacheWrapper_mjs.cacheWrapper.put(_this4._cacheName, request, responseClone, _this4._plugins);
669
+ const cachePut = cacheWrapper_mjs.cacheWrapper.put({
670
+ cacheName: _this4._cacheName,
671
+ request,
672
+ response: responseClone,
673
+ event,
674
+ plugins: _this4._plugins
675
+ });
639
676
 
640
677
  if (event) {
641
678
  try {
@@ -657,13 +694,21 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
657
694
  /**
658
695
  * Used if the network timeouts or fails to make the request.
659
696
  *
660
- * @param {Request} request The fetchEvent request to match in the cache
697
+ * @param {Object} options
698
+ * @param {Request} request The request to match in the cache
699
+ * @param {Event} [options.event]
661
700
  * @return {Promise<Object>}
662
701
  *
663
702
  * @private
664
703
  */
665
- _respondFromCache(request) {
666
- return cacheWrapper_mjs.cacheWrapper.match(this._cacheName, request, this._matchOptions, this._plugins);
704
+ _respondFromCache({ event, request }) {
705
+ return cacheWrapper_mjs.cacheWrapper.match({
706
+ cacheName: this._cacheName,
707
+ request,
708
+ event,
709
+ matchOptions: this._matchOptions,
710
+ plugins: this._plugins
711
+ });
667
712
  }
668
713
  }
669
714
 
@@ -714,8 +759,8 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
714
759
  * will work with the
715
760
  * [Workbox Router]{@link workbox.routing.Router}.
716
761
  *
717
- * @param {Object} input
718
- * @param {FetchEvent} input.event The fetch event to run this strategy
762
+ * @param {Object} options
763
+ * @param {FetchEvent} options.event The fetch event to run this strategy
719
764
  * against.
720
765
  * @return {Promise<Response>}
721
766
  */
@@ -746,12 +791,12 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
746
791
  * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
747
792
  * for more usage information.
748
793
  *
749
- * @param {Object} input
750
- * @param {Request|string} input.request Either a
751
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
752
- * object, or a string URL, corresponding to the request to be made.
753
- * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be
754
- * called automatically to extend the service worker's lifetime.
794
+ * @param {Object} options
795
+ * @param {Request|string} options.request Either a
796
+ * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
797
+ * object, or a string URL, corresponding to the request to be made.
798
+ * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
799
+ * be called automatically to extend the service worker's lifetime.
755
800
  * @return {Promise<Response>}
756
801
  */
757
802
  makeRequest({ event, request }) {
@@ -774,7 +819,12 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
774
819
  let error;
775
820
  let response;
776
821
  try {
777
- response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this2._fetchOptions, _this2._plugins, event ? event.preloadResponse : undefined);
822
+ response = yield fetchWrapper_mjs.fetchWrapper.fetch({
823
+ request,
824
+ event,
825
+ fetchOptions: _this2._fetchOptions,
826
+ plugins: _this2._plugins
827
+ });
778
828
  } catch (err) {
779
829
  error = err;
780
830
  }
@@ -867,8 +917,8 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
867
917
  * will work with the
868
918
  * [Workbox Router]{@link workbox.routing.Router}.
869
919
  *
870
- * @param {Object} input
871
- * @param {FetchEvent} input.event The fetch event to run this strategy
920
+ * @param {Object} options
921
+ * @param {FetchEvent} options.event The fetch event to run this strategy
872
922
  * against.
873
923
  * @return {Promise<Response>}
874
924
  */
@@ -899,12 +949,12 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
899
949
  * See "[Advanced Recipes](https://developers.google.com/web/tools/workbox/guides/advanced-recipes#make-requests)"
900
950
  * for more usage information.
901
951
  *
902
- * @param {Object} input
903
- * @param {Request|string} input.request Either a
904
- * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
905
- * object, or a string URL, corresponding to the request to be made.
906
- * @param {FetchEvent} [input.event] If provided, `event.waitUntil()` will be
907
- * called automatically to extend the service worker's lifetime.
952
+ * @param {Object} options
953
+ * @param {Request|string} options.request Either a
954
+ * [`Request`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Request}
955
+ * object, or a string URL, corresponding to the request to be made.
956
+ * @param {FetchEvent} [options.event] If provided, `event.waitUntil()` will
957
+ * be called automatically to extend the service worker's lifetime.
908
958
  * @return {Promise<Response>}
909
959
  */
910
960
  makeRequest({ event, request }) {
@@ -926,9 +976,15 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
926
976
  });
927
977
  }
928
978
 
929
- const fetchAndCachePromise = _this2._getFromNetwork(request, event);
979
+ const fetchAndCachePromise = _this2._getFromNetwork({ request, event });
930
980
 
931
- let response = yield cacheWrapper_mjs.cacheWrapper.match(_this2._cacheName, request, _this2._matchOptions, _this2._plugins);
981
+ let response = yield cacheWrapper_mjs.cacheWrapper.match({
982
+ cacheName: _this2._cacheName,
983
+ request,
984
+ event,
985
+ matchOptions: _this2._matchOptions,
986
+ plugins: _this2._plugins
987
+ });
932
988
 
933
989
  if (response) {
934
990
  {
@@ -965,19 +1021,31 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
965
1021
  }
966
1022
 
967
1023
  /**
968
- * @param {Request} request
969
- * @param {FetchEvent} [event]
1024
+ * @param {Object} options
1025
+ * @param {Request} options.request
1026
+ * @param {Event} [options.event]
970
1027
  * @return {Promise<Response>}
971
1028
  *
972
1029
  * @private
973
1030
  */
974
- _getFromNetwork(request, event) {
1031
+ _getFromNetwork({ request, event }) {
975
1032
  var _this3 = this;
976
1033
 
977
1034
  return babelHelpers.asyncToGenerator(function* () {
978
- const response = yield fetchWrapper_mjs.fetchWrapper.fetch(request, _this3._fetchOptions, _this3._plugins, event ? event.preloadResponse : undefined);
1035
+ const response = yield fetchWrapper_mjs.fetchWrapper.fetch({
1036
+ request,
1037
+ event,
1038
+ fetchOptions: _this3._fetchOptions,
1039
+ plugins: _this3._plugins
1040
+ });
979
1041
 
980
- const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put(_this3._cacheName, request, response.clone(), _this3._plugins);
1042
+ const cachePutPromise = cacheWrapper_mjs.cacheWrapper.put({
1043
+ cacheName: _this3._cacheName,
1044
+ request,
1045
+ response: response.clone(),
1046
+ event,
1047
+ plugins: _this3._plugins
1048
+ });
981
1049
 
982
1050
  if (event) {
983
1051
  try {
@@ -1035,27 +1103,32 @@ this.workbox.strategies = (function (logger_mjs,assert_mjs,cacheNames_mjs,cacheW
1035
1103
 
1036
1104
  /**
1037
1105
  * @function workbox.strategies.cacheFirst
1038
- * @param {workbox.strategies.StrategyOptions} options
1106
+ * @param {Object} options See the {@link workbox.strategies.CacheFirst}
1107
+ * constructor for more info.
1039
1108
  */
1040
1109
 
1041
1110
  /**
1042
1111
  * @function workbox.strategies.cacheOnly
1043
- * @param {workbox.strategies.StrategyOptions} options
1112
+ * @param {Object} options See the {@link workbox.strategies.CacheOnly}
1113
+ * constructor for more info.
1044
1114
  */
1045
1115
 
1046
1116
  /**
1047
1117
  * @function workbox.strategies.networkFirst
1048
- * @param {workbox.strategies.StrategyOptions} options
1118
+ * @param {Object} options See the {@link workbox.strategies.NetworkFirst}
1119
+ * constructor for more info.
1049
1120
  */
1050
1121
 
1051
1122
  /**
1052
1123
  * @function workbox.strategies.networkOnly
1053
- * @param {workbox.strategies.StrategyOptions} options
1124
+ * @param {Object} options See the {@link workbox.strategies.NetworkOnly}
1125
+ * constructor for more info.
1054
1126
  */
1055
1127
 
1056
1128
  /**
1057
1129
  * @function workbox.strategies.staleWhileRevalidate
1058
- * @param {workbox.strategies.StrategyOptions} options
1130
+ * @param {Object} options See the
1131
+ * {@link workbox.strategies.StaleWhileRevalidate} constructor for more info.
1059
1132
  */
1060
1133
 
1061
1134
  const mapping = {