jekyll-pwa-workbox 0.0.6 → 0.0.91

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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-workbox.rb +2 -2
  3. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js +818 -0
  4. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.dev.js.map +1 -0
  5. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js +2 -0
  6. data/lib/vendor/workbox-v5.1.3/workbox-background-sync.prod.js.map +1 -0
  7. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js +288 -0
  8. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.dev.js.map +1 -0
  9. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js +2 -0
  10. data/lib/vendor/workbox-v5.1.3/workbox-broadcast-update.prod.js.map +1 -0
  11. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js +191 -0
  12. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.dev.js.map +1 -0
  13. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js +2 -0
  14. data/lib/vendor/workbox-v5.1.3/workbox-cacheable-response.prod.js.map +1 -0
  15. data/lib/vendor/workbox-v5.1.3/workbox-core.dev.js +1858 -0
  16. data/lib/vendor/workbox-v5.1.3/workbox-core.dev.js.map +1 -0
  17. data/lib/vendor/workbox-v5.1.3/workbox-core.prod.js +2 -0
  18. data/lib/vendor/workbox-v5.1.3/workbox-core.prod.js.map +1 -0
  19. data/lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js +649 -0
  20. data/lib/vendor/workbox-v5.1.3/workbox-expiration.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js +2 -0
  22. data/lib/vendor/workbox-v5.1.3/workbox-expiration.prod.js.map +1 -0
  23. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js +102 -0
  24. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.dev.js.map +1 -0
  25. data/lib/vendor/{workbox-v4.3.1 → workbox-v5.1.3}/workbox-navigation-preload.prod.js +1 -1
  26. data/lib/vendor/workbox-v5.1.3/workbox-navigation-preload.prod.js.map +1 -0
  27. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js +235 -0
  28. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js +2 -0
  30. data/lib/vendor/workbox-v5.1.3/workbox-offline-ga.prod.js.map +1 -0
  31. data/lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js +1210 -0
  32. data/lib/vendor/workbox-v5.1.3/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js +2 -0
  34. data/lib/vendor/workbox-v5.1.3/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js +262 -0
  36. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.dev.js.map +1 -0
  37. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js +2 -0
  38. data/lib/vendor/workbox-v5.1.3/workbox-range-requests.prod.js.map +1 -0
  39. data/lib/vendor/workbox-v5.1.3/workbox-routing.dev.js +923 -0
  40. data/lib/vendor/workbox-v5.1.3/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/workbox-v5.1.3/workbox-routing.prod.js +2 -0
  42. data/lib/vendor/workbox-v5.1.3/workbox-routing.prod.js.map +1 -0
  43. data/lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js +923 -0
  44. data/lib/vendor/workbox-v5.1.3/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js +2 -0
  46. data/lib/vendor/workbox-v5.1.3/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/workbox-v5.1.3/workbox-streams.dev.js +318 -0
  48. data/lib/vendor/workbox-v5.1.3/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v5.1.3/workbox-streams.prod.js +2 -0
  50. data/lib/vendor/workbox-v5.1.3/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/workbox-v5.1.3/workbox-sw.js +2 -0
  52. data/lib/vendor/workbox-v5.1.3/workbox-sw.js.map +1 -0
  53. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs +1094 -0
  54. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.es5.mjs.map +1 -0
  55. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs +943 -0
  56. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.mjs.map +1 -0
  57. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js +1105 -0
  58. data/lib/vendor/workbox-v5.1.3/workbox-window.dev.umd.js.map +1 -0
  59. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs +2 -0
  60. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.es5.mjs.map +1 -0
  61. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs +2 -0
  62. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.mjs.map +1 -0
  63. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js +2 -0
  64. data/lib/vendor/workbox-v5.1.3/workbox-window.prod.umd.js.map +1 -0
  65. metadata +73 -78
  66. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js +0 -822
  67. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js +0 -2
  69. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js.map +0 -1
  70. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js +0 -496
  71. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js.map +0 -1
  72. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js +0 -2
  73. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js.map +0 -1
  74. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js +0 -200
  75. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js.map +0 -1
  76. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js +0 -2
  77. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js.map +0 -1
  78. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js +0 -1712
  79. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js.map +0 -1
  80. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js +0 -2
  81. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js.map +0 -1
  82. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js +0 -652
  83. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js.map +0 -1
  84. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js +0 -2
  85. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js.map +0 -1
  86. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js +0 -110
  87. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js.map +0 -1
  88. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.prod.js.map +0 -1
  89. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js +0 -243
  90. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js.map +0 -1
  91. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js +0 -2
  92. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js.map +0 -1
  93. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js +0 -989
  94. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js.map +0 -1
  95. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js +0 -2
  96. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js.map +0 -1
  97. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js +0 -268
  98. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js.map +0 -1
  99. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js +0 -2
  100. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js.map +0 -1
  101. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js +0 -1020
  102. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js.map +0 -1
  103. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js +0 -2
  104. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js.map +0 -1
  105. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js +0 -1138
  106. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js.map +0 -1
  107. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js +0 -2
  108. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js.map +0 -1
  109. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js +0 -337
  110. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js.map +0 -1
  111. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js +0 -2
  112. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js.map +0 -1
  113. data/lib/vendor/workbox-v4.3.1/workbox-sw.js +0 -2
  114. data/lib/vendor/workbox-v4.3.1/workbox-sw.js.map +0 -1
  115. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs +0 -885
  116. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs.map +0 -1
  117. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs +0 -751
  118. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs.map +0 -1
  119. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js +0 -896
  120. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js.map +0 -1
  121. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs +0 -2
  122. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs.map +0 -1
  123. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs +0 -2
  124. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs.map +0 -1
  125. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js +0 -2
  126. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"workbox-window.dev.es5.mjs","sources":["../_version.mjs","../messageSW.mjs","../../workbox-core/_version.mjs","../../workbox-core/_private/Deferred.mjs","../../workbox-core/_private/logger.mjs","../utils/EventTargetShim.mjs","../utils/urlsMatch.mjs","../utils/WorkboxEvent.mjs","../Workbox.mjs","../index.mjs"],"sourcesContent":["try{self['workbox:window:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\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*/\n\nimport './_version.mjs';\n\n\n/**\n * Sends a data object to a service worker via `postMessage` and resolves with\n * a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will not\n * resolve.\n *\n * @param {ServiceWorker} sw The service worker to send the message to.\n * @param {Object} data An object to send to the service worker.\n * @return {Promise<Object|undefined>}\n *\n * @memberof module:workbox-window\n */\nconst messageSW = (sw, data) => {\n return new Promise((resolve) => {\n let messageChannel = new MessageChannel();\n messageChannel.port1.onmessage = (evt) => resolve(evt.data);\n sw.postMessage(data, [messageChannel.port2]);\n });\n};\n\nexport {messageSW};\n","try{self['workbox:core:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\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\nimport '../_version.mjs';\n\n\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 */\nexport class 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}\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*/\n\nimport '../_version.mjs';\n\n\nconst logger = process.env.NODE_ENV === 'production' ? null : (() => {\n let inGroup = false;\n\n const methodToColorMap = {\n debug: `#7f8c8d`, // Gray\n log: `#2ecc71`, // Green\n warn: `#f39c12`, // Yellow\n error: `#c0392b`, // Red\n groupCollapsed: `#3498db`, // Blue\n groupEnd: null, // No colored prefix on groupEnd\n };\n\n const print = function(method, args) {\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\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\n // When in a group, the workbox prefix is not displayed.\n const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];\n\n console[method](...logPrefix, ...args);\n\n if (method === 'groupCollapsed') {\n inGroup = true;\n }\n if (method === 'groupEnd') {\n inGroup = false;\n }\n };\n\n const api = {};\n for (const method of Object.keys(methodToColorMap)) {\n api[method] = (...args) => {\n print(method, args);\n };\n }\n\n return api;\n})();\n\nexport {logger};\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*/\n\nimport '../_version.mjs';\n\n\n/**\n * A minimal `EventTarget` shim.\n * This is necessary because not all browsers support constructable\n * `EventTarget`, so using a real `EventTarget` will error.\n * @private\n */\nclass EventTargetShim {\n /**\n * Creates an event listener registry\n *\n * @private\n */\n constructor() {\n // A registry of event types to listeners.\n this._eventListenerRegistry = {};\n }\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n addEventListener(type, listener) {\n this._getEventListenersByType(type).add(listener);\n }\n\n /**\n * @param {string} type\n * @param {Function} listener\n * @private\n */\n removeEventListener(type, listener) {\n this._getEventListenersByType(type).delete(listener);\n }\n\n /**\n * @param {Event} event\n * @private\n */\n dispatchEvent(event) {\n event.target = this;\n this._getEventListenersByType(event.type).forEach(\n (listener) => listener(event));\n }\n\n /**\n * Returns a Set of listeners associated with the passed event type.\n * If no handlers have been registered, an empty Set is returned.\n *\n * @param {string} type The event type.\n * @return {Set} An array of handler functions.\n * @private\n */\n _getEventListenersByType(type) {\n return this._eventListenerRegistry[type] =\n (this._eventListenerRegistry[type] || new Set());\n }\n}\n\nexport {EventTargetShim};\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*/\n\nimport '../_version.mjs';\n\n\n/**\n * Returns true if two URLs have the same `.href` property. The URLS can be\n * relative, and if they are the current location href is used to resolve URLs.\n *\n * @private\n * @param {string} url1\n * @param {string} url2\n * @return {boolean}\n */\nconst urlsMatch = (url1, url2) => {\n return new URL(url1, location).href === new URL(url2, location).href;\n};\n\nexport {urlsMatch};\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*/\n\nimport '../_version.mjs';\n\n/**\n * A minimal `Event` subclass shim.\n * This doesn't *actually* subclass `Event` because not all browsers support\n * constructable `EventTarget`, and using a real `Event` will error.\n * @private\n */\nclass WorkboxEvent {\n /**\n * @param {string} type\n * @param {Object} props\n */\n constructor(type, props) {\n Object.assign(this, props, {type});\n }\n}\n\nexport {WorkboxEvent};\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*/\n\nimport {Deferred} from 'workbox-core/_private/Deferred.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {messageSW} from './messageSW.mjs';\nimport {EventTargetShim} from './utils/EventTargetShim.mjs';\nimport {urlsMatch} from './utils/urlsMatch.mjs';\nimport {WorkboxEvent} from './utils/WorkboxEvent.mjs';\nimport './_version.mjs';\n\n\n// The time a SW must be in the waiting phase before we can conclude\n// `skipWaiting()` wasn't called. This 200 amount wasn't scientifically\n// chosen, but it seems to avoid false positives in my testing.\nconst WAITING_TIMEOUT_DURATION = 200;\n\n// The amount of time after a registration that we can reasonably conclude\n// that the registration didn't trigger an update.\nconst REGISTRATION_TIMEOUT_DURATION = 60000;\n\n/**\n * A class to aid in handling service worker registration, updates, and\n * reacting to service worker lifecycle events.\n *\n * @fires [message]{@link module:workbox-window.Workbox#message}\n * @fires [installed]{@link module:workbox-window.Workbox#installed}\n * @fires [waiting]{@link module:workbox-window.Workbox#waiting}\n * @fires [controlling]{@link module:workbox-window.Workbox#controlling}\n * @fires [activated]{@link module:workbox-window.Workbox#activated}\n * @fires [redundant]{@link module:workbox-window.Workbox#redundant}\n * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}\n * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}\n * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}\n *\n * @memberof module:workbox-window\n */\nclass Workbox extends EventTargetShim {\n /**\n * Creates a new Workbox instance with a script URL and service worker\n * options. The script URL and options are the same as those used when\n * calling `navigator.serviceWorker.register(scriptURL, options)`. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n *\n * @param {string} scriptURL The service worker script associated with this\n * instance.\n * @param {Object} [registerOptions] The service worker options associated\n * with this instance.\n */\n constructor(scriptURL, registerOptions = {}) {\n super();\n\n this._scriptURL = scriptURL;\n this._registerOptions = registerOptions;\n this._updateFoundCount = 0;\n\n // Deferreds we can resolve later.\n this._swDeferred = new Deferred();\n this._activeDeferred = new Deferred();\n this._controllingDeferred = new Deferred();\n\n // Bind event handler callbacks.\n this._onMessage = this._onMessage.bind(this);\n this._onStateChange = this._onStateChange.bind(this);\n this._onUpdateFound = this._onUpdateFound.bind(this);\n this._onControllerChange = this._onControllerChange.bind(this);\n }\n\n /**\n * Registers a service worker for this instances script URL and service\n * worker options. By default this method delays registration until after\n * the window has loaded.\n *\n * @param {Object} [options]\n * @param {Function} [options.immediate=false] Setting this to true will\n * register the service worker immediately, even if the window has\n * not loaded (not recommended).\n */\n async register({immediate = false} = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (this._registrationTime) {\n logger.error('Cannot re-register a Workbox instance after it has ' +\n 'been registered. Create a new instance instead.');\n return;\n }\n }\n\n if (!immediate && document.readyState !== 'complete') {\n await new Promise((res) => addEventListener('load', res));\n }\n\n // Set this flag to true if any service worker was controlling the page\n // at registration time.\n this._isUpdate = Boolean(navigator.serviceWorker.controller);\n\n // Before registering, attempt to determine if a SW is already controlling\n // the page, and if that SW script (and version, if specified) matches this\n // instance's script.\n this._compatibleControllingSW = this._getControllingSWIfCompatible();\n\n this._registration = await this._registerScript();\n\n // If we have a compatible controller, store the controller as the \"own\"\n // SW, resolve active/controlling deferreds and add necessary listeners.\n if (this._compatibleControllingSW) {\n this._sw = this._compatibleControllingSW;\n this._activeDeferred.resolve(this._compatibleControllingSW);\n this._controllingDeferred.resolve(this._compatibleControllingSW);\n\n this._reportWindowReady(this._compatibleControllingSW);\n this._compatibleControllingSW.addEventListener(\n 'statechange', this._onStateChange, {once: true});\n }\n\n // If there's a waiting service worker with a matching URL before the\n // `updatefound` event fires, it likely means that this site is open\n // in another tab, or the user refreshed the page (and thus the prevoius\n // page wasn't fully unloaded before this page started loading).\n // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting\n const waitingSW = this._registration.waiting;\n if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL)) {\n // Store the waiting SW as the \"own\" Sw, even if it means overwriting\n // a compatible controller.\n this._sw = waitingSW;\n\n // Run this in the next microtask, so any code that adds an event\n // listener after awaiting `register()` will get this event.\n Promise.resolve().then(() => {\n this.dispatchEvent(new WorkboxEvent('waiting', {\n sw: waitingSW,\n wasWaitingBeforeRegister: true,\n }));\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('A service worker was already waiting to activate ' +\n 'before this script was registered...');\n }\n });\n }\n\n // If an \"own\" SW is already set, resolve the deferred.\n if (this._sw) {\n this._swDeferred.resolve(this._sw);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Successfully registered service worker.', this._scriptURL);\n\n if (navigator.serviceWorker.controller) {\n if (this._compatibleControllingSW) {\n logger.debug('A service worker with the same script URL ' +\n 'is already controlling this page.');\n } else {\n logger.debug('A service worker with a different script URL is ' +\n 'currently controlling the page. The browser is now fetching ' +\n 'the new script now...');\n }\n }\n\n const currentPageIsOutOfScope = () => {\n const scopeURL = new URL(\n this._registerOptions.scope || this._scriptURL, document.baseURI);\n const scopeURLBasePath = new URL('./', scopeURL.href).pathname;\n return !location.pathname.startsWith(scopeURLBasePath);\n };\n if (currentPageIsOutOfScope()) {\n logger.warn('The current page is not in scope for the registered ' +\n 'service worker. Was this a mistake?');\n }\n }\n\n this._registration.addEventListener('updatefound', this._onUpdateFound);\n navigator.serviceWorker.addEventListener(\n 'controllerchange', this._onControllerChange, {once: true});\n\n // Add message listeners.\n if ('BroadcastChannel' in self) {\n this._broadcastChannel = new BroadcastChannel('workbox');\n this._broadcastChannel.addEventListener('message', this._onMessage);\n }\n navigator.serviceWorker.addEventListener('message', this._onMessage);\n\n return this._registration;\n }\n\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is active. If a service worker was already controlling at registration\n * time then it will resolve to that if the script URLs (and optionally\n * script versions) match, otherwise it will wait until an update is found\n * and activates.\n *\n * @return {Promise<ServiceWorker>}\n */\n get active() {\n return this._activeDeferred.promise;\n }\n\n /**\n * Resolves to the service worker registered by this instance as soon as it\n * is controlling the page. If a service worker was already controlling at\n * registration time then it will resolve to that if the script URLs (and\n * optionally script versions) match, otherwise it will wait until an update\n * is found and starts controlling the page.\n * Note: the first time a service worker is installed it will active but\n * not start controlling the page unless `clients.claim()` is called in the\n * service worker.\n *\n * @return {Promise<ServiceWorker>}\n */\n get controlling() {\n return this._controllingDeferred.promise;\n }\n\n /**\n * Resolves with a reference to a service worker that matches the script URL\n * of this instance, as soon as it's available.\n *\n * If, at registration time, there's already an active or waiting service\n * worker with a matching script URL, it will be used (with the waiting\n * service worker taking precedence over the active service worker if both\n * match, since the waiting service worker would have been registered more\n * recently).\n * If there's no matching active or waiting service worker at registration\n * time then the promise will not resolve until an update is found and starts\n * installing, at which point the installing service worker is used.\n *\n * @return {Promise<ServiceWorker>}\n */\n async getSW() {\n // If `this._sw` is set, resolve with that as we want `getSW()` to\n // return the correct (new) service worker if an update is found.\n return this._sw || this._swDeferred.promise;\n }\n\n /**\n * Sends the passed data object to the service worker registered by this\n * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves\n * with a response (if any).\n *\n * A response can be set in a message handler in the service worker by\n * calling `event.ports[0].postMessage(...)`, which will resolve the promise\n * returned by `messageSW()`. If no response is set, the promise will never\n * resolve.\n *\n * @param {Object} data An object to send to the service worker\n * @return {Promise<Object>}\n */\n async messageSW(data) {\n const sw = await this.getSW();\n return messageSW(sw, data);\n }\n\n /**\n * Checks for a service worker already controlling the page and returns\n * it if its script URL matchs.\n *\n * @private\n * @return {ServiceWorker|undefined}\n */\n _getControllingSWIfCompatible() {\n const controller = navigator.serviceWorker.controller;\n if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {\n return controller;\n }\n }\n\n /**\n * Registers a service worker for this instances script URL and register\n * options and tracks the time registration was complete.\n *\n * @private\n */\n async _registerScript() {\n try {\n const reg = await navigator.serviceWorker.register(\n this._scriptURL, this._registerOptions);\n\n // Keep track of when registration happened, so it can be used in the\n // `this._onUpdateFound` heuristic. Also use the presence of this\n // property as a way to see if `.register()` has been called.\n this._registrationTime = performance.now();\n\n return reg;\n } catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(error);\n }\n // Re-throw the error.\n throw error;\n }\n }\n\n\n /**\n * Sends a message to the passed service worker that the window is ready.\n *\n * @param {ServiceWorker} sw\n * @private\n */\n _reportWindowReady(sw) {\n messageSW(sw, {\n type: 'WINDOW_READY',\n meta: 'workbox-window',\n });\n }\n\n /**\n * @private\n */\n _onUpdateFound() {\n const installingSW = this._registration.installing;\n\n // If the script URL passed to `navigator.serviceWorker.register()` is\n // different from the current controlling SW's script URL, we know any\n // successful registration calls will trigger an `updatefound` event.\n // But if the registered script URL is the same as the current controlling\n // SW's script URL, we'll only get an `updatefound` event if the file\n // changed since it was last registered. This can be a problem if the user\n // opens up the same page in a different tab, and that page registers\n // a SW that triggers an update. It's a problem because this page has no\n // good way of knowing whether the `updatefound` event came from the SW\n // script it registered or from a registration attempt made by a newer\n // version of the page running in another tab.\n // To minimize the possibility of a false positive, we use the logic here:\n let updateLikelyTriggeredExternally =\n // Since we enforce only calling `register()` once, and since we don't\n // add the `updatefound` event listener until the `register()` call, if\n // `_updateFoundCount` is > 0 then it means this method has already\n // been called, thus this SW must be external\n this._updateFoundCount > 0 ||\n // If the script URL of the installing SW is different from this\n // instance's script URL, we know it's definitely not from our\n // registration.\n !urlsMatch(installingSW.scriptURL, this._scriptURL) ||\n // If all of the above are false, then we use a time-based heuristic:\n // Any `updatefound` event that occurs long after our registration is\n // assumed to be external.\n (performance.now() >\n this._registrationTime + REGISTRATION_TIMEOUT_DURATION) ?\n // If any of the above are not true, we assume the update was\n // triggered by this instance.\n true : false;\n\n if (updateLikelyTriggeredExternally) {\n this._externalSW = installingSW;\n this._registration.removeEventListener(\n 'updatefound', this._onUpdateFound);\n } else {\n // If the update was not triggered externally we know the installing\n // SW is the one we registered, so we set it.\n this._sw = installingSW;\n this._swDeferred.resolve(installingSW);\n\n // The `installing` state isn't something we have a dedicated\n // callback for, but we do log messages for it in development.\n if (process.env.NODE_ENV !== 'production') {\n if (navigator.serviceWorker.controller) {\n logger.log('Updated service worker found. Installing now...');\n } else {\n logger.log('Service worker is installing...');\n }\n }\n }\n\n // Increment the `updatefound` count, so future invocations of this\n // method can be sure they were triggered externally.\n ++this._updateFoundCount;\n\n // Add a `statechange` listener regardless of whether this update was\n // triggered externally, since we have callbacks for both.\n installingSW.addEventListener('statechange', this._onStateChange);\n }\n\n /**\n * @private\n * @param {Event} originalEvent\n */\n _onStateChange(originalEvent) {\n const sw = originalEvent.target;\n const {state} = sw;\n const isExternal = sw === this._externalSW;\n const eventPrefix = isExternal ? 'external' : '';\n\n const eventProps = {sw, originalEvent};\n if (!isExternal && this._isUpdate) {\n eventProps.isUpdate = true;\n }\n\n this.dispatchEvent(new WorkboxEvent(\n eventPrefix + state, eventProps));\n\n if (state === 'installed') {\n // This timeout is used to ignore cases where the service worker calls\n // `skipWaiting()` in the install event, thus moving it directly in the\n // activating state. (Since all service workers *must* go through the\n // waiting phase, the only way to detect `skipWaiting()` called in the\n // install event is to observe that the time spent in the waiting phase\n // is very short.)\n // NOTE: we don't need separate timeouts for the own and external SWs\n // since they can't go through these phases at the same time.\n this._waitingTimeout = setTimeout(() => {\n // Ensure the SW is still waiting (it may now be redundant).\n if (state === 'installed' && this._registration.waiting === sw) {\n this.dispatchEvent(new WorkboxEvent(\n eventPrefix + 'waiting', eventProps));\n\n if (process.env.NODE_ENV !== 'production') {\n if (isExternal) {\n logger.warn('An external service worker has installed but is ' +\n 'waiting for this client to close before activating...');\n } else {\n logger.warn('The service worker has installed but is waiting ' +\n 'for existing clients to close before activating...');\n }\n }\n }\n }, WAITING_TIMEOUT_DURATION);\n } else if (state === 'activating') {\n clearTimeout(this._waitingTimeout);\n if (!isExternal) {\n this._activeDeferred.resolve(sw);\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n switch (state) {\n case 'installed':\n if (isExternal) {\n logger.warn('An external service worker has installed. ' +\n 'You may want to suggest users reload this page.');\n } else {\n logger.log('Registered service worker installed.');\n }\n break;\n case 'activated':\n if (isExternal) {\n logger.warn('An external service worker has activated.');\n } else {\n logger.log('Registered service worker activated.');\n if (sw !== navigator.serviceWorker.controller) {\n logger.warn('The registered service worker is active but ' +\n 'not yet controlling the page. Reload or run ' +\n '`clients.claim()` in the service worker.');\n }\n }\n break;\n case 'redundant':\n if (sw === this._compatibleControllingSW) {\n logger.log('Previously controlling service worker now redundant!');\n } else if (!isExternal) {\n logger.log('Registered service worker now redundant!');\n }\n break;\n }\n }\n }\n\n /**\n * @private\n * @param {Event} originalEvent\n */\n _onControllerChange(originalEvent) {\n const sw = this._sw;\n if (sw === navigator.serviceWorker.controller) {\n this.dispatchEvent(new WorkboxEvent('controlling', {sw, originalEvent}));\n if (process.env.NODE_ENV !== 'production') {\n logger.log('Registered service worker now controlling this page.');\n }\n this._controllingDeferred.resolve(sw);\n }\n }\n\n /**\n * @private\n * @param {Event} originalEvent\n */\n _onMessage(originalEvent) {\n const {data} = originalEvent;\n this.dispatchEvent(new WorkboxEvent('message', {data, originalEvent}));\n }\n}\n\n// The jsdoc comments below outline the events this instance may dispatch:\n// -----------------------------------------------------------------------\n\n/**\n * The `message` event is dispatched any time a `postMessage` (or a\n * `BroadcastChannel` message with the `workbox` channel name) is received.\n *\n * @event module:workbox-window.Workbox#message\n * @type {WorkboxEvent}\n * @property {*} data The `data` property from the original `message` event.\n * @property {Event} originalEvent The original [`message`]{@link https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent}\n * event.\n * @property {string} type `message`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `installed` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed`.\n *\n * Then can happen either the very first time a service worker is installed,\n * or after an update to the current service worker is found. In the case\n * of an update being found, the event's `isUpdate` property will be `true`.\n *\n * @event module:workbox-window.Workbox#installed\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `installed`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `waiting` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `installed` and then doesn't immediately change to `activating`.\n * It may also be dispatched if a service worker with the same\n * [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * was already waiting when the [`register()`]{@link module:workbox-window.Workbox#register}\n * method was called.\n *\n * @event module:workbox-window.Workbox#waiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The native `controllerchange` event\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {boolean|undefined} wasWaitingBeforeRegister True if a service worker with\n * a matching `scriptURL` was already waiting when this `Workbox`\n * instance called `register()`.\n * @property {string} type `waiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `controlling` event is dispatched if a\n * [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * fires on the service worker [container]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer}\n * and the [`scriptURL`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/scriptURL}\n * of the new [controller]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/controller}\n * matches the `scriptURL` of the `Workbox` instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}.\n *\n * @event module:workbox-window.Workbox#controlling\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`controllerchange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/oncontrollerchange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this service worker was registered.\n * @property {string} type `controlling`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `activated` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#activated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `activated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `redundant` event is dispatched if the state of a\n * [`Workbox`]{@link module:workbox-window.Workbox} instance's\n * [registered service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-registered-sw}\n * changes to `redundant`.\n *\n * @event module:workbox-window.Workbox#redundant\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {boolean|undefined} isUpdate True if a service worker was already\n * controlling when this `Workbox` instance called `register()`.\n * @property {string} type `redundant`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `externalinstalled` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-external-sw}\n * changes to `installed`.\n *\n * @event module:workbox-window.Workbox#externalinstalled\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalinstalled`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `externalwaiting` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-external-sw}\n * changes to `waiting`.\n *\n * @event module:workbox-window.Workbox#externalwaiting\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event|undefined} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalwaiting`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\n/**\n * The `externalactivated` event is dispatched if the state of an\n * [external service worker]{@link https://developers.google.com/web/tools/workbox/modules/workbox-precaching#def-external-sw}\n * changes to `activated`.\n *\n * @event module:workbox-window.Workbox#externalactivated\n * @type {WorkboxEvent}\n * @property {ServiceWorker} sw The service worker instance.\n * @property {Event} originalEvent The original [`statechange`]{@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/onstatechange}\n * event.\n * @property {string} type `externalactivated`.\n * @property {Workbox} target The `Workbox` instance.\n */\n\nexport {Workbox};\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*/\n\nimport {messageSW} from './messageSW.mjs';\nimport {Workbox} from './Workbox.mjs';\nimport './_version.mjs';\n\n\n/**\n * @module workbox-window\n */\nexport {\n Workbox,\n messageSW,\n};\n"],"names":["self","_","e","messageSW","sw","data","Promise","resolve","messageChannel","MessageChannel","port1","onmessage","evt","postMessage","port2","Deferred","promise","reject","logger","process","inGroup","methodToColorMap","debug","log","warn","error","groupCollapsed","groupEnd","print","method","args","test","navigator","userAgent","console","styles","logPrefix","join","api","Object","keys","EventTargetShim","_eventListenerRegistry","addEventListener","type","listener","_getEventListenersByType","add","removeEventListener","delete","dispatchEvent","event","target","forEach","Set","urlsMatch","url1","url2","URL","location","href","WorkboxEvent","props","assign","body","recover","result","then","f","i","arguments","length","apply","value","direct","WAITING_TIMEOUT_DURATION","REGISTRATION_TIMEOUT_DURATION","Workbox","scriptURL","registerOptions","_scriptURL","_registerOptions","_updateFoundCount","_swDeferred","_activeDeferred","_controllingDeferred","_onMessage","bind","_onStateChange","_onUpdateFound","_onControllerChange","register","immediate","_registrationTime","document","readyState","res","_isUpdate","Boolean","serviceWorker","controller","_compatibleControllingSW","_getControllingSWIfCompatible","_registerScript","_registration","_sw","_reportWindowReady","once","waitingSW","waiting","wasWaitingBeforeRegister","currentPageIsOutOfScope","scopeURL","scope","baseURI","scopeURLBasePath","pathname","startsWith","_broadcastChannel","BroadcastChannel","getSW","reg","performance","now","meta","installingSW","installing","updateLikelyTriggeredExternally","_externalSW","originalEvent","state","isExternal","eventPrefix","eventProps","isUpdate","_waitingTimeout","setTimeout","clearTimeout"],"mappings":"AAAA,IAAG;EAACA,IAAI,CAAC,sBAAD,CAAJ,IAA8BC,CAAC,EAA/B;CAAJ,CAAsC,OAAMC,CAAN,EAAQ;;ACA9C;;;;;;;AAQA,AAGA;;;;;;;;;;;;;;;;AAeA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,EAAD,EAAKC,IAAL,EAAc;SACvB,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;QAC1BC,cAAc,GAAG,IAAIC,cAAJ,EAArB;;IACAD,cAAc,CAACE,KAAf,CAAqBC,SAArB,GAAiC,UAACC,GAAD;aAASL,OAAO,CAACK,GAAG,CAACP,IAAL,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e;QACjB5H,IADiB,GACT4H,aADS,CACjB5H,IADiB;SAEnB6C,aAAL,CAAmB,IAAIW,YAAJ,CAAiB,SAAjB,EAA4B;MAACxD,IAAI,EAAJA,IAAD;MAAO4H,aAAa,EAAbA;KAAnC,CAAnB;;;;;wBA7RW;aACJ,KAAK7C,eAAL,CAAqBpE,OAA5B;;;;;;;;;;;;;;;;;wBAegB;aACT,KAAKqE,oBAAL,CAA0BrE,OAAjC;;;;;EA7KkByB;;AC1CtB;;;;;;;;;;"}
@@ -1,751 +0,0 @@
1
- try {
2
- self['workbox:window:4.3.1'] && _();
3
- } catch (e) {} // eslint-disable-line
4
-
5
- /*
6
- Copyright 2019 Google LLC
7
-
8
- Use of this source code is governed by an MIT-style
9
- license that can be found in the LICENSE file or at
10
- https://opensource.org/licenses/MIT.
11
- */
12
- /**
13
- * Sends a data object to a service worker via `postMessage` and resolves with
14
- * a response (if any).
15
- *
16
- * A response can be set in a message handler in the service worker by
17
- * calling `event.ports[0].postMessage(...)`, which will resolve the promise
18
- * returned by `messageSW()`. If no response is set, the promise will not
19
- * resolve.
20
- *
21
- * @param {ServiceWorker} sw The service worker to send the message to.
22
- * @param {Object} data An object to send to the service worker.
23
- * @return {Promise<Object|undefined>}
24
- *
25
- * @memberof module:workbox-window
26
- */
27
-
28
- const messageSW = (sw, data) => {
29
- return new Promise(resolve => {
30
- let messageChannel = new MessageChannel();
31
-
32
- messageChannel.port1.onmessage = evt => resolve(evt.data);
33
-
34
- sw.postMessage(data, [messageChannel.port2]);
35
- });
36
- };
37
-
38
- try {
39
- self['workbox:core:4.3.1'] && _();
40
- } catch (e) {} // eslint-disable-line
41
-
42
- /*
43
- Copyright 2018 Google LLC
44
-
45
- Use of this source code is governed by an MIT-style
46
- license that can be found in the LICENSE file or at
47
- https://opensource.org/licenses/MIT.
48
- */
49
- /**
50
- * The Deferred class composes Promises in a way that allows for them to be
51
- * resolved or rejected from outside the constructor. In most cases promises
52
- * should be used directly, but Deferreds can be necessary when the logic to
53
- * resolve a promise must be separate.
54
- *
55
- * @private
56
- */
57
-
58
- class Deferred {
59
- /**
60
- * Creates a promise and exposes its resolve and reject functions as methods.
61
- */
62
- constructor() {
63
- this.promise = new Promise((resolve, reject) => {
64
- this.resolve = resolve;
65
- this.reject = reject;
66
- });
67
- }
68
-
69
- }
70
-
71
- /*
72
- Copyright 2019 Google LLC
73
- Use of this source code is governed by an MIT-style
74
- license that can be found in the LICENSE file or at
75
- https://opensource.org/licenses/MIT.
76
- */
77
- const logger = (() => {
78
- let inGroup = false;
79
- const methodToColorMap = {
80
- debug: `#7f8c8d`,
81
- // Gray
82
- log: `#2ecc71`,
83
- // Green
84
- warn: `#f39c12`,
85
- // Yellow
86
- error: `#c0392b`,
87
- // Red
88
- groupCollapsed: `#3498db`,
89
- // Blue
90
- groupEnd: null // No colored prefix on groupEnd
91
-
92
- };
93
-
94
- const print = function (method, args) {
95
- if (method === 'groupCollapsed') {
96
- // Safari doesn't print all console.groupCollapsed() arguments:
97
- // https://bugs.webkit.org/show_bug.cgi?id=182754
98
- if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
99
- console[method](...args);
100
- return;
101
- }
102
- }
103
-
104
- const styles = [`background: ${methodToColorMap[method]}`, `border-radius: 0.5em`, `color: white`, `font-weight: bold`, `padding: 2px 0.5em`]; // When in a group, the workbox prefix is not displayed.
105
-
106
- const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
107
- console[method](...logPrefix, ...args);
108
-
109
- if (method === 'groupCollapsed') {
110
- inGroup = true;
111
- }
112
-
113
- if (method === 'groupEnd') {
114
- inGroup = false;
115
- }
116
- };
117
-
118
- const api = {};
119
-
120
- for (const method of Object.keys(methodToColorMap)) {
121
- api[method] = (...args) => {
122
- print(method, args);
123
- };
124
- }
125
-
126
- return api;
127
- })();
128
-
129
- /*
130
- Copyright 2019 Google LLC
131
-
132
- Use of this source code is governed by an MIT-style
133
- license that can be found in the LICENSE file or at
134
- https://opensource.org/licenses/MIT.
135
- */
136
- /**
137
- * A minimal `EventTarget` shim.
138
- * This is necessary because not all browsers support constructable
139
- * `EventTarget`, so using a real `EventTarget` will error.
140
- * @private
141
- */
142
-
143
- class EventTargetShim {
144
- /**
145
- * Creates an event listener registry
146
- *
147
- * @private
148
- */
149
- constructor() {
150
- // A registry of event types to listeners.
151
- this._eventListenerRegistry = {};
152
- }
153
- /**
154
- * @param {string} type
155
- * @param {Function} listener
156
- * @private
157
- */
158
-
159
-
160
- addEventListener(type, listener) {
161
- this._getEventListenersByType(type).add(listener);
162
- }
163
- /**
164
- * @param {string} type
165
- * @param {Function} listener
166
- * @private
167
- */
168
-
169
-
170
- removeEventListener(type, listener) {
171
- this._getEventListenersByType(type).delete(listener);
172
- }
173
- /**
174
- * @param {Event} event
175
- * @private
176
- */
177
-
178
-
179
- dispatchEvent(event) {
180
- event.target = this;
181
-
182
- this._getEventListenersByType(event.type).forEach(listener => listener(event));
183
- }
184
- /**
185
- * Returns a Set of listeners associated with the passed event type.
186
- * If no handlers have been registered, an empty Set is returned.
187
- *
188
- * @param {string} type The event type.
189
- * @return {Set} An array of handler functions.
190
- * @private
191
- */
192
-
193
-
194
- _getEventListenersByType(type) {
195
- return this._eventListenerRegistry[type] = this._eventListenerRegistry[type] || new Set();
196
- }
197
-
198
- }
199
-
200
- /*
201
- Copyright 2019 Google LLC
202
-
203
- Use of this source code is governed by an MIT-style
204
- license that can be found in the LICENSE file or at
205
- https://opensource.org/licenses/MIT.
206
- */
207
- /**
208
- * Returns true if two URLs have the same `.href` property. The URLS can be
209
- * relative, and if they are the current location href is used to resolve URLs.
210
- *
211
- * @private
212
- * @param {string} url1
213
- * @param {string} url2
214
- * @return {boolean}
215
- */
216
-
217
- const urlsMatch = (url1, url2) => {
218
- return new URL(url1, location).href === new URL(url2, location).href;
219
- };
220
-
221
- /*
222
- Copyright 2019 Google LLC
223
-
224
- Use of this source code is governed by an MIT-style
225
- license that can be found in the LICENSE file or at
226
- https://opensource.org/licenses/MIT.
227
- */
228
- /**
229
- * A minimal `Event` subclass shim.
230
- * This doesn't *actually* subclass `Event` because not all browsers support
231
- * constructable `EventTarget`, and using a real `Event` will error.
232
- * @private
233
- */
234
-
235
- class WorkboxEvent {
236
- /**
237
- * @param {string} type
238
- * @param {Object} props
239
- */
240
- constructor(type, props) {
241
- Object.assign(this, props, {
242
- type
243
- });
244
- }
245
-
246
- }
247
-
248
- /*
249
- Copyright 2019 Google LLC
250
-
251
- Use of this source code is governed by an MIT-style
252
- license that can be found in the LICENSE file or at
253
- https://opensource.org/licenses/MIT.
254
- */
255
- // `skipWaiting()` wasn't called. This 200 amount wasn't scientifically
256
- // chosen, but it seems to avoid false positives in my testing.
257
-
258
- const WAITING_TIMEOUT_DURATION = 200; // The amount of time after a registration that we can reasonably conclude
259
- // that the registration didn't trigger an update.
260
-
261
- const REGISTRATION_TIMEOUT_DURATION = 60000;
262
- /**
263
- * A class to aid in handling service worker registration, updates, and
264
- * reacting to service worker lifecycle events.
265
- *
266
- * @fires [message]{@link module:workbox-window.Workbox#message}
267
- * @fires [installed]{@link module:workbox-window.Workbox#installed}
268
- * @fires [waiting]{@link module:workbox-window.Workbox#waiting}
269
- * @fires [controlling]{@link module:workbox-window.Workbox#controlling}
270
- * @fires [activated]{@link module:workbox-window.Workbox#activated}
271
- * @fires [redundant]{@link module:workbox-window.Workbox#redundant}
272
- * @fires [externalinstalled]{@link module:workbox-window.Workbox#externalinstalled}
273
- * @fires [externalwaiting]{@link module:workbox-window.Workbox#externalwaiting}
274
- * @fires [externalactivated]{@link module:workbox-window.Workbox#externalactivated}
275
- *
276
- * @memberof module:workbox-window
277
- */
278
-
279
- class Workbox extends EventTargetShim {
280
- /**
281
- * Creates a new Workbox instance with a script URL and service worker
282
- * options. The script URL and options are the same as those used when
283
- * calling `navigator.serviceWorker.register(scriptURL, options)`. See:
284
- * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register
285
- *
286
- * @param {string} scriptURL The service worker script associated with this
287
- * instance.
288
- * @param {Object} [registerOptions] The service worker options associated
289
- * with this instance.
290
- */
291
- constructor(scriptURL, registerOptions = {}) {
292
- super();
293
- this._scriptURL = scriptURL;
294
- this._registerOptions = registerOptions;
295
- this._updateFoundCount = 0; // Deferreds we can resolve later.
296
-
297
- this._swDeferred = new Deferred();
298
- this._activeDeferred = new Deferred();
299
- this._controllingDeferred = new Deferred(); // Bind event handler callbacks.
300
-
301
- this._onMessage = this._onMessage.bind(this);
302
- this._onStateChange = this._onStateChange.bind(this);
303
- this._onUpdateFound = this._onUpdateFound.bind(this);
304
- this._onControllerChange = this._onControllerChange.bind(this);
305
- }
306
- /**
307
- * Registers a service worker for this instances script URL and service
308
- * worker options. By default this method delays registration until after
309
- * the window has loaded.
310
- *
311
- * @param {Object} [options]
312
- * @param {Function} [options.immediate=false] Setting this to true will
313
- * register the service worker immediately, even if the window has
314
- * not loaded (not recommended).
315
- */
316
-
317
-
318
- async register({
319
- immediate = false
320
- } = {}) {
321
- {
322
- if (this._registrationTime) {
323
- logger.error('Cannot re-register a Workbox instance after it has ' + 'been registered. Create a new instance instead.');
324
- return;
325
- }
326
- }
327
-
328
- if (!immediate && document.readyState !== 'complete') {
329
- await new Promise(res => addEventListener('load', res));
330
- } // Set this flag to true if any service worker was controlling the page
331
- // at registration time.
332
-
333
-
334
- this._isUpdate = Boolean(navigator.serviceWorker.controller); // Before registering, attempt to determine if a SW is already controlling
335
- // the page, and if that SW script (and version, if specified) matches this
336
- // instance's script.
337
-
338
- this._compatibleControllingSW = this._getControllingSWIfCompatible();
339
- this._registration = await this._registerScript(); // If we have a compatible controller, store the controller as the "own"
340
- // SW, resolve active/controlling deferreds and add necessary listeners.
341
-
342
- if (this._compatibleControllingSW) {
343
- this._sw = this._compatibleControllingSW;
344
-
345
- this._activeDeferred.resolve(this._compatibleControllingSW);
346
-
347
- this._controllingDeferred.resolve(this._compatibleControllingSW);
348
-
349
- this._reportWindowReady(this._compatibleControllingSW);
350
-
351
- this._compatibleControllingSW.addEventListener('statechange', this._onStateChange, {
352
- once: true
353
- });
354
- } // If there's a waiting service worker with a matching URL before the
355
- // `updatefound` event fires, it likely means that this site is open
356
- // in another tab, or the user refreshed the page (and thus the prevoius
357
- // page wasn't fully unloaded before this page started loading).
358
- // https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#waiting
359
-
360
-
361
- const waitingSW = this._registration.waiting;
362
-
363
- if (waitingSW && urlsMatch(waitingSW.scriptURL, this._scriptURL)) {
364
- // Store the waiting SW as the "own" Sw, even if it means overwriting
365
- // a compatible controller.
366
- this._sw = waitingSW; // Run this in the next microtask, so any code that adds an event
367
- // listener after awaiting `register()` will get this event.
368
-
369
- Promise.resolve().then(() => {
370
- this.dispatchEvent(new WorkboxEvent('waiting', {
371
- sw: waitingSW,
372
- wasWaitingBeforeRegister: true
373
- }));
374
-
375
- {
376
- logger.warn('A service worker was already waiting to activate ' + 'before this script was registered...');
377
- }
378
- });
379
- } // If an "own" SW is already set, resolve the deferred.
380
-
381
-
382
- if (this._sw) {
383
- this._swDeferred.resolve(this._sw);
384
- }
385
-
386
- {
387
- logger.log('Successfully registered service worker.', this._scriptURL);
388
-
389
- if (navigator.serviceWorker.controller) {
390
- if (this._compatibleControllingSW) {
391
- logger.debug('A service worker with the same script URL ' + 'is already controlling this page.');
392
- } else {
393
- logger.debug('A service worker with a different script URL is ' + 'currently controlling the page. The browser is now fetching ' + 'the new script now...');
394
- }
395
- }
396
-
397
- const currentPageIsOutOfScope = () => {
398
- const scopeURL = new URL(this._registerOptions.scope || this._scriptURL, document.baseURI);
399
- const scopeURLBasePath = new URL('./', scopeURL.href).pathname;
400
- return !location.pathname.startsWith(scopeURLBasePath);
401
- };
402
-
403
- if (currentPageIsOutOfScope()) {
404
- logger.warn('The current page is not in scope for the registered ' + 'service worker. Was this a mistake?');
405
- }
406
- }
407
-
408
- this._registration.addEventListener('updatefound', this._onUpdateFound);
409
-
410
- navigator.serviceWorker.addEventListener('controllerchange', this._onControllerChange, {
411
- once: true
412
- }); // Add message listeners.
413
-
414
- if ('BroadcastChannel' in self) {
415
- this._broadcastChannel = new BroadcastChannel('workbox');
416
-
417
- this._broadcastChannel.addEventListener('message', this._onMessage);
418
- }
419
-
420
- navigator.serviceWorker.addEventListener('message', this._onMessage);
421
- return this._registration;
422
- }
423
- /**
424
- * Resolves to the service worker registered by this instance as soon as it
425
- * is active. If a service worker was already controlling at registration
426
- * time then it will resolve to that if the script URLs (and optionally
427
- * script versions) match, otherwise it will wait until an update is found
428
- * and activates.
429
- *
430
- * @return {Promise<ServiceWorker>}
431
- */
432
-
433
-
434
- get active() {
435
- return this._activeDeferred.promise;
436
- }
437
- /**
438
- * Resolves to the service worker registered by this instance as soon as it
439
- * is controlling the page. If a service worker was already controlling at
440
- * registration time then it will resolve to that if the script URLs (and
441
- * optionally script versions) match, otherwise it will wait until an update
442
- * is found and starts controlling the page.
443
- * Note: the first time a service worker is installed it will active but
444
- * not start controlling the page unless `clients.claim()` is called in the
445
- * service worker.
446
- *
447
- * @return {Promise<ServiceWorker>}
448
- */
449
-
450
-
451
- get controlling() {
452
- return this._controllingDeferred.promise;
453
- }
454
- /**
455
- * Resolves with a reference to a service worker that matches the script URL
456
- * of this instance, as soon as it's available.
457
- *
458
- * If, at registration time, there's already an active or waiting service
459
- * worker with a matching script URL, it will be used (with the waiting
460
- * service worker taking precedence over the active service worker if both
461
- * match, since the waiting service worker would have been registered more
462
- * recently).
463
- * If there's no matching active or waiting service worker at registration
464
- * time then the promise will not resolve until an update is found and starts
465
- * installing, at which point the installing service worker is used.
466
- *
467
- * @return {Promise<ServiceWorker>}
468
- */
469
-
470
-
471
- async getSW() {
472
- // If `this._sw` is set, resolve with that as we want `getSW()` to
473
- // return the correct (new) service worker if an update is found.
474
- return this._sw || this._swDeferred.promise;
475
- }
476
- /**
477
- * Sends the passed data object to the service worker registered by this
478
- * instance (via [`getSW()`]{@link module:workbox-window.Workbox#getSW}) and resolves
479
- * with a response (if any).
480
- *
481
- * A response can be set in a message handler in the service worker by
482
- * calling `event.ports[0].postMessage(...)`, which will resolve the promise
483
- * returned by `messageSW()`. If no response is set, the promise will never
484
- * resolve.
485
- *
486
- * @param {Object} data An object to send to the service worker
487
- * @return {Promise<Object>}
488
- */
489
-
490
-
491
- async messageSW(data) {
492
- const sw = await this.getSW();
493
- return messageSW(sw, data);
494
- }
495
- /**
496
- * Checks for a service worker already controlling the page and returns
497
- * it if its script URL matchs.
498
- *
499
- * @private
500
- * @return {ServiceWorker|undefined}
501
- */
502
-
503
-
504
- _getControllingSWIfCompatible() {
505
- const controller = navigator.serviceWorker.controller;
506
-
507
- if (controller && urlsMatch(controller.scriptURL, this._scriptURL)) {
508
- return controller;
509
- }
510
- }
511
- /**
512
- * Registers a service worker for this instances script URL and register
513
- * options and tracks the time registration was complete.
514
- *
515
- * @private
516
- */
517
-
518
-
519
- async _registerScript() {
520
- try {
521
- const reg = await navigator.serviceWorker.register(this._scriptURL, this._registerOptions); // Keep track of when registration happened, so it can be used in the
522
- // `this._onUpdateFound` heuristic. Also use the presence of this
523
- // property as a way to see if `.register()` has been called.
524
-
525
- this._registrationTime = performance.now();
526
- return reg;
527
- } catch (error) {
528
- {
529
- logger.error(error);
530
- } // Re-throw the error.
531
-
532
-
533
- throw error;
534
- }
535
- }
536
- /**
537
- * Sends a message to the passed service worker that the window is ready.
538
- *
539
- * @param {ServiceWorker} sw
540
- * @private
541
- */
542
-
543
-
544
- _reportWindowReady(sw) {
545
- messageSW(sw, {
546
- type: 'WINDOW_READY',
547
- meta: 'workbox-window'
548
- });
549
- }
550
- /**
551
- * @private
552
- */
553
-
554
-
555
- _onUpdateFound() {
556
- const installingSW = this._registration.installing; // If the script URL passed to `navigator.serviceWorker.register()` is
557
- // different from the current controlling SW's script URL, we know any
558
- // successful registration calls will trigger an `updatefound` event.
559
- // But if the registered script URL is the same as the current controlling
560
- // SW's script URL, we'll only get an `updatefound` event if the file
561
- // changed since it was last registered. This can be a problem if the user
562
- // opens up the same page in a different tab, and that page registers
563
- // a SW that triggers an update. It's a problem because this page has no
564
- // good way of knowing whether the `updatefound` event came from the SW
565
- // script it registered or from a registration attempt made by a newer
566
- // version of the page running in another tab.
567
- // To minimize the possibility of a false positive, we use the logic here:
568
-
569
- let updateLikelyTriggeredExternally = // Since we enforce only calling `register()` once, and since we don't
570
- // add the `updatefound` event listener until the `register()` call, if
571
- // `_updateFoundCount` is > 0 then it means this method has already
572
- // been called, thus this SW must be external
573
- this._updateFoundCount > 0 || // If the script URL of the installing SW is different from this
574
- // instance's script URL, we know it's definitely not from our
575
- // registration.
576
- !urlsMatch(installingSW.scriptURL, this._scriptURL) || // If all of the above are false, then we use a time-based heuristic:
577
- // Any `updatefound` event that occurs long after our registration is
578
- // assumed to be external.
579
- performance.now() > this._registrationTime + REGISTRATION_TIMEOUT_DURATION ? // If any of the above are not true, we assume the update was
580
- // triggered by this instance.
581
- true : false;
582
-
583
- if (updateLikelyTriggeredExternally) {
584
- this._externalSW = installingSW;
585
-
586
- this._registration.removeEventListener('updatefound', this._onUpdateFound);
587
- } else {
588
- // If the update was not triggered externally we know the installing
589
- // SW is the one we registered, so we set it.
590
- this._sw = installingSW;
591
-
592
- this._swDeferred.resolve(installingSW); // The `installing` state isn't something we have a dedicated
593
- // callback for, but we do log messages for it in development.
594
-
595
-
596
- {
597
- if (navigator.serviceWorker.controller) {
598
- logger.log('Updated service worker found. Installing now...');
599
- } else {
600
- logger.log('Service worker is installing...');
601
- }
602
- }
603
- } // Increment the `updatefound` count, so future invocations of this
604
- // method can be sure they were triggered externally.
605
-
606
-
607
- ++this._updateFoundCount; // Add a `statechange` listener regardless of whether this update was
608
- // triggered externally, since we have callbacks for both.
609
-
610
- installingSW.addEventListener('statechange', this._onStateChange);
611
- }
612
- /**
613
- * @private
614
- * @param {Event} originalEvent
615
- */
616
-
617
-
618
- _onStateChange(originalEvent) {
619
- const sw = originalEvent.target;
620
- const {
621
- state
622
- } = sw;
623
- const isExternal = sw === this._externalSW;
624
- const eventPrefix = isExternal ? 'external' : '';
625
- const eventProps = {
626
- sw,
627
- originalEvent
628
- };
629
-
630
- if (!isExternal && this._isUpdate) {
631
- eventProps.isUpdate = true;
632
- }
633
-
634
- this.dispatchEvent(new WorkboxEvent(eventPrefix + state, eventProps));
635
-
636
- if (state === 'installed') {
637
- // This timeout is used to ignore cases where the service worker calls
638
- // `skipWaiting()` in the install event, thus moving it directly in the
639
- // activating state. (Since all service workers *must* go through the
640
- // waiting phase, the only way to detect `skipWaiting()` called in the
641
- // install event is to observe that the time spent in the waiting phase
642
- // is very short.)
643
- // NOTE: we don't need separate timeouts for the own and external SWs
644
- // since they can't go through these phases at the same time.
645
- this._waitingTimeout = setTimeout(() => {
646
- // Ensure the SW is still waiting (it may now be redundant).
647
- if (state === 'installed' && this._registration.waiting === sw) {
648
- this.dispatchEvent(new WorkboxEvent(eventPrefix + 'waiting', eventProps));
649
-
650
- {
651
- if (isExternal) {
652
- logger.warn('An external service worker has installed but is ' + 'waiting for this client to close before activating...');
653
- } else {
654
- logger.warn('The service worker has installed but is waiting ' + 'for existing clients to close before activating...');
655
- }
656
- }
657
- }
658
- }, WAITING_TIMEOUT_DURATION);
659
- } else if (state === 'activating') {
660
- clearTimeout(this._waitingTimeout);
661
-
662
- if (!isExternal) {
663
- this._activeDeferred.resolve(sw);
664
- }
665
- }
666
-
667
- {
668
- switch (state) {
669
- case 'installed':
670
- if (isExternal) {
671
- logger.warn('An external service worker has installed. ' + 'You may want to suggest users reload this page.');
672
- } else {
673
- logger.log('Registered service worker installed.');
674
- }
675
-
676
- break;
677
-
678
- case 'activated':
679
- if (isExternal) {
680
- logger.warn('An external service worker has activated.');
681
- } else {
682
- logger.log('Registered service worker activated.');
683
-
684
- if (sw !== navigator.serviceWorker.controller) {
685
- logger.warn('The registered service worker is active but ' + 'not yet controlling the page. Reload or run ' + '`clients.claim()` in the service worker.');
686
- }
687
- }
688
-
689
- break;
690
-
691
- case 'redundant':
692
- if (sw === this._compatibleControllingSW) {
693
- logger.log('Previously controlling service worker now redundant!');
694
- } else if (!isExternal) {
695
- logger.log('Registered service worker now redundant!');
696
- }
697
-
698
- break;
699
- }
700
- }
701
- }
702
- /**
703
- * @private
704
- * @param {Event} originalEvent
705
- */
706
-
707
-
708
- _onControllerChange(originalEvent) {
709
- const sw = this._sw;
710
-
711
- if (sw === navigator.serviceWorker.controller) {
712
- this.dispatchEvent(new WorkboxEvent('controlling', {
713
- sw,
714
- originalEvent
715
- }));
716
-
717
- {
718
- logger.log('Registered service worker now controlling this page.');
719
- }
720
-
721
- this._controllingDeferred.resolve(sw);
722
- }
723
- }
724
- /**
725
- * @private
726
- * @param {Event} originalEvent
727
- */
728
-
729
-
730
- _onMessage(originalEvent) {
731
- const {
732
- data
733
- } = originalEvent;
734
- this.dispatchEvent(new WorkboxEvent('message', {
735
- data,
736
- originalEvent
737
- }));
738
- }
739
-
740
- } // The jsdoc comments below outline the events this instance may dispatch:
741
-
742
- /*
743
- Copyright 2019 Google LLC
744
-
745
- Use of this source code is governed by an MIT-style
746
- license that can be found in the LICENSE file or at
747
- https://opensource.org/licenses/MIT.
748
- */
749
-
750
- export { Workbox, messageSW };
751
- //# sourceMappingURL=workbox-window.dev.mjs.map