jekyll-pwa-workbox 0.0.7.alpha → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jekyll-pwa-workbox.rb +1 -1
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-background-sync.dev.js +12 -13
- data/lib/vendor/workbox-v5.0.0/workbox-background-sync.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-background-sync.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-background-sync.prod.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.dev.js +288 -0
- data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-broadcast-update.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-cacheable-response.dev.js +6 -7
- data/lib/vendor/workbox-v5.0.0/workbox-cacheable-response.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-cacheable-response.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-cacheable-response.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-core.dev.js +306 -67
- data/lib/vendor/workbox-v5.0.0/workbox-core.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-core.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-core.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-expiration.dev.js +13 -14
- data/lib/vendor/workbox-v5.0.0/workbox-expiration.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-expiration.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-expiration.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-navigation-preload.dev.js +4 -5
- data/lib/vendor/workbox-v5.0.0/workbox-navigation-preload.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-navigation-preload.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-navigation-preload.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-offline-ga.dev.js +12 -13
- data/lib/vendor/workbox-v5.0.0/workbox-offline-ga.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-offline-ga.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-offline-ga.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-precaching.dev.js +314 -86
- data/lib/vendor/workbox-v5.0.0/workbox-precaching.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-precaching.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-precaching.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-range-requests.dev.js +8 -9
- data/lib/vendor/workbox-v5.0.0/workbox-range-requests.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-range-requests.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-range-requests.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-routing.dev.js +79 -182
- data/lib/vendor/workbox-v5.0.0/workbox-routing.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-routing.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-routing.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-strategies.dev.js +23 -227
- data/lib/vendor/workbox-v5.0.0/workbox-strategies.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-strategies.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-strategies.prod.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-streams.dev.js +16 -31
- data/lib/vendor/workbox-v5.0.0/workbox-streams.dev.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-streams.prod.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-streams.prod.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-sw.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-sw.js.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-window.dev.es5.mjs +317 -113
- data/lib/vendor/workbox-v5.0.0/workbox-window.dev.es5.mjs.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-window.dev.mjs +244 -44
- data/lib/vendor/workbox-v5.0.0/workbox-window.dev.mjs.map +1 -0
- data/lib/vendor/{workbox-v5.0.0.alpha1 → workbox-v5.0.0}/workbox-window.dev.umd.js +317 -113
- data/lib/vendor/workbox-v5.0.0/workbox-window.dev.umd.js.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-window.prod.es5.mjs +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-window.prod.es5.mjs.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-window.prod.mjs +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-window.prod.mjs.map +1 -0
- data/lib/vendor/workbox-v5.0.0/workbox-window.prod.umd.js +2 -0
- data/lib/vendor/workbox-v5.0.0/workbox-window.prod.umd.js.map +1 -0
- metadata +70 -69
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js +0 -486
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.dev.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.es5.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.umd.js.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs.map +0 -1
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js +0 -2
- data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-core.dev.js","sources":["../_version.js","../_private/logger.js","../models/messages/messages.js","../models/messages/messageGenerator.js","../_private/WorkboxError.js","../_private/assert.js","../models/quotaErrorCallbacks.js","../registerQuotaErrorCallback.js","../_private/cacheNames.js","../_private/executeQuotaErrorCallbacks.js","../_private/getFriendlyURL.js","../utils/pluginUtils.js","../_private/cacheWrapper.js","../_private/canConstructReadableStream.js","../_private/canConstructResponseFromBodyStream.js","../_private/dontWaitFor.js","../_private/DBWrapper.js","../_private/Deferred.js","../_private/deleteDatabase.js","../_private/fetchWrapper.js","../_private/timeout.js","../_private/resultingClientExists.js","../_private.js","../cacheNames.js","../copyResponse.js","../clientsClaim.js","../setCacheNameDetails.js","../skipWaiting.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst logger = (process.env.NODE_ENV === 'production' ? null : (() => {\n // Don't overwrite this value if it's already set.\n // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923\n if (!('__WB_DISABLE_DEV_LOGS' in self)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: `#7f8c8d`,\n log: `#2ecc71`,\n warn: `#f39c12`,\n error: `#c0392b`,\n groupCollapsed: `#3498db`,\n groupEnd: null,\n };\n const print = function (method, args) {\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === 'groupCollapsed') {\n // Safari doesn't print all console.groupCollapsed() arguments:\n // https://bugs.webkit.org/show_bug.cgi?id=182754\n if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n `border-radius: 0.5em`,\n `color: white`,\n `font-weight: bold`,\n `padding: 2px 0.5em`,\n ];\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n console[method](...logPrefix, ...args);\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n const api = {};\n const loggerMethods = Object.keys(methodToColorMap);\n for (const key of loggerMethods) {\n const method = key;\n api[method] = (...args) => {\n print(method, args);\n };\n }\n return api;\n})());\nexport { logger };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../../_version.js';\nexport const 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 ` +\n `unexpected value. ${validValueDescription} Received a value of ` +\n `${JSON.stringify(value)}.`;\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 '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 ` +\n `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n 'incorrect-type': ({ expectedType, paramName, moduleName, className, 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 ` +\n `'${moduleName}.${className ? (className + '.') : ''}` +\n `${funcName}()' must be of type ${expectedType}.`;\n },\n 'incorrect-class': ({ expectedClass, paramName, moduleName, className, funcName, isReturnValueProblem }) => {\n if (!expectedClass || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n if (isReturnValueProblem) {\n return `The return value from ` +\n `'${moduleName}.${className ? (className + '.') : ''}${funcName}()' ` +\n `must be an instance of class ${expectedClass.name}.`;\n }\n return `The parameter '${paramName}' passed into ` +\n `'${moduleName}.${className ? (className + '.') : ''}${funcName}()' ` +\n `must be an instance of class ${expectedClass.name}.`;\n },\n 'missing-a-method': ({ expectedMethod, paramName, moduleName, className, funcName }) => {\n if (!expectedMethod || !paramName || !moduleName || !className\n || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` +\n `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n 'add-to-cache-list-unexpected-type': ({ entry }) => {\n return `An unexpected entry was passed to ` +\n `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` +\n `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` +\n `strings with one or more characters, objects with a url property or ` +\n `Request objects.`;\n },\n 'add-to-cache-list-conflicting-entries': ({ firstEntry, secondEntry }) => {\n if (!firstEntry || !secondEntry) {\n throw new Error(`Unexpected input to ` +\n `'add-to-cache-list-duplicate-entries' error.`);\n }\n return `Two of the entries passed to ` +\n `'workbox-precaching.PrecacheController.addToCacheList()' had the URL ` +\n `${firstEntry._entryId} but different revision details. Workbox is ` +\n `is unable to cache and version the asset correctly. Please remove one ` +\n `of the entries.`;\n },\n 'plugin-error-request-will-fetch': ({ thrownError }) => {\n if (!thrownError) {\n throw new Error(`Unexpected input to ` +\n `'plugin-error-request-will-fetch', error.`);\n }\n return `An error was thrown by a plugins 'requestWillFetch()' method. ` +\n `The thrown error message was: '${thrownError.message}'.`;\n },\n 'invalid-cache-name': ({ cacheNameId, value }) => {\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n return `You must provide a name containing at least one character for ` +\n `setCacheDetails({${cacheNameId}: '...'}). Received a value of ` +\n `'${JSON.stringify(value)}'`;\n },\n 'unregister-route-but-not-found-with-method': ({ method }) => {\n if (!method) {\n throw new Error(`Unexpected input to ` +\n `'unregister-route-but-not-found-with-method' error.`);\n }\n return `The route you're trying to unregister was not previously ` +\n `registered for the method type '${method}'.`;\n },\n 'unregister-route-route-not-registered': () => {\n return `The route you're trying to unregister was not previously ` +\n `registered.`;\n },\n 'queue-replay-failed': ({ name }) => {\n return `Replaying the background sync queue '${name}' failed.`;\n },\n 'duplicate-queue-name': ({ name }) => {\n return `The Queue name '${name}' is already being used. ` +\n `All instances of backgroundSync.Queue must be given unique names.`;\n },\n 'expired-test-without-max-age': ({ methodName, paramName }) => {\n return `The '${methodName}()' method can only be used when the ` +\n `'${paramName}' is used in the constructor.`;\n },\n 'unsupported-route-type': ({ moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter was an unsupported type. ` +\n `Please check the docs for ${moduleName}.${className}.${funcName} for ` +\n `valid input types.`;\n },\n 'not-array-of-class': ({ value, expectedClass, moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter must be an array of ` +\n `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` +\n `Please check the call to ${moduleName}.${className}.${funcName}() ` +\n `to fix the issue.`;\n },\n 'max-entries-or-age-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.maxEntries or config.maxAgeSeconds` +\n `in ${moduleName}.${className}.${funcName}`;\n },\n 'statuses-or-headers-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.statuses or config.headers` +\n `in ${moduleName}.${className}.${funcName}`;\n },\n 'invalid-string': ({ moduleName, funcName, paramName }) => {\n if (!paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with ` +\n `'http' (for cross-origin matches) or '/' (for same-origin matches). ` +\n `Please see the docs for ${moduleName}.${funcName}() for ` +\n `more info.`;\n },\n 'channel-name-required': () => {\n return `You must provide a channelName to construct a ` +\n `BroadcastCacheUpdate instance.`;\n },\n 'invalid-responses-are-same-args': () => {\n return `The arguments passed into responsesAreSame() appear to be ` +\n `invalid. Please ensure valid Responses are used.`;\n },\n 'expire-custom-caches-only': () => {\n return `You must provide a 'cacheName' property when using the ` +\n `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'. ` +\n `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 ` +\n `value, and optional end value. The Range header provided was ` +\n `\"${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 ` +\n `one of those values is needed. The Range header provided was ` +\n `\"${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 ` +\n `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 ` +\n `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 ` +\n `defined.`;\n },\n 'no-response': ({ url, error }) => {\n let message = `The strategy could not generate a response for '${url}'.`;\n if (error) {\n message += ` The underlying error is ${error}.`;\n }\n return message;\n },\n 'bad-precaching-response': ({ url, status }) => {\n return `The precaching request for '${url}' failed with an HTTP ` +\n `status of ${status}.`;\n },\n 'non-precached-url': ({ url }) => {\n return `createHandlerBoundToURL('${url}') was called, but that URL is ` +\n `not precached. Please pass in a URL that is precached instead.`;\n },\n 'add-to-cache-list-conflicting-integrities': ({ url }) => {\n return `Two of the entries passed to ` +\n `'workbox-precaching.PrecacheController.addToCacheList()' had the URL ` +\n `${url} with different integrity values. Please remove one of them.`;\n },\n 'missing-precache-entry': ({ cacheName, url }) => {\n return `Unable to find a precached response in ${cacheName} for ${url}.`;\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { messages } from './messages.js';\nimport '../../_version.js';\nconst fallback = (code, ...args) => {\n let msg = code;\n if (args.length > 0) {\n msg += ` :: ${JSON.stringify(args)}`;\n }\n return msg;\n};\nconst generatorFunction = (code, details = {}) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n return message(details);\n};\nexport const messageGenerator = (process.env.NODE_ENV === 'production') ?\n fallback : generatorFunction;\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { messageGenerator } from '../models/messages/messageGenerator.js';\nimport '../_version.js';\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 */\nclass 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 = messageGenerator(errorCode, details);\n super(message);\n this.name = errorCode;\n this.details = details;\n }\n}\nexport { WorkboxError };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from '../_private/WorkboxError.js';\nimport '../_version.js';\n/*\n * This method returns true if the current context is a service worker.\n */\nconst isSWEnv = (moduleName) => {\n if (!('ServiceWorkerGlobalScope' in self)) {\n throw new WorkboxError('not-in-sw', { moduleName });\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 */\nconst isArray = (value, details) => {\n if (!Array.isArray(value)) {\n throw new WorkboxError('not-an-array', details);\n }\n};\nconst hasMethod = (object, expectedMethod, details) => {\n const type = typeof object[expectedMethod];\n if (type !== 'function') {\n details['expectedMethod'] = expectedMethod;\n throw new WorkboxError('missing-a-method', details);\n }\n};\nconst isType = (object, expectedType, details) => {\n if (typeof object !== expectedType) {\n details['expectedType'] = expectedType;\n throw new WorkboxError('incorrect-type', details);\n }\n};\nconst isInstance = (object, expectedClass, details) => {\n if (!(object instanceof expectedClass)) {\n details['expectedClass'] = expectedClass;\n throw new WorkboxError('incorrect-class', details);\n }\n};\nconst isOneOf = (value, validValues, details) => {\n if (!validValues.includes(value)) {\n details['validValueDescription'] =\n `Valid values are ${JSON.stringify(validValues)}.`;\n throw new WorkboxError('invalid-value', details);\n }\n};\nconst isArrayOfClass = (value, expectedClass, details) => {\n const error = new WorkboxError('not-array-of-class', details);\n if (!Array.isArray(value)) {\n throw error;\n }\n for (let item of value) {\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n};\nconst finalAssertExports = process.env.NODE_ENV === 'production' ? null : {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isSWEnv,\n isType,\n isArrayOfClass,\n};\nexport { finalAssertExports as assert };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n// Callbacks to be executed whenever there's a quota error.\nconst quotaErrorCallbacks = new Set();\nexport { quotaErrorCallbacks };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from './_private/logger.js';\nimport { assert } from './_private/assert.js';\nimport { quotaErrorCallbacks } from './models/quotaErrorCallbacks.js';\nimport './_version.js';\n/**\n * Adds a function to the set of quotaErrorCallbacks that will be executed if\n * there's a quota error.\n *\n * @param {Function} callback\n * @memberof module:workbox-core\n */\nfunction registerQuotaErrorCallback(callback) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(callback, 'function', {\n moduleName: 'workbox-core',\n funcName: 'register',\n paramName: 'callback',\n });\n }\n quotaErrorCallbacks.add(callback);\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered a callback to respond to quota errors.', callback);\n }\n}\nexport { registerQuotaErrorCallback };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst _cacheNameDetails = {\n googleAnalytics: 'googleAnalytics',\n precache: 'precache-v2',\n prefix: 'workbox',\n runtime: 'runtime',\n suffix: typeof registration !== 'undefined' ? registration.scope : '',\n};\nconst _createCacheName = (cacheName) => {\n return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix]\n .filter((value) => value && value.length > 0)\n .join('-');\n};\nconst eachCacheNameDetail = (fn) => {\n for (const key of Object.keys(_cacheNameDetails)) {\n fn(key);\n }\n};\nexport const cacheNames = {\n updateDetails: (details) => {\n eachCacheNameDetail((key) => {\n if (typeof details[key] === 'string') {\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 getPrefix: () => {\n return _cacheNameDetails.prefix;\n },\n getRuntimeName: (userCacheName) => {\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n },\n getSuffix: () => {\n return _cacheNameDetails.suffix;\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from '../_private/logger.js';\nimport { quotaErrorCallbacks } from '../models/quotaErrorCallbacks.js';\nimport '../_version.js';\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 module:workbox-core\n * @private\n */\nasync function executeQuotaErrorCallbacks() {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`About to run ${quotaErrorCallbacks.size} ` +\n `callbacks to clean up caches.`);\n }\n for (const callback of quotaErrorCallbacks) {\n await callback();\n if (process.env.NODE_ENV !== 'production') {\n logger.log(callback, 'is complete.');\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Finished running callbacks.');\n }\n}\nexport { executeQuotaErrorCallbacks };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst getFriendlyURL = (url) => {\n const urlObj = new URL(String(url), location.href);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n};\nexport { getFriendlyURL };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nexport const pluginUtils = {\n filter: (plugins, callbackName) => {\n return plugins.filter((plugin) => callbackName in plugin);\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from './assert.js';\nimport { executeQuotaErrorCallbacks } from './executeQuotaErrorCallbacks.js';\nimport { getFriendlyURL } from './getFriendlyURL.js';\nimport { logger } from './logger.js';\nimport { pluginUtils } from '../utils/pluginUtils.js';\nimport { WorkboxError } from './WorkboxError.js';\nimport '../_version.js';\n/**\n * Wrapper around cache.put().\n *\n * Will call `cacheDidUpdate` on plugins if the cache was updated, using\n * `matchOptions` when determining what the old entry is.\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 * @param {Object} [options.matchOptions]\n *\n * @private\n * @memberof module:workbox-core\n */\nconst putWrapper = async ({ cacheName, request, response, event, plugins = [], matchOptions, }) => {\n if (process.env.NODE_ENV !== 'production') {\n if (request.method && request.method !== 'GET') {\n throw new WorkboxError('attempt-to-cache-non-get-request', {\n url: getFriendlyURL(request.url),\n method: request.method,\n });\n }\n }\n const effectiveRequest = await _getEffectiveRequest({\n plugins, request, mode: 'write'\n });\n if (!response) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(`Cannot cache non-existent response for ` +\n `'${getFriendlyURL(effectiveRequest.url)}'.`);\n }\n throw new WorkboxError('cache-put-with-no-response', {\n url: getFriendlyURL(effectiveRequest.url),\n });\n }\n let responseToCache = await _isResponseSafeToCache({\n event,\n plugins,\n response,\n request: effectiveRequest,\n });\n if (!responseToCache) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` +\n `not be cached.`, responseToCache);\n }\n return;\n }\n const cache = await self.caches.open(cacheName);\n const updatePlugins = pluginUtils.filter(plugins, \"cacheDidUpdate\" /* CACHE_DID_UPDATE */);\n let oldResponse = updatePlugins.length > 0 ?\n await matchWrapper({ cacheName, matchOptions, request: effectiveRequest }) :\n null;\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Updating the '${cacheName}' cache with a new Response for ` +\n `${getFriendlyURL(effectiveRequest.url)}.`);\n }\n try {\n await cache.put(effectiveRequest, responseToCache);\n }\n catch (error) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n if (error.name === 'QuotaExceededError') {\n await executeQuotaErrorCallbacks();\n }\n throw error;\n }\n for (let plugin of updatePlugins) {\n await plugin[\"cacheDidUpdate\" /* CACHE_DID_UPDATE */].call(plugin, {\n cacheName,\n event,\n oldResponse,\n newResponse: responseToCache,\n request: effectiveRequest,\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 prompted 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 */\nconst matchWrapper = async ({ cacheName, request, event, matchOptions, plugins = [], }) => {\n const cache = await self.caches.open(cacheName);\n const effectiveRequest = await _getEffectiveRequest({\n plugins, request, mode: 'read'\n });\n let cachedResponse = await cache.match(effectiveRequest, matchOptions);\n if (process.env.NODE_ENV !== 'production') {\n if (cachedResponse) {\n logger.debug(`Found a cached response in '${cacheName}'.`);\n }\n else {\n logger.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (const plugin of plugins) {\n if (\"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */ in plugin) {\n const pluginMethod = plugin[\"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */];\n cachedResponse = await pluginMethod.call(plugin, {\n cacheName,\n event,\n matchOptions,\n cachedResponse,\n request: effectiveRequest,\n });\n if (process.env.NODE_ENV !== 'production') {\n if (cachedResponse) {\n assert.isInstance(cachedResponse, Response, {\n moduleName: 'Plugin',\n funcName: \"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */,\n isReturnValueProblem: true,\n });\n }\n }\n }\n }\n return cachedResponse;\n};\n/**\n * This method will call cacheWillUpdate on the available plugins (or use\n * status === 200) 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 */\nconst _isResponseSafeToCache = async ({ request, response, event, plugins = [], }) => {\n let responseToCache = response;\n let pluginsUsed = false;\n for (let plugin of plugins) {\n if (\"cacheWillUpdate\" /* CACHE_WILL_UPDATE */ in plugin) {\n pluginsUsed = true;\n const pluginMethod = plugin[\"cacheWillUpdate\" /* CACHE_WILL_UPDATE */];\n responseToCache = await pluginMethod.call(plugin, {\n request,\n response: responseToCache,\n event,\n });\n if (process.env.NODE_ENV !== 'production') {\n if (responseToCache) {\n assert.isInstance(responseToCache, Response, {\n moduleName: 'Plugin',\n funcName: \"cacheWillUpdate\" /* CACHE_WILL_UPDATE */,\n isReturnValueProblem: true,\n });\n }\n }\n if (!responseToCache) {\n break;\n }\n }\n }\n if (!pluginsUsed) {\n if (process.env.NODE_ENV !== 'production') {\n if (responseToCache) {\n if (responseToCache.status !== 200) {\n if (responseToCache.status === 0) {\n logger.warn(`The response for '${request.url}' is an opaque ` +\n `response. The caching strategy that you're using will not ` +\n `cache opaque responses by default.`);\n }\n else {\n logger.debug(`The response for '${request.url}' returned ` +\n `a status code of '${response.status}' and won't be cached as a ` +\n `result.`);\n }\n }\n }\n }\n responseToCache = responseToCache && responseToCache.status === 200 ?\n responseToCache : undefined;\n }\n return responseToCache ? responseToCache : null;\n};\n/**\n * Checks the list of plugins for the cacheKeyWillBeUsed callback, and\n * executes any of those callbacks found in sequence. The final `Request` object\n * returned by the last plugin is treated as the cache key for cache reads\n * and/or writes.\n *\n * @param {Object} options\n * @param {Request} options.request\n * @param {string} options.mode\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Request>}\n *\n * @private\n * @memberof module:workbox-core\n */\nconst _getEffectiveRequest = async ({ request, mode, plugins = [], }) => {\n const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, \"cacheKeyWillBeUsed\" /* CACHE_KEY_WILL_BE_USED */);\n let effectiveRequest = request;\n for (const plugin of cacheKeyWillBeUsedPlugins) {\n effectiveRequest = await plugin[\"cacheKeyWillBeUsed\" /* CACHE_KEY_WILL_BE_USED */].call(plugin, { mode, request: effectiveRequest });\n if (typeof effectiveRequest === 'string') {\n effectiveRequest = new Request(effectiveRequest);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(effectiveRequest, Request, {\n moduleName: 'Plugin',\n funcName: \"cacheKeyWillBeUsed\" /* CACHE_KEY_WILL_BE_USED */,\n isReturnValueProblem: true,\n });\n }\n }\n return effectiveRequest;\n};\nexport const cacheWrapper = {\n put: putWrapper,\n match: matchWrapper,\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nlet supportStatus;\n/**\n * A utility function that determines whether the current browser supports\n * constructing a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * object.\n *\n * @return {boolean} `true`, if the current browser can successfully\n * construct a `ReadableStream`, `false` otherwise.\n *\n * @private\n */\nfunction canConstructReadableStream() {\n if (supportStatus === undefined) {\n // See https://github.com/GoogleChrome/workbox/issues/1473\n try {\n new ReadableStream({ start() { } });\n supportStatus = true;\n }\n catch (error) {\n supportStatus = false;\n }\n }\n return supportStatus;\n}\nexport { canConstructReadableStream };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nlet supportStatus;\n/**\n * A utility function that determines whether the current browser supports\n * constructing a new `Response` from a `response.body` stream.\n *\n * @return {boolean} `true`, if the current browser can successfully\n * construct a `Response` from a `response.body` stream, `false` otherwise.\n *\n * @private\n */\nfunction canConstructResponseFromBodyStream() {\n if (supportStatus === undefined) {\n const testResponse = new Response('');\n if ('body' in testResponse) {\n try {\n new Response(testResponse.body);\n supportStatus = true;\n }\n catch (error) {\n supportStatus = false;\n }\n }\n supportStatus = false;\n }\n return supportStatus;\n}\nexport { canConstructResponseFromBodyStream };\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n promise.then(() => { });\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\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 */\nexport class DBWrapper {\n /**\n * @param {string} name\n * @param {number} version\n * @param {Object=} [callback]\n * @param {!Function} [callbacks.onupgradeneeded]\n * @param {!Function} [callbacks.onversionchange] Defaults to\n * DBWrapper.prototype._onversionchange when not specified.\n * @private\n */\n constructor(name, version, { onupgradeneeded, onversionchange, } = {}) {\n this._db = null;\n this._name = name;\n this._version = version;\n this._onupgradeneeded = onupgradeneeded;\n this._onversionchange = onversionchange || (() => this.close());\n }\n /**\n * Returns the IDBDatabase instance (not normally needed).\n * @return {IDBDatabase|undefined}\n *\n * @private\n */\n get db() {\n return this._db;\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 * @private\n */\n async open() {\n if (this._db)\n return;\n this._db = await new Promise((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(() => {\n openRequestTimedOut = true;\n reject(new Error('The open request was blocked and timed out'));\n }, this.OPEN_TIMEOUT);\n const openRequest = indexedDB.open(this._name, this._version);\n openRequest.onerror = () => reject(openRequest.error);\n openRequest.onupgradeneeded = (evt) => {\n if (openRequestTimedOut) {\n openRequest.transaction.abort();\n openRequest.result.close();\n }\n else if (typeof this._onupgradeneeded === 'function') {\n this._onupgradeneeded(evt);\n }\n };\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n if (openRequestTimedOut) {\n db.close();\n }\n else {\n db.onversionchange = this._onversionchange.bind(this);\n resolve(db);\n }\n };\n });\n return this;\n }\n /**\n * Polyfills the native `getKey()` method. Note, this is overridden at\n * runtime if the browser supports the native method.\n *\n * @param {string} storeName\n * @param {*} query\n * @return {Array}\n * @private\n */\n async getKey(storeName, query) {\n return (await this.getAllKeys(storeName, query, 1))[0];\n }\n /**\n * Polyfills the native `getAll()` method. Note, this is overridden at\n * runtime if the browser supports the native method.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n * @private\n */\n async getAll(storeName, query, count) {\n return await this.getAllMatching(storeName, { query, count });\n }\n /**\n * Polyfills the native `getAllKeys()` method. Note, this is overridden at\n * runtime if the browser supports the native method.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n * @private\n */\n async getAllKeys(storeName, query, count) {\n const entries = await this.getAllMatching(storeName, { query, count, includeKeys: true });\n return entries.map((entry) => entry.key);\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 {string} [opts.index] The index to use (if specified).\n * @param {*} [opts.query]\n * @param {IDBCursorDirection} [opts.direction]\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 * @private\n */\n async getAllMatching(storeName, { index, query = null, // IE/Edge errors if query === `undefined`.\n direction = 'next', count, includeKeys = false, } = {}) {\n return await this.transaction([storeName], 'readonly', (txn, done) => {\n const store = txn.objectStore(storeName);\n const target = index ? store.index(index) : store;\n const results = [];\n const request = target.openCursor(query, direction);\n request.onsuccess = () => {\n const cursor = request.result;\n if (cursor) {\n results.push(includeKeys ? cursor : cursor.value);\n if (count && results.length >= count) {\n done(results);\n }\n else {\n cursor.continue();\n }\n }\n else {\n done(results);\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 two arguments:\n * 1. The IDBTransaction object\n * 2. A `done` function, that's used to resolve the promise when\n * when the transaction is done, if passed a value, the promise is\n * resolved to that value.\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} callback\n * @return {*} The result of the transaction ran by the callback.\n * @private\n */\n async transaction(storeNames, type, callback) {\n await this.open();\n return await new Promise((resolve, reject) => {\n const txn = this._db.transaction(storeNames, type);\n txn.onabort = () => reject(txn.error);\n txn.oncomplete = () => resolve();\n callback(txn, (value) => resolve(value));\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 * @private\n */\n async _call(method, storeName, type, ...args) {\n const callback = (txn, done) => {\n const objStore = txn.objectStore(storeName);\n // TODO(philipwalton): Fix this underlying TS2684 error.\n // @ts-ignore\n const request = objStore[method].apply(objStore, args);\n request.onsuccess = () => done(request.result);\n };\n return await this.transaction([storeName], type, callback);\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) {\n this._db.close();\n this._db = null;\n }\n }\n}\n// Exposed on the prototype to let users modify the default timeout on a\n// per-instance or global basis.\nDBWrapper.prototype.OPEN_TIMEOUT = 2000;\n// Wrap native IDBObjectStore methods according to their mode.\nconst methodsToWrap = {\n readonly: ['get', 'count', 'getKey', 'getAll', 'getAllKeys'],\n readwrite: ['add', 'put', 'clear', 'delete'],\n};\nfor (const [mode, methods] of Object.entries(methodsToWrap)) {\n for (const method of methods) {\n if (method in IDBObjectStore.prototype) {\n // Don't use arrow functions here since we're outside of the class.\n DBWrapper.prototype[method] =\n async function (storeName, ...args) {\n return await this._call(method, storeName, mode, ...args);\n };\n }\n }\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Deletes the database.\n * Note: this is exported separately from the DBWrapper module because most\n * usages of IndexedDB in workbox dont need deleting, and this way it can be\n * reused in tests to delete databases without creating DBWrapper instances.\n *\n * @param {string} name The database name.\n * @private\n */\nexport const deleteDatabase = async (name) => {\n await new Promise((resolve, reject) => {\n const request = indexedDB.deleteDatabase(name);\n request.onerror = () => {\n reject(request.error);\n };\n request.onblocked = () => {\n reject(new Error('Delete blocked'));\n };\n request.onsuccess = () => {\n resolve();\n };\n });\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from './WorkboxError.js';\nimport { logger } from './logger.js';\nimport { assert } from './assert.js';\nimport { getFriendlyURL } from '../_private/getFriendlyURL.js';\nimport { pluginUtils } from '../utils/pluginUtils.js';\nimport '../_version.js';\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 {ExtendableEvent} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\nconst wrappedFetch = async ({ request, fetchOptions, event, plugins = [], }) => {\n if (typeof request === 'string') {\n request = new Request(request);\n }\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 instanceof FetchEvent && event.preloadResponse) {\n const possiblePreloadResponse = await event.preloadResponse;\n if (possiblePreloadResponse) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Using a preloaded navigation response for ` +\n `'${getFriendlyURL(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n paramName: 'request',\n expectedClass: Request,\n moduleName: 'workbox-core',\n className: 'fetchWrapper',\n funcName: 'wrappedFetch',\n });\n }\n const failedFetchPlugins = pluginUtils.filter(plugins, \"fetchDidFail\" /* FETCH_DID_FAIL */);\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 ?\n request.clone() : null;\n try {\n for (let plugin of plugins) {\n if (\"requestWillFetch\" /* REQUEST_WILL_FETCH */ in plugin) {\n const pluginMethod = plugin[\"requestWillFetch\" /* REQUEST_WILL_FETCH */];\n const requestClone = request.clone();\n request = (await pluginMethod.call(plugin, {\n request: requestClone,\n event,\n }));\n if (process.env.NODE_ENV !== 'production') {\n if (request) {\n assert.isInstance(request, Request, {\n moduleName: 'Plugin',\n funcName: \"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */,\n isReturnValueProblem: true,\n });\n }\n }\n }\n }\n }\n catch (err) {\n throw new WorkboxError('plugin-error-request-will-fetch', {\n thrownError: err,\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 let pluginFilteredRequest = request.clone();\n try {\n let fetchResponse;\n // See https://github.com/GoogleChrome/workbox/issues/1796\n if (request.mode === 'navigate') {\n fetchResponse = await fetch(request);\n }\n else {\n fetchResponse = await fetch(request, fetchOptions);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Network request for ` +\n `'${getFriendlyURL(request.url)}' returned a response with ` +\n `status '${fetchResponse.status}'.`);\n }\n for (const plugin of plugins) {\n if (\"fetchDidSucceed\" /* FETCH_DID_SUCCEED */ in plugin) {\n fetchResponse = await plugin[\"fetchDidSucceed\" /* FETCH_DID_SUCCEED */]\n .call(plugin, {\n event,\n request: pluginFilteredRequest,\n response: fetchResponse,\n });\n if (process.env.NODE_ENV !== 'production') {\n if (fetchResponse) {\n assert.isInstance(fetchResponse, Response, {\n moduleName: 'Plugin',\n funcName: \"fetchDidSucceed\" /* FETCH_DID_SUCCEED */,\n isReturnValueProblem: true,\n });\n }\n }\n }\n }\n return fetchResponse;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(`Network request for ` +\n `'${getFriendlyURL(request.url)}' threw an error.`, error);\n }\n for (const plugin of failedFetchPlugins) {\n await plugin[\"fetchDidFail\" /* FETCH_DID_FAIL */].call(plugin, {\n error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone(),\n });\n }\n throw error;\n }\n};\nconst fetchWrapper = {\n fetch: wrappedFetch,\n};\nexport { fetchWrapper };\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns a promise that resolves and the passed number of milliseconds.\n * This utility is an async/await-friendly version of `setTimeout`.\n *\n * @param {number} ms\n * @return {Promise}\n * @private\n */\nexport function timeout(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { timeout } from './timeout.js';\nimport '../_version.js';\nconst MAX_RETRY_TIME = 2000;\n/**\n * Returns a promise that resolves to a window client matching the passed\n * `resultingClientId`. For browsers that don't support `resultingClientId`\n * or if waiting for the resulting client to apper takes too long, resolve to\n * `undefined`.\n *\n * @param {string} [resultingClientId]\n * @return {Promise<Client|undefined>}\n * @private\n */\nexport async function resultingClientExists(resultingClientId) {\n if (!resultingClientId) {\n return;\n }\n let existingWindows = await self.clients.matchAll({ type: 'window' });\n const existingWindowIds = new Set(existingWindows.map((w) => w.id));\n let resultingWindow;\n const startTime = performance.now();\n // Only wait up to `MAX_RETRY_TIME` to find a matching client.\n while (performance.now() - startTime < MAX_RETRY_TIME) {\n existingWindows = await self.clients.matchAll({ type: 'window' });\n resultingWindow = existingWindows.find((w) => {\n if (resultingClientId) {\n // If we have a `resultingClientId`, we can match on that.\n return w.id === resultingClientId;\n }\n else {\n // Otherwise match on finding a window not in `existingWindowIds`.\n return !existingWindowIds.has(w.id);\n }\n });\n if (resultingWindow) {\n break;\n }\n // Sleep for 100ms and retry.\n await timeout(100);\n }\n return resultingWindow;\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n// We either expose defaults or we expose every named export.\nimport { assert } from './_private/assert.js';\nimport { cacheNames } from './_private/cacheNames.js';\nimport { cacheWrapper } from './_private/cacheWrapper.js';\nimport { canConstructReadableStream } from './_private/canConstructReadableStream.js';\nimport { canConstructResponseFromBodyStream } from './_private/canConstructResponseFromBodyStream.js';\nimport { dontWaitFor } from './_private/dontWaitFor.js';\nimport { DBWrapper } from './_private/DBWrapper.js';\nimport { Deferred } from './_private/Deferred.js';\nimport { deleteDatabase } from './_private/deleteDatabase.js';\nimport { executeQuotaErrorCallbacks } from './_private/executeQuotaErrorCallbacks.js';\nimport { fetchWrapper } from './_private/fetchWrapper.js';\nimport { getFriendlyURL } from './_private/getFriendlyURL.js';\nimport { logger } from './_private/logger.js';\nimport { resultingClientExists } from './_private/resultingClientExists.js';\nimport { timeout } from './_private/timeout.js';\nimport { WorkboxError } from './_private/WorkboxError.js';\nimport './_version.js';\nexport { assert, cacheNames, cacheWrapper, canConstructReadableStream, canConstructResponseFromBodyStream, dontWaitFor, DBWrapper, Deferred, deleteDatabase, executeQuotaErrorCallbacks, fetchWrapper, getFriendlyURL, logger, resultingClientExists, timeout, WorkboxError, };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { cacheNames as _cacheNames } from './_private/cacheNames.js';\nimport './_version.js';\n/**\n * Get the current cache names and prefix/suffix 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`, and `cacheNames.runtime` is used for everything else.\n *\n * `cacheNames.prefix` can be used to retrieve just the current prefix value.\n * `cacheNames.suffix` can be used to retrieve just the current suffix value.\n *\n * @return {Object} An object with `precache`, `runtime`, `prefix`, and\n * `googleAnalytics` properties.\n *\n * @memberof module:workbox-core\n */\nconst cacheNames = {\n get googleAnalytics() {\n return _cacheNames.getGoogleAnalyticsName();\n },\n get precache() {\n return _cacheNames.getPrecacheName();\n },\n get prefix() {\n return _cacheNames.getPrefix();\n },\n get runtime() {\n return _cacheNames.getRuntimeName();\n },\n get suffix() {\n return _cacheNames.getSuffix();\n },\n};\nexport { cacheNames };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { canConstructResponseFromBodyStream } from './_private/canConstructResponseFromBodyStream.js';\nimport './_version.js';\n/**\n * Allows developers to copy a response and modify its `headers`, `status`,\n * or `statusText` values (the values settable via a\n * [`ResponseInit`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#Syntax}\n * object in the constructor).\n * To modify these values, pass a function as the second argument. That\n * function will be invoked with a single object with the response properties\n * `{headers, status, statusText}`. The return value of this function will\n * be used as the `ResponseInit` for the new `Response`. To change the values\n * either modify the passed parameter(s) and return it, or return a totally\n * new object.\n *\n * @param {Response} response\n * @param {Function} modifier\n * @memberof module:workbox-core\n */\nasync function copyResponse(response, modifier) {\n const clonedResponse = response.clone();\n // Create a fresh `ResponseInit` object by cloning the headers.\n const responseInit = {\n headers: new Headers(clonedResponse.headers),\n status: clonedResponse.status,\n statusText: clonedResponse.statusText,\n };\n // Apply any user modifications.\n const modifiedResponseInit = modifier ? modifier(responseInit) : responseInit;\n // Create the new response from the body stream and `ResponseInit`\n // modifications. Note: not all browsers support the Response.body stream,\n // so fall back to reading the entire body into memory as a blob.\n const body = canConstructResponseFromBodyStream() ?\n clonedResponse.body : await clonedResponse.blob();\n return new Response(body, modifiedResponseInit);\n}\n;\nexport { copyResponse };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Claim any currently available clients once the service worker\n * becomes active. This is normally used in conjunction with `skipWaiting()`.\n *\n * @memberof module:workbox-core\n */\nfunction clientsClaim() {\n self.addEventListener('activate', () => self.clients.claim());\n}\n;\nexport { clientsClaim };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from './_private/assert.js';\nimport { cacheNames } from './_private/cacheNames.js';\nimport { WorkboxError } from './_private/WorkboxError.js';\nimport './_version.js';\n/**\n * Modifies the default cache names used by the Workbox packages.\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 * @memberof module:workbox-core\n */\nfunction setCacheNameDetails(details) {\n if (process.env.NODE_ENV !== 'production') {\n Object.keys(details).forEach((key) => {\n assert.isType(details[key], 'string', {\n moduleName: 'workbox-core',\n funcName: 'setCacheNameDetails',\n paramName: `details.${key}`,\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 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 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 cacheNames.updateDetails(details);\n}\n;\nexport { setCacheNameDetails };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Force a service worker to activate immediately, instead of\n * [waiting](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting)\n * for existing clients to close.\n *\n * @memberof module:workbox-core\n */\nfunction skipWaiting() {\n // We need to explicitly call `self.skipWaiting()` here because we're\n // shadowing `skipWaiting` with this local function.\n self.addEventListener('install', () => self.skipWaiting());\n}\n;\nexport { skipWaiting };\n"],"names":["self","_","e","logger","process","__WB_DISABLE_DEV_LOGS","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","test","navigator","userAgent","console","styles","logPrefix","join","api","loggerMethods","Object","keys","key","messages","paramName","validValueDescription","value","Error","JSON","stringify","moduleName","className","funcName","expectedType","expectedClass","isReturnValueProblem","name","expectedMethod","entry","firstEntry","secondEntry","_entryId","thrownError","message","cacheNameId","methodName","normalizedRangeHeader","size","start","end","url","status","cacheName","generatorFunction","code","details","messageGenerator","WorkboxError","constructor","errorCode","isSWEnv","isArray","Array","hasMethod","object","type","isType","isInstance","isOneOf","validValues","includes","isArrayOfClass","item","finalAssertExports","quotaErrorCallbacks","Set","registerQuotaErrorCallback","callback","assert","add","_cacheNameDetails","googleAnalytics","precache","prefix","runtime","suffix","registration","scope","_createCacheName","filter","length","eachCacheNameDetail","fn","cacheNames","updateDetails","getGoogleAnalyticsName","userCacheName","getPrecacheName","getPrefix","getRuntimeName","getSuffix","executeQuotaErrorCallbacks","getFriendlyURL","urlObj","URL","String","location","href","origin","pathname","pluginUtils","plugins","callbackName","plugin","putWrapper","request","response","event","matchOptions","effectiveRequest","_getEffectiveRequest","mode","responseToCache","_isResponseSafeToCache","cache","caches","open","updatePlugins","oldResponse","matchWrapper","put","call","newResponse","cachedResponse","match","pluginMethod","Response","pluginsUsed","undefined","cacheKeyWillBeUsedPlugins","Request","cacheWrapper","supportStatus","canConstructReadableStream","ReadableStream","canConstructResponseFromBodyStream","testResponse","body","dontWaitFor","promise","then","DBWrapper","version","onupgradeneeded","onversionchange","_db","_name","_version","_onupgradeneeded","_onversionchange","close","db","Promise","resolve","reject","openRequestTimedOut","setTimeout","OPEN_TIMEOUT","openRequest","indexedDB","onerror","evt","transaction","abort","result","onsuccess","bind","getKey","storeName","query","getAllKeys","getAll","count","getAllMatching","entries","includeKeys","map","index","direction","txn","done","store","objectStore","target","results","openCursor","cursor","push","continue","storeNames","onabort","oncomplete","_call","objStore","apply","prototype","methodsToWrap","readonly","readwrite","methods","IDBObjectStore","Deferred","deleteDatabase","onblocked","wrappedFetch","fetchOptions","FetchEvent","preloadResponse","possiblePreloadResponse","failedFetchPlugins","originalRequest","clone","requestClone","err","pluginFilteredRequest","fetchResponse","fetch","fetchWrapper","timeout","ms","MAX_RETRY_TIME","resultingClientExists","resultingClientId","existingWindows","clients","matchAll","existingWindowIds","w","id","resultingWindow","startTime","performance","now","find","has","_cacheNames","copyResponse","modifier","clonedResponse","responseInit","headers","Headers","statusText","modifiedResponseInit","blob","clientsClaim","addEventListener","claim","setCacheNameDetails","forEach","skipWaiting"],"mappings":";;;;IAEA,IAAI;IACAA,EAAAA,IAAI,CAAC,oBAAD,CAAJ,IAA8BC,CAAC,EAA/B;IACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ICLV;;;;;;AAMA,IACA,MAAMC,MAAM,GAAIC,CAA+C,CAAC,MAAM;IAClE;IACA;IACA,MAAI,EAAE,2BAA2BJ,IAA7B,CAAJ,EAAwC;IACpCA,IAAAA,IAAI,CAACK,qBAAL,GAA6B,KAA7B;IACH;;IACD,MAAIC,OAAO,GAAG,KAAd;IACA,QAAMC,gBAAgB,GAAG;IACrBC,IAAAA,KAAK,EAAG,SADa;IAErBC,IAAAA,GAAG,EAAG,SAFe;IAGrBC,IAAAA,IAAI,EAAG,SAHc;IAIrBC,IAAAA,KAAK,EAAG,SAJa;IAKrBC,IAAAA,cAAc,EAAG,SALI;IAMrBC,IAAAA,QAAQ,EAAE;IANW,GAAzB;;IAQA,QAAMC,KAAK,GAAG,UAAUC,MAAV,EAAkBC,IAAlB,EAAwB;IAClC,QAAIhB,IAAI,CAACK,qBAAT,EAAgC;IAC5B;IACH;;IACD,QAAIU,MAAM,KAAK,gBAAf,EAAiC;IAC7B;IACA;IACA,UAAI,iCAAiCE,IAAjC,CAAsCC,SAAS,CAACC,SAAhD,CAAJ,EAAgE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,GAAuB;IACnB;IACA;IACA1Q,EAAAA,IAAI,CAACsQ,gBAAL,CAAsB,SAAtB,EAAiC,MAAMtQ,IAAI,CAAC0Q,WAAL,EAAvC;IACH;;;;;;;;;;;;;;;;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
this.workbox=this.workbox||{},this.workbox.core=function(e){"use strict";try{self["workbox:core:5.0.0"]&&_()}catch(e){}const t=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n};class n extends Error{constructor(e,n){super(t(e,n)),this.name=e,this.details=n}}const s=new Set;const r={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},i=e=>[r.prefix,e,r.suffix].filter(e=>e&&e.length>0).join("-"),a={updateDetails:e=>{(e=>{for(const t of Object.keys(r))e(t)})(t=>{"string"==typeof e[t]&&(r[t]=e[t])})},getGoogleAnalyticsName:e=>e||i(r.googleAnalytics),getPrecacheName:e=>e||i(r.precache),getPrefix:()=>r.prefix,getRuntimeName:e=>e||i(r.runtime),getSuffix:()=>r.suffix};async function o(){for(const e of s)await e()}const c=e=>{const t=new URL(String(e),location.href);return t.origin===location.origin?t.pathname:t.href},u=(e,t)=>e.filter(e=>t in e),l=async({cacheName:e,request:t,event:n,matchOptions:s,plugins:r=[]})=>{const i=await self.caches.open(e),a=await h({plugins:r,request:t,mode:"read"});let o=await i.match(a,s);for(const t of r)if("cachedResponseWillBeUsed"in t){const r=t.cachedResponseWillBeUsed;o=await r.call(t,{cacheName:e,event:n,matchOptions:s,cachedResponse:o,request:a})}return o},f=async({request:e,response:t,event:n,plugins:s=[]})=>{let r=t,i=!1;for(let t of s)if("cacheWillUpdate"in t){i=!0;const s=t.cacheWillUpdate;if(!(r=await s.call(t,{request:e,response:r,event:n})))break}return i||(r=r&&200===r.status?r:void 0),r||null},h=async({request:e,mode:t,plugins:n=[]})=>{const s=u(n,"cacheKeyWillBeUsed");let r=e;for(const e of s)"string"==typeof(r=await e.cacheKeyWillBeUsed.call(e,{mode:t,request:r}))&&(r=new Request(r));return r},w={put:async({cacheName:e,request:t,response:s,event:r,plugins:i=[],matchOptions:a})=>{const w=await h({plugins:i,request:t,mode:"write"});if(!s)throw new n("cache-put-with-no-response",{url:c(w.url)});let d=await f({event:r,plugins:i,response:s,request:w});if(!d)return;const p=await self.caches.open(e),g=u(i,"cacheDidUpdate");let y=g.length>0?await l({cacheName:e,matchOptions:a,request:w}):null;try{await p.put(w,d)}catch(e){throw"QuotaExceededError"===e.name&&await o(),e}for(let t of g)await t.cacheDidUpdate.call(t,{cacheName:e,event:r,oldResponse:y,newResponse:d,request:w})},match:l};let d,p;function g(){if(void 0===p){const e=new Response("");if("body"in e)try{new Response(e.body),p=!0}catch(e){p=!1}p=!1}return p}class y{constructor(e,t,{onupgradeneeded:n,onversionchange:s}={}){this.t=null,this.s=e,this.i=t,this.o=n,this.u=s||(()=>this.close())}get db(){return this.t}async open(){if(!this.t)return this.t=await new Promise((e,t)=>{let n=!1;setTimeout(()=>{n=!0,t(new Error("The open request was blocked and timed out"))},this.OPEN_TIMEOUT);const s=indexedDB.open(this.s,this.i);s.onerror=(()=>t(s.error)),s.onupgradeneeded=(e=>{n?(s.transaction.abort(),s.result.close()):"function"==typeof this.o&&this.o(e)}),s.onsuccess=(()=>{const t=s.result;n?t.close():(t.onversionchange=this.u.bind(this),e(t))})}),this}async getKey(e,t){return(await this.getAllKeys(e,t,1))[0]}async getAll(e,t,n){return await this.getAllMatching(e,{query:t,count:n})}async getAllKeys(e,t,n){return(await this.getAllMatching(e,{query:t,count:n,includeKeys:!0})).map(e=>e.key)}async getAllMatching(e,{index:t,query:n=null,direction:s="next",count:r,includeKeys:i=!1}={}){return await this.transaction([e],"readonly",(a,o)=>{const c=a.objectStore(e),u=t?c.index(t):c,l=[],f=u.openCursor(n,s);f.onsuccess=(()=>{const e=f.result;e?(l.push(i?e:e.value),r&&l.length>=r?o(l):e.continue()):o(l)})})}async transaction(e,t,n){return await this.open(),await new Promise((s,r)=>{const i=this.t.transaction(e,t);i.onabort=(()=>r(i.error)),i.oncomplete=(()=>s()),n(i,e=>s(e))})}async l(e,t,n,...s){return await this.transaction([t],n,(n,r)=>{const i=n.objectStore(t),a=i[e].apply(i,s);a.onsuccess=(()=>r(a.result))})}close(){this.t&&(this.t.close(),this.t=null)}}y.prototype.OPEN_TIMEOUT=2e3;const m={readonly:["get","count","getKey","getAll","getAllKeys"],readwrite:["add","put","clear","delete"]};for(const[e,t]of Object.entries(m))for(const n of t)n in IDBObjectStore.prototype&&(y.prototype[n]=async function(t,...s){return await this.l(n,t,e,...s)});const q={fetch:async({request:e,fetchOptions:t,event:s,plugins:r=[]})=>{if("string"==typeof e&&(e=new Request(e)),s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const i=u(r,"fetchDidFail"),a=i.length>0?e.clone():null;try{for(let t of r)if("requestWillFetch"in t){const n=t.requestWillFetch,r=e.clone();e=await n.call(t,{request:r,event:s})}}catch(e){throw new n("plugin-error-request-will-fetch",{thrownError:e})}let o=e.clone();try{let n;n="navigate"===e.mode?await fetch(e):await fetch(e,t);for(const e of r)"fetchDidSucceed"in e&&(n=await e.fetchDidSucceed.call(e,{event:s,request:o,response:n}));return n}catch(e){for(const t of i)await t.fetchDidFail.call(t,{error:e,event:s,originalRequest:a.clone(),request:o.clone()});throw e}}};function v(e){return new Promise(t=>setTimeout(t,e))}const x=2e3;var R=Object.freeze({assert:null,cacheNames:a,cacheWrapper:w,canConstructReadableStream:function(){if(void 0===d)try{new ReadableStream({start(){}}),d=!0}catch(e){d=!1}return d},canConstructResponseFromBodyStream:g,dontWaitFor:function(e){e.then(()=>{})},DBWrapper:y,Deferred:class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},deleteDatabase:async e=>{await new Promise((t,n)=>{const s=indexedDB.deleteDatabase(e);s.onerror=(()=>{n(s.error)}),s.onblocked=(()=>{n(new Error("Delete blocked"))}),s.onsuccess=(()=>{t()})})},executeQuotaErrorCallbacks:o,fetchWrapper:q,getFriendlyURL:c,logger:null,resultingClientExists:async function(e){if(!e)return;let t=await self.clients.matchAll({type:"window"});const n=new Set(t.map(e=>e.id));let s;const r=performance.now();for(;performance.now()-r<x&&!(s=(t=await self.clients.matchAll({type:"window"})).find(t=>e?t.id===e:!n.has(t.id)));)await v(100);return s},timeout:v,WorkboxError:n});const b={get googleAnalytics(){return a.getGoogleAnalyticsName()},get precache(){return a.getPrecacheName()},get prefix(){return a.getPrefix()},get runtime(){return a.getRuntimeName()},get suffix(){return a.getSuffix()}};return e._private=R,e.cacheNames=b,e.clientsClaim=function(){self.addEventListener("activate",()=>self.clients.claim())},e.copyResponse=async function(e,t){const n=e.clone(),s={headers:new Headers(n.headers),status:n.status,statusText:n.statusText},r=t?t(s):s,i=g()?n.body:await n.blob();return new Response(i,r)},e.registerQuotaErrorCallback=function(e){s.add(e)},e.setCacheNameDetails=function(e){a.updateDetails(e)},e.skipWaiting=function(){self.addEventListener("install",()=>self.skipWaiting())},e}({});
|
2
|
+
//# sourceMappingURL=workbox-core.prod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-core.prod.js","sources":["../_version.js","../_private/logger.js","../models/messages/messageGenerator.js","../_private/WorkboxError.js","../_private/assert.js","../models/quotaErrorCallbacks.js","../_private/cacheNames.js","../_private/executeQuotaErrorCallbacks.js","../_private/getFriendlyURL.js","../utils/pluginUtils.js","../_private/cacheWrapper.js","../_private/canConstructReadableStream.js","../_private/canConstructResponseFromBodyStream.js","../_private/DBWrapper.js","../_private/deleteDatabase.js","../_private/fetchWrapper.js","../_private/timeout.js","../_private/resultingClientExists.js","../_private/dontWaitFor.js","../_private/Deferred.js","../cacheNames.js","../clientsClaim.js","../copyResponse.js","../registerQuotaErrorCallback.js","../setCacheNameDetails.js","../skipWaiting.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:core:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst logger = (process.env.NODE_ENV === 'production' ? null : (() => {\n // Don't overwrite this value if it's already set.\n // See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923\n if (!('__WB_DISABLE_DEV_LOGS' in self)) {\n self.__WB_DISABLE_DEV_LOGS = false;\n }\n let inGroup = false;\n const methodToColorMap = {\n debug: `#7f8c8d`,\n log: `#2ecc71`,\n warn: `#f39c12`,\n error: `#c0392b`,\n groupCollapsed: `#3498db`,\n groupEnd: null,\n };\n const print = function (method, args) {\n if (self.__WB_DISABLE_DEV_LOGS) {\n return;\n }\n if (method === 'groupCollapsed') {\n // Safari doesn't print all console.groupCollapsed() arguments:\n // https://bugs.webkit.org/show_bug.cgi?id=182754\n if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n console[method](...args);\n return;\n }\n }\n const styles = [\n `background: ${methodToColorMap[method]}`,\n `border-radius: 0.5em`,\n `color: white`,\n `font-weight: bold`,\n `padding: 2px 0.5em`,\n ];\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n console[method](...logPrefix, ...args);\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n const api = {};\n const loggerMethods = Object.keys(methodToColorMap);\n for (const key of loggerMethods) {\n const method = key;\n api[method] = (...args) => {\n print(method, args);\n };\n }\n return api;\n})());\nexport { logger };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { messages } from './messages.js';\nimport '../../_version.js';\nconst fallback = (code, ...args) => {\n let msg = code;\n if (args.length > 0) {\n msg += ` :: ${JSON.stringify(args)}`;\n }\n return msg;\n};\nconst generatorFunction = (code, details = {}) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n return message(details);\n};\nexport const messageGenerator = (process.env.NODE_ENV === 'production') ?\n fallback : generatorFunction;\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { messageGenerator } from '../models/messages/messageGenerator.js';\nimport '../_version.js';\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 */\nclass 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 = messageGenerator(errorCode, details);\n super(message);\n this.name = errorCode;\n this.details = details;\n }\n}\nexport { WorkboxError };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from '../_private/WorkboxError.js';\nimport '../_version.js';\n/*\n * This method returns true if the current context is a service worker.\n */\nconst isSWEnv = (moduleName) => {\n if (!('ServiceWorkerGlobalScope' in self)) {\n throw new WorkboxError('not-in-sw', { moduleName });\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 */\nconst isArray = (value, details) => {\n if (!Array.isArray(value)) {\n throw new WorkboxError('not-an-array', details);\n }\n};\nconst hasMethod = (object, expectedMethod, details) => {\n const type = typeof object[expectedMethod];\n if (type !== 'function') {\n details['expectedMethod'] = expectedMethod;\n throw new WorkboxError('missing-a-method', details);\n }\n};\nconst isType = (object, expectedType, details) => {\n if (typeof object !== expectedType) {\n details['expectedType'] = expectedType;\n throw new WorkboxError('incorrect-type', details);\n }\n};\nconst isInstance = (object, expectedClass, details) => {\n if (!(object instanceof expectedClass)) {\n details['expectedClass'] = expectedClass;\n throw new WorkboxError('incorrect-class', details);\n }\n};\nconst isOneOf = (value, validValues, details) => {\n if (!validValues.includes(value)) {\n details['validValueDescription'] =\n `Valid values are ${JSON.stringify(validValues)}.`;\n throw new WorkboxError('invalid-value', details);\n }\n};\nconst isArrayOfClass = (value, expectedClass, details) => {\n const error = new WorkboxError('not-array-of-class', details);\n if (!Array.isArray(value)) {\n throw error;\n }\n for (let item of value) {\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n};\nconst finalAssertExports = process.env.NODE_ENV === 'production' ? null : {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isSWEnv,\n isType,\n isArrayOfClass,\n};\nexport { finalAssertExports as assert };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n// Callbacks to be executed whenever there's a quota error.\nconst quotaErrorCallbacks = new Set();\nexport { quotaErrorCallbacks };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst _cacheNameDetails = {\n googleAnalytics: 'googleAnalytics',\n precache: 'precache-v2',\n prefix: 'workbox',\n runtime: 'runtime',\n suffix: typeof registration !== 'undefined' ? registration.scope : '',\n};\nconst _createCacheName = (cacheName) => {\n return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix]\n .filter((value) => value && value.length > 0)\n .join('-');\n};\nconst eachCacheNameDetail = (fn) => {\n for (const key of Object.keys(_cacheNameDetails)) {\n fn(key);\n }\n};\nexport const cacheNames = {\n updateDetails: (details) => {\n eachCacheNameDetail((key) => {\n if (typeof details[key] === 'string') {\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 getPrefix: () => {\n return _cacheNameDetails.prefix;\n },\n getRuntimeName: (userCacheName) => {\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n },\n getSuffix: () => {\n return _cacheNameDetails.suffix;\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from '../_private/logger.js';\nimport { quotaErrorCallbacks } from '../models/quotaErrorCallbacks.js';\nimport '../_version.js';\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 module:workbox-core\n * @private\n */\nasync function executeQuotaErrorCallbacks() {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`About to run ${quotaErrorCallbacks.size} ` +\n `callbacks to clean up caches.`);\n }\n for (const callback of quotaErrorCallbacks) {\n await callback();\n if (process.env.NODE_ENV !== 'production') {\n logger.log(callback, 'is complete.');\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Finished running callbacks.');\n }\n}\nexport { executeQuotaErrorCallbacks };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst getFriendlyURL = (url) => {\n const urlObj = new URL(String(url), location.href);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n};\nexport { getFriendlyURL };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nexport const pluginUtils = {\n filter: (plugins, callbackName) => {\n return plugins.filter((plugin) => callbackName in plugin);\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from './assert.js';\nimport { executeQuotaErrorCallbacks } from './executeQuotaErrorCallbacks.js';\nimport { getFriendlyURL } from './getFriendlyURL.js';\nimport { logger } from './logger.js';\nimport { pluginUtils } from '../utils/pluginUtils.js';\nimport { WorkboxError } from './WorkboxError.js';\nimport '../_version.js';\n/**\n * Wrapper around cache.put().\n *\n * Will call `cacheDidUpdate` on plugins if the cache was updated, using\n * `matchOptions` when determining what the old entry is.\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 * @param {Object} [options.matchOptions]\n *\n * @private\n * @memberof module:workbox-core\n */\nconst putWrapper = async ({ cacheName, request, response, event, plugins = [], matchOptions, }) => {\n if (process.env.NODE_ENV !== 'production') {\n if (request.method && request.method !== 'GET') {\n throw new WorkboxError('attempt-to-cache-non-get-request', {\n url: getFriendlyURL(request.url),\n method: request.method,\n });\n }\n }\n const effectiveRequest = await _getEffectiveRequest({\n plugins, request, mode: 'write'\n });\n if (!response) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(`Cannot cache non-existent response for ` +\n `'${getFriendlyURL(effectiveRequest.url)}'.`);\n }\n throw new WorkboxError('cache-put-with-no-response', {\n url: getFriendlyURL(effectiveRequest.url),\n });\n }\n let responseToCache = await _isResponseSafeToCache({\n event,\n plugins,\n response,\n request: effectiveRequest,\n });\n if (!responseToCache) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` +\n `not be cached.`, responseToCache);\n }\n return;\n }\n const cache = await self.caches.open(cacheName);\n const updatePlugins = pluginUtils.filter(plugins, \"cacheDidUpdate\" /* CACHE_DID_UPDATE */);\n let oldResponse = updatePlugins.length > 0 ?\n await matchWrapper({ cacheName, matchOptions, request: effectiveRequest }) :\n null;\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Updating the '${cacheName}' cache with a new Response for ` +\n `${getFriendlyURL(effectiveRequest.url)}.`);\n }\n try {\n await cache.put(effectiveRequest, responseToCache);\n }\n catch (error) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n if (error.name === 'QuotaExceededError') {\n await executeQuotaErrorCallbacks();\n }\n throw error;\n }\n for (let plugin of updatePlugins) {\n await plugin[\"cacheDidUpdate\" /* CACHE_DID_UPDATE */].call(plugin, {\n cacheName,\n event,\n oldResponse,\n newResponse: responseToCache,\n request: effectiveRequest,\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 prompted 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 */\nconst matchWrapper = async ({ cacheName, request, event, matchOptions, plugins = [], }) => {\n const cache = await self.caches.open(cacheName);\n const effectiveRequest = await _getEffectiveRequest({\n plugins, request, mode: 'read'\n });\n let cachedResponse = await cache.match(effectiveRequest, matchOptions);\n if (process.env.NODE_ENV !== 'production') {\n if (cachedResponse) {\n logger.debug(`Found a cached response in '${cacheName}'.`);\n }\n else {\n logger.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (const plugin of plugins) {\n if (\"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */ in plugin) {\n const pluginMethod = plugin[\"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */];\n cachedResponse = await pluginMethod.call(plugin, {\n cacheName,\n event,\n matchOptions,\n cachedResponse,\n request: effectiveRequest,\n });\n if (process.env.NODE_ENV !== 'production') {\n if (cachedResponse) {\n assert.isInstance(cachedResponse, Response, {\n moduleName: 'Plugin',\n funcName: \"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */,\n isReturnValueProblem: true,\n });\n }\n }\n }\n }\n return cachedResponse;\n};\n/**\n * This method will call cacheWillUpdate on the available plugins (or use\n * status === 200) 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 */\nconst _isResponseSafeToCache = async ({ request, response, event, plugins = [], }) => {\n let responseToCache = response;\n let pluginsUsed = false;\n for (let plugin of plugins) {\n if (\"cacheWillUpdate\" /* CACHE_WILL_UPDATE */ in plugin) {\n pluginsUsed = true;\n const pluginMethod = plugin[\"cacheWillUpdate\" /* CACHE_WILL_UPDATE */];\n responseToCache = await pluginMethod.call(plugin, {\n request,\n response: responseToCache,\n event,\n });\n if (process.env.NODE_ENV !== 'production') {\n if (responseToCache) {\n assert.isInstance(responseToCache, Response, {\n moduleName: 'Plugin',\n funcName: \"cacheWillUpdate\" /* CACHE_WILL_UPDATE */,\n isReturnValueProblem: true,\n });\n }\n }\n if (!responseToCache) {\n break;\n }\n }\n }\n if (!pluginsUsed) {\n if (process.env.NODE_ENV !== 'production') {\n if (responseToCache) {\n if (responseToCache.status !== 200) {\n if (responseToCache.status === 0) {\n logger.warn(`The response for '${request.url}' is an opaque ` +\n `response. The caching strategy that you're using will not ` +\n `cache opaque responses by default.`);\n }\n else {\n logger.debug(`The response for '${request.url}' returned ` +\n `a status code of '${response.status}' and won't be cached as a ` +\n `result.`);\n }\n }\n }\n }\n responseToCache = responseToCache && responseToCache.status === 200 ?\n responseToCache : undefined;\n }\n return responseToCache ? responseToCache : null;\n};\n/**\n * Checks the list of plugins for the cacheKeyWillBeUsed callback, and\n * executes any of those callbacks found in sequence. The final `Request` object\n * returned by the last plugin is treated as the cache key for cache reads\n * and/or writes.\n *\n * @param {Object} options\n * @param {Request} options.request\n * @param {string} options.mode\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Request>}\n *\n * @private\n * @memberof module:workbox-core\n */\nconst _getEffectiveRequest = async ({ request, mode, plugins = [], }) => {\n const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, \"cacheKeyWillBeUsed\" /* CACHE_KEY_WILL_BE_USED */);\n let effectiveRequest = request;\n for (const plugin of cacheKeyWillBeUsedPlugins) {\n effectiveRequest = await plugin[\"cacheKeyWillBeUsed\" /* CACHE_KEY_WILL_BE_USED */].call(plugin, { mode, request: effectiveRequest });\n if (typeof effectiveRequest === 'string') {\n effectiveRequest = new Request(effectiveRequest);\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(effectiveRequest, Request, {\n moduleName: 'Plugin',\n funcName: \"cacheKeyWillBeUsed\" /* CACHE_KEY_WILL_BE_USED */,\n isReturnValueProblem: true,\n });\n }\n }\n return effectiveRequest;\n};\nexport const cacheWrapper = {\n put: putWrapper,\n match: matchWrapper,\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nlet supportStatus;\n/**\n * A utility function that determines whether the current browser supports\n * constructing a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)\n * object.\n *\n * @return {boolean} `true`, if the current browser can successfully\n * construct a `ReadableStream`, `false` otherwise.\n *\n * @private\n */\nfunction canConstructReadableStream() {\n if (supportStatus === undefined) {\n // See https://github.com/GoogleChrome/workbox/issues/1473\n try {\n new ReadableStream({ start() { } });\n supportStatus = true;\n }\n catch (error) {\n supportStatus = false;\n }\n }\n return supportStatus;\n}\nexport { canConstructReadableStream };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nlet supportStatus;\n/**\n * A utility function that determines whether the current browser supports\n * constructing a new `Response` from a `response.body` stream.\n *\n * @return {boolean} `true`, if the current browser can successfully\n * construct a `Response` from a `response.body` stream, `false` otherwise.\n *\n * @private\n */\nfunction canConstructResponseFromBodyStream() {\n if (supportStatus === undefined) {\n const testResponse = new Response('');\n if ('body' in testResponse) {\n try {\n new Response(testResponse.body);\n supportStatus = true;\n }\n catch (error) {\n supportStatus = false;\n }\n }\n supportStatus = false;\n }\n return supportStatus;\n}\nexport { canConstructResponseFromBodyStream };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * 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 */\nexport class DBWrapper {\n /**\n * @param {string} name\n * @param {number} version\n * @param {Object=} [callback]\n * @param {!Function} [callbacks.onupgradeneeded]\n * @param {!Function} [callbacks.onversionchange] Defaults to\n * DBWrapper.prototype._onversionchange when not specified.\n * @private\n */\n constructor(name, version, { onupgradeneeded, onversionchange, } = {}) {\n this._db = null;\n this._name = name;\n this._version = version;\n this._onupgradeneeded = onupgradeneeded;\n this._onversionchange = onversionchange || (() => this.close());\n }\n /**\n * Returns the IDBDatabase instance (not normally needed).\n * @return {IDBDatabase|undefined}\n *\n * @private\n */\n get db() {\n return this._db;\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 * @private\n */\n async open() {\n if (this._db)\n return;\n this._db = await new Promise((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(() => {\n openRequestTimedOut = true;\n reject(new Error('The open request was blocked and timed out'));\n }, this.OPEN_TIMEOUT);\n const openRequest = indexedDB.open(this._name, this._version);\n openRequest.onerror = () => reject(openRequest.error);\n openRequest.onupgradeneeded = (evt) => {\n if (openRequestTimedOut) {\n openRequest.transaction.abort();\n openRequest.result.close();\n }\n else if (typeof this._onupgradeneeded === 'function') {\n this._onupgradeneeded(evt);\n }\n };\n openRequest.onsuccess = () => {\n const db = openRequest.result;\n if (openRequestTimedOut) {\n db.close();\n }\n else {\n db.onversionchange = this._onversionchange.bind(this);\n resolve(db);\n }\n };\n });\n return this;\n }\n /**\n * Polyfills the native `getKey()` method. Note, this is overridden at\n * runtime if the browser supports the native method.\n *\n * @param {string} storeName\n * @param {*} query\n * @return {Array}\n * @private\n */\n async getKey(storeName, query) {\n return (await this.getAllKeys(storeName, query, 1))[0];\n }\n /**\n * Polyfills the native `getAll()` method. Note, this is overridden at\n * runtime if the browser supports the native method.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n * @private\n */\n async getAll(storeName, query, count) {\n return await this.getAllMatching(storeName, { query, count });\n }\n /**\n * Polyfills the native `getAllKeys()` method. Note, this is overridden at\n * runtime if the browser supports the native method.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n * @private\n */\n async getAllKeys(storeName, query, count) {\n const entries = await this.getAllMatching(storeName, { query, count, includeKeys: true });\n return entries.map((entry) => entry.key);\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 {string} [opts.index] The index to use (if specified).\n * @param {*} [opts.query]\n * @param {IDBCursorDirection} [opts.direction]\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 * @private\n */\n async getAllMatching(storeName, { index, query = null, // IE/Edge errors if query === `undefined`.\n direction = 'next', count, includeKeys = false, } = {}) {\n return await this.transaction([storeName], 'readonly', (txn, done) => {\n const store = txn.objectStore(storeName);\n const target = index ? store.index(index) : store;\n const results = [];\n const request = target.openCursor(query, direction);\n request.onsuccess = () => {\n const cursor = request.result;\n if (cursor) {\n results.push(includeKeys ? cursor : cursor.value);\n if (count && results.length >= count) {\n done(results);\n }\n else {\n cursor.continue();\n }\n }\n else {\n done(results);\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 two arguments:\n * 1. The IDBTransaction object\n * 2. A `done` function, that's used to resolve the promise when\n * when the transaction is done, if passed a value, the promise is\n * resolved to that value.\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} callback\n * @return {*} The result of the transaction ran by the callback.\n * @private\n */\n async transaction(storeNames, type, callback) {\n await this.open();\n return await new Promise((resolve, reject) => {\n const txn = this._db.transaction(storeNames, type);\n txn.onabort = () => reject(txn.error);\n txn.oncomplete = () => resolve();\n callback(txn, (value) => resolve(value));\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 * @private\n */\n async _call(method, storeName, type, ...args) {\n const callback = (txn, done) => {\n const objStore = txn.objectStore(storeName);\n // TODO(philipwalton): Fix this underlying TS2684 error.\n // @ts-ignore\n const request = objStore[method].apply(objStore, args);\n request.onsuccess = () => done(request.result);\n };\n return await this.transaction([storeName], type, callback);\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) {\n this._db.close();\n this._db = null;\n }\n }\n}\n// Exposed on the prototype to let users modify the default timeout on a\n// per-instance or global basis.\nDBWrapper.prototype.OPEN_TIMEOUT = 2000;\n// Wrap native IDBObjectStore methods according to their mode.\nconst methodsToWrap = {\n readonly: ['get', 'count', 'getKey', 'getAll', 'getAllKeys'],\n readwrite: ['add', 'put', 'clear', 'delete'],\n};\nfor (const [mode, methods] of Object.entries(methodsToWrap)) {\n for (const method of methods) {\n if (method in IDBObjectStore.prototype) {\n // Don't use arrow functions here since we're outside of the class.\n DBWrapper.prototype[method] =\n async function (storeName, ...args) {\n return await this._call(method, storeName, mode, ...args);\n };\n }\n }\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Deletes the database.\n * Note: this is exported separately from the DBWrapper module because most\n * usages of IndexedDB in workbox dont need deleting, and this way it can be\n * reused in tests to delete databases without creating DBWrapper instances.\n *\n * @param {string} name The database name.\n * @private\n */\nexport const deleteDatabase = async (name) => {\n await new Promise((resolve, reject) => {\n const request = indexedDB.deleteDatabase(name);\n request.onerror = () => {\n reject(request.error);\n };\n request.onblocked = () => {\n reject(new Error('Delete blocked'));\n };\n request.onsuccess = () => {\n resolve();\n };\n });\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from './WorkboxError.js';\nimport { logger } from './logger.js';\nimport { assert } from './assert.js';\nimport { getFriendlyURL } from '../_private/getFriendlyURL.js';\nimport { pluginUtils } from '../utils/pluginUtils.js';\nimport '../_version.js';\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 {ExtendableEvent} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\nconst wrappedFetch = async ({ request, fetchOptions, event, plugins = [], }) => {\n if (typeof request === 'string') {\n request = new Request(request);\n }\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 instanceof FetchEvent && event.preloadResponse) {\n const possiblePreloadResponse = await event.preloadResponse;\n if (possiblePreloadResponse) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Using a preloaded navigation response for ` +\n `'${getFriendlyURL(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n paramName: 'request',\n expectedClass: Request,\n moduleName: 'workbox-core',\n className: 'fetchWrapper',\n funcName: 'wrappedFetch',\n });\n }\n const failedFetchPlugins = pluginUtils.filter(plugins, \"fetchDidFail\" /* FETCH_DID_FAIL */);\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 ?\n request.clone() : null;\n try {\n for (let plugin of plugins) {\n if (\"requestWillFetch\" /* REQUEST_WILL_FETCH */ in plugin) {\n const pluginMethod = plugin[\"requestWillFetch\" /* REQUEST_WILL_FETCH */];\n const requestClone = request.clone();\n request = (await pluginMethod.call(plugin, {\n request: requestClone,\n event,\n }));\n if (process.env.NODE_ENV !== 'production') {\n if (request) {\n assert.isInstance(request, Request, {\n moduleName: 'Plugin',\n funcName: \"cachedResponseWillBeUsed\" /* CACHED_RESPONSE_WILL_BE_USED */,\n isReturnValueProblem: true,\n });\n }\n }\n }\n }\n }\n catch (err) {\n throw new WorkboxError('plugin-error-request-will-fetch', {\n thrownError: err,\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 let pluginFilteredRequest = request.clone();\n try {\n let fetchResponse;\n // See https://github.com/GoogleChrome/workbox/issues/1796\n if (request.mode === 'navigate') {\n fetchResponse = await fetch(request);\n }\n else {\n fetchResponse = await fetch(request, fetchOptions);\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Network request for ` +\n `'${getFriendlyURL(request.url)}' returned a response with ` +\n `status '${fetchResponse.status}'.`);\n }\n for (const plugin of plugins) {\n if (\"fetchDidSucceed\" /* FETCH_DID_SUCCEED */ in plugin) {\n fetchResponse = await plugin[\"fetchDidSucceed\" /* FETCH_DID_SUCCEED */]\n .call(plugin, {\n event,\n request: pluginFilteredRequest,\n response: fetchResponse,\n });\n if (process.env.NODE_ENV !== 'production') {\n if (fetchResponse) {\n assert.isInstance(fetchResponse, Response, {\n moduleName: 'Plugin',\n funcName: \"fetchDidSucceed\" /* FETCH_DID_SUCCEED */,\n isReturnValueProblem: true,\n });\n }\n }\n }\n }\n return fetchResponse;\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(`Network request for ` +\n `'${getFriendlyURL(request.url)}' threw an error.`, error);\n }\n for (const plugin of failedFetchPlugins) {\n await plugin[\"fetchDidFail\" /* FETCH_DID_FAIL */].call(plugin, {\n error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone(),\n });\n }\n throw error;\n }\n};\nconst fetchWrapper = {\n fetch: wrappedFetch,\n};\nexport { fetchWrapper };\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns a promise that resolves and the passed number of milliseconds.\n * This utility is an async/await-friendly version of `setTimeout`.\n *\n * @param {number} ms\n * @return {Promise}\n * @private\n */\nexport function timeout(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { timeout } from './timeout.js';\nimport '../_version.js';\nconst MAX_RETRY_TIME = 2000;\n/**\n * Returns a promise that resolves to a window client matching the passed\n * `resultingClientId`. For browsers that don't support `resultingClientId`\n * or if waiting for the resulting client to apper takes too long, resolve to\n * `undefined`.\n *\n * @param {string} [resultingClientId]\n * @return {Promise<Client|undefined>}\n * @private\n */\nexport async function resultingClientExists(resultingClientId) {\n if (!resultingClientId) {\n return;\n }\n let existingWindows = await self.clients.matchAll({ type: 'window' });\n const existingWindowIds = new Set(existingWindows.map((w) => w.id));\n let resultingWindow;\n const startTime = performance.now();\n // Only wait up to `MAX_RETRY_TIME` to find a matching client.\n while (performance.now() - startTime < MAX_RETRY_TIME) {\n existingWindows = await self.clients.matchAll({ type: 'window' });\n resultingWindow = existingWindows.find((w) => {\n if (resultingClientId) {\n // If we have a `resultingClientId`, we can match on that.\n return w.id === resultingClientId;\n }\n else {\n // Otherwise match on finding a window not in `existingWindowIds`.\n return !existingWindowIds.has(w.id);\n }\n });\n if (resultingWindow) {\n break;\n }\n // Sleep for 100ms and retry.\n await timeout(100);\n }\n return resultingWindow;\n}\n","/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A helper function that prevents a promise from being flagged as unused.\n *\n * @private\n **/\nexport function dontWaitFor(promise) {\n // Effective no-op.\n promise.then(() => { });\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n /**\n * Creates a promise and exposes its resolve and reject functions as methods.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n }\n}\nexport { Deferred };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { cacheNames as _cacheNames } from './_private/cacheNames.js';\nimport './_version.js';\n/**\n * Get the current cache names and prefix/suffix 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`, and `cacheNames.runtime` is used for everything else.\n *\n * `cacheNames.prefix` can be used to retrieve just the current prefix value.\n * `cacheNames.suffix` can be used to retrieve just the current suffix value.\n *\n * @return {Object} An object with `precache`, `runtime`, `prefix`, and\n * `googleAnalytics` properties.\n *\n * @memberof module:workbox-core\n */\nconst cacheNames = {\n get googleAnalytics() {\n return _cacheNames.getGoogleAnalyticsName();\n },\n get precache() {\n return _cacheNames.getPrecacheName();\n },\n get prefix() {\n return _cacheNames.getPrefix();\n },\n get runtime() {\n return _cacheNames.getRuntimeName();\n },\n get suffix() {\n return _cacheNames.getSuffix();\n },\n};\nexport { cacheNames };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Claim any currently available clients once the service worker\n * becomes active. This is normally used in conjunction with `skipWaiting()`.\n *\n * @memberof module:workbox-core\n */\nfunction clientsClaim() {\n self.addEventListener('activate', () => self.clients.claim());\n}\n;\nexport { clientsClaim };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { canConstructResponseFromBodyStream } from './_private/canConstructResponseFromBodyStream.js';\nimport './_version.js';\n/**\n * Allows developers to copy a response and modify its `headers`, `status`,\n * or `statusText` values (the values settable via a\n * [`ResponseInit`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#Syntax}\n * object in the constructor).\n * To modify these values, pass a function as the second argument. That\n * function will be invoked with a single object with the response properties\n * `{headers, status, statusText}`. The return value of this function will\n * be used as the `ResponseInit` for the new `Response`. To change the values\n * either modify the passed parameter(s) and return it, or return a totally\n * new object.\n *\n * @param {Response} response\n * @param {Function} modifier\n * @memberof module:workbox-core\n */\nasync function copyResponse(response, modifier) {\n const clonedResponse = response.clone();\n // Create a fresh `ResponseInit` object by cloning the headers.\n const responseInit = {\n headers: new Headers(clonedResponse.headers),\n status: clonedResponse.status,\n statusText: clonedResponse.statusText,\n };\n // Apply any user modifications.\n const modifiedResponseInit = modifier ? modifier(responseInit) : responseInit;\n // Create the new response from the body stream and `ResponseInit`\n // modifications. Note: not all browsers support the Response.body stream,\n // so fall back to reading the entire body into memory as a blob.\n const body = canConstructResponseFromBodyStream() ?\n clonedResponse.body : await clonedResponse.blob();\n return new Response(body, modifiedResponseInit);\n}\n;\nexport { copyResponse };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from './_private/logger.js';\nimport { assert } from './_private/assert.js';\nimport { quotaErrorCallbacks } from './models/quotaErrorCallbacks.js';\nimport './_version.js';\n/**\n * Adds a function to the set of quotaErrorCallbacks that will be executed if\n * there's a quota error.\n *\n * @param {Function} callback\n * @memberof module:workbox-core\n */\nfunction registerQuotaErrorCallback(callback) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(callback, 'function', {\n moduleName: 'workbox-core',\n funcName: 'register',\n paramName: 'callback',\n });\n }\n quotaErrorCallbacks.add(callback);\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered a callback to respond to quota errors.', callback);\n }\n}\nexport { registerQuotaErrorCallback };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from './_private/assert.js';\nimport { cacheNames } from './_private/cacheNames.js';\nimport { WorkboxError } from './_private/WorkboxError.js';\nimport './_version.js';\n/**\n * Modifies the default cache names used by the Workbox packages.\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 * @memberof module:workbox-core\n */\nfunction setCacheNameDetails(details) {\n if (process.env.NODE_ENV !== 'production') {\n Object.keys(details).forEach((key) => {\n assert.isType(details[key], 'string', {\n moduleName: 'workbox-core',\n funcName: 'setCacheNameDetails',\n paramName: `details.${key}`,\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 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 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 cacheNames.updateDetails(details);\n}\n;\nexport { setCacheNameDetails };\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * Force a service worker to activate immediately, instead of\n * [waiting](https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting)\n * for existing clients to close.\n *\n * @memberof module:workbox-core\n */\nfunction skipWaiting() {\n // We need to explicitly call `self.skipWaiting()` here because we're\n // shadowing `skipWaiting` with this local function.\n self.addEventListener('install', () => self.skipWaiting());\n}\n;\nexport { skipWaiting };\n"],"names":["self","_","e","messageGenerator","code","args","msg","length","JSON","stringify","WorkboxError","Error","constructor","errorCode","details","name","quotaErrorCallbacks","Set","_cacheNameDetails","googleAnalytics","precache","prefix","runtime","suffix","registration","scope","_createCacheName","cacheName","filter","value","join","cacheNames","updateDetails","fn","key","Object","keys","eachCacheNameDetail","getGoogleAnalyticsName","userCacheName","getPrecacheName","getPrefix","getRuntimeName","getSuffix","async","executeQuotaErrorCallbacks","callback","getFriendlyURL","url","urlObj","URL","String","location","href","origin","pathname","pluginUtils","plugins","callbackName","plugin","matchWrapper","request","event","matchOptions","cache","caches","open","effectiveRequest","_getEffectiveRequest","mode","cachedResponse","match","pluginMethod","call","_isResponseSafeToCache","response","responseToCache","pluginsUsed","status","undefined","cacheKeyWillBeUsedPlugins","Request","cacheWrapper","put","updatePlugins","oldResponse","error","newResponse","supportStatus","canConstructResponseFromBodyStream","testResponse","Response","body","DBWrapper","version","onupgradeneeded","onversionchange","_db","_name","_version","_onupgradeneeded","_onversionchange","this","close","Promise","resolve","reject","openRequestTimedOut","setTimeout","OPEN_TIMEOUT","openRequest","indexedDB","onerror","evt","transaction","abort","result","onsuccess","db","bind","storeName","query","getAllKeys","count","getAllMatching","includeKeys","map","entry","index","direction","txn","done","store","objectStore","target","results","openCursor","cursor","push","continue","storeNames","type","onabort","oncomplete","method","objStore","apply","prototype","methodsToWrap","readonly","readwrite","methods","entries","IDBObjectStore","_call","fetchWrapper","fetch","fetchOptions","FetchEvent","preloadResponse","possiblePreloadResponse","failedFetchPlugins","originalRequest","clone","requestClone","err","thrownError","pluginFilteredRequest","fetchResponse","timeout","ms","MAX_RETRY_TIME","ReadableStream","start","promise","then","deleteDatabase","onblocked","resultingClientId","existingWindows","clients","matchAll","existingWindowIds","w","id","resultingWindow","startTime","performance","now","find","has","_cacheNames","addEventListener","claim","modifier","clonedResponse","responseInit","headers","Headers","statusText","modifiedResponseInit","blob","add","skipWaiting"],"mappings":"yEAEA,IACIA,KAAK,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C,EAAe,CACjBC,QAAS,IAAIC,QAAQH,EAAeE,SACpCvH,OAAQqH,EAAerH,OACvByH,WAAYJ,EAAeI,YAGzBC,EAAuBN,EAAWA,EAASE,GAAgBA,EAI3DxG,EAAOH,IACT0G,EAAevG,WAAauG,EAAeM,cACxC,IAAI9G,SAASC,EAAM4G,iCCtB9B,SAAoC1J,GAQhC9B,EAAoB0L,IAAI5J,0BCE5B,SAA6BhC,GA4BzBiB,EAAWC,cAAclB,kBCzC7B,WAGId,KAAKgM,iBAAiB,UAAW,IAAMhM,KAAK2M"}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
this.workbox = this.workbox || {};
|
2
|
-
this.workbox.expiration = (function (exports,
|
2
|
+
this.workbox.expiration = (function (exports, assert_js, dontWaitFor_js, logger_js, WorkboxError_js, DBWrapper_js, deleteDatabase_js, cacheNames_js, getFriendlyURL_js, registerQuotaErrorCallback_js) {
|
3
3
|
'use strict';
|
4
4
|
|
5
|
-
// @ts-ignore
|
6
5
|
try {
|
7
|
-
self['workbox:expiration:5.0.0
|
6
|
+
self['workbox:expiration:5.0.0'] && _();
|
8
7
|
} catch (e) {}
|
9
8
|
|
10
9
|
/*
|
@@ -203,7 +202,7 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
203
202
|
* limit on the number of responses stored in a
|
204
203
|
* [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache).
|
205
204
|
*
|
206
|
-
* @memberof workbox
|
205
|
+
* @memberof module:workbox-expiration
|
207
206
|
*/
|
208
207
|
|
209
208
|
class CacheExpiration {
|
@@ -277,7 +276,7 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
277
276
|
const minTimestamp = this._maxAgeSeconds ? Date.now() - this._maxAgeSeconds * 1000 : 0;
|
278
277
|
const urlsExpired = await this._timestampModel.expireEntries(minTimestamp, this._maxEntries); // Delete URLs from the cache
|
279
278
|
|
280
|
-
const cache = await caches.open(this._cacheName);
|
279
|
+
const cache = await self.caches.open(this._cacheName);
|
281
280
|
|
282
281
|
for (const url of urlsExpired) {
|
283
282
|
await cache.delete(url);
|
@@ -298,7 +297,7 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
298
297
|
|
299
298
|
if (this._rerunRequested) {
|
300
299
|
this._rerunRequested = false;
|
301
|
-
this.expireEntries();
|
300
|
+
dontWaitFor_js.dontWaitFor(this.expireEntries());
|
302
301
|
}
|
303
302
|
}
|
304
303
|
/**
|
@@ -389,10 +388,10 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
389
388
|
* When using `maxEntries`, the entry least-recently requested will be removed
|
390
389
|
* from the cache first.
|
391
390
|
*
|
392
|
-
* @memberof workbox
|
391
|
+
* @memberof module:workbox-expiration
|
393
392
|
*/
|
394
393
|
|
395
|
-
class
|
394
|
+
class ExpirationPlugin {
|
396
395
|
/**
|
397
396
|
* @param {Object} config
|
398
397
|
* @param {number} [config.maxEntries] The maximum number of entries to cache.
|
@@ -405,7 +404,7 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
405
404
|
constructor(config = {}) {
|
406
405
|
/**
|
407
406
|
* A "lifecycle" callback that will be triggered automatically by the
|
408
|
-
* `workbox
|
407
|
+
* `workbox-strategies` handlers when a `Response` is about to be returned
|
409
408
|
* from a [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache) to
|
410
409
|
* the handler. It allows the `Response` to be inspected for freshness and
|
411
410
|
* prevents it from being used if the `Response`'s `Date` header value is
|
@@ -436,7 +435,7 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
436
435
|
|
437
436
|
const cacheExpiration = this._getCacheExpiration(cacheName);
|
438
437
|
|
439
|
-
cacheExpiration.expireEntries(); // Update the metadata for the request URL to the current timestamp,
|
438
|
+
dontWaitFor_js.dontWaitFor(cacheExpiration.expireEntries()); // Update the metadata for the request URL to the current timestamp,
|
440
439
|
// but don't `await` it as we don't want to block the response.
|
441
440
|
|
442
441
|
const updateTimestampDone = cacheExpiration.updateTimestamp(request.url);
|
@@ -458,7 +457,7 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
458
457
|
};
|
459
458
|
/**
|
460
459
|
* A "lifecycle" callback that will be triggered automatically by the
|
461
|
-
* `workbox
|
460
|
+
* `workbox-strategies` handlers when an entry is added to a cache.
|
462
461
|
*
|
463
462
|
* @param {Object} options
|
464
463
|
* @param {string} options.cacheName Name of the cache that was updated.
|
@@ -633,7 +632,7 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
633
632
|
// Do this one at a time instead of all at once via `Promise.all()` to
|
634
633
|
// reduce the chance of inconsistency if a promise rejects.
|
635
634
|
for (const [cacheName, cacheExpiration] of this._cacheExpirations) {
|
636
|
-
await caches.delete(cacheName);
|
635
|
+
await self.caches.delete(cacheName);
|
637
636
|
await cacheExpiration.delete();
|
638
637
|
} // Reset this._cacheExpirations to its initial state.
|
639
638
|
|
@@ -644,9 +643,9 @@ this.workbox.expiration = (function (exports, DBWrapper_js, deleteDatabase_js, W
|
|
644
643
|
}
|
645
644
|
|
646
645
|
exports.CacheExpiration = CacheExpiration;
|
647
|
-
exports.
|
646
|
+
exports.ExpirationPlugin = ExpirationPlugin;
|
648
647
|
|
649
648
|
return exports;
|
650
649
|
|
651
|
-
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core));
|
650
|
+
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core));
|
652
651
|
//# sourceMappingURL=workbox-expiration.dev.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-expiration.dev.js","sources":["../_version.js","../models/CacheTimestampsModel.js","../CacheExpiration.js","../ExpirationPlugin.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:expiration:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { DBWrapper } from 'workbox-core/_private/DBWrapper.js';\nimport { deleteDatabase } from 'workbox-core/_private/deleteDatabase.js';\nimport '../_version.js';\nconst DB_NAME = 'workbox-expiration';\nconst OBJECT_STORE_NAME = 'cache-entries';\nconst normalizeURL = (unNormalizedUrl) => {\n const url = new URL(unNormalizedUrl, location.href);\n url.hash = '';\n return url.href;\n};\n/**\n * Returns the timestamp model.\n *\n * @private\n */\nclass CacheTimestampsModel {\n /**\n *\n * @param {string} cacheName\n *\n * @private\n */\n constructor(cacheName) {\n this._cacheName = cacheName;\n this._db = new DBWrapper(DB_NAME, 1, {\n onupgradeneeded: (event) => this._handleUpgrade(event),\n });\n }\n /**\n * Should perform an upgrade of indexedDB.\n *\n * @param {Event} event\n *\n * @private\n */\n _handleUpgrade(event) {\n const db = event.target.result;\n // TODO(philipwalton): EdgeHTML doesn't support arrays as a keyPath, so we\n // have to use the `id` keyPath here and create our own values (a\n // concatenation of `url + cacheName`) instead of simply using\n // `keyPath: ['url', 'cacheName']`, which is supported in other browsers.\n const objStore = db.createObjectStore(OBJECT_STORE_NAME, { keyPath: 'id' });\n // TODO(philipwalton): once we don't have to support EdgeHTML, we can\n // create a single index with the keyPath `['cacheName', 'timestamp']`\n // instead of doing both these indexes.\n objStore.createIndex('cacheName', 'cacheName', { unique: false });\n objStore.createIndex('timestamp', 'timestamp', { unique: false });\n // Previous versions of `workbox-expiration` used `this._cacheName`\n // as the IDBDatabase name.\n deleteDatabase(this._cacheName);\n }\n /**\n * @param {string} url\n * @param {number} timestamp\n *\n * @private\n */\n async setTimestamp(url, timestamp) {\n url = normalizeURL(url);\n const entry = {\n url,\n timestamp,\n cacheName: this._cacheName,\n // Creating an ID from the URL and cache name won't be necessary once\n // Edge switches to Chromium and all browsers we support work with\n // array keyPaths.\n id: this._getId(url),\n };\n await this._db.put(OBJECT_STORE_NAME, entry);\n }\n /**\n * Returns the timestamp stored for a given URL.\n *\n * @param {string} url\n * @return {number}\n *\n * @private\n */\n async getTimestamp(url) {\n const entry = await this._db.get(OBJECT_STORE_NAME, this._getId(url));\n return entry.timestamp;\n }\n /**\n * Iterates through all the entries in the object store (from newest to\n * oldest) and removes entries once either `maxCount` is reached or the\n * entry's timestamp is less than `minTimestamp`.\n *\n * @param {number} minTimestamp\n * @param {number} maxCount\n * @return {Array<string>}\n *\n * @private\n */\n async expireEntries(minTimestamp, maxCount) {\n const entriesToDelete = await this._db.transaction(OBJECT_STORE_NAME, 'readwrite', (txn, done) => {\n const store = txn.objectStore(OBJECT_STORE_NAME);\n const request = store.index('timestamp').openCursor(null, 'prev');\n const entriesToDelete = [];\n let entriesNotDeletedCount = 0;\n request.onsuccess = () => {\n const cursor = request.result;\n if (cursor) {\n const result = cursor.value;\n // TODO(philipwalton): once we can use a multi-key index, we\n // won't have to check `cacheName` here.\n if (result.cacheName === this._cacheName) {\n // Delete an entry if it's older than the max age or\n // if we already have the max number allowed.\n if ((minTimestamp && result.timestamp < minTimestamp) ||\n (maxCount && entriesNotDeletedCount >= maxCount)) {\n // TODO(philipwalton): we should be able to delete the\n // entry right here, but doing so causes an iteration\n // bug in Safari stable (fixed in TP). Instead we can\n // store the keys of the entries to delete, and then\n // delete the separate transactions.\n // https://github.com/GoogleChrome/workbox/issues/1978\n // cursor.delete();\n // We only need to return the URL, not the whole entry.\n entriesToDelete.push(cursor.value);\n }\n else {\n entriesNotDeletedCount++;\n }\n }\n cursor.continue();\n }\n else {\n done(entriesToDelete);\n }\n };\n });\n // TODO(philipwalton): once the Safari bug in the following issue is fixed,\n // we should be able to remove this loop and do the entry deletion in the\n // cursor loop above:\n // https://github.com/GoogleChrome/workbox/issues/1978\n const urlsDeleted = [];\n for (const entry of entriesToDelete) {\n await this._db.delete(OBJECT_STORE_NAME, entry.id);\n urlsDeleted.push(entry.url);\n }\n return urlsDeleted;\n }\n /**\n * Takes a URL and returns an ID that will be unique in the object store.\n *\n * @param {string} url\n * @return {string}\n *\n * @private\n */\n _getId(url) {\n // Creating an ID from the URL and cache name won't be necessary once\n // Edge switches to Chromium and all browsers we support work with\n // array keyPaths.\n return this._cacheName + '|' + normalizeURL(url);\n }\n}\nexport { CacheTimestampsModel };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { CacheTimestampsModel } from './models/CacheTimestampsModel.js';\nimport './_version.js';\n/**\n * The `CacheExpiration` class allows you define an expiration and / or\n * limit on the number of responses stored in a\n * [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache).\n *\n * @memberof module:workbox-expiration\n */\nclass CacheExpiration {\n /**\n * To construct a new CacheExpiration instance you must provide at least\n * one of the `config` properties.\n *\n * @param {string} cacheName Name of the cache to apply restrictions to.\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n */\n constructor(cacheName, config = {}) {\n this._isRunning = false;\n this._rerunRequested = false;\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(cacheName, 'string', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'cacheName',\n });\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n });\n }\n if (config.maxEntries) {\n assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxEntries',\n });\n // TODO: Assert is positive\n }\n if (config.maxAgeSeconds) {\n assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds',\n });\n // TODO: Assert is positive\n }\n }\n this._maxEntries = config.maxEntries;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheName = cacheName;\n this._timestampModel = new CacheTimestampsModel(cacheName);\n }\n /**\n * Expires entries for the given cache and given criteria.\n */\n async expireEntries() {\n if (this._isRunning) {\n this._rerunRequested = true;\n return;\n }\n this._isRunning = true;\n const minTimestamp = this._maxAgeSeconds ?\n Date.now() - (this._maxAgeSeconds * 1000) : 0;\n const urlsExpired = await this._timestampModel.expireEntries(minTimestamp, this._maxEntries);\n // Delete URLs from the cache\n const cache = await self.caches.open(this._cacheName);\n for (const url of urlsExpired) {\n await cache.delete(url);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (urlsExpired.length > 0) {\n logger.groupCollapsed(`Expired ${urlsExpired.length} ` +\n `${urlsExpired.length === 1 ? 'entry' : 'entries'} and removed ` +\n `${urlsExpired.length === 1 ? 'it' : 'them'} from the ` +\n `'${this._cacheName}' cache.`);\n logger.log(`Expired the following ${urlsExpired.length === 1 ?\n 'URL' : 'URLs'}:`);\n urlsExpired.forEach((url) => logger.log(` ${url}`));\n logger.groupEnd();\n }\n else {\n logger.debug(`Cache expiration ran and found no entries to remove.`);\n }\n }\n this._isRunning = false;\n if (this._rerunRequested) {\n this._rerunRequested = false;\n dontWaitFor(this.expireEntries());\n }\n }\n /**\n * Update the timestamp for the given URL. This ensures the when\n * removing entries based on maximum entries, most recently used\n * is accurate or when expiring, the timestamp is up-to-date.\n *\n * @param {string} url\n */\n async updateTimestamp(url) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(url, 'string', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'updateTimestamp',\n paramName: 'url',\n });\n }\n await this._timestampModel.setTimestamp(url, Date.now());\n }\n /**\n * Can be used to check if a URL has expired or not before it's used.\n *\n * This requires a look up from IndexedDB, so can be slow.\n *\n * Note: This method will not remove the cached entry, call\n * `expireEntries()` to remove indexedDB and Cache entries.\n *\n * @param {string} url\n * @return {boolean}\n */\n async isURLExpired(url) {\n if (!this._maxAgeSeconds) {\n if (process.env.NODE_ENV !== 'production') {\n throw new WorkboxError(`expired-test-without-max-age`, {\n methodName: 'isURLExpired',\n paramName: 'maxAgeSeconds',\n });\n }\n return false;\n }\n else {\n const timestamp = await this._timestampModel.getTimestamp(url);\n const expireOlderThan = Date.now() - (this._maxAgeSeconds * 1000);\n return (timestamp < expireOlderThan);\n }\n }\n /**\n * Removes the IndexedDB object store used to keep track of cache expiration\n * metadata.\n */\n async delete() {\n // Make sure we don't attempt another rerun if we're called in the middle of\n // a cache expiration.\n this._rerunRequested = false;\n await this._timestampModel.expireEntries(Infinity); // Expires all.\n }\n}\nexport { CacheExpiration };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { registerQuotaErrorCallback } from 'workbox-core/registerQuotaErrorCallback.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { CacheExpiration } from './CacheExpiration.js';\nimport './_version.js';\n/**\n * This plugin can be used in the Workbox APIs to regularly enforce a\n * limit on the age and / or the number of cached requests.\n *\n * Whenever a cached request is used or updated, this plugin will look\n * at the used Cache and remove any old or extra requests.\n *\n * When using `maxAgeSeconds`, requests may be used *once* after expiring\n * because the expiration clean up will not have occurred until *after* the\n * cached request has been used. If the request has a \"Date\" header, then\n * a light weight expiration check is performed and the request will not be\n * used immediately.\n *\n * When using `maxEntries`, the entry least-recently requested will be removed\n * from the cache first.\n *\n * @memberof module:workbox-expiration\n */\nclass ExpirationPlugin {\n /**\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n * @param {boolean} [config.purgeOnQuotaError] Whether to opt this cache in to\n * automatic deletion if the available storage quota has been exceeded.\n */\n constructor(config = {}) {\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-strategies` handlers when a `Response` is about to be returned\n * from a [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache) to\n * the handler. It allows the `Response` to be inspected for freshness and\n * prevents it from being used if the `Response`'s `Date` header value is\n * older than the configured `maxAgeSeconds`.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache the response is in.\n * @param {Response} options.cachedResponse The `Response` object that's been\n * read from a cache and whose freshness should be checked.\n * @return {Response} Either the `cachedResponse`, if it's\n * fresh, or `null` if the `Response` is older than `maxAgeSeconds`.\n *\n * @private\n */\n this.cachedResponseWillBeUsed = async ({ event, request, cacheName, cachedResponse }) => {\n if (!cachedResponse) {\n return null;\n }\n let isFresh = this._isResponseDateFresh(cachedResponse);\n // Expire entries to ensure that even if the expiration date has\n // expired, it'll only be used once.\n const cacheExpiration = this._getCacheExpiration(cacheName);\n dontWaitFor(cacheExpiration.expireEntries());\n // Update the metadata for the request URL to the current timestamp,\n // but don't `await` it as we don't want to block the response.\n const updateTimestampDone = cacheExpiration.updateTimestamp(request.url);\n if (event) {\n try {\n event.waitUntil(updateTimestampDone);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n // The event may not be a fetch event; only log the URL if it is.\n if ('request' in event) {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache entry for ` +\n `'${getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n }\n return isFresh ? cachedResponse : null;\n };\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-strategies` handlers when an entry is added to a cache.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache that was updated.\n * @param {string} options.request The Request for the cached entry.\n *\n * @private\n */\n this.cacheDidUpdate = async ({ cacheName, request }) => {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(cacheName, 'string', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'cacheName',\n });\n assert.isInstance(request, Request, {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'request',\n });\n }\n const cacheExpiration = this._getCacheExpiration(cacheName);\n await cacheExpiration.updateTimestamp(request.url);\n await cacheExpiration.expireEntries();\n };\n if (process.env.NODE_ENV !== 'production') {\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n });\n }\n if (config.maxEntries) {\n assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxEntries',\n });\n }\n if (config.maxAgeSeconds) {\n assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds',\n });\n }\n }\n this._config = config;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheExpirations = new Map();\n if (config.purgeOnQuotaError) {\n registerQuotaErrorCallback(() => this.deleteCacheAndMetadata());\n }\n }\n /**\n * A simple helper method to return a CacheExpiration instance for a given\n * cache name.\n *\n * @param {string} cacheName\n * @return {CacheExpiration}\n *\n * @private\n */\n _getCacheExpiration(cacheName) {\n if (cacheName === cacheNames.getRuntimeName()) {\n throw new WorkboxError('expire-custom-caches-only');\n }\n let cacheExpiration = this._cacheExpirations.get(cacheName);\n if (!cacheExpiration) {\n cacheExpiration = new CacheExpiration(cacheName, this._config);\n this._cacheExpirations.set(cacheName, cacheExpiration);\n }\n return cacheExpiration;\n }\n /**\n * @param {Response} cachedResponse\n * @return {boolean}\n *\n * @private\n */\n _isResponseDateFresh(cachedResponse) {\n if (!this._maxAgeSeconds) {\n // We aren't expiring by age, so return true, it's fresh\n return true;\n }\n // Check if the 'date' header will suffice a quick expiration check.\n // See https://github.com/GoogleChromeLabs/sw-toolbox/issues/164 for\n // discussion.\n const dateHeaderTimestamp = this._getDateHeaderTimestamp(cachedResponse);\n if (dateHeaderTimestamp === null) {\n // Unable to parse date, so assume it's fresh.\n return true;\n }\n // If we have a valid headerTime, then our response is fresh iff the\n // headerTime plus maxAgeSeconds is greater than the current time.\n const now = Date.now();\n return dateHeaderTimestamp >= now - (this._maxAgeSeconds * 1000);\n }\n /**\n * This method will extract the data header and parse it into a useful\n * value.\n *\n * @param {Response} cachedResponse\n * @return {number|null}\n *\n * @private\n */\n _getDateHeaderTimestamp(cachedResponse) {\n if (!cachedResponse.headers.has('date')) {\n return null;\n }\n const dateHeader = cachedResponse.headers.get('date');\n const parsedDate = new Date(dateHeader);\n const headerTime = parsedDate.getTime();\n // If the Date header was invalid for some reason, parsedDate.getTime()\n // will return NaN.\n if (isNaN(headerTime)) {\n return null;\n }\n return headerTime;\n }\n /**\n * This is a helper method that performs two operations:\n *\n * - Deletes *all* the underlying Cache instances associated with this plugin\n * instance, by calling caches.delete() on your behalf.\n * - Deletes the metadata from IndexedDB used to keep track of expiration\n * details for each Cache instance.\n *\n * When using cache expiration, calling this method is preferable to calling\n * `caches.delete()` directly, since this will ensure that the IndexedDB\n * metadata is also cleanly removed and open IndexedDB instances are deleted.\n *\n * Note that if you're *not* using cache expiration for a given cache, calling\n * `caches.delete()` and passing in the cache's name should be sufficient.\n * There is no Workbox-specific method needed for cleanup in that case.\n */\n async deleteCacheAndMetadata() {\n // Do this one at a time instead of all at once via `Promise.all()` to\n // reduce the chance of inconsistency if a promise rejects.\n for (const [cacheName, cacheExpiration] of this._cacheExpirations) {\n await self.caches.delete(cacheName);\n await cacheExpiration.delete();\n }\n // Reset this._cacheExpirations to its initial state.\n this._cacheExpirations = new Map();\n }\n}\nexport { ExpirationPlugin };\n"],"names":["self","_","e","DB_NAME","OBJECT_STORE_NAME","normalizeURL","unNormalizedUrl","url","URL","location","href","hash","CacheTimestampsModel","constructor","cacheName","_cacheName","_db","DBWrapper","onupgradeneeded","event","_handleUpgrade","db","target","result","objStore","createObjectStore","keyPath","createIndex","unique","deleteDatabase","setTimestamp","timestamp","entry","id","_getId","put","getTimestamp","get","expireEntries","minTimestamp","maxCount","entriesToDelete","transaction","txn","done","store","objectStore","request","index","openCursor","entriesNotDeletedCount","onsuccess","cursor","value","push","continue","urlsDeleted","delete","CacheExpiration","config","_isRunning","_rerunRequested","assert","isType","moduleName","className","funcName","paramName","maxEntries","maxAgeSeconds","WorkboxError","_maxEntries","_maxAgeSeconds","_timestampModel","Date","now","urlsExpired","cache","caches","open","length","logger","groupCollapsed","log","forEach","groupEnd","debug","dontWaitFor","updateTimestamp","isURLExpired","methodName","expireOlderThan","Infinity","ExpirationPlugin","cachedResponseWillBeUsed","cachedResponse","isFresh","_isResponseDateFresh","cacheExpiration","_getCacheExpiration","updateTimestampDone","waitUntil","error","warn","getFriendlyURL","cacheDidUpdate","isInstance","Request","_config","_cacheExpirations","Map","purgeOnQuotaError","registerQuotaErrorCallback","deleteCacheAndMetadata","cacheNames","getRuntimeName","set","dateHeaderTimestamp","_getDateHeaderTimestamp","headers","has","dateHeader","parsedDate","headerTime","getTime","isNaN"],"mappings":";;;;IAEA,IAAI;IACAA,EAAAA,IAAI,CAAC,0BAAD,CAAJ,IAAoCC,CAAC,EAArC;IACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ICLV;;;;;;;AAOA,IAGA,MAAMC,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B,cAAD,EAAiB;IACpC,QAAI,CAACA,cAAc,CAACwB,OAAf,CAAuBC,GAAvB,CAA2B,MAA3B,CAAL,EAAyC;IACrC,aAAO,IAAP;IACH;;IACD,UAAMC,UAAU,GAAG1B,cAAc,CAACwB,OAAf,CAAuBlF,GAAvB,CAA2B,MAA3B,CAAnB;IACA,UAAMqF,UAAU,GAAG,IAAIhD,IAAJ,CAAS+C,UAAT,CAAnB;IACA,UAAME,UAAU,GAAGD,UAAU,CAACE,OAAX,EAAnB,CANoC;IAQpC;;IACA,QAAIC,KAAK,CAACF,UAAD,CAAT,EAAuB;IACnB,aAAO,IAAP;IACH;;IACD,WAAOA,UAAP;IACH;IACD;;;;;;;;;;;;;;;;;;IAgBA,QAAMV,sBAAN,GAA+B;IAC3B;IACA;IACA,SAAK,MAAM,CAACnG,SAAD,EAAYoF,eAAZ,CAAX,IAA2C,KAAKW,iBAAhD,EAAmE;IAC/D,YAAM7G,IAAI,CAAC8E,MAAL,CAAYrB,MAAZ,CAAmB3C,SAAnB,CAAN;IACA,YAAMoF,eAAe,CAACzC,MAAhB,EAAN;IACH,KAN0B;;;IAQ3B,SAAKoD,iBAAL,GAAyB,IAAIC,GAAJ,EAAzB;IACH;;IAlNkB;;;;;;;;;;;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
this.workbox=this.workbox||{},this.workbox.expiration=function(t,s,e,i,a,n,h){"use strict";try{self["workbox:expiration:5.0.0"]&&_()}catch(t){}const r="workbox-expiration",c="cache-entries",o=t=>{const s=new URL(t,location.href);return s.hash="",s.href};class u{constructor(t){this.t=t,this.s=new i.DBWrapper(r,1,{onupgradeneeded:t=>this.i(t)})}i(t){const s=t.target.result.createObjectStore(c,{keyPath:"id"});s.createIndex("cacheName","cacheName",{unique:!1}),s.createIndex("timestamp","timestamp",{unique:!1}),a.deleteDatabase(this.t)}async setTimestamp(t,s){const e={url:t=o(t),timestamp:s,cacheName:this.t,id:this.h(t)};await this.s.put(c,e)}async getTimestamp(t){return(await this.s.get(c,this.h(t))).timestamp}async expireEntries(t,s){const e=await this.s.transaction(c,"readwrite",(e,i)=>{const a=e.objectStore(c).index("timestamp").openCursor(null,"prev"),n=[];let h=0;a.onsuccess=(()=>{const e=a.result;if(e){const i=e.value;i.cacheName===this.t&&(t&&i.timestamp<t||s&&h>=s?n.push(e.value):h++),e.continue()}else i(n)})}),i=[];for(const t of e)await this.s.delete(c,t.id),i.push(t.url);return i}h(t){return this.t+"|"+o(t)}}class w{constructor(t,s={}){this.o=!1,this.u=!1,this.l=s.maxEntries,this.m=s.maxAgeSeconds,this.t=t,this.p=new u(t)}async expireEntries(){if(this.o)return void(this.u=!0);this.o=!0;const t=this.m?Date.now()-1e3*this.m:0,e=await this.p.expireEntries(t,this.l),i=await self.caches.open(this.t);for(const t of e)await i.delete(t);this.o=!1,this.u&&(this.u=!1,s.dontWaitFor(this.expireEntries()))}async updateTimestamp(t){await this.p.setTimestamp(t,Date.now())}async isURLExpired(t){if(this.m){return await this.p.getTimestamp(t)<Date.now()-1e3*this.m}return!1}async delete(){this.u=!1,await this.p.expireEntries(1/0)}}return t.CacheExpiration=w,t.ExpirationPlugin=class{constructor(t={}){this.cachedResponseWillBeUsed=(async({event:t,request:e,cacheName:i,cachedResponse:a})=>{if(!a)return null;let n=this.k(a);const h=this.D(i);s.dontWaitFor(h.expireEntries());const r=h.updateTimestamp(e.url);if(t)try{t.waitUntil(r)}catch(t){}return n?a:null}),this.cacheDidUpdate=(async({cacheName:t,request:s})=>{const e=this.D(t);await e.updateTimestamp(s.url),await e.expireEntries()}),this.N=t,this.m=t.maxAgeSeconds,this.g=new Map,t.purgeOnQuotaError&&h.registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata())}D(t){if(t===n.cacheNames.getRuntimeName())throw new e.WorkboxError("expire-custom-caches-only");let s=this.g.get(t);return s||(s=new w(t,this.N),this.g.set(t,s)),s}k(t){if(!this.m)return!0;const s=this._(t);return null===s||s>=Date.now()-1e3*this.m}_(t){if(!t.headers.has("date"))return null;const s=t.headers.get("date"),e=new Date(s).getTime();return isNaN(e)?null:e}async deleteCacheAndMetadata(){for(const[t,s]of this.g)await self.caches.delete(t),await s.delete();this.g=new Map}},t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core);
|
2
|
+
//# sourceMappingURL=workbox-expiration.prod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-expiration.prod.js","sources":["../_version.js","../models/CacheTimestampsModel.js","../CacheExpiration.js","../ExpirationPlugin.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:expiration:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { DBWrapper } from 'workbox-core/_private/DBWrapper.js';\nimport { deleteDatabase } from 'workbox-core/_private/deleteDatabase.js';\nimport '../_version.js';\nconst DB_NAME = 'workbox-expiration';\nconst OBJECT_STORE_NAME = 'cache-entries';\nconst normalizeURL = (unNormalizedUrl) => {\n const url = new URL(unNormalizedUrl, location.href);\n url.hash = '';\n return url.href;\n};\n/**\n * Returns the timestamp model.\n *\n * @private\n */\nclass CacheTimestampsModel {\n /**\n *\n * @param {string} cacheName\n *\n * @private\n */\n constructor(cacheName) {\n this._cacheName = cacheName;\n this._db = new DBWrapper(DB_NAME, 1, {\n onupgradeneeded: (event) => this._handleUpgrade(event),\n });\n }\n /**\n * Should perform an upgrade of indexedDB.\n *\n * @param {Event} event\n *\n * @private\n */\n _handleUpgrade(event) {\n const db = event.target.result;\n // TODO(philipwalton): EdgeHTML doesn't support arrays as a keyPath, so we\n // have to use the `id` keyPath here and create our own values (a\n // concatenation of `url + cacheName`) instead of simply using\n // `keyPath: ['url', 'cacheName']`, which is supported in other browsers.\n const objStore = db.createObjectStore(OBJECT_STORE_NAME, { keyPath: 'id' });\n // TODO(philipwalton): once we don't have to support EdgeHTML, we can\n // create a single index with the keyPath `['cacheName', 'timestamp']`\n // instead of doing both these indexes.\n objStore.createIndex('cacheName', 'cacheName', { unique: false });\n objStore.createIndex('timestamp', 'timestamp', { unique: false });\n // Previous versions of `workbox-expiration` used `this._cacheName`\n // as the IDBDatabase name.\n deleteDatabase(this._cacheName);\n }\n /**\n * @param {string} url\n * @param {number} timestamp\n *\n * @private\n */\n async setTimestamp(url, timestamp) {\n url = normalizeURL(url);\n const entry = {\n url,\n timestamp,\n cacheName: this._cacheName,\n // Creating an ID from the URL and cache name won't be necessary once\n // Edge switches to Chromium and all browsers we support work with\n // array keyPaths.\n id: this._getId(url),\n };\n await this._db.put(OBJECT_STORE_NAME, entry);\n }\n /**\n * Returns the timestamp stored for a given URL.\n *\n * @param {string} url\n * @return {number}\n *\n * @private\n */\n async getTimestamp(url) {\n const entry = await this._db.get(OBJECT_STORE_NAME, this._getId(url));\n return entry.timestamp;\n }\n /**\n * Iterates through all the entries in the object store (from newest to\n * oldest) and removes entries once either `maxCount` is reached or the\n * entry's timestamp is less than `minTimestamp`.\n *\n * @param {number} minTimestamp\n * @param {number} maxCount\n * @return {Array<string>}\n *\n * @private\n */\n async expireEntries(minTimestamp, maxCount) {\n const entriesToDelete = await this._db.transaction(OBJECT_STORE_NAME, 'readwrite', (txn, done) => {\n const store = txn.objectStore(OBJECT_STORE_NAME);\n const request = store.index('timestamp').openCursor(null, 'prev');\n const entriesToDelete = [];\n let entriesNotDeletedCount = 0;\n request.onsuccess = () => {\n const cursor = request.result;\n if (cursor) {\n const result = cursor.value;\n // TODO(philipwalton): once we can use a multi-key index, we\n // won't have to check `cacheName` here.\n if (result.cacheName === this._cacheName) {\n // Delete an entry if it's older than the max age or\n // if we already have the max number allowed.\n if ((minTimestamp && result.timestamp < minTimestamp) ||\n (maxCount && entriesNotDeletedCount >= maxCount)) {\n // TODO(philipwalton): we should be able to delete the\n // entry right here, but doing so causes an iteration\n // bug in Safari stable (fixed in TP). Instead we can\n // store the keys of the entries to delete, and then\n // delete the separate transactions.\n // https://github.com/GoogleChrome/workbox/issues/1978\n // cursor.delete();\n // We only need to return the URL, not the whole entry.\n entriesToDelete.push(cursor.value);\n }\n else {\n entriesNotDeletedCount++;\n }\n }\n cursor.continue();\n }\n else {\n done(entriesToDelete);\n }\n };\n });\n // TODO(philipwalton): once the Safari bug in the following issue is fixed,\n // we should be able to remove this loop and do the entry deletion in the\n // cursor loop above:\n // https://github.com/GoogleChrome/workbox/issues/1978\n const urlsDeleted = [];\n for (const entry of entriesToDelete) {\n await this._db.delete(OBJECT_STORE_NAME, entry.id);\n urlsDeleted.push(entry.url);\n }\n return urlsDeleted;\n }\n /**\n * Takes a URL and returns an ID that will be unique in the object store.\n *\n * @param {string} url\n * @return {string}\n *\n * @private\n */\n _getId(url) {\n // Creating an ID from the URL and cache name won't be necessary once\n // Edge switches to Chromium and all browsers we support work with\n // array keyPaths.\n return this._cacheName + '|' + normalizeURL(url);\n }\n}\nexport { CacheTimestampsModel };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { CacheTimestampsModel } from './models/CacheTimestampsModel.js';\nimport './_version.js';\n/**\n * The `CacheExpiration` class allows you define an expiration and / or\n * limit on the number of responses stored in a\n * [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache).\n *\n * @memberof module:workbox-expiration\n */\nclass CacheExpiration {\n /**\n * To construct a new CacheExpiration instance you must provide at least\n * one of the `config` properties.\n *\n * @param {string} cacheName Name of the cache to apply restrictions to.\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n */\n constructor(cacheName, config = {}) {\n this._isRunning = false;\n this._rerunRequested = false;\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(cacheName, 'string', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'cacheName',\n });\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n });\n }\n if (config.maxEntries) {\n assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxEntries',\n });\n // TODO: Assert is positive\n }\n if (config.maxAgeSeconds) {\n assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds',\n });\n // TODO: Assert is positive\n }\n }\n this._maxEntries = config.maxEntries;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheName = cacheName;\n this._timestampModel = new CacheTimestampsModel(cacheName);\n }\n /**\n * Expires entries for the given cache and given criteria.\n */\n async expireEntries() {\n if (this._isRunning) {\n this._rerunRequested = true;\n return;\n }\n this._isRunning = true;\n const minTimestamp = this._maxAgeSeconds ?\n Date.now() - (this._maxAgeSeconds * 1000) : 0;\n const urlsExpired = await this._timestampModel.expireEntries(minTimestamp, this._maxEntries);\n // Delete URLs from the cache\n const cache = await self.caches.open(this._cacheName);\n for (const url of urlsExpired) {\n await cache.delete(url);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (urlsExpired.length > 0) {\n logger.groupCollapsed(`Expired ${urlsExpired.length} ` +\n `${urlsExpired.length === 1 ? 'entry' : 'entries'} and removed ` +\n `${urlsExpired.length === 1 ? 'it' : 'them'} from the ` +\n `'${this._cacheName}' cache.`);\n logger.log(`Expired the following ${urlsExpired.length === 1 ?\n 'URL' : 'URLs'}:`);\n urlsExpired.forEach((url) => logger.log(` ${url}`));\n logger.groupEnd();\n }\n else {\n logger.debug(`Cache expiration ran and found no entries to remove.`);\n }\n }\n this._isRunning = false;\n if (this._rerunRequested) {\n this._rerunRequested = false;\n dontWaitFor(this.expireEntries());\n }\n }\n /**\n * Update the timestamp for the given URL. This ensures the when\n * removing entries based on maximum entries, most recently used\n * is accurate or when expiring, the timestamp is up-to-date.\n *\n * @param {string} url\n */\n async updateTimestamp(url) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(url, 'string', {\n moduleName: 'workbox-expiration',\n className: 'CacheExpiration',\n funcName: 'updateTimestamp',\n paramName: 'url',\n });\n }\n await this._timestampModel.setTimestamp(url, Date.now());\n }\n /**\n * Can be used to check if a URL has expired or not before it's used.\n *\n * This requires a look up from IndexedDB, so can be slow.\n *\n * Note: This method will not remove the cached entry, call\n * `expireEntries()` to remove indexedDB and Cache entries.\n *\n * @param {string} url\n * @return {boolean}\n */\n async isURLExpired(url) {\n if (!this._maxAgeSeconds) {\n if (process.env.NODE_ENV !== 'production') {\n throw new WorkboxError(`expired-test-without-max-age`, {\n methodName: 'isURLExpired',\n paramName: 'maxAgeSeconds',\n });\n }\n return false;\n }\n else {\n const timestamp = await this._timestampModel.getTimestamp(url);\n const expireOlderThan = Date.now() - (this._maxAgeSeconds * 1000);\n return (timestamp < expireOlderThan);\n }\n }\n /**\n * Removes the IndexedDB object store used to keep track of cache expiration\n * metadata.\n */\n async delete() {\n // Make sure we don't attempt another rerun if we're called in the middle of\n // a cache expiration.\n this._rerunRequested = false;\n await this._timestampModel.expireEntries(Infinity); // Expires all.\n }\n}\nexport { CacheExpiration };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { registerQuotaErrorCallback } from 'workbox-core/registerQuotaErrorCallback.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { CacheExpiration } from './CacheExpiration.js';\nimport './_version.js';\n/**\n * This plugin can be used in the Workbox APIs to regularly enforce a\n * limit on the age and / or the number of cached requests.\n *\n * Whenever a cached request is used or updated, this plugin will look\n * at the used Cache and remove any old or extra requests.\n *\n * When using `maxAgeSeconds`, requests may be used *once* after expiring\n * because the expiration clean up will not have occurred until *after* the\n * cached request has been used. If the request has a \"Date\" header, then\n * a light weight expiration check is performed and the request will not be\n * used immediately.\n *\n * When using `maxEntries`, the entry least-recently requested will be removed\n * from the cache first.\n *\n * @memberof module:workbox-expiration\n */\nclass ExpirationPlugin {\n /**\n * @param {Object} config\n * @param {number} [config.maxEntries] The maximum number of entries to cache.\n * Entries used the least will be removed as the maximum is reached.\n * @param {number} [config.maxAgeSeconds] The maximum age of an entry before\n * it's treated as stale and removed.\n * @param {boolean} [config.purgeOnQuotaError] Whether to opt this cache in to\n * automatic deletion if the available storage quota has been exceeded.\n */\n constructor(config = {}) {\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-strategies` handlers when a `Response` is about to be returned\n * from a [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache) to\n * the handler. It allows the `Response` to be inspected for freshness and\n * prevents it from being used if the `Response`'s `Date` header value is\n * older than the configured `maxAgeSeconds`.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache the response is in.\n * @param {Response} options.cachedResponse The `Response` object that's been\n * read from a cache and whose freshness should be checked.\n * @return {Response} Either the `cachedResponse`, if it's\n * fresh, or `null` if the `Response` is older than `maxAgeSeconds`.\n *\n * @private\n */\n this.cachedResponseWillBeUsed = async ({ event, request, cacheName, cachedResponse }) => {\n if (!cachedResponse) {\n return null;\n }\n let isFresh = this._isResponseDateFresh(cachedResponse);\n // Expire entries to ensure that even if the expiration date has\n // expired, it'll only be used once.\n const cacheExpiration = this._getCacheExpiration(cacheName);\n dontWaitFor(cacheExpiration.expireEntries());\n // Update the metadata for the request URL to the current timestamp,\n // but don't `await` it as we don't want to block the response.\n const updateTimestampDone = cacheExpiration.updateTimestamp(request.url);\n if (event) {\n try {\n event.waitUntil(updateTimestampDone);\n }\n catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n // The event may not be a fetch event; only log the URL if it is.\n if ('request' in event) {\n logger.warn(`Unable to ensure service worker stays alive when ` +\n `updating cache entry for ` +\n `'${getFriendlyURL(event.request.url)}'.`);\n }\n }\n }\n }\n return isFresh ? cachedResponse : null;\n };\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-strategies` handlers when an entry is added to a cache.\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache that was updated.\n * @param {string} options.request The Request for the cached entry.\n *\n * @private\n */\n this.cacheDidUpdate = async ({ cacheName, request }) => {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(cacheName, 'string', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'cacheName',\n });\n assert.isInstance(request, Request, {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'cacheDidUpdate',\n paramName: 'request',\n });\n }\n const cacheExpiration = this._getCacheExpiration(cacheName);\n await cacheExpiration.updateTimestamp(request.url);\n await cacheExpiration.expireEntries();\n };\n if (process.env.NODE_ENV !== 'production') {\n if (!(config.maxEntries || config.maxAgeSeconds)) {\n throw new WorkboxError('max-entries-or-age-required', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n });\n }\n if (config.maxEntries) {\n assert.isType(config.maxEntries, 'number', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxEntries',\n });\n }\n if (config.maxAgeSeconds) {\n assert.isType(config.maxAgeSeconds, 'number', {\n moduleName: 'workbox-expiration',\n className: 'Plugin',\n funcName: 'constructor',\n paramName: 'config.maxAgeSeconds',\n });\n }\n }\n this._config = config;\n this._maxAgeSeconds = config.maxAgeSeconds;\n this._cacheExpirations = new Map();\n if (config.purgeOnQuotaError) {\n registerQuotaErrorCallback(() => this.deleteCacheAndMetadata());\n }\n }\n /**\n * A simple helper method to return a CacheExpiration instance for a given\n * cache name.\n *\n * @param {string} cacheName\n * @return {CacheExpiration}\n *\n * @private\n */\n _getCacheExpiration(cacheName) {\n if (cacheName === cacheNames.getRuntimeName()) {\n throw new WorkboxError('expire-custom-caches-only');\n }\n let cacheExpiration = this._cacheExpirations.get(cacheName);\n if (!cacheExpiration) {\n cacheExpiration = new CacheExpiration(cacheName, this._config);\n this._cacheExpirations.set(cacheName, cacheExpiration);\n }\n return cacheExpiration;\n }\n /**\n * @param {Response} cachedResponse\n * @return {boolean}\n *\n * @private\n */\n _isResponseDateFresh(cachedResponse) {\n if (!this._maxAgeSeconds) {\n // We aren't expiring by age, so return true, it's fresh\n return true;\n }\n // Check if the 'date' header will suffice a quick expiration check.\n // See https://github.com/GoogleChromeLabs/sw-toolbox/issues/164 for\n // discussion.\n const dateHeaderTimestamp = this._getDateHeaderTimestamp(cachedResponse);\n if (dateHeaderTimestamp === null) {\n // Unable to parse date, so assume it's fresh.\n return true;\n }\n // If we have a valid headerTime, then our response is fresh iff the\n // headerTime plus maxAgeSeconds is greater than the current time.\n const now = Date.now();\n return dateHeaderTimestamp >= now - (this._maxAgeSeconds * 1000);\n }\n /**\n * This method will extract the data header and parse it into a useful\n * value.\n *\n * @param {Response} cachedResponse\n * @return {number|null}\n *\n * @private\n */\n _getDateHeaderTimestamp(cachedResponse) {\n if (!cachedResponse.headers.has('date')) {\n return null;\n }\n const dateHeader = cachedResponse.headers.get('date');\n const parsedDate = new Date(dateHeader);\n const headerTime = parsedDate.getTime();\n // If the Date header was invalid for some reason, parsedDate.getTime()\n // will return NaN.\n if (isNaN(headerTime)) {\n return null;\n }\n return headerTime;\n }\n /**\n * This is a helper method that performs two operations:\n *\n * - Deletes *all* the underlying Cache instances associated with this plugin\n * instance, by calling caches.delete() on your behalf.\n * - Deletes the metadata from IndexedDB used to keep track of expiration\n * details for each Cache instance.\n *\n * When using cache expiration, calling this method is preferable to calling\n * `caches.delete()` directly, since this will ensure that the IndexedDB\n * metadata is also cleanly removed and open IndexedDB instances are deleted.\n *\n * Note that if you're *not* using cache expiration for a given cache, calling\n * `caches.delete()` and passing in the cache's name should be sufficient.\n * There is no Workbox-specific method needed for cleanup in that case.\n */\n async deleteCacheAndMetadata() {\n // Do this one at a time instead of all at once via `Promise.all()` to\n // reduce the chance of inconsistency if a promise rejects.\n for (const [cacheName, cacheExpiration] of this._cacheExpirations) {\n await self.caches.delete(cacheName);\n await cacheExpiration.delete();\n }\n // Reset this._cacheExpirations to its initial state.\n this._cacheExpirations = new Map();\n }\n}\nexport { ExpirationPlugin };\n"],"names":["self","_","e","DB_NAME","OBJECT_STORE_NAME","normalizeURL","unNormalizedUrl","url","URL","location","href","hash","CacheTimestampsModel","constructor","cacheName","_cacheName","_db","DBWrapper","onupgradeneeded","event","this","_handleUpgrade","objStore","target","result","createObjectStore","keyPath","createIndex","unique","deleteDatabase","timestamp","entry","id","_getId","put","get","minTimestamp","maxCount","entriesToDelete","transaction","txn","done","request","objectStore","index","openCursor","entriesNotDeletedCount","onsuccess","cursor","value","push","continue","urlsDeleted","delete","CacheExpiration","config","_isRunning","_rerunRequested","_maxEntries","maxEntries","_maxAgeSeconds","maxAgeSeconds","_timestampModel","Date","now","urlsExpired","expireEntries","cache","caches","open","dontWaitFor","setTimestamp","getTimestamp","Infinity","cachedResponseWillBeUsed","async","cachedResponse","isFresh","_isResponseDateFresh","cacheExpiration","_getCacheExpiration","updateTimestampDone","updateTimestamp","waitUntil","error","cacheDidUpdate","_config","_cacheExpirations","Map","purgeOnQuotaError","registerQuotaErrorCallback","deleteCacheAndMetadata","cacheNames","getRuntim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,YAYjCS,eAAiBV,QAAS7D,UAAAA,EAAW4B,QAAAA,YAehCqC,EAAkB3D,KAAK4D,EAAoBlE,SAC3CiE,EAAgBG,gBAAgBxC,EAAQnC,WACxCwE,EAAgBb,uBA2BrBoB,EAAU/B,OACVK,EAAiBL,EAAOM,mBACxB0B,EAAoB,IAAIC,IACzBjC,EAAOkC,mBACPC,6BAA2B,IAAMtE,KAAKuE,0BAY9CX,EAAoBlE,MACZA,IAAc8E,aAAWC,uBACnB,IAAIC,eAAa,iCAEvBf,EAAkB3D,KAAKmE,EAAkBpD,IAAIrB,UAC5CiE,IACDA,EAAkB,IAAIzB,EAAgBxC,EAAWM,KAAKkE,QACjDC,EAAkBQ,IAAIjF,EAAWiE,IAEnCA,EAQXD,EAAqBF,OACZxD,KAAKwC,SAEC,QAKLoC,EAAsB5E,KAAK6E,EAAwBrB,UAC7B,OAAxBoB,GAOGA,GADKjC,KAAKC,MAC0C,IAAtB5C,KAAKwC,EAW9CqC,EAAwBrB,OACfA,EAAesB,QAAQC,IAAI,eACrB,WAELC,EAAaxB,EAAesB,QAAQ/D,IAAI,QAExCkE,EADa,IAAItC,KAAKqC,GACEE,iBAG1BC,MAAMF,GACC,KAEJA,qCAqBF,MAAOvF,EAAWiE,KAAoB3D,KAAKmE,QACtCvF,KAAKoE,OAAOf,OAAOvC,SACnBiE,EAAgB1B,cAGrBkC,EAAoB,IAAIC"}
|
@@ -2,9 +2,8 @@ this.workbox = this.workbox || {};
|
|
2
2
|
this.workbox.navigationPreload = (function (exports, logger_js) {
|
3
3
|
'use strict';
|
4
4
|
|
5
|
-
// @ts-ignore
|
6
5
|
try {
|
7
|
-
self['workbox:navigation-preload:5.0.0
|
6
|
+
self['workbox:navigation-preload:5.0.0'] && _();
|
8
7
|
} catch (e) {}
|
9
8
|
|
10
9
|
/*
|
@@ -18,7 +17,7 @@ this.workbox.navigationPreload = (function (exports, logger_js) {
|
|
18
17
|
* @return {boolean} Whether or not the current browser supports enabling
|
19
18
|
* navigation preload.
|
20
19
|
*
|
21
|
-
* @memberof workbox
|
20
|
+
* @memberof module:workbox-navigation-preload
|
22
21
|
*/
|
23
22
|
|
24
23
|
function isSupported() {
|
@@ -35,7 +34,7 @@ this.workbox.navigationPreload = (function (exports, logger_js) {
|
|
35
34
|
/**
|
36
35
|
* If the browser supports Navigation Preload, then this will disable it.
|
37
36
|
*
|
38
|
-
* @memberof workbox
|
37
|
+
* @memberof module:workbox-navigation-preload
|
39
38
|
*/
|
40
39
|
|
41
40
|
function disable() {
|
@@ -69,7 +68,7 @@ this.workbox.navigationPreload = (function (exports, logger_js) {
|
|
69
68
|
* the value of the `Service-Worker-Navigation-Preload` header which will be
|
70
69
|
* sent to the server when making the navigation request.
|
71
70
|
*
|
72
|
-
* @memberof workbox
|
71
|
+
* @memberof module:workbox-navigation-preload
|
73
72
|
*/
|
74
73
|
|
75
74
|
function enable(headerValue) {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-navigation-preload.dev.js","sources":["../_version.js","../isSupported.js","../disable.js","../enable.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:navigation-preload:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * @return {boolean} Whether or not the current browser supports enabling\n * navigation preload.\n *\n * @memberof module:workbox-navigation-preload\n */\nfunction isSupported() {\n return Boolean(self.registration && self.registration.navigationPreload);\n}\nexport { isSupported };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { isSupported } from './isSupported.js';\nimport './_version.js';\n/**\n * If the browser supports Navigation Preload, then this will disable it.\n *\n * @memberof module:workbox-navigation-preload\n */\nfunction disable() {\n if (isSupported()) {\n self.addEventListener('activate', (event) => {\n event.waitUntil(self.registration.navigationPreload.disable().then(() => {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is disabled.`);\n }\n }));\n });\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n}\nexport { disable };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { isSupported } from './isSupported.js';\nimport './_version.js';\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 module:workbox-navigation-preload\n */\nfunction 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 if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is enabled.`);\n }\n }));\n });\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n}\nexport { enable };\n"],"names":["self","_","e","isSupported","Boolean","registration","navigationPreload","disable","addEventListener","event","waitUntil","then","logger","log","enable","headerValue","setHeaderValue"],"mappings":";;;;IAEA,IAAI;IACAA,EAAAA,IAAI,CAAC,kCAAD,CAAJ,IAA4CC,CAAC,EAA7C;IACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ICLV;;;;;;;AAOA,IACA;;;;;;;IAMA,SAASC,WAAT,GAAuB;IACnB,SAAOC,OAAO,CAACJ,IAAI,CAACK,YAAL,IAAqBL,IAAI,CAACK,YAAL,CAAkBC,iBAAxC,CAAd;IACH;;IChBD;;;;;;;AAOA,IAGA;;;;;;IAKA,SAASC,OAAT,GAAmB;IACf,MAAIJ,WAAW,EAAf,EAAmB;IACfH,IAAAA,IAAI,CAACQ,gBAAL,CAAsB,UAAtB,EAAmCC,KAAD,IAAW;IACzCA,MAAAA,KAAK,CAACC,SAAN,CAAgBV,IAAI,CAACK,YAAL,CAAkBC,iBAAlB,CAAoCC,OAApC,GAA8CI,IAA9C,CAAmD,MAAM;IACrE,QAA2C;IACvCC,UAAAA,gBAAM,CAACC,GAAP,CAAY,iCAAZ;IACH;IACJ,OAJe,CAAhB;IAKH,KAND;IAOH,GARD,MASK;IACD,IAA2C;IACvCD,MAAAA,gBAAM,CAACC,GAAP,CAAY,sDAAZ;IACH;IACJ;IACJ;;IC9BD;;;;;;;AAOA,IAGA;;;;;;;;;;;IAUA,SAASC,MAAT,CAAgBC,WAAhB,EAA6B;IACzB,MAAIZ,WAAW,EAAf,EAAmB;IACfH,IAAAA,IAAI,CAACQ,gBAAL,CAAsB,UAAtB,EAAmCC,KAAD,IAAW;IACzCA,MAAAA,KAAK,CAACC,SAAN,CAAgBV,IAAI,CAACK,YAAL,CAAkBC,iBAAlB,CAAoCQ,MAApC,GAA6CH,IAA7C,CAAkD,MAAM;IACpE;IACA,YAAII,WAAJ,EAAiB;IACbf,UAAAA,IAAI,CAACK,YAAL,CAAkBC,iBAAlB,CAAoCU,cAApC,CAAmDD,WAAnD;IACH;;IACD,QAA2C;IACvCH,UAAAA,gBAAM,CAACC,GAAP,CAAY,gCAAZ;IACH;IACJ,OARe,CAAhB;IASH,KAVD;IAWH,GAZD,MAaK;IACD,IAA2C;IACvCD,MAAAA,gBAAM,CAACC,GAAP,CAAY,sDAAZ;IACH;IACJ;IACJ;;;;;;;;;;;;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){"use strict";try{self["workbox:navigation-preload:5.0.0"]&&_()}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
|
+
//# sourceMappingURL=workbox-navigation-preload.prod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-navigation-preload.prod.js","sources":["../_version.js","../isSupported.js","../disable.js","../enable.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:navigation-preload:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport './_version.js';\n/**\n * @return {boolean} Whether or not the current browser supports enabling\n * navigation preload.\n *\n * @memberof module:workbox-navigation-preload\n */\nfunction isSupported() {\n return Boolean(self.registration && self.registration.navigationPreload);\n}\nexport { isSupported };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { isSupported } from './isSupported.js';\nimport './_version.js';\n/**\n * If the browser supports Navigation Preload, then this will disable it.\n *\n * @memberof module:workbox-navigation-preload\n */\nfunction disable() {\n if (isSupported()) {\n self.addEventListener('activate', (event) => {\n event.waitUntil(self.registration.navigationPreload.disable().then(() => {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is disabled.`);\n }\n }));\n });\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n}\nexport { disable };\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { isSupported } from './isSupported.js';\nimport './_version.js';\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 module:workbox-navigation-preload\n */\nfunction 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 if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is enabled.`);\n }\n }));\n });\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n}\nexport { enable };\n"],"names":["self","_","e","isSupported","Boolean","registration","navigationPreload","addEventListener","event","waitUntil","disable","then","headerValue","enable","setHeaderValue"],"mappings":"sFAEA,IACIA,KAAK,qCAAuCC,IAEhD,MAAOC,ICSP,SAASC,WACEC,QAAQJ,KAAKK,cAAgBL,KAAKK,aAAaC,oCCA1D,WACQH,KACAH,KAAKO,iBAAiB,WAAaC,IAC/BA,EAAMC,UAAUT,KAAKK,aAAaC,kBAAkBI,UAAUC,KAAK,qBCE/E,SAAgBC,GACRT,KACAH,KAAKO,iBAAiB,WAAaC,IAC/BA,EAAMC,UAAUT,KAAKK,aAAaC,kBAAkBO,SAASF,KAAK,KAE1DC,GACAZ,KAAKK,aAAaC,kBAAkBQ,eAAeF"}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
this.workbox = this.workbox || {};
|
2
|
-
this.workbox.googleAnalytics = (function (exports,
|
2
|
+
this.workbox.googleAnalytics = (function (exports, BackgroundSyncPlugin_js, cacheNames_js, getFriendlyURL_js, logger_js, Route_js, Router_js, NetworkFirst_js, NetworkOnly_js) {
|
3
3
|
'use strict';
|
4
4
|
|
5
|
-
// @ts-ignore
|
6
5
|
try {
|
7
|
-
self['workbox:google-analytics:5.0.0
|
6
|
+
self['workbox:google-analytics:5.0.0'] && _();
|
8
7
|
} catch (e) {}
|
9
8
|
|
10
9
|
/*
|
@@ -37,12 +36,12 @@ this.workbox.googleAnalytics = (function (exports, Plugin_js, cacheNames_js, get
|
|
37
36
|
*/
|
38
37
|
/**
|
39
38
|
* Creates the requestWillDequeue callback to be used with the background
|
40
|
-
* sync
|
39
|
+
* sync plugin. The callback takes the failed request and adds the
|
41
40
|
* `qt` param based on the current time, as well as applies any other
|
42
41
|
* user-defined hit modifications.
|
43
42
|
*
|
44
|
-
* @param {Object} config See workbox.
|
45
|
-
* @return {Function} The
|
43
|
+
* @param {Object} config See {@link module:workbox-google-analytics.initialize}.
|
44
|
+
* @return {Function} The requestWillDequeue callback function.
|
46
45
|
*
|
47
46
|
* @private
|
48
47
|
*/
|
@@ -69,7 +68,7 @@ this.workbox.googleAnalytics = (function (exports, Plugin_js, cacheNames_js, get
|
|
69
68
|
const originalHitTime = timestamp - (Number(params.get('qt')) || 0);
|
70
69
|
const queueTime = Date.now() - originalHitTime; // Set the qt param prior to applying hitFilter or parameterOverrides.
|
71
70
|
|
72
|
-
params.set('qt', String(queueTime)); // Apply `
|
71
|
+
params.set('qt', String(queueTime)); // Apply `parameterOverrides`, if set.
|
73
72
|
|
74
73
|
if (config.parameterOverrides) {
|
75
74
|
for (const param of Object.keys(config.parameterOverrides)) {
|
@@ -117,20 +116,20 @@ this.workbox.googleAnalytics = (function (exports, Plugin_js, cacheNames_js, get
|
|
117
116
|
/**
|
118
117
|
* Creates GET and POST routes to catch failed Measurement Protocol hits.
|
119
118
|
*
|
120
|
-
* @param {
|
119
|
+
* @param {BackgroundSyncPlugin} bgSyncPlugin
|
121
120
|
* @return {Array<Route>} The created routes.
|
122
121
|
*
|
123
122
|
* @private
|
124
123
|
*/
|
125
124
|
|
126
125
|
|
127
|
-
const createCollectRoutes =
|
126
|
+
const createCollectRoutes = bgSyncPlugin => {
|
128
127
|
const match = ({
|
129
128
|
url
|
130
129
|
}) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);
|
131
130
|
|
132
131
|
const handler = new NetworkOnly_js.NetworkOnly({
|
133
|
-
plugins: [
|
132
|
+
plugins: [bgSyncPlugin]
|
134
133
|
});
|
135
134
|
return [new Route_js.Route(match, handler, 'GET'), new Route_js.Route(match, handler, 'POST')];
|
136
135
|
};
|
@@ -208,17 +207,17 @@ this.workbox.googleAnalytics = (function (exports, Plugin_js, cacheNames_js, get
|
|
208
207
|
* the hit. The function is invoked with the original hit's URLSearchParams
|
209
208
|
* object as its only argument.
|
210
209
|
*
|
211
|
-
* @memberof workbox
|
210
|
+
* @memberof module:workbox-google-analytics
|
212
211
|
*/
|
213
212
|
|
214
213
|
|
215
214
|
const initialize = (options = {}) => {
|
216
215
|
const cacheName = cacheNames_js.cacheNames.getGoogleAnalyticsName(options.cacheName);
|
217
|
-
const
|
216
|
+
const bgSyncPlugin = new BackgroundSyncPlugin_js.BackgroundSyncPlugin(QUEUE_NAME, {
|
218
217
|
maxRetentionTime: MAX_RETENTION_TIME,
|
219
218
|
onSync: createOnSyncCallback(options)
|
220
219
|
});
|
221
|
-
const routes = [createGtmJsRoute(cacheName), createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(
|
220
|
+
const routes = [createGtmJsRoute(cacheName), createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(bgSyncPlugin)];
|
222
221
|
const router = new Router_js.Router();
|
223
222
|
|
224
223
|
for (const route of routes) {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-offline-ga.dev.js","sources":["../_version.js","../utils/constants.js","../initialize.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:google-analytics:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nexport const QUEUE_NAME = 'workbox-google-analytics';\nexport const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes\nexport const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';\nexport const GTM_HOST = 'www.googletagmanager.com';\nexport const ANALYTICS_JS_PATH = '/analytics.js';\nexport const GTAG_JS_PATH = '/gtag/js';\nexport const GTM_JS_PATH = '/gtm.js';\nexport const COLLECT_DEFAULT_PATH = '/collect';\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)\nexport const COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { BackgroundSyncPlugin } from 'workbox-background-sync/BackgroundSyncPlugin.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { Route } from 'workbox-routing/Route.js';\nimport { Router } from 'workbox-routing/Router.js';\nimport { NetworkFirst } from 'workbox-strategies/NetworkFirst.js';\nimport { NetworkOnly } from 'workbox-strategies/NetworkOnly.js';\nimport { QUEUE_NAME, MAX_RETENTION_TIME, GOOGLE_ANALYTICS_HOST, GTM_HOST, ANALYTICS_JS_PATH, GTAG_JS_PATH, GTM_JS_PATH, COLLECT_PATHS_REGEX, } from './utils/constants.js';\nimport './_version.js';\n/**\n * Creates the requestWillDequeue callback to be used with the background\n * sync 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 {@link module:workbox-google-analytics.initialize}.\n * @return {Function} The requestWillDequeue callback function.\n *\n * @private\n */\nconst createOnSyncCallback = (config) => {\n return async ({ queue }) => {\n let entry;\n while (entry = await queue.shiftRequest()) {\n const { request, timestamp } = entry;\n const url = new URL(request.url);\n try {\n // Measurement protocol requests can set their payload parameters in\n // either the URL query string (for GET requests) or the POST body.\n const params = request.method === 'POST' ?\n new URLSearchParams(await request.clone().text()) :\n url.searchParams;\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 // Set the qt param prior to applying hitFilter or parameterOverrides.\n params.set('qt', String(queueTime));\n // Apply `parameterOverrides`, if set.\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 // Apply `hitFilter`, if set.\n if (typeof config.hitFilter === 'function') {\n config.hitFilter.call(null, params);\n }\n // Retry the fetch. Ignore URL search params from the URL as they're\n // now in the post body.\n await fetch(new Request(url.origin + url.pathname, {\n body: params.toString(),\n method: 'POST',\n mode: 'cors',\n credentials: 'omit',\n headers: { 'Content-Type': 'text/plain' },\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Request for '${getFriendlyURL(url.href)}'` +\n `has been replayed`);\n }\n }\n catch (err) {\n await queue.unshiftRequest(entry);\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Request for '${getFriendlyURL(url.href)}'` +\n `failed to replay, putting it back in the queue.`);\n }\n throw err;\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`All Google Analytics request successfully replayed; ` +\n `the queue is now empty!`);\n }\n };\n};\n/**\n * Creates GET and POST routes to catch failed Measurement Protocol hits.\n *\n * @param {BackgroundSyncPlugin} bgSyncPlugin\n * @return {Array<Route>} The created routes.\n *\n * @private\n */\nconst createCollectRoutes = (bgSyncPlugin) => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST &&\n COLLECT_PATHS_REGEX.test(url.pathname);\n const handler = new NetworkOnly({\n plugins: [bgSyncPlugin],\n });\n return [\n new Route(match, handler, 'GET'),\n new 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 */\nconst createAnalyticsJsRoute = (cacheName) => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST &&\n url.pathname === ANALYTICS_JS_PATH;\n const handler = new NetworkFirst({ cacheName });\n return new Route(match, handler, 'GET');\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 */\nconst createGtagJsRoute = (cacheName) => {\n const match = ({ url }) => url.hostname === GTM_HOST &&\n url.pathname === GTAG_JS_PATH;\n const handler = new NetworkFirst({ cacheName });\n return new Route(match, handler, 'GET');\n};\n/**\n * Creates a route with a network first strategy for the gtm.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\nconst createGtmJsRoute = (cacheName) => {\n const match = ({ url }) => url.hostname === GTM_HOST &&\n url.pathname === GTM_JS_PATH;\n const handler = new NetworkFirst({ cacheName });\n return new Route(match, handler, 'GET');\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 module:workbox-google-analytics\n */\nconst initialize = (options = {}) => {\n const cacheName = cacheNames.getGoogleAnalyticsName(options.cacheName);\n const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n onSync: createOnSyncCallback(options),\n });\n const routes = [\n createGtmJsRoute(cacheName),\n createAnalyticsJsRoute(cacheName),\n createGtagJsRoute(cacheName),\n ...createCollectRoutes(bgSyncPlugin),\n ];\n const router = new Router();\n for (const route of routes) {\n router.registerRoute(route);\n }\n router.addFetchListener();\n};\nexport { initialize, };\n"],"names":["self","_","e","QUEUE_NAME","MAX_RETENTION_TIME","GOOGLE_ANALYTICS_HOST","GTM_HOST","ANALYTICS_JS_PATH","GTAG_JS_PATH","GTM_JS_PATH","COLLECT_PATHS_REGEX","createOnSyncCallback","config","queue","entry","shiftRequest","request","timestamp","url","URL","params","method","URLSearchParams","clone","text","searchParams","originalHitTime","Number","get","queueTime","Date","now","set","String","parameterOverrides","param","Object","keys","value","hitFilter","call","fetch","Request","origin","pathname","body","toString","mode","credentials","headers","process","logger","log","getFriendlyURL","href","err","unshiftRequest","createCollectRoutes","bgSyncPlugin","match","hostname","test","handler","NetworkOnly","plugins","Route","createAnalyticsJsRoute","cacheName","NetworkFirst","createGtagJsRoute","createGtmJsRoute","initialize","options","cacheNames","getGoogleAnalyticsName","BackgroundSyncPlugin","maxRetentionTime","onSync","routes","router","Router","route","registerRoute","addFetchListener"],"mappings":";;;;IAEA,IAAI;IACAA,EAAAA,IAAI,CAAC,gCAAD,CAAJ,IAA0CC,CAAC,EAA3C;IACH,CAFD,CAGA,OAAOC,CAAP,EAAU;;ICLV;;;;;;;AAOA,IACO,MAAMC,UAAU,GAAG,0BAAnB;AACP,IAAO,MAAMC,kBAAkB,GAAG,KAAK,EAAhC;;AACP,IAAO,MAAMC,qBAAqB,GAAG,0BAA9B;AACP,IAAO,MAAMC,QAAQ,GAAG,0BAAjB;AACP,IAAO,MAAMC,iBAAiB,GAAG,eAA1B;AACP,IAAO,MAAMC,YAAY,GAAG,UAArB;AACP,IAAO,MAAMC,WAAW,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,OAAO,GAAG,IAAIM,4BAAJ,CAAiB;IAAED,IAAAA;IAAF,GAAjB,CAAhB;IACA,SAAO,IAAIF,cAAJ,CAAUN,KAAV,EAAiBG,OAAjB,EAA0B,KAA1B,CAAP;IACH,CALD;IAMA;;;;;;;;;;;;;;;;;;AAgBA,UAAMS,UAAU,GAAG,CAACC,OAAO,GAAG,EAAX,KAAkB;IACjC,QAAML,SAAS,GAAGM,wBAAU,CAACC,sBAAX,CAAkCF,OAAO,CAACL,SAA1C,CAAlB;IACA,QAAMT,YAAY,GAAG,IAAIiB,4CAAJ,CAAyBxE,UAAzB,EAAqC;IACtDyE,IAAAA,gBAAgB,EAAExE,kBADoC;IAEtDyE,IAAAA,MAAM,EAAElE,oBAAoB,CAAC6D,OAAD;IAF0B,GAArC,CAArB;IAIA,QAAMM,MAAM,GAAG,CACXR,gBAAgB,CAACH,SAAD,CADL,EAEXD,sBAAsB,CAACC,SAAD,CAFX,EAGXE,iBAAiB,CAACF,SAAD,CAHN,EAIX,GAAGV,mBAAmB,CAACC,YAAD,CAJX,CAAf;IAMA,QAAMqB,MAAM,GAAG,IAAIC,gBAAJ,EAAf;;IACA,OAAK,MAAMC,KAAX,IAAoBH,MAApB,EAA4B;IACxBC,IAAAA,MAAM,CAACG,aAAP,CAAqBD,KAArB;IACH;;IACDF,EAAAA,MAAM,CAACI,gBAAP;IACH,CAjBD;;;;;;;;;;"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(t,e,o,n,a,c,w,r,s){"use strict";try{self["workbox:google-analytics:5.0.0"]&&_()}catch(t){}const i=/^\/(\w+\/)?collect/,l=t=>async({queue:e})=>{let o;for(;o=await e.shiftRequest();){const{request:n,timestamp:a}=o,c=new URL(n.url);try{const w="POST"===n.method?new URLSearchParams(await n.clone().text()):c.searchParams,r=a-(Number(w.get("qt"))||0),s=Date.now()-r;if(w.set("qt",String(s)),t.parameterOverrides)for(const e of Object.keys(t.parameterOverrides)){const o=t.parameterOverrides[e];w.set(e,o)}"function"==typeof t.hitFilter&&t.hitFilter.call(null,w),await fetch(new Request(c.origin+c.pathname,{body:w.toString(),method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"text/plain"}}))}catch(t){throw await e.unshiftRequest(o),t}}},g=t=>{const e=({url:t})=>"www.google-analytics.com"===t.hostname&&i.test(t.pathname),o=new s.NetworkOnly({plugins:[t]});return[new c.Route(e,o,"GET"),new c.Route(e,o,"POST")]},m=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.google-analytics.com"===t.hostname&&"/analytics.js"===t.pathname,e,"GET")},u=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.googletagmanager.com"===t.hostname&&"/gtag/js"===t.pathname,e,"GET")},h=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.googletagmanager.com"===t.hostname&&"/gtm.js"===t.pathname,e,"GET")};return t.initialize=((t={})=>{const n=o.cacheNames.getGoogleAnalyticsName(t.cacheName),a=new e.BackgroundSyncPlugin("workbox-google-analytics",{maxRetentionTime:2880,onSync:l(t)}),c=[h(n),m(n),u(n),...g(a)],r=new w.Router;for(const t of c)r.registerRoute(t);r.addFetchListener()}),t}({},workbox.backgroundSync,workbox.core._private,workbox.core._private,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
|
2
|
+
//# sourceMappingURL=workbox-offline-ga.prod.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"workbox-offline-ga.prod.js","sources":["../_version.js","../utils/constants.js","../initialize.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:google-analytics:5.0.0'] && _();\n}\ncatch (e) { }\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nexport const QUEUE_NAME = 'workbox-google-analytics';\nexport const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes\nexport const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';\nexport const GTM_HOST = 'www.googletagmanager.com';\nexport const ANALYTICS_JS_PATH = '/analytics.js';\nexport const GTAG_JS_PATH = '/gtag/js';\nexport const GTM_JS_PATH = '/gtm.js';\nexport const COLLECT_DEFAULT_PATH = '/collect';\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)\nexport const COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { BackgroundSyncPlugin } from 'workbox-background-sync/BackgroundSyncPlugin.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { Route } from 'workbox-routing/Route.js';\nimport { Router } from 'workbox-routing/Router.js';\nimport { NetworkFirst } from 'workbox-strategies/NetworkFirst.js';\nimport { NetworkOnly } from 'workbox-strategies/NetworkOnly.js';\nimport { QUEUE_NAME, MAX_RETENTION_TIME, GOOGLE_ANALYTICS_HOST, GTM_HOST, ANALYTICS_JS_PATH, GTAG_JS_PATH, GTM_JS_PATH, COLLECT_PATHS_REGEX, } from './utils/constants.js';\nimport './_version.js';\n/**\n * Creates the requestWillDequeue callback to be used with the background\n * sync 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 {@link module:workbox-google-analytics.initialize}.\n * @return {Function} The requestWillDequeue callback function.\n *\n * @private\n */\nconst createOnSyncCallback = (config) => {\n return async ({ queue }) => {\n let entry;\n while (entry = await queue.shiftRequest()) {\n const { request, timestamp } = entry;\n const url = new URL(request.url);\n try {\n // Measurement protocol requests can set their payload parameters in\n // either the URL query string (for GET requests) or the POST body.\n const params = request.method === 'POST' ?\n new URLSearchParams(await request.clone().text()) :\n url.searchParams;\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 // Set the qt param prior to applying hitFilter or parameterOverrides.\n params.set('qt', String(queueTime));\n // Apply `parameterOverrides`, if set.\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 // Apply `hitFilter`, if set.\n if (typeof config.hitFilter === 'function') {\n config.hitFilter.call(null, params);\n }\n // Retry the fetch. Ignore URL search params from the URL as they're\n // now in the post body.\n await fetch(new Request(url.origin + url.pathname, {\n body: params.toString(),\n method: 'POST',\n mode: 'cors',\n credentials: 'omit',\n headers: { 'Content-Type': 'text/plain' },\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Request for '${getFriendlyURL(url.href)}'` +\n `has been replayed`);\n }\n }\n catch (err) {\n await queue.unshiftRequest(entry);\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Request for '${getFriendlyURL(url.href)}'` +\n `failed to replay, putting it back in the queue.`);\n }\n throw err;\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`All Google Analytics request successfully replayed; ` +\n `the queue is now empty!`);\n }\n };\n};\n/**\n * Creates GET and POST routes to catch failed Measurement Protocol hits.\n *\n * @param {BackgroundSyncPlugin} bgSyncPlugin\n * @return {Array<Route>} The created routes.\n *\n * @private\n */\nconst createCollectRoutes = (bgSyncPlugin) => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST &&\n COLLECT_PATHS_REGEX.test(url.pathname);\n const handler = new NetworkOnly({\n plugins: [bgSyncPlugin],\n });\n return [\n new Route(match, handler, 'GET'),\n new 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 */\nconst createAnalyticsJsRoute = (cacheName) => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST &&\n url.pathname === ANALYTICS_JS_PATH;\n const handler = new NetworkFirst({ cacheName });\n return new Route(match, handler, 'GET');\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 */\nconst createGtagJsRoute = (cacheName) => {\n const match = ({ url }) => url.hostname === GTM_HOST &&\n url.pathname === GTAG_JS_PATH;\n const handler = new NetworkFirst({ cacheName });\n return new Route(match, handler, 'GET');\n};\n/**\n * Creates a route with a network first strategy for the gtm.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\nconst createGtmJsRoute = (cacheName) => {\n const match = ({ url }) => url.hostname === GTM_HOST &&\n url.pathname === GTM_JS_PATH;\n const handler = new NetworkFirst({ cacheName });\n return new Route(match, handler, 'GET');\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 module:workbox-google-analytics\n */\nconst initialize = (options = {}) => {\n const cacheName = cacheNames.getGoogleAnalyticsName(options.cacheName);\n const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n onSync: createOnSyncCallback(options),\n });\n const routes = [\n createGtmJsRoute(cacheName),\n createAnalyticsJsRoute(cacheName),\n createGtagJsRoute(cacheName),\n ...createCollectRoutes(bgSyncPlugin),\n ];\n const router = new Router();\n for (const route of routes) {\n router.registerRoute(route);\n }\n router.addFetchListener();\n};\nexport { initialize, };\n"],"names":["self","_","e","COLLECT_PATHS_REGEX","createOnSyncCallback","config","async","queue","entry","shiftRequest","request","timestamp","url","URL","params","method","URLSearchParams","clone","text","searchParams","originalHitTime","Number","get","queueTime","Date","now","set","String","parameterOverrides","param","Object","keys","value","hitFilter","call","fetch","Request","origin","pathname","body","toString","mode","credentials","headers","err","unshiftRequest","createCollectRoutes","bgSyncPlugin","match","hostname","test","handler","NetworkOnly","plugins","Route","createAnalyticsJsRoute","cacheName","NetworkFirst","createGtagJsRoute","createGtmJsRoute","options","cacheNames","getGoogleAnalyticsName","BackgroundSyncPlugin","maxRetentionTime","onSync","routes","router","Router","route","registerRoute","addFetchListener"],"mappings":"oGAEA,IACIA,KAAK,mCAAqCC,IAE9C,MAAOC,ICGA,MAYMC,EAAsB,qBCQ7BC,EAAwBC,GACnBC,OAASC,MAAAA,UACRC,OACGA,QAAcD,EAAME,gBAAgB,OACjCC,QAAEA,EAAFC,UAAWA,GAAcH,EACzBI,EAAM,IAAIC,IAAIH,EAAQE,eAIlBE,EAA4B,SAAnBJ,EAAQK,OACnB,IAAIC,sBAAsBN,EAAQO,QAAQC,QAC1CN,EAAIO,aAGFC,EAAkBT,GAAaU,OAAOP,EAAOQ,IAAI,QAAU,GAC3DC,EAAYC,KAAKC,MAAQL,KAE/BN,EAAOY,IAAI,KAAMC,OAAOJ,IAEpBlB,EAAOuB,uBACF,MAAMC,KAASC,OAAOC,KAAK1B,EAAOuB,oBAAqB,OAClDI,EAAQ3B,EAAOuB,mBAAmBC,GACxCf,EAAOY,IAAIG,EAAOG,GAIM,mBAArB3B,EAAO4B,WACd5B,EAAO4B,UAAUC,KAAK,KAAMpB,SAI1BqB,MAAM,IAAIC,QAAQxB,EAAIyB,OAASzB,EAAI0B,SAAU,CAC/CC,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heNames_js, getFriendlyURL_js, logger_js, cacheWrapper_js, fetchWrapper_js, WorkboxError_js) {
|
2
|
+
this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFriendlyURL_js, logger_js, cacheWrapper_js, fetchWrapper_js, WorkboxError_js, copyResponse_js) {
|
3
3
|
'use strict';
|
4
4
|
|
5
|
-
// @ts-ignore
|
6
5
|
try {
|
7
|
-
self['workbox:precaching:5.0.0
|
6
|
+
self['workbox:precaching:5.0.0'] && _();
|
8
7
|
} catch (e) {}
|
9
8
|
|
10
9
|
/*
|
@@ -46,40 +45,11 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
46
45
|
*
|
47
46
|
* @param {Array<Object>} newPlugins
|
48
47
|
*
|
49
|
-
* @alias workbox.precaching.addPlugins
|
50
|
-
*/
|
51
|
-
|
52
|
-
const addPlugins = newPlugins => {
|
53
|
-
precachePlugins.add(newPlugins);
|
54
|
-
};
|
55
|
-
|
56
|
-
/*
|
57
|
-
Copyright 2018 Google LLC
|
58
|
-
|
59
|
-
Use of this source code is governed by an MIT-style
|
60
|
-
license that can be found in the LICENSE file or at
|
61
|
-
https://opensource.org/licenses/MIT.
|
62
|
-
*/
|
63
|
-
/**
|
64
|
-
* @param {Response} response
|
65
|
-
* @return {Response}
|
66
|
-
*
|
67
|
-
* @private
|
68
48
|
* @memberof module:workbox-precaching
|
69
49
|
*/
|
70
50
|
|
71
|
-
|
72
|
-
|
73
|
-
// to reading the entire body into memory as a blob.
|
74
|
-
|
75
|
-
const bodyPromise = 'body' in clonedResponse ? Promise.resolve(clonedResponse.body) : clonedResponse.blob();
|
76
|
-
const body = await bodyPromise; // new Response() is happy when passed either a stream or a Blob.
|
77
|
-
|
78
|
-
return new Response(body, {
|
79
|
-
headers: clonedResponse.headers,
|
80
|
-
status: clonedResponse.status,
|
81
|
-
statusText: clonedResponse.statusText
|
82
|
-
});
|
51
|
+
function addPlugins(newPlugins) {
|
52
|
+
precachePlugins.add(newPlugins);
|
83
53
|
}
|
84
54
|
|
85
55
|
/*
|
@@ -249,7 +219,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
249
219
|
}
|
250
220
|
|
251
221
|
/*
|
252
|
-
Copyright
|
222
|
+
Copyright 2019 Google LLC
|
253
223
|
|
254
224
|
Use of this source code is governed by an MIT-style
|
255
225
|
license that can be found in the LICENSE file or at
|
@@ -271,6 +241,8 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
271
241
|
constructor(cacheName) {
|
272
242
|
this._cacheName = cacheNames_js.cacheNames.getPrecacheName(cacheName);
|
273
243
|
this._urlsToCacheKeys = new Map();
|
244
|
+
this._urlsToCacheModes = new Map();
|
245
|
+
this._cacheKeysToIntegrities = new Map();
|
274
246
|
}
|
275
247
|
/**
|
276
248
|
* This method will add items to the precache list, removing duplicates
|
@@ -292,11 +264,21 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
292
264
|
});
|
293
265
|
}
|
294
266
|
|
267
|
+
const urlsToWarnAbout = [];
|
268
|
+
|
295
269
|
for (const entry of entries) {
|
270
|
+
// See https://github.com/GoogleChrome/workbox/issues/2259
|
271
|
+
if (typeof entry === 'string') {
|
272
|
+
urlsToWarnAbout.push(entry);
|
273
|
+
} else if (entry && entry.revision === undefined) {
|
274
|
+
urlsToWarnAbout.push(entry.url);
|
275
|
+
}
|
276
|
+
|
296
277
|
const {
|
297
278
|
cacheKey,
|
298
279
|
url
|
299
280
|
} = createCacheKey(entry);
|
281
|
+
const cacheMode = typeof entry !== 'string' && entry.revision ? 'reload' : 'default';
|
300
282
|
|
301
283
|
if (this._urlsToCacheKeys.has(url) && this._urlsToCacheKeys.get(url) !== cacheKey) {
|
302
284
|
throw new WorkboxError_js.WorkboxError('add-to-cache-list-conflicting-entries', {
|
@@ -305,7 +287,27 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
305
287
|
});
|
306
288
|
}
|
307
289
|
|
290
|
+
if (typeof entry !== 'string' && entry.integrity) {
|
291
|
+
if (this._cacheKeysToIntegrities.has(cacheKey) && this._cacheKeysToIntegrities.get(cacheKey) !== entry.integrity) {
|
292
|
+
throw new WorkboxError_js.WorkboxError('add-to-cache-list-conflicting-integrities', {
|
293
|
+
url
|
294
|
+
});
|
295
|
+
}
|
296
|
+
|
297
|
+
this._cacheKeysToIntegrities.set(cacheKey, entry.integrity);
|
298
|
+
}
|
299
|
+
|
308
300
|
this._urlsToCacheKeys.set(url, cacheKey);
|
301
|
+
|
302
|
+
this._urlsToCacheModes.set(url, cacheMode);
|
303
|
+
|
304
|
+
if (urlsToWarnAbout.length > 0) {
|
305
|
+
const warningMessage = `Workbox is precaching URLs without revision ` + `info: ${urlsToWarnAbout.join(', ')}\nThis is generally NOT safe. ` + `Learn more at https://bit.ly/wb-precache`;
|
306
|
+
|
307
|
+
{
|
308
|
+
logger_js.logger.warn(warningMessage);
|
309
|
+
}
|
310
|
+
}
|
309
311
|
}
|
310
312
|
}
|
311
313
|
/**
|
@@ -316,7 +318,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
316
318
|
* @param {Event} [options.event] The install event (if needed).
|
317
319
|
* @param {Array<Object>} [options.plugins] Plugins to be used for fetching
|
318
320
|
* and caching during install.
|
319
|
-
* @return {Promise<workbox
|
321
|
+
* @return {Promise<module:workbox-precaching.InstallResult>}
|
320
322
|
*/
|
321
323
|
|
322
324
|
|
@@ -335,48 +337,62 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
335
337
|
}
|
336
338
|
}
|
337
339
|
|
338
|
-
const
|
339
|
-
const
|
340
|
-
const cache = await caches.open(this._cacheName);
|
340
|
+
const toBePrecached = [];
|
341
|
+
const alreadyPrecached = [];
|
342
|
+
const cache = await self.caches.open(this._cacheName);
|
341
343
|
const alreadyCachedRequests = await cache.keys();
|
342
|
-
const
|
344
|
+
const existingCacheKeys = new Set(alreadyCachedRequests.map(request => request.url));
|
343
345
|
|
344
|
-
for (const cacheKey of this._urlsToCacheKeys
|
345
|
-
if (
|
346
|
-
|
346
|
+
for (const [url, cacheKey] of this._urlsToCacheKeys) {
|
347
|
+
if (existingCacheKeys.has(cacheKey)) {
|
348
|
+
alreadyPrecached.push(url);
|
347
349
|
} else {
|
348
|
-
|
350
|
+
toBePrecached.push({
|
351
|
+
cacheKey,
|
352
|
+
url
|
353
|
+
});
|
349
354
|
}
|
350
355
|
}
|
351
356
|
|
352
|
-
const precacheRequests =
|
357
|
+
const precacheRequests = toBePrecached.map(({
|
358
|
+
cacheKey,
|
359
|
+
url
|
360
|
+
}) => {
|
361
|
+
const integrity = this._cacheKeysToIntegrities.get(cacheKey);
|
362
|
+
|
363
|
+
const cacheMode = this._urlsToCacheModes.get(url);
|
364
|
+
|
353
365
|
return this._addURLToCache({
|
366
|
+
cacheKey,
|
367
|
+
cacheMode,
|
354
368
|
event,
|
369
|
+
integrity,
|
355
370
|
plugins,
|
356
371
|
url
|
357
372
|
});
|
358
373
|
});
|
359
374
|
await Promise.all(precacheRequests);
|
375
|
+
const updatedURLs = toBePrecached.map(item => item.url);
|
360
376
|
|
361
377
|
{
|
362
|
-
printInstallDetails(
|
378
|
+
printInstallDetails(updatedURLs, alreadyPrecached);
|
363
379
|
}
|
364
380
|
|
365
381
|
return {
|
366
|
-
updatedURLs
|
367
|
-
notUpdatedURLs:
|
382
|
+
updatedURLs,
|
383
|
+
notUpdatedURLs: alreadyPrecached
|
368
384
|
};
|
369
385
|
}
|
370
386
|
/**
|
371
387
|
* Deletes assets that are no longer present in the current precache manifest.
|
372
388
|
* Call this method from the service worker activate event.
|
373
389
|
*
|
374
|
-
* @return {Promise<workbox
|
390
|
+
* @return {Promise<module:workbox-precaching.CleanupResult>}
|
375
391
|
*/
|
376
392
|
|
377
393
|
|
378
394
|
async activate() {
|
379
|
-
const cache = await caches.open(this._cacheName);
|
395
|
+
const cache = await self.caches.open(this._cacheName);
|
380
396
|
const currentlyCachedRequests = await cache.keys();
|
381
397
|
const expectedCacheKeys = new Set(this._urlsToCacheKeys.values());
|
382
398
|
const deletedURLs = [];
|
@@ -407,19 +423,28 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
407
423
|
*
|
408
424
|
* @private
|
409
425
|
* @param {Object} options
|
426
|
+
* @param {string} options.cacheKey The string to use a cache key.
|
410
427
|
* @param {string} options.url The URL to fetch and cache.
|
428
|
+
* @param {string} [options.cacheMode] The cache mode for the network request.
|
411
429
|
* @param {Event} [options.event] The install event (if passed).
|
412
430
|
* @param {Array<Object>} [options.plugins] An array of plugins to apply to
|
413
431
|
* fetch and caching.
|
432
|
+
* @param {string} [options.integrity] The value to use for the `integrity`
|
433
|
+
* field when making the request.
|
414
434
|
*/
|
415
435
|
|
416
436
|
|
417
437
|
async _addURLToCache({
|
438
|
+
cacheKey,
|
418
439
|
url,
|
440
|
+
cacheMode,
|
419
441
|
event,
|
420
|
-
plugins
|
442
|
+
plugins,
|
443
|
+
integrity
|
421
444
|
}) {
|
422
445
|
const request = new Request(url, {
|
446
|
+
integrity,
|
447
|
+
cache: cacheMode,
|
423
448
|
credentials: 'same-origin'
|
424
449
|
});
|
425
450
|
let response = await fetchWrapper_js.fetchWrapper.fetch({
|
@@ -428,7 +453,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
428
453
|
request
|
429
454
|
}); // Allow developers to override the default logic about what is and isn't
|
430
455
|
// valid by passing in a plugin implementing cacheWillUpdate(), e.g.
|
431
|
-
// a
|
456
|
+
// a `CacheableResponsePlugin` instance.
|
432
457
|
|
433
458
|
let cacheWillUpdatePlugin;
|
434
459
|
|
@@ -441,7 +466,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
441
466
|
const isValidResponse = cacheWillUpdatePlugin ? // Use a callback if provided. It returns a truthy value if valid.
|
442
467
|
// NOTE: invoke the method on the plugin instance so the `this` context
|
443
468
|
// is correct.
|
444
|
-
cacheWillUpdatePlugin.cacheWillUpdate({
|
469
|
+
await cacheWillUpdatePlugin.cacheWillUpdate({
|
445
470
|
event,
|
446
471
|
request,
|
447
472
|
response
|
@@ -455,17 +480,22 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
455
480
|
url,
|
456
481
|
status: response.status
|
457
482
|
});
|
458
|
-
}
|
483
|
+
} // Redirected responses cannot be used to satisfy a navigation request, so
|
484
|
+
// any redirected response must be "copied" rather than cloned, so the new
|
485
|
+
// response doesn't contain the `redirected` flag. See:
|
486
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=669363&desc=2#c1
|
487
|
+
|
459
488
|
|
460
489
|
if (response.redirected) {
|
461
|
-
response = await
|
490
|
+
response = await copyResponse_js.copyResponse(response);
|
462
491
|
}
|
463
492
|
|
464
493
|
await cacheWrapper_js.cacheWrapper.put({
|
465
494
|
event,
|
466
495
|
plugins,
|
467
|
-
request,
|
468
496
|
response,
|
497
|
+
// `request` already uses `url`. We may be able to reuse it.
|
498
|
+
request: cacheKey === url ? request : new Request(cacheKey),
|
469
499
|
cacheName: this._cacheName,
|
470
500
|
matchOptions: {
|
471
501
|
ignoreSearch: true
|
@@ -509,6 +539,112 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
509
539
|
const urlObject = new URL(url, location.href);
|
510
540
|
return this._urlsToCacheKeys.get(urlObject.href);
|
511
541
|
}
|
542
|
+
/**
|
543
|
+
* This acts as a drop-in replacement for [`cache.match()`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/match)
|
544
|
+
* with the following differences:
|
545
|
+
*
|
546
|
+
* - It knows what the name of the precache is, and only checks in that cache.
|
547
|
+
* - It allows you to pass in an "original" URL without versioning parameters,
|
548
|
+
* and it will automatically look up the correct cache key for the currently
|
549
|
+
* active revision of that URL.
|
550
|
+
*
|
551
|
+
* E.g., `matchPrecache('index.html')` will find the correct precached
|
552
|
+
* response for the currently active service worker, even if the actual cache
|
553
|
+
* key is `'/index.html?__WB_REVISION__=1234abcd'`.
|
554
|
+
*
|
555
|
+
* @param {string|Request} request The key (without revisioning parameters)
|
556
|
+
* to look up in the precache.
|
557
|
+
* @return {Promise<Response|undefined>}
|
558
|
+
*/
|
559
|
+
|
560
|
+
|
561
|
+
async matchPrecache(request) {
|
562
|
+
const url = request instanceof Request ? request.url : request;
|
563
|
+
const cacheKey = this.getCacheKeyForURL(url);
|
564
|
+
|
565
|
+
if (cacheKey) {
|
566
|
+
const cache = await self.caches.open(this._cacheName);
|
567
|
+
return cache.match(cacheKey);
|
568
|
+
}
|
569
|
+
|
570
|
+
return undefined;
|
571
|
+
}
|
572
|
+
/**
|
573
|
+
* Returns a function that can be used within a
|
574
|
+
* {@link module:workbox-routing.Route} that will find a response for the
|
575
|
+
* incoming request against the precache.
|
576
|
+
*
|
577
|
+
* If for an unexpected reason there is a cache miss for the request,
|
578
|
+
* this will fall back to retrieving the `Response` via `fetch()` when
|
579
|
+
* `fallbackToNetwork` is `true`.
|
580
|
+
*
|
581
|
+
* @param {boolean} [fallbackToNetwork=true] Whether to attempt to get the
|
582
|
+
* response from the network if there's a precache miss.
|
583
|
+
* @return {module:workbox-routing~handlerCallback}
|
584
|
+
*/
|
585
|
+
|
586
|
+
|
587
|
+
createHandler(fallbackToNetwork = true) {
|
588
|
+
return async ({
|
589
|
+
request
|
590
|
+
}) => {
|
591
|
+
try {
|
592
|
+
const response = await this.matchPrecache(request);
|
593
|
+
|
594
|
+
if (response) {
|
595
|
+
return response;
|
596
|
+
} // This shouldn't normally happen, but there are edge cases:
|
597
|
+
// https://github.com/GoogleChrome/workbox/issues/1441
|
598
|
+
|
599
|
+
|
600
|
+
throw new WorkboxError_js.WorkboxError('missing-precache-entry', {
|
601
|
+
cacheName: this._cacheName,
|
602
|
+
url: request instanceof Request ? request.url : request
|
603
|
+
});
|
604
|
+
} catch (error) {
|
605
|
+
if (fallbackToNetwork) {
|
606
|
+
{
|
607
|
+
logger_js.logger.debug(`Unable to respond with precached response. ` + `Falling back to network.`, error);
|
608
|
+
}
|
609
|
+
|
610
|
+
return fetch(request);
|
611
|
+
}
|
612
|
+
|
613
|
+
throw error;
|
614
|
+
}
|
615
|
+
};
|
616
|
+
}
|
617
|
+
/**
|
618
|
+
* Returns a function that looks up `url` in the precache (taking into
|
619
|
+
* account revision information), and returns the corresponding `Response`.
|
620
|
+
*
|
621
|
+
* If for an unexpected reason there is a cache miss when looking up `url`,
|
622
|
+
* this will fall back to retrieving the `Response` via `fetch()` when
|
623
|
+
* `fallbackToNetwork` is `true`.
|
624
|
+
*
|
625
|
+
* @param {string} url The precached URL which will be used to lookup the
|
626
|
+
* `Response`.
|
627
|
+
* @param {boolean} [fallbackToNetwork=true] Whether to attempt to get the
|
628
|
+
* response from the network if there's a precache miss.
|
629
|
+
* @return {module:workbox-routing~handlerCallback}
|
630
|
+
*/
|
631
|
+
|
632
|
+
|
633
|
+
createHandlerBoundToURL(url, fallbackToNetwork = true) {
|
634
|
+
const cacheKey = this.getCacheKeyForURL(url);
|
635
|
+
|
636
|
+
if (!cacheKey) {
|
637
|
+
throw new WorkboxError_js.WorkboxError('non-precached-url', {
|
638
|
+
url
|
639
|
+
});
|
640
|
+
}
|
641
|
+
|
642
|
+
const handler = this.createHandler(fallbackToNetwork);
|
643
|
+
const request = new Request(url);
|
644
|
+
return () => handler({
|
645
|
+
request
|
646
|
+
});
|
647
|
+
}
|
512
648
|
|
513
649
|
}
|
514
650
|
|
@@ -672,7 +808,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
672
808
|
* of tests.
|
673
809
|
*
|
674
810
|
* @private
|
675
|
-
* @param {Object} options
|
811
|
+
* @param {Object} [options]
|
676
812
|
* @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
|
677
813
|
* check cache entries for a URLs ending with '/' to see if there is a hit when
|
678
814
|
* appending the `directoryIndex` value.
|
@@ -682,7 +818,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
682
818
|
* check the cache for the URL with a `.html` added to the end of the end.
|
683
819
|
* @param {workbox.precaching~urlManipulation} [options.urlManipulation]
|
684
820
|
* This is a function that should take a URL and return an array of
|
685
|
-
* alternative
|
821
|
+
* alternative URLs that should be checked for precache matches.
|
686
822
|
*/
|
687
823
|
|
688
824
|
const addFetchListener = ({
|
@@ -691,8 +827,9 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
691
827
|
cleanURLs = true,
|
692
828
|
urlManipulation
|
693
829
|
} = {}) => {
|
694
|
-
const cacheName = cacheNames_js.cacheNames.getPrecacheName();
|
695
|
-
|
830
|
+
const cacheName = cacheNames_js.cacheNames.getPrecacheName(); // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705
|
831
|
+
|
832
|
+
self.addEventListener('fetch', event => {
|
696
833
|
const precachedURL = getCacheKeyForURL(event.request.url, {
|
697
834
|
cleanURLs,
|
698
835
|
directoryIndex,
|
@@ -708,7 +845,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
708
845
|
return;
|
709
846
|
}
|
710
847
|
|
711
|
-
let responsePromise = caches.open(cacheName).then(cache => {
|
848
|
+
let responsePromise = self.caches.open(cacheName).then(cache => {
|
712
849
|
return cache.match(precachedURL);
|
713
850
|
}).then(cachedResponse => {
|
714
851
|
if (cachedResponse) {
|
@@ -762,7 +899,7 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
762
899
|
* responded to, allowing the event to fall through to other `fetch` event
|
763
900
|
* listeners.
|
764
901
|
*
|
765
|
-
* @param {Object} options
|
902
|
+
* @param {Object} [options]
|
766
903
|
* @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
|
767
904
|
* check cache entries for a URLs ending with '/' to see if there is a hit when
|
768
905
|
* appending the `directoryIndex` value.
|
@@ -770,19 +907,19 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
770
907
|
* array of regex's to remove search params when looking for a cache match.
|
771
908
|
* @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will
|
772
909
|
* check the cache for the URL with a `.html` added to the end of the end.
|
773
|
-
* @param {workbox
|
910
|
+
* @param {module:workbox-precaching~urlManipulation} [options.urlManipulation]
|
774
911
|
* This is a function that should take a URL and return an array of
|
775
|
-
* alternative
|
912
|
+
* alternative URLs that should be checked for precache matches.
|
776
913
|
*
|
777
|
-
* @
|
914
|
+
* @memberof module:workbox-precaching
|
778
915
|
*/
|
779
916
|
|
780
|
-
|
917
|
+
function addRoute(options) {
|
781
918
|
if (!listenerAdded) {
|
782
919
|
addFetchListener(options);
|
783
920
|
listenerAdded = true;
|
784
921
|
}
|
785
|
-
}
|
922
|
+
}
|
786
923
|
|
787
924
|
/*
|
788
925
|
Copyright 2018 Google LLC
|
@@ -812,11 +949,11 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
812
949
|
*/
|
813
950
|
|
814
951
|
const deleteOutdatedCaches = async (currentPrecacheName, substringToFind = SUBSTRING_TO_FIND) => {
|
815
|
-
const cacheNames = await caches.keys();
|
952
|
+
const cacheNames = await self.caches.keys();
|
816
953
|
const cacheNamesToDelete = cacheNames.filter(cacheName => {
|
817
954
|
return cacheName.includes(substringToFind) && cacheName.includes(self.registration.scope) && cacheName !== currentPrecacheName;
|
818
955
|
});
|
819
|
-
await Promise.all(cacheNamesToDelete.map(cacheName => caches.delete(cacheName)));
|
956
|
+
await Promise.all(cacheNamesToDelete.map(cacheName => self.caches.delete(cacheName)));
|
820
957
|
return cacheNamesToDelete;
|
821
958
|
};
|
822
959
|
|
@@ -831,11 +968,12 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
831
968
|
* Adds an `activate` event listener which will clean up incompatible
|
832
969
|
* precaches that were created by older versions of Workbox.
|
833
970
|
*
|
834
|
-
* @
|
971
|
+
* @memberof module:workbox-precaching
|
835
972
|
*/
|
836
973
|
|
837
|
-
|
838
|
-
|
974
|
+
function cleanupOutdatedCaches() {
|
975
|
+
// See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705
|
976
|
+
self.addEventListener('activate', event => {
|
839
977
|
const cacheName = cacheNames_js.cacheNames.getPrecacheName();
|
840
978
|
event.waitUntil(deleteOutdatedCaches(cacheName).then(cachesDeleted => {
|
841
979
|
{
|
@@ -845,7 +983,65 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
845
983
|
}
|
846
984
|
}));
|
847
985
|
});
|
848
|
-
}
|
986
|
+
}
|
987
|
+
|
988
|
+
/*
|
989
|
+
Copyright 2019 Google LLC
|
990
|
+
|
991
|
+
Use of this source code is governed by an MIT-style
|
992
|
+
license that can be found in the LICENSE file or at
|
993
|
+
https://opensource.org/licenses/MIT.
|
994
|
+
*/
|
995
|
+
/**
|
996
|
+
* Helper function that calls
|
997
|
+
* {@link PrecacheController#createHandler} on the default
|
998
|
+
* {@link PrecacheController} instance.
|
999
|
+
*
|
1000
|
+
* If you are creating your own {@link PrecacheController}, then call the
|
1001
|
+
* {@link PrecacheController#createHandler} on that instance,
|
1002
|
+
* instead of using this function.
|
1003
|
+
*
|
1004
|
+
* @param {boolean} [fallbackToNetwork=true] Whether to attempt to get the
|
1005
|
+
* response from the network if there's a precache miss.
|
1006
|
+
* @return {module:workbox-routing~handlerCallback}
|
1007
|
+
*
|
1008
|
+
* @memberof module:workbox-precaching
|
1009
|
+
*/
|
1010
|
+
|
1011
|
+
function createHandler(fallbackToNetwork = true) {
|
1012
|
+
const precacheController = getOrCreatePrecacheController();
|
1013
|
+
return precacheController.createHandler(fallbackToNetwork);
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
/*
|
1017
|
+
Copyright 2019 Google LLC
|
1018
|
+
|
1019
|
+
Use of this source code is governed by an MIT-style
|
1020
|
+
license that can be found in the LICENSE file or at
|
1021
|
+
https://opensource.org/licenses/MIT.
|
1022
|
+
*/
|
1023
|
+
/**
|
1024
|
+
* Helper function that calls
|
1025
|
+
* {@link PrecacheController#createHandlerBoundToURL} on the default
|
1026
|
+
* {@link PrecacheController} instance.
|
1027
|
+
*
|
1028
|
+
* If you are creating your own {@link PrecacheController}, then call the
|
1029
|
+
* {@link PrecacheController#createHandlerBoundToURL} on that instance,
|
1030
|
+
* instead of using this function.
|
1031
|
+
*
|
1032
|
+
* @param {string} url The precached URL which will be used to lookup the
|
1033
|
+
* `Response`.
|
1034
|
+
* @param {boolean} [fallbackToNetwork=true] Whether to attempt to get the
|
1035
|
+
* response from the network if there's a precache miss.
|
1036
|
+
* @return {module:workbox-routing~handlerCallback}
|
1037
|
+
*
|
1038
|
+
* @memberof module:workbox-precaching
|
1039
|
+
*/
|
1040
|
+
|
1041
|
+
function createHandlerBoundToURL(url) {
|
1042
|
+
const precacheController = getOrCreatePrecacheController();
|
1043
|
+
return precacheController.createHandlerBoundToURL(url);
|
1044
|
+
}
|
849
1045
|
|
850
1046
|
/*
|
851
1047
|
Copyright 2019 Google LLC
|
@@ -871,13 +1067,41 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
871
1067
|
* @param {string} url The URL whose cache key to look up.
|
872
1068
|
* @return {string} The cache key that corresponds to that URL.
|
873
1069
|
*
|
874
|
-
* @
|
1070
|
+
* @memberof module:workbox-precaching
|
875
1071
|
*/
|
876
1072
|
|
877
|
-
|
1073
|
+
function getCacheKeyForURL$1(url) {
|
878
1074
|
const precacheController = getOrCreatePrecacheController();
|
879
1075
|
return precacheController.getCacheKeyForURL(url);
|
880
|
-
}
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
/*
|
1079
|
+
Copyright 2019 Google LLC
|
1080
|
+
|
1081
|
+
Use of this source code is governed by an MIT-style
|
1082
|
+
license that can be found in the LICENSE file or at
|
1083
|
+
https://opensource.org/licenses/MIT.
|
1084
|
+
*/
|
1085
|
+
/**
|
1086
|
+
* Helper function that calls
|
1087
|
+
* {@link PrecacheController#matchPrecache} on the default
|
1088
|
+
* {@link PrecacheController} instance.
|
1089
|
+
*
|
1090
|
+
* If you are creating your own {@link PrecacheController}, then call
|
1091
|
+
* {@link PrecacheController#matchPrecache} on that instance,
|
1092
|
+
* instead of using this function.
|
1093
|
+
*
|
1094
|
+
* @param {string|Request} request The key (without revisioning parameters)
|
1095
|
+
* to look up in the precache.
|
1096
|
+
* @return {Promise<Response|undefined>}
|
1097
|
+
*
|
1098
|
+
* @memberof module:workbox-precaching
|
1099
|
+
*/
|
1100
|
+
|
1101
|
+
function matchPrecache(request) {
|
1102
|
+
const precacheController = getOrCreatePrecacheController();
|
1103
|
+
return precacheController.matchPrecache(request);
|
1104
|
+
}
|
881
1105
|
|
882
1106
|
/*
|
883
1107
|
Copyright 2019 Google LLC
|
@@ -924,11 +1148,11 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
924
1148
|
*
|
925
1149
|
* @param {Array<Object|string>} [entries=[]] Array of entries to precache.
|
926
1150
|
*
|
927
|
-
* @
|
1151
|
+
* @memberof module:workbox-precaching
|
928
1152
|
*/
|
929
1153
|
|
930
1154
|
|
931
|
-
|
1155
|
+
function precache(entries) {
|
932
1156
|
const precacheController = getOrCreatePrecacheController();
|
933
1157
|
precacheController.addToCacheList(entries);
|
934
1158
|
|
@@ -936,10 +1160,11 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
936
1160
|
// NOTE: these listeners will only be added once (even if the `precache()`
|
937
1161
|
// method is called multiple times) because event listeners are implemented
|
938
1162
|
// as a set, where each listener must be unique.
|
939
|
-
|
940
|
-
addEventListener('
|
1163
|
+
// See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705
|
1164
|
+
self.addEventListener('install', installListener);
|
1165
|
+
self.addEventListener('activate', activateListener);
|
941
1166
|
}
|
942
|
-
}
|
1167
|
+
}
|
943
1168
|
|
944
1169
|
/*
|
945
1170
|
Copyright 2019 Google LLC
|
@@ -957,16 +1182,16 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
957
1182
|
* [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.
|
958
1183
|
*
|
959
1184
|
* @param {Array<Object|string>} entries Array of entries to precache.
|
960
|
-
* @param {Object} options See
|
1185
|
+
* @param {Object} [options] See
|
961
1186
|
* [addRoute() options]{@link module:workbox-precaching.addRoute}.
|
962
1187
|
*
|
963
|
-
* @
|
1188
|
+
* @memberof module:workbox-precaching
|
964
1189
|
*/
|
965
1190
|
|
966
|
-
|
1191
|
+
function precacheAndRoute(entries, options) {
|
967
1192
|
precache(entries);
|
968
1193
|
addRoute(options);
|
969
|
-
}
|
1194
|
+
}
|
970
1195
|
|
971
1196
|
/*
|
972
1197
|
Copyright 2018 Google LLC
|
@@ -984,11 +1209,14 @@ this.workbox.precaching = (function (exports, assert_js, cacheNames_js, getFrien
|
|
984
1209
|
exports.addPlugins = addPlugins;
|
985
1210
|
exports.addRoute = addRoute;
|
986
1211
|
exports.cleanupOutdatedCaches = cleanupOutdatedCaches;
|
1212
|
+
exports.createHandler = createHandler;
|
1213
|
+
exports.createHandlerBoundToURL = createHandlerBoundToURL;
|
987
1214
|
exports.getCacheKeyForURL = getCacheKeyForURL$1;
|
1215
|
+
exports.matchPrecache = matchPrecache;
|
988
1216
|
exports.precache = precache;
|
989
1217
|
exports.precacheAndRoute = precacheAndRoute;
|
990
1218
|
|
991
1219
|
return exports;
|
992
1220
|
|
993
|
-
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private));
|
1221
|
+
}({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core));
|
994
1222
|
//# sourceMappingURL=workbox-precaching.dev.js.map
|