Leon4gr45 commited on
Commit
b2cfa75
·
verified ·
1 Parent(s): 56e6a09

Include updated package-lock.json (part 14)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. node_modules/workbox-background-sync/src/lib/QueueStore.ts +179 -0
  2. node_modules/workbox-background-sync/src/lib/StorableRequest.ts +156 -0
  3. node_modules/workbox-background-sync/tsconfig.json +11 -0
  4. node_modules/workbox-broadcast-update/BroadcastCacheUpdate.d.ts +70 -0
  5. node_modules/workbox-broadcast-update/BroadcastCacheUpdate.js +164 -0
  6. node_modules/workbox-broadcast-update/BroadcastCacheUpdate.mjs +1 -0
  7. node_modules/workbox-broadcast-update/BroadcastUpdatePlugin.d.ts +41 -0
  8. node_modules/workbox-broadcast-update/BroadcastUpdatePlugin.js +51 -0
  9. node_modules/workbox-broadcast-update/BroadcastUpdatePlugin.mjs +1 -0
  10. node_modules/workbox-broadcast-update/LICENSE +19 -0
  11. node_modules/workbox-broadcast-update/README.md +1 -0
  12. node_modules/workbox-broadcast-update/_version.d.ts +0 -0
  13. node_modules/workbox-broadcast-update/_version.js +6 -0
  14. node_modules/workbox-broadcast-update/_version.mjs +1 -0
  15. node_modules/workbox-broadcast-update/build/workbox-broadcast-update.dev.js +282 -0
  16. node_modules/workbox-broadcast-update/build/workbox-broadcast-update.dev.js.map +1 -0
  17. node_modules/workbox-broadcast-update/build/workbox-broadcast-update.prod.js +2 -0
  18. node_modules/workbox-broadcast-update/build/workbox-broadcast-update.prod.js.map +1 -0
  19. node_modules/workbox-broadcast-update/index.d.ts +8 -0
  20. node_modules/workbox-broadcast-update/index.js +15 -0
  21. node_modules/workbox-broadcast-update/index.mjs +1 -0
  22. node_modules/workbox-broadcast-update/package.json +31 -0
  23. node_modules/workbox-broadcast-update/responsesAreSame.d.ts +14 -0
  24. node_modules/workbox-broadcast-update/responsesAreSame.js +47 -0
  25. node_modules/workbox-broadcast-update/responsesAreSame.mjs +1 -0
  26. node_modules/workbox-broadcast-update/src/BroadcastCacheUpdate.ts +215 -0
  27. node_modules/workbox-broadcast-update/src/BroadcastUpdatePlugin.ts +63 -0
  28. node_modules/workbox-broadcast-update/src/_version.ts +2 -0
  29. node_modules/workbox-broadcast-update/src/index.ts +27 -0
  30. node_modules/workbox-broadcast-update/src/responsesAreSame.ts +72 -0
  31. node_modules/workbox-broadcast-update/src/utils/constants.ts +18 -0
  32. node_modules/workbox-broadcast-update/tsconfig.json +11 -0
  33. node_modules/workbox-broadcast-update/utils/constants.d.ts +5 -0
  34. node_modules/workbox-broadcast-update/utils/constants.js +16 -0
  35. node_modules/workbox-broadcast-update/utils/constants.mjs +1 -0
  36. node_modules/workbox-build/.ncurc.js +19 -0
  37. node_modules/workbox-build/LICENSE +19 -0
  38. node_modules/workbox-build/README.md +1 -0
  39. node_modules/workbox-build/build/cdn-details.json +6 -0
  40. node_modules/workbox-build/build/generate-sw.d.ts +47 -0
  41. node_modules/workbox-build/build/generate-sw.js +105 -0
  42. node_modules/workbox-build/build/get-manifest.d.ts +20 -0
  43. node_modules/workbox-build/build/get-manifest.js +35 -0
  44. node_modules/workbox-build/build/index.d.ts +10 -0
  45. node_modules/workbox-build/build/index.js +35 -0
  46. node_modules/workbox-build/build/inject-manifest.d.ts +30 -0
  47. node_modules/workbox-build/build/inject-manifest.js +133 -0
  48. node_modules/workbox-build/build/lib/additional-manifest-entries-transform.d.ts +13 -0
  49. node_modules/workbox-build/build/lib/additional-manifest-entries-transform.js +47 -0
  50. node_modules/workbox-build/build/lib/bundle.d.ts +9 -0
node_modules/workbox-background-sync/src/lib/QueueStore.ts ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ import {assert} from 'workbox-core/_private/assert.js';
10
+ import {
11
+ UnidentifiedQueueStoreEntry,
12
+ QueueStoreEntry,
13
+ QueueDb,
14
+ } from './QueueDb.js';
15
+ import '../_version.js';
16
+
17
+ /**
18
+ * A class to manage storing requests from a Queue in IndexedDB,
19
+ * indexed by their queue name for easier access.
20
+ *
21
+ * Most developers will not need to access this class directly;
22
+ * it is exposed for advanced use cases.
23
+ */
24
+ export class QueueStore {
25
+ private readonly _queueName: string;
26
+ private readonly _queueDb: QueueDb;
27
+
28
+ /**
29
+ * Associates this instance with a Queue instance, so entries added can be
30
+ * identified by their queue name.
31
+ *
32
+ * @param {string} queueName
33
+ */
34
+ constructor(queueName: string) {
35
+ this._queueName = queueName;
36
+ this._queueDb = new QueueDb();
37
+ }
38
+
39
+ /**
40
+ * Append an entry last in the queue.
41
+ *
42
+ * @param {Object} entry
43
+ * @param {Object} entry.requestData
44
+ * @param {number} [entry.timestamp]
45
+ * @param {Object} [entry.metadata]
46
+ */
47
+ async pushEntry(entry: UnidentifiedQueueStoreEntry): Promise<void> {
48
+ if (process.env.NODE_ENV !== 'production') {
49
+ assert!.isType(entry, 'object', {
50
+ moduleName: 'workbox-background-sync',
51
+ className: 'QueueStore',
52
+ funcName: 'pushEntry',
53
+ paramName: 'entry',
54
+ });
55
+ assert!.isType(entry.requestData, 'object', {
56
+ moduleName: 'workbox-background-sync',
57
+ className: 'QueueStore',
58
+ funcName: 'pushEntry',
59
+ paramName: 'entry.requestData',
60
+ });
61
+ }
62
+
63
+ // Don't specify an ID since one is automatically generated.
64
+ delete entry.id;
65
+ entry.queueName = this._queueName;
66
+
67
+ await this._queueDb.addEntry(entry);
68
+ }
69
+
70
+ /**
71
+ * Prepend an entry first in the queue.
72
+ *
73
+ * @param {Object} entry
74
+ * @param {Object} entry.requestData
75
+ * @param {number} [entry.timestamp]
76
+ * @param {Object} [entry.metadata]
77
+ */
78
+ async unshiftEntry(entry: UnidentifiedQueueStoreEntry): Promise<void> {
79
+ if (process.env.NODE_ENV !== 'production') {
80
+ assert!.isType(entry, 'object', {
81
+ moduleName: 'workbox-background-sync',
82
+ className: 'QueueStore',
83
+ funcName: 'unshiftEntry',
84
+ paramName: 'entry',
85
+ });
86
+ assert!.isType(entry.requestData, 'object', {
87
+ moduleName: 'workbox-background-sync',
88
+ className: 'QueueStore',
89
+ funcName: 'unshiftEntry',
90
+ paramName: 'entry.requestData',
91
+ });
92
+ }
93
+
94
+ const firstId = await this._queueDb.getFirstEntryId();
95
+
96
+ if (firstId) {
97
+ // Pick an ID one less than the lowest ID in the object store.
98
+ entry.id = firstId - 1;
99
+ } else {
100
+ // Otherwise let the auto-incrementor assign the ID.
101
+ delete entry.id;
102
+ }
103
+ entry.queueName = this._queueName;
104
+
105
+ await this._queueDb.addEntry(entry);
106
+ }
107
+
108
+ /**
109
+ * Removes and returns the last entry in the queue matching the `queueName`.
110
+ *
111
+ * @return {Promise<QueueStoreEntry|undefined>}
112
+ */
113
+ async popEntry(): Promise<QueueStoreEntry | undefined> {
114
+ return this._removeEntry(
115
+ await this._queueDb.getLastEntryByQueueName(this._queueName),
116
+ );
117
+ }
118
+
119
+ /**
120
+ * Removes and returns the first entry in the queue matching the `queueName`.
121
+ *
122
+ * @return {Promise<QueueStoreEntry|undefined>}
123
+ */
124
+ async shiftEntry(): Promise<QueueStoreEntry | undefined> {
125
+ return this._removeEntry(
126
+ await this._queueDb.getFirstEntryByQueueName(this._queueName),
127
+ );
128
+ }
129
+
130
+ /**
131
+ * Returns all entries in the store matching the `queueName`.
132
+ *
133
+ * @param {Object} options See {@link workbox-background-sync.Queue~getAll}
134
+ * @return {Promise<Array<Object>>}
135
+ */
136
+ async getAll(): Promise<QueueStoreEntry[]> {
137
+ return await this._queueDb.getAllEntriesByQueueName(this._queueName);
138
+ }
139
+
140
+ /**
141
+ * Returns the number of entries in the store matching the `queueName`.
142
+ *
143
+ * @param {Object} options See {@link workbox-background-sync.Queue~size}
144
+ * @return {Promise<number>}
145
+ */
146
+ async size(): Promise<number> {
147
+ return await this._queueDb.getEntryCountByQueueName(this._queueName);
148
+ }
149
+
150
+ /**
151
+ * Deletes the entry for the given ID.
152
+ *
153
+ * WARNING: this method does not ensure the deleted entry belongs to this
154
+ * queue (i.e. matches the `queueName`). But this limitation is acceptable
155
+ * as this class is not publicly exposed. An additional check would make
156
+ * this method slower than it needs to be.
157
+ *
158
+ * @param {number} id
159
+ */
160
+ async deleteEntry(id: number): Promise<void> {
161
+ await this._queueDb.deleteEntry(id);
162
+ }
163
+
164
+ /**
165
+ * Removes and returns the first or last entry in the queue (based on the
166
+ * `direction` argument) matching the `queueName`.
167
+ *
168
+ * @return {Promise<QueueStoreEntry|undefined>}
169
+ * @private
170
+ */
171
+ async _removeEntry(
172
+ entry?: QueueStoreEntry,
173
+ ): Promise<QueueStoreEntry | undefined> {
174
+ if (entry) {
175
+ await this.deleteEntry(entry.id);
176
+ }
177
+ return entry;
178
+ }
179
+ }
node_modules/workbox-background-sync/src/lib/StorableRequest.ts ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ import {assert} from 'workbox-core/_private/assert.js';
10
+ import {MapLikeObject} from 'workbox-core/types.js';
11
+ import '../_version.js';
12
+
13
+ type SerializableProperties =
14
+ | 'method'
15
+ | 'referrer'
16
+ | 'referrerPolicy'
17
+ | 'mode'
18
+ | 'credentials'
19
+ | 'cache'
20
+ | 'redirect'
21
+ | 'integrity'
22
+ | 'keepalive';
23
+
24
+ const serializableProperties: SerializableProperties[] = [
25
+ 'method',
26
+ 'referrer',
27
+ 'referrerPolicy',
28
+ 'mode',
29
+ 'credentials',
30
+ 'cache',
31
+ 'redirect',
32
+ 'integrity',
33
+ 'keepalive',
34
+ ];
35
+
36
+ export interface RequestData extends MapLikeObject {
37
+ url: string;
38
+ headers: MapLikeObject;
39
+ body?: ArrayBuffer;
40
+ }
41
+
42
+ /**
43
+ * A class to make it easier to serialize and de-serialize requests so they
44
+ * can be stored in IndexedDB.
45
+ *
46
+ * Most developers will not need to access this class directly;
47
+ * it is exposed for advanced use cases.
48
+ */
49
+ class StorableRequest {
50
+ private readonly _requestData: RequestData;
51
+
52
+ /**
53
+ * Converts a Request object to a plain object that can be structured
54
+ * cloned or JSON-stringified.
55
+ *
56
+ * @param {Request} request
57
+ * @return {Promise<StorableRequest>}
58
+ */
59
+ static async fromRequest(request: Request): Promise<StorableRequest> {
60
+ const requestData: RequestData = {
61
+ url: request.url,
62
+ headers: {},
63
+ };
64
+
65
+ // Set the body if present.
66
+ if (request.method !== 'GET') {
67
+ // Use ArrayBuffer to support non-text request bodies.
68
+ // NOTE: we can't use Blobs becuse Safari doesn't support storing
69
+ // Blobs in IndexedDB in some cases:
70
+ // https://github.com/dfahlander/Dexie.js/issues/618#issuecomment-398348457
71
+ requestData.body = await request.clone().arrayBuffer();
72
+ }
73
+
74
+ // Convert the headers from an iterable to an object.
75
+ for (const [key, value] of request.headers.entries()) {
76
+ requestData.headers[key] = value;
77
+ }
78
+
79
+ // Add all other serializable request properties
80
+ for (const prop of serializableProperties) {
81
+ if (request[prop] !== undefined) {
82
+ requestData[prop] = request[prop];
83
+ }
84
+ }
85
+
86
+ return new StorableRequest(requestData);
87
+ }
88
+
89
+ /**
90
+ * Accepts an object of request data that can be used to construct a
91
+ * `Request` but can also be stored in IndexedDB.
92
+ *
93
+ * @param {Object} requestData An object of request data that includes the
94
+ * `url` plus any relevant properties of
95
+ * [requestInit]{@link https://fetch.spec.whatwg.org/#requestinit}.
96
+ */
97
+ constructor(requestData: RequestData) {
98
+ if (process.env.NODE_ENV !== 'production') {
99
+ assert!.isType(requestData, 'object', {
100
+ moduleName: 'workbox-background-sync',
101
+ className: 'StorableRequest',
102
+ funcName: 'constructor',
103
+ paramName: 'requestData',
104
+ });
105
+ assert!.isType(requestData.url, 'string', {
106
+ moduleName: 'workbox-background-sync',
107
+ className: 'StorableRequest',
108
+ funcName: 'constructor',
109
+ paramName: 'requestData.url',
110
+ });
111
+ }
112
+
113
+ // If the request's mode is `navigate`, convert it to `same-origin` since
114
+ // navigation requests can't be constructed via script.
115
+ if (requestData['mode'] === 'navigate') {
116
+ requestData['mode'] = 'same-origin';
117
+ }
118
+
119
+ this._requestData = requestData;
120
+ }
121
+
122
+ /**
123
+ * Returns a deep clone of the instances `_requestData` object.
124
+ *
125
+ * @return {Object}
126
+ */
127
+ toObject(): RequestData {
128
+ const requestData = Object.assign({}, this._requestData);
129
+ requestData.headers = Object.assign({}, this._requestData.headers);
130
+ if (requestData.body) {
131
+ requestData.body = requestData.body.slice(0);
132
+ }
133
+
134
+ return requestData;
135
+ }
136
+
137
+ /**
138
+ * Converts this instance to a Request.
139
+ *
140
+ * @return {Request}
141
+ */
142
+ toRequest(): Request {
143
+ return new Request(this._requestData.url, this._requestData);
144
+ }
145
+
146
+ /**
147
+ * Creates and returns a deep clone of the instance.
148
+ *
149
+ * @return {StorableRequest}
150
+ */
151
+ clone(): StorableRequest {
152
+ return new StorableRequest(this.toObject());
153
+ }
154
+ }
155
+
156
+ export {StorableRequest};
node_modules/workbox-background-sync/tsconfig.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "extends": "../../tsconfig",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "outDir": "./",
6
+ "rootDir": "./src",
7
+ "tsBuildInfoFile": "./tsconfig.tsbuildinfo"
8
+ },
9
+ "include": ["src/**/*.ts"],
10
+ "references": [{"path": "../workbox-core/"}]
11
+ }
node_modules/workbox-broadcast-update/BroadcastCacheUpdate.d.ts ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { CacheDidUpdateCallbackParam } from 'workbox-core/types.js';
2
+ import './_version.js';
3
+ export interface BroadcastCacheUpdateOptions {
4
+ headersToCheck?: string[];
5
+ generatePayload?: (options: CacheDidUpdateCallbackParam) => Record<string, any>;
6
+ notifyAllClients?: boolean;
7
+ }
8
+ /**
9
+ * Uses the `postMessage()` API to inform any open windows/tabs when a cached
10
+ * response has been updated.
11
+ *
12
+ * For efficiency's sake, the underlying response bodies are not compared;
13
+ * only specific response headers are checked.
14
+ *
15
+ * @memberof workbox-broadcast-update
16
+ */
17
+ declare class BroadcastCacheUpdate {
18
+ private readonly _headersToCheck;
19
+ private readonly _generatePayload;
20
+ private readonly _notifyAllClients;
21
+ /**
22
+ * Construct a BroadcastCacheUpdate instance with a specific `channelName` to
23
+ * broadcast messages on
24
+ *
25
+ * @param {Object} [options]
26
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
27
+ * A list of headers that will be used to determine whether the responses
28
+ * differ.
29
+ * @param {string} [options.generatePayload] A function whose return value
30
+ * will be used as the `payload` field in any cache update messages sent
31
+ * to the window clients.
32
+ * @param {boolean} [options.notifyAllClients=true] If true (the default) then
33
+ * all open clients will receive a message. If false, then only the client
34
+ * that make the original request will be notified of the update.
35
+ */
36
+ constructor({ generatePayload, headersToCheck, notifyAllClients, }?: BroadcastCacheUpdateOptions);
37
+ /**
38
+ * Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)
39
+ * and sends a message (via `postMessage()`) to all window clients if the
40
+ * responses differ. Neither of the Responses can be
41
+ * [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
42
+ *
43
+ * The message that's posted has the following format (where `payload` can
44
+ * be customized via the `generatePayload` option the instance is created
45
+ * with):
46
+ *
47
+ * ```
48
+ * {
49
+ * type: 'CACHE_UPDATED',
50
+ * meta: 'workbox-broadcast-update',
51
+ * payload: {
52
+ * cacheName: 'the-cache-name',
53
+ * updatedURL: 'https://example.com/'
54
+ * }
55
+ * }
56
+ * ```
57
+ *
58
+ * @param {Object} options
59
+ * @param {Response} [options.oldResponse] Cached response to compare.
60
+ * @param {Response} options.newResponse Possibly updated response to compare.
61
+ * @param {Request} options.request The request.
62
+ * @param {string} options.cacheName Name of the cache the responses belong
63
+ * to. This is included in the broadcast message.
64
+ * @param {Event} options.event event The event that triggered
65
+ * this possible cache update.
66
+ * @return {Promise} Resolves once the update is sent.
67
+ */
68
+ notifyIfUpdated(options: CacheDidUpdateCallbackParam): Promise<void>;
69
+ }
70
+ export { BroadcastCacheUpdate };
node_modules/workbox-broadcast-update/BroadcastCacheUpdate.js ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+ import { assert } from 'workbox-core/_private/assert.js';
9
+ import { timeout } from 'workbox-core/_private/timeout.js';
10
+ import { resultingClientExists } from 'workbox-core/_private/resultingClientExists.js';
11
+ import { logger } from 'workbox-core/_private/logger.js';
12
+ import { responsesAreSame } from './responsesAreSame.js';
13
+ import { CACHE_UPDATED_MESSAGE_META, CACHE_UPDATED_MESSAGE_TYPE, DEFAULT_HEADERS_TO_CHECK, NOTIFY_ALL_CLIENTS, } from './utils/constants.js';
14
+ import './_version.js';
15
+ // UA-sniff Safari: https://stackoverflow.com/questions/7944460/detect-safari-browser
16
+ // TODO(philipwalton): remove once this Safari bug fix has been released.
17
+ // https://bugs.webkit.org/show_bug.cgi?id=201169
18
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
19
+ /**
20
+ * Generates the default payload used in update messages. By default the
21
+ * payload includes the `cacheName` and `updatedURL` fields.
22
+ *
23
+ * @return Object
24
+ * @private
25
+ */
26
+ function defaultPayloadGenerator(data) {
27
+ return {
28
+ cacheName: data.cacheName,
29
+ updatedURL: data.request.url,
30
+ };
31
+ }
32
+ /**
33
+ * Uses the `postMessage()` API to inform any open windows/tabs when a cached
34
+ * response has been updated.
35
+ *
36
+ * For efficiency's sake, the underlying response bodies are not compared;
37
+ * only specific response headers are checked.
38
+ *
39
+ * @memberof workbox-broadcast-update
40
+ */
41
+ class BroadcastCacheUpdate {
42
+ /**
43
+ * Construct a BroadcastCacheUpdate instance with a specific `channelName` to
44
+ * broadcast messages on
45
+ *
46
+ * @param {Object} [options]
47
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
48
+ * A list of headers that will be used to determine whether the responses
49
+ * differ.
50
+ * @param {string} [options.generatePayload] A function whose return value
51
+ * will be used as the `payload` field in any cache update messages sent
52
+ * to the window clients.
53
+ * @param {boolean} [options.notifyAllClients=true] If true (the default) then
54
+ * all open clients will receive a message. If false, then only the client
55
+ * that make the original request will be notified of the update.
56
+ */
57
+ constructor({ generatePayload, headersToCheck, notifyAllClients, } = {}) {
58
+ this._headersToCheck = headersToCheck || DEFAULT_HEADERS_TO_CHECK;
59
+ this._generatePayload = generatePayload || defaultPayloadGenerator;
60
+ this._notifyAllClients = notifyAllClients !== null && notifyAllClients !== void 0 ? notifyAllClients : NOTIFY_ALL_CLIENTS;
61
+ }
62
+ /**
63
+ * Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)
64
+ * and sends a message (via `postMessage()`) to all window clients if the
65
+ * responses differ. Neither of the Responses can be
66
+ * [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
67
+ *
68
+ * The message that's posted has the following format (where `payload` can
69
+ * be customized via the `generatePayload` option the instance is created
70
+ * with):
71
+ *
72
+ * ```
73
+ * {
74
+ * type: 'CACHE_UPDATED',
75
+ * meta: 'workbox-broadcast-update',
76
+ * payload: {
77
+ * cacheName: 'the-cache-name',
78
+ * updatedURL: 'https://example.com/'
79
+ * }
80
+ * }
81
+ * ```
82
+ *
83
+ * @param {Object} options
84
+ * @param {Response} [options.oldResponse] Cached response to compare.
85
+ * @param {Response} options.newResponse Possibly updated response to compare.
86
+ * @param {Request} options.request The request.
87
+ * @param {string} options.cacheName Name of the cache the responses belong
88
+ * to. This is included in the broadcast message.
89
+ * @param {Event} options.event event The event that triggered
90
+ * this possible cache update.
91
+ * @return {Promise} Resolves once the update is sent.
92
+ */
93
+ async notifyIfUpdated(options) {
94
+ if (process.env.NODE_ENV !== 'production') {
95
+ assert.isType(options.cacheName, 'string', {
96
+ moduleName: 'workbox-broadcast-update',
97
+ className: 'BroadcastCacheUpdate',
98
+ funcName: 'notifyIfUpdated',
99
+ paramName: 'cacheName',
100
+ });
101
+ assert.isInstance(options.newResponse, Response, {
102
+ moduleName: 'workbox-broadcast-update',
103
+ className: 'BroadcastCacheUpdate',
104
+ funcName: 'notifyIfUpdated',
105
+ paramName: 'newResponse',
106
+ });
107
+ assert.isInstance(options.request, Request, {
108
+ moduleName: 'workbox-broadcast-update',
109
+ className: 'BroadcastCacheUpdate',
110
+ funcName: 'notifyIfUpdated',
111
+ paramName: 'request',
112
+ });
113
+ }
114
+ // Without two responses there is nothing to compare.
115
+ if (!options.oldResponse) {
116
+ return;
117
+ }
118
+ if (!responsesAreSame(options.oldResponse, options.newResponse, this._headersToCheck)) {
119
+ if (process.env.NODE_ENV !== 'production') {
120
+ logger.log(`Newer response found (and cached) for:`, options.request.url);
121
+ }
122
+ const messageData = {
123
+ type: CACHE_UPDATED_MESSAGE_TYPE,
124
+ meta: CACHE_UPDATED_MESSAGE_META,
125
+ payload: this._generatePayload(options),
126
+ };
127
+ // For navigation requests, wait until the new window client exists
128
+ // before sending the message
129
+ if (options.request.mode === 'navigate') {
130
+ let resultingClientId;
131
+ if (options.event instanceof FetchEvent) {
132
+ resultingClientId = options.event.resultingClientId;
133
+ }
134
+ const resultingWin = await resultingClientExists(resultingClientId);
135
+ // Safari does not currently implement postMessage buffering and
136
+ // there's no good way to feature detect that, so to increase the
137
+ // chances of the message being delivered in Safari, we add a timeout.
138
+ // We also do this if `resultingClientExists()` didn't return a client,
139
+ // which means it timed out, so it's worth waiting a bit longer.
140
+ if (!resultingWin || isSafari) {
141
+ // 3500 is chosen because (according to CrUX data) 80% of mobile
142
+ // websites hit the DOMContentLoaded event in less than 3.5 seconds.
143
+ // And presumably sites implementing service worker are on the
144
+ // higher end of the performance spectrum.
145
+ await timeout(3500);
146
+ }
147
+ }
148
+ if (this._notifyAllClients) {
149
+ const windows = await self.clients.matchAll({ type: 'window' });
150
+ for (const win of windows) {
151
+ win.postMessage(messageData);
152
+ }
153
+ }
154
+ else {
155
+ // See https://github.com/GoogleChrome/workbox/issues/2895
156
+ if (options.event instanceof FetchEvent) {
157
+ const client = await self.clients.get(options.event.clientId);
158
+ client === null || client === void 0 ? void 0 : client.postMessage(messageData);
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ export { BroadcastCacheUpdate };
node_modules/workbox-broadcast-update/BroadcastCacheUpdate.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from './BroadcastCacheUpdate.js';
node_modules/workbox-broadcast-update/BroadcastUpdatePlugin.d.ts ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { WorkboxPlugin } from 'workbox-core/types.js';
2
+ import { BroadcastCacheUpdateOptions } from './BroadcastCacheUpdate.js';
3
+ import './_version.js';
4
+ /**
5
+ * This plugin will automatically broadcast a message whenever a cached response
6
+ * is updated.
7
+ *
8
+ * @memberof workbox-broadcast-update
9
+ */
10
+ declare class BroadcastUpdatePlugin implements WorkboxPlugin {
11
+ private readonly _broadcastUpdate;
12
+ /**
13
+ * Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with
14
+ * the passed options and calls its `notifyIfUpdated` method whenever the
15
+ * plugin's `cacheDidUpdate` callback is invoked.
16
+ *
17
+ * @param {Object} [options]
18
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
19
+ * A list of headers that will be used to determine whether the responses
20
+ * differ.
21
+ * @param {string} [options.generatePayload] A function whose return value
22
+ * will be used as the `payload` field in any cache update messages sent
23
+ * to the window clients.
24
+ */
25
+ constructor(options?: BroadcastCacheUpdateOptions);
26
+ /**
27
+ * A "lifecycle" callback that will be triggered automatically by the
28
+ * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is
29
+ * added to a cache.
30
+ *
31
+ * @private
32
+ * @param {Object} options The input object to this function.
33
+ * @param {string} options.cacheName Name of the cache being updated.
34
+ * @param {Response} [options.oldResponse] The previous cached value, if any.
35
+ * @param {Response} options.newResponse The new value in the cache.
36
+ * @param {Request} options.request The request that triggered the update.
37
+ * @param {Request} options.event The event that triggered the update.
38
+ */
39
+ cacheDidUpdate: WorkboxPlugin['cacheDidUpdate'];
40
+ }
41
+ export { BroadcastUpdatePlugin };
node_modules/workbox-broadcast-update/BroadcastUpdatePlugin.js ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+ import { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';
9
+ import { BroadcastCacheUpdate, } from './BroadcastCacheUpdate.js';
10
+ import './_version.js';
11
+ /**
12
+ * This plugin will automatically broadcast a message whenever a cached response
13
+ * is updated.
14
+ *
15
+ * @memberof workbox-broadcast-update
16
+ */
17
+ class BroadcastUpdatePlugin {
18
+ /**
19
+ * Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with
20
+ * the passed options and calls its `notifyIfUpdated` method whenever the
21
+ * plugin's `cacheDidUpdate` callback is invoked.
22
+ *
23
+ * @param {Object} [options]
24
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
25
+ * A list of headers that will be used to determine whether the responses
26
+ * differ.
27
+ * @param {string} [options.generatePayload] A function whose return value
28
+ * will be used as the `payload` field in any cache update messages sent
29
+ * to the window clients.
30
+ */
31
+ constructor(options) {
32
+ /**
33
+ * A "lifecycle" callback that will be triggered automatically by the
34
+ * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is
35
+ * added to a cache.
36
+ *
37
+ * @private
38
+ * @param {Object} options The input object to this function.
39
+ * @param {string} options.cacheName Name of the cache being updated.
40
+ * @param {Response} [options.oldResponse] The previous cached value, if any.
41
+ * @param {Response} options.newResponse The new value in the cache.
42
+ * @param {Request} options.request The request that triggered the update.
43
+ * @param {Request} options.event The event that triggered the update.
44
+ */
45
+ this.cacheDidUpdate = async (options) => {
46
+ dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options));
47
+ };
48
+ this._broadcastUpdate = new BroadcastCacheUpdate(options);
49
+ }
50
+ }
51
+ export { BroadcastUpdatePlugin };
node_modules/workbox-broadcast-update/BroadcastUpdatePlugin.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from './BroadcastUpdatePlugin.js';
node_modules/workbox-broadcast-update/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright 2018 Google LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
node_modules/workbox-broadcast-update/README.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-broadcast-update
node_modules/workbox-broadcast-update/_version.d.ts ADDED
File without changes
node_modules/workbox-broadcast-update/_version.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ "use strict";
2
+ // @ts-ignore
3
+ try {
4
+ self['workbox:broadcast-update:7.4.0'] && _();
5
+ }
6
+ catch (e) { }
node_modules/workbox-broadcast-update/_version.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ try{self['workbox:broadcast-update:7.4.1']&&_()}catch(e){}// eslint-disable-line
node_modules/workbox-broadcast-update/build/workbox-broadcast-update.dev.js ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ this.workbox = this.workbox || {};
2
+ this.workbox.broadcastUpdate = (function (exports, assert_js, timeout_js, resultingClientExists_js, logger_js, WorkboxError_js, dontWaitFor_js) {
3
+ 'use strict';
4
+
5
+ // @ts-ignore
6
+ try {
7
+ self['workbox:broadcast-update:7.4.0'] && _();
8
+ } catch (e) {}
9
+
10
+ /*
11
+ Copyright 2018 Google LLC
12
+
13
+ Use of this source code is governed by an MIT-style
14
+ license that can be found in the LICENSE file or at
15
+ https://opensource.org/licenses/MIT.
16
+ */
17
+ /**
18
+ * Given two `Response's`, compares several header values to see if they are
19
+ * the same or not.
20
+ *
21
+ * @param {Response} firstResponse
22
+ * @param {Response} secondResponse
23
+ * @param {Array<string>} headersToCheck
24
+ * @return {boolean}
25
+ *
26
+ * @memberof workbox-broadcast-update
27
+ */
28
+ const responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {
29
+ {
30
+ if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {
31
+ throw new WorkboxError_js.WorkboxError('invalid-responses-are-same-args');
32
+ }
33
+ }
34
+ const atLeastOneHeaderAvailable = headersToCheck.some(header => {
35
+ return firstResponse.headers.has(header) && secondResponse.headers.has(header);
36
+ });
37
+ if (!atLeastOneHeaderAvailable) {
38
+ {
39
+ logger_js.logger.warn(`Unable to determine where the response has been updated ` + `because none of the headers that would be checked are present.`);
40
+ logger_js.logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);
41
+ }
42
+ // Just return true, indicating the that responses are the same, since we
43
+ // can't determine otherwise.
44
+ return true;
45
+ }
46
+ return headersToCheck.every(header => {
47
+ const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);
48
+ const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);
49
+ return headerStateComparison && headerValueComparison;
50
+ });
51
+ };
52
+
53
+ /*
54
+ Copyright 2018 Google LLC
55
+
56
+ Use of this source code is governed by an MIT-style
57
+ license that can be found in the LICENSE file or at
58
+ https://opensource.org/licenses/MIT.
59
+ */
60
+ const CACHE_UPDATED_MESSAGE_TYPE = 'CACHE_UPDATED';
61
+ const CACHE_UPDATED_MESSAGE_META = 'workbox-broadcast-update';
62
+ const NOTIFY_ALL_CLIENTS = true;
63
+ const DEFAULT_HEADERS_TO_CHECK = ['content-length', 'etag', 'last-modified'];
64
+
65
+ /*
66
+ Copyright 2018 Google LLC
67
+
68
+ Use of this source code is governed by an MIT-style
69
+ license that can be found in the LICENSE file or at
70
+ https://opensource.org/licenses/MIT.
71
+ */
72
+ // UA-sniff Safari: https://stackoverflow.com/questions/7944460/detect-safari-browser
73
+ // TODO(philipwalton): remove once this Safari bug fix has been released.
74
+ // https://bugs.webkit.org/show_bug.cgi?id=201169
75
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
76
+ /**
77
+ * Generates the default payload used in update messages. By default the
78
+ * payload includes the `cacheName` and `updatedURL` fields.
79
+ *
80
+ * @return Object
81
+ * @private
82
+ */
83
+ function defaultPayloadGenerator(data) {
84
+ return {
85
+ cacheName: data.cacheName,
86
+ updatedURL: data.request.url
87
+ };
88
+ }
89
+ /**
90
+ * Uses the `postMessage()` API to inform any open windows/tabs when a cached
91
+ * response has been updated.
92
+ *
93
+ * For efficiency's sake, the underlying response bodies are not compared;
94
+ * only specific response headers are checked.
95
+ *
96
+ * @memberof workbox-broadcast-update
97
+ */
98
+ class BroadcastCacheUpdate {
99
+ /**
100
+ * Construct a BroadcastCacheUpdate instance with a specific `channelName` to
101
+ * broadcast messages on
102
+ *
103
+ * @param {Object} [options]
104
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
105
+ * A list of headers that will be used to determine whether the responses
106
+ * differ.
107
+ * @param {string} [options.generatePayload] A function whose return value
108
+ * will be used as the `payload` field in any cache update messages sent
109
+ * to the window clients.
110
+ * @param {boolean} [options.notifyAllClients=true] If true (the default) then
111
+ * all open clients will receive a message. If false, then only the client
112
+ * that make the original request will be notified of the update.
113
+ */
114
+ constructor({
115
+ generatePayload,
116
+ headersToCheck,
117
+ notifyAllClients
118
+ } = {}) {
119
+ this._headersToCheck = headersToCheck || DEFAULT_HEADERS_TO_CHECK;
120
+ this._generatePayload = generatePayload || defaultPayloadGenerator;
121
+ this._notifyAllClients = notifyAllClients !== null && notifyAllClients !== void 0 ? notifyAllClients : NOTIFY_ALL_CLIENTS;
122
+ }
123
+ /**
124
+ * Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)
125
+ * and sends a message (via `postMessage()`) to all window clients if the
126
+ * responses differ. Neither of the Responses can be
127
+ * [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
128
+ *
129
+ * The message that's posted has the following format (where `payload` can
130
+ * be customized via the `generatePayload` option the instance is created
131
+ * with):
132
+ *
133
+ * ```
134
+ * {
135
+ * type: 'CACHE_UPDATED',
136
+ * meta: 'workbox-broadcast-update',
137
+ * payload: {
138
+ * cacheName: 'the-cache-name',
139
+ * updatedURL: 'https://example.com/'
140
+ * }
141
+ * }
142
+ * ```
143
+ *
144
+ * @param {Object} options
145
+ * @param {Response} [options.oldResponse] Cached response to compare.
146
+ * @param {Response} options.newResponse Possibly updated response to compare.
147
+ * @param {Request} options.request The request.
148
+ * @param {string} options.cacheName Name of the cache the responses belong
149
+ * to. This is included in the broadcast message.
150
+ * @param {Event} options.event event The event that triggered
151
+ * this possible cache update.
152
+ * @return {Promise} Resolves once the update is sent.
153
+ */
154
+ async notifyIfUpdated(options) {
155
+ {
156
+ assert_js.assert.isType(options.cacheName, 'string', {
157
+ moduleName: 'workbox-broadcast-update',
158
+ className: 'BroadcastCacheUpdate',
159
+ funcName: 'notifyIfUpdated',
160
+ paramName: 'cacheName'
161
+ });
162
+ assert_js.assert.isInstance(options.newResponse, Response, {
163
+ moduleName: 'workbox-broadcast-update',
164
+ className: 'BroadcastCacheUpdate',
165
+ funcName: 'notifyIfUpdated',
166
+ paramName: 'newResponse'
167
+ });
168
+ assert_js.assert.isInstance(options.request, Request, {
169
+ moduleName: 'workbox-broadcast-update',
170
+ className: 'BroadcastCacheUpdate',
171
+ funcName: 'notifyIfUpdated',
172
+ paramName: 'request'
173
+ });
174
+ }
175
+ // Without two responses there is nothing to compare.
176
+ if (!options.oldResponse) {
177
+ return;
178
+ }
179
+ if (!responsesAreSame(options.oldResponse, options.newResponse, this._headersToCheck)) {
180
+ {
181
+ logger_js.logger.log(`Newer response found (and cached) for:`, options.request.url);
182
+ }
183
+ const messageData = {
184
+ type: CACHE_UPDATED_MESSAGE_TYPE,
185
+ meta: CACHE_UPDATED_MESSAGE_META,
186
+ payload: this._generatePayload(options)
187
+ };
188
+ // For navigation requests, wait until the new window client exists
189
+ // before sending the message
190
+ if (options.request.mode === 'navigate') {
191
+ let resultingClientId;
192
+ if (options.event instanceof FetchEvent) {
193
+ resultingClientId = options.event.resultingClientId;
194
+ }
195
+ const resultingWin = await resultingClientExists_js.resultingClientExists(resultingClientId);
196
+ // Safari does not currently implement postMessage buffering and
197
+ // there's no good way to feature detect that, so to increase the
198
+ // chances of the message being delivered in Safari, we add a timeout.
199
+ // We also do this if `resultingClientExists()` didn't return a client,
200
+ // which means it timed out, so it's worth waiting a bit longer.
201
+ if (!resultingWin || isSafari) {
202
+ // 3500 is chosen because (according to CrUX data) 80% of mobile
203
+ // websites hit the DOMContentLoaded event in less than 3.5 seconds.
204
+ // And presumably sites implementing service worker are on the
205
+ // higher end of the performance spectrum.
206
+ await timeout_js.timeout(3500);
207
+ }
208
+ }
209
+ if (this._notifyAllClients) {
210
+ const windows = await self.clients.matchAll({
211
+ type: 'window'
212
+ });
213
+ for (const win of windows) {
214
+ win.postMessage(messageData);
215
+ }
216
+ } else {
217
+ // See https://github.com/GoogleChrome/workbox/issues/2895
218
+ if (options.event instanceof FetchEvent) {
219
+ const client = await self.clients.get(options.event.clientId);
220
+ client === null || client === void 0 ? void 0 : client.postMessage(messageData);
221
+ }
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ /*
228
+ Copyright 2018 Google LLC
229
+
230
+ Use of this source code is governed by an MIT-style
231
+ license that can be found in the LICENSE file or at
232
+ https://opensource.org/licenses/MIT.
233
+ */
234
+ /**
235
+ * This plugin will automatically broadcast a message whenever a cached response
236
+ * is updated.
237
+ *
238
+ * @memberof workbox-broadcast-update
239
+ */
240
+ class BroadcastUpdatePlugin {
241
+ /**
242
+ * Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with
243
+ * the passed options and calls its `notifyIfUpdated` method whenever the
244
+ * plugin's `cacheDidUpdate` callback is invoked.
245
+ *
246
+ * @param {Object} [options]
247
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
248
+ * A list of headers that will be used to determine whether the responses
249
+ * differ.
250
+ * @param {string} [options.generatePayload] A function whose return value
251
+ * will be used as the `payload` field in any cache update messages sent
252
+ * to the window clients.
253
+ */
254
+ constructor(options) {
255
+ /**
256
+ * A "lifecycle" callback that will be triggered automatically by the
257
+ * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is
258
+ * added to a cache.
259
+ *
260
+ * @private
261
+ * @param {Object} options The input object to this function.
262
+ * @param {string} options.cacheName Name of the cache being updated.
263
+ * @param {Response} [options.oldResponse] The previous cached value, if any.
264
+ * @param {Response} options.newResponse The new value in the cache.
265
+ * @param {Request} options.request The request that triggered the update.
266
+ * @param {Request} options.event The event that triggered the update.
267
+ */
268
+ this.cacheDidUpdate = async options => {
269
+ dontWaitFor_js.dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options));
270
+ };
271
+ this._broadcastUpdate = new BroadcastCacheUpdate(options);
272
+ }
273
+ }
274
+
275
+ exports.BroadcastCacheUpdate = BroadcastCacheUpdate;
276
+ exports.BroadcastUpdatePlugin = BroadcastUpdatePlugin;
277
+ exports.responsesAreSame = responsesAreSame;
278
+
279
+ return exports;
280
+
281
+ })({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private);
282
+ //# sourceMappingURL=workbox-broadcast-update.dev.js.map
node_modules/workbox-broadcast-update/build/workbox-broadcast-update.dev.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"workbox-broadcast-update.dev.js","sources":["../_version.js","../responsesAreSame.js","../utils/constants.js","../BroadcastCacheUpdate.js","../BroadcastUpdatePlugin.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:broadcast-update:7.4.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 { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport './_version.js';\n/**\n * Given two `Response's`, compares several header values to see if they are\n * the same or not.\n *\n * @param {Response} firstResponse\n * @param {Response} secondResponse\n * @param {Array<string>} headersToCheck\n * @return {boolean}\n *\n * @memberof workbox-broadcast-update\n */\nconst responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {\n if (process.env.NODE_ENV !== 'production') {\n if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {\n throw new WorkboxError('invalid-responses-are-same-args');\n }\n }\n const atLeastOneHeaderAvailable = headersToCheck.some((header) => {\n return (firstResponse.headers.has(header) && secondResponse.headers.has(header));\n });\n if (!atLeastOneHeaderAvailable) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to determine where the response has been updated ` +\n `because none of the headers that would be checked are present.`);\n logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);\n }\n // Just return true, indicating the that responses are the same, since we\n // can't determine otherwise.\n return true;\n }\n return headersToCheck.every((header) => {\n const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);\n const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);\n return headerStateComparison && headerValueComparison;\n });\n};\nexport { responsesAreSame };\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 CACHE_UPDATED_MESSAGE_TYPE = 'CACHE_UPDATED';\nexport const CACHE_UPDATED_MESSAGE_META = 'workbox-broadcast-update';\nexport const NOTIFY_ALL_CLIENTS = true;\nexport const DEFAULT_HEADERS_TO_CHECK = [\n 'content-length',\n 'etag',\n 'last-modified',\n];\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { timeout } from 'workbox-core/_private/timeout.js';\nimport { resultingClientExists } from 'workbox-core/_private/resultingClientExists.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { responsesAreSame } from './responsesAreSame.js';\nimport { CACHE_UPDATED_MESSAGE_META, CACHE_UPDATED_MESSAGE_TYPE, DEFAULT_HEADERS_TO_CHECK, NOTIFY_ALL_CLIENTS, } from './utils/constants.js';\nimport './_version.js';\n// UA-sniff Safari: https://stackoverflow.com/questions/7944460/detect-safari-browser\n// TODO(philipwalton): remove once this Safari bug fix has been released.\n// https://bugs.webkit.org/show_bug.cgi?id=201169\nconst isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n/**\n * Generates the default payload used in update messages. By default the\n * payload includes the `cacheName` and `updatedURL` fields.\n *\n * @return Object\n * @private\n */\nfunction defaultPayloadGenerator(data) {\n return {\n cacheName: data.cacheName,\n updatedURL: data.request.url,\n };\n}\n/**\n * Uses the `postMessage()` API to inform any open windows/tabs when a cached\n * response has been updated.\n *\n * For efficiency's sake, the underlying response bodies are not compared;\n * only specific response headers are checked.\n *\n * @memberof workbox-broadcast-update\n */\nclass BroadcastCacheUpdate {\n /**\n * Construct a BroadcastCacheUpdate instance with a specific `channelName` to\n * broadcast messages on\n *\n * @param {Object} [options]\n * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]\n * A list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.generatePayload] A function whose return value\n * will be used as the `payload` field in any cache update messages sent\n * to the window clients.\n * @param {boolean} [options.notifyAllClients=true] If true (the default) then\n * all open clients will receive a message. If false, then only the client\n * that make the original request will be notified of the update.\n */\n constructor({ generatePayload, headersToCheck, notifyAllClients, } = {}) {\n this._headersToCheck = headersToCheck || DEFAULT_HEADERS_TO_CHECK;\n this._generatePayload = generatePayload || defaultPayloadGenerator;\n this._notifyAllClients = notifyAllClients !== null && notifyAllClients !== void 0 ? notifyAllClients : NOTIFY_ALL_CLIENTS;\n }\n /**\n * Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n * and sends a message (via `postMessage()`) to all window clients if the\n * responses differ. Neither of the Responses can be\n * [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).\n *\n * The message that's posted has the following format (where `payload` can\n * be customized via the `generatePayload` option the instance is created\n * with):\n *\n * ```\n * {\n * type: 'CACHE_UPDATED',\n * meta: 'workbox-broadcast-update',\n * payload: {\n * cacheName: 'the-cache-name',\n * updatedURL: 'https://example.com/'\n * }\n * }\n * ```\n *\n * @param {Object} options\n * @param {Response} [options.oldResponse] Cached response to compare.\n * @param {Response} options.newResponse Possibly updated response to compare.\n * @param {Request} options.request The request.\n * @param {string} options.cacheName Name of the cache the responses belong\n * to. This is included in the broadcast message.\n * @param {Event} options.event event The event that triggered\n * this possible cache update.\n * @return {Promise} Resolves once the update is sent.\n */\n async notifyIfUpdated(options) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(options.cacheName, 'string', {\n moduleName: 'workbox-broadcast-update',\n className: 'BroadcastCacheUpdate',\n funcName: 'notifyIfUpdated',\n paramName: 'cacheName',\n });\n assert.isInstance(options.newResponse, Response, {\n moduleName: 'workbox-broadcast-update',\n className: 'BroadcastCacheUpdate',\n funcName: 'notifyIfUpdated',\n paramName: 'newResponse',\n });\n assert.isInstance(options.request, Request, {\n moduleName: 'workbox-broadcast-update',\n className: 'BroadcastCacheUpdate',\n funcName: 'notifyIfUpdated',\n paramName: 'request',\n });\n }\n // Without two responses there is nothing to compare.\n if (!options.oldResponse) {\n return;\n }\n if (!responsesAreSame(options.oldResponse, options.newResponse, this._headersToCheck)) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Newer response found (and cached) for:`, options.request.url);\n }\n const messageData = {\n type: CACHE_UPDATED_MESSAGE_TYPE,\n meta: CACHE_UPDATED_MESSAGE_META,\n payload: this._generatePayload(options),\n };\n // For navigation requests, wait until the new window client exists\n // before sending the message\n if (options.request.mode === 'navigate') {\n let resultingClientId;\n if (options.event instanceof FetchEvent) {\n resultingClientId = options.event.resultingClientId;\n }\n const resultingWin = await resultingClientExists(resultingClientId);\n // Safari does not currently implement postMessage buffering and\n // there's no good way to feature detect that, so to increase the\n // chances of the message being delivered in Safari, we add a timeout.\n // We also do this if `resultingClientExists()` didn't return a client,\n // which means it timed out, so it's worth waiting a bit longer.\n if (!resultingWin || isSafari) {\n // 3500 is chosen because (according to CrUX data) 80% of mobile\n // websites hit the DOMContentLoaded event in less than 3.5 seconds.\n // And presumably sites implementing service worker are on the\n // higher end of the performance spectrum.\n await timeout(3500);\n }\n }\n if (this._notifyAllClients) {\n const windows = await self.clients.matchAll({ type: 'window' });\n for (const win of windows) {\n win.postMessage(messageData);\n }\n }\n else {\n // See https://github.com/GoogleChrome/workbox/issues/2895\n if (options.event instanceof FetchEvent) {\n const client = await self.clients.get(options.event.clientId);\n client === null || client === void 0 ? void 0 : client.postMessage(messageData);\n }\n }\n }\n }\n}\nexport { BroadcastCacheUpdate };\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 { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { BroadcastCacheUpdate, } from './BroadcastCacheUpdate.js';\nimport './_version.js';\n/**\n * This plugin will automatically broadcast a message whenever a cached response\n * is updated.\n *\n * @memberof workbox-broadcast-update\n */\nclass BroadcastUpdatePlugin {\n /**\n * Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with\n * the passed options and calls its `notifyIfUpdated` method whenever the\n * plugin's `cacheDidUpdate` callback is invoked.\n *\n * @param {Object} [options]\n * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]\n * A list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.generatePayload] A function whose return value\n * will be used as the `payload` field in any cache update messages sent\n * to the window clients.\n */\n constructor(options) {\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is\n * added to a cache.\n *\n * @private\n * @param {Object} options The input object to this function.\n * @param {string} options.cacheName Name of the cache being updated.\n * @param {Response} [options.oldResponse] The previous cached value, if any.\n * @param {Response} options.newResponse The new value in the cache.\n * @param {Request} options.request The request that triggered the update.\n * @param {Request} options.event The event that triggered the update.\n */\n this.cacheDidUpdate = async (options) => {\n dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options));\n };\n this._broadcastUpdate = new BroadcastCacheUpdate(options);\n }\n}\nexport { BroadcastUpdatePlugin };\n"],"names":["self","_","e","responsesAreSame","firstResponse","secondResponse","headersToCheck","Response","WorkboxError","atLeastOneHeaderAvailable","some","header","headers","has","logger","warn","debug","every","headerStateComparison","headerValueComparison","get","CACHE_UPDATED_MESSAGE_TYPE","CACHE_UPDATED_MESSAGE_META","NOTIFY_ALL_CLIENTS","DEFAULT_HEADERS_TO_CHECK","isSafari","test","navigator","userAgent","defaultPayloadGenerator","data","cacheName","updatedURL","request","url","BroadcastCacheUpdate","constructor","generatePayload","notifyAllClients","_headersToCheck","_generatePayload","_notifyAllClients","notifyIfUpdated","options","assert","isType","moduleName","className","funcName","paramName","isInstance","newResponse","Request","oldResponse","log","messageData","type","meta","payload","mode","resultingClientId","event","FetchEvent","resultingWin","resultingClientExists","timeout","windows","clients","matchAll","win","postMessage","client","clientId","BroadcastUpdatePlugin","cacheDidUpdate","dontWaitFor","_broadcastUpdate"],"mappings":";;;;IACA;IACA,IAAI;IACAA,EAAAA,IAAI,CAAC,gCAAgC,CAAC,IAAIC,CAAC,EAAE;IACjD,CAAC,CACD,OAAOC,CAAC,EAAE,CAAE;;ICLZ;IACA;;IAEA;IACA;IACA;IACA;IAIA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA,UAAMC,gBAAgB,GAAGA,CAACC,aAAa,EAAEC,cAAc,EAAEC,cAAc,KAAK;IACxE,EAA2C;QACvC,IAAI,EAAEF,aAAa,YAAYG,QAAQ,IAAIF,cAAc,YAAYE,QAAQ,CAAC,EAAE;IAC5E,MAAA,MAAM,IAAIC,4BAAY,CAAC,iCAAiC,CAAC;IAC7D,IAAA;IACJ,EAAA;IACA,EAAA,MAAMC,yBAAyB,GAAGH,cAAc,CAACI,IAAI,CAAEC,MAAM,IAAK;IAC9D,IAAA,OAAQP,aAAa,CAACQ,OAAO,CAACC,GAAG,CAACF,MAAM,CAAC,IAAIN,cAAc,CAACO,OAAO,CAACC,GAAG,CAACF,MAAM,CAAC;IACnF,EAAA,CAAC,CAAC;MACF,IAAI,CAACF,yBAAyB,EAAE;IAC5B,IAA2C;IACvCK,MAAAA,gBAAM,CAACC,IAAI,CAAE,CAAA,wDAAA,CAAyD,GACjE,gEAA+D,CAAC;UACrED,gBAAM,CAACE,KAAK,CAAE,CAAA,qCAAA,CAAsC,EAAEZ,aAAa,EAAEC,cAAc,EAAEC,cAAc,CAAC;IACxG,IAAA;IACA;IACA;IACA,IAAA,OAAO,IAAI;IACf,EAAA;IACA,EAAA,OAAOA,cAAc,CAACW,KAAK,CAAEN,MAAM,IAAK;IACpC,IAAA,MAAMO,qBAAqB,GAAGd,aAAa,CAACQ,OAAO,CAACC,GAAG,CAACF,MAAM,CAAC,KAAKN,cAAc,CAACO,OAAO,CAACC,GAAG,CAACF,MAAM,CAAC;IACtG,IAAA,MAAMQ,qBAAqB,GAAGf,aAAa,CAACQ,OAAO,CAACQ,GAAG,CAACT,MAAM,CAAC,KAAKN,cAAc,CAACO,OAAO,CAACQ,GAAG,CAACT,MAAM,CAAC;QACtG,OAAOO,qBAAqB,IAAIC,qBAAqB;IACzD,EAAA,CAAC,CAAC;IACN;;IC7CA;IACA;;IAEA;IACA;IACA;IACA;IAEO,MAAME,0BAA0B,GAAG,eAAe;IAClD,MAAMC,0BAA0B,GAAG,0BAA0B;IAC7D,MAAMC,kBAAkB,GAAG,IAAI;IAC/B,MAAMC,wBAAwB,GAAG,CACpC,gBAAgB,EAChB,MAAM,EACN,eAAe,CAClB;;ICfD;IACA;;IAEA;IACA;IACA;IACA;IAQA;IACA;IACA;IACA,MAAMC,QAAQ,GAAG,gCAAgC,CAACC,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC;IAC3E;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAASC,uBAAuBA,CAACC,IAAI,EAAE;MACnC,OAAO;QACHC,SAAS,EAAED,IAAI,CAACC,SAAS;IACzBC,IAAAA,UAAU,EAAEF,IAAI,CAACG,OAAO,CAACC;OAC5B;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMC,oBAAoB,CAAC;IACvB;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACIC,EAAAA,WAAWA,CAAC;QAAEC,eAAe;QAAE/B,cAAc;IAAEgC,IAAAA;OAAmB,GAAG,EAAE,EAAE;IACrE,IAAA,IAAI,CAACC,eAAe,GAAGjC,cAAc,IAAIkB,wBAAwB;IACjE,IAAA,IAAI,CAACgB,gBAAgB,GAAGH,eAAe,IAAIR,uBAAuB;IAClE,IAAA,IAAI,CAACY,iBAAiB,GAAGH,gBAAgB,KAAK,IAAI,IAAIA,gBAAgB,KAAK,MAAM,GAAGA,gBAAgB,GAAGf,kBAAkB;IAC7H,EAAA;IACA;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;MACI,MAAMmB,eAAeA,CAACC,OAAO,EAAE;IAC3B,IAA2C;UACvCC,gBAAM,CAACC,MAAM,CAACF,OAAO,CAACZ,SAAS,EAAE,QAAQ,EAAE;IACvCe,QAAAA,UAAU,EAAE,0BAA0B;IACtCC,QAAAA,SAAS,EAAE,sBAAsB;IACjCC,QAAAA,QAAQ,EAAE,iBAAiB;IAC3BC,QAAAA,SAAS,EAAE;IACf,OAAC,CAAC;UACFL,gBAAM,CAACM,UAAU,CAACP,OAAO,CAACQ,WAAW,EAAE5C,QAAQ,EAAE;IAC7CuC,QAAAA,UAAU,EAAE,0BAA0B;IACtCC,QAAAA,SAAS,EAAE,sBAAsB;IACjCC,QAAAA,QAAQ,EAAE,iBAAiB;IAC3BC,QAAAA,SAAS,EAAE;IACf,OAAC,CAAC;UACFL,gBAAM,CAACM,UAAU,CAACP,OAAO,CAACV,OAAO,EAAEmB,OAAO,EAAE;IACxCN,QAAAA,UAAU,EAAE,0BAA0B;IACtCC,QAAAA,SAAS,EAAE,sBAAsB;IACjCC,QAAAA,QAAQ,EAAE,iBAAiB;IAC3BC,QAAAA,SAAS,EAAE;IACf,OAAC,CAAC;IACN,IAAA;IACA;IACA,IAAA,IAAI,CAACN,OAAO,CAACU,WAAW,EAAE;IACtB,MAAA;IACJ,IAAA;IACA,IAAA,IAAI,CAAClD,gBAAgB,CAACwC,OAAO,CAACU,WAAW,EAAEV,OAAO,CAACQ,WAAW,EAAE,IAAI,CAACZ,eAAe,CAAC,EAAE;IACnF,MAA2C;YACvCzB,gBAAM,CAACwC,GAAG,CAAE,CAAA,sCAAA,CAAuC,EAAEX,OAAO,CAACV,OAAO,CAACC,GAAG,CAAC;IAC7E,MAAA;IACA,MAAA,MAAMqB,WAAW,GAAG;IAChBC,QAAAA,IAAI,EAAEnC,0BAA0B;IAChCoC,QAAAA,IAAI,EAAEnC,0BAA0B;IAChCoC,QAAAA,OAAO,EAAE,IAAI,CAAClB,gBAAgB,CAACG,OAAO;WACzC;IACD;IACA;IACA,MAAA,IAAIA,OAAO,CAACV,OAAO,CAAC0B,IAAI,KAAK,UAAU,EAAE;IACrC,QAAA,IAAIC,iBAAiB;IACrB,QAAA,IAAIjB,OAAO,CAACkB,KAAK,YAAYC,UAAU,EAAE;IACrCF,UAAAA,iBAAiB,GAAGjB,OAAO,CAACkB,KAAK,CAACD,iBAAiB;IACvD,QAAA;IACA,QAAA,MAAMG,YAAY,GAAG,MAAMC,8CAAqB,CAACJ,iBAAiB,CAAC;IACnE;IACA;IACA;IACA;IACA;IACA,QAAA,IAAI,CAACG,YAAY,IAAItC,QAAQ,EAAE;IAC3B;IACA;IACA;IACA;cACA,MAAMwC,kBAAO,CAAC,IAAI,CAAC;IACvB,QAAA;IACJ,MAAA;UACA,IAAI,IAAI,CAACxB,iBAAiB,EAAE;YACxB,MAAMyB,OAAO,GAAG,MAAMlE,IAAI,CAACmE,OAAO,CAACC,QAAQ,CAAC;IAAEZ,UAAAA,IAAI,EAAE;IAAS,SAAC,CAAC;IAC/D,QAAA,KAAK,MAAMa,GAAG,IAAIH,OAAO,EAAE;IACvBG,UAAAA,GAAG,CAACC,WAAW,CAACf,WAAW,CAAC;IAChC,QAAA;IACJ,MAAA,CAAC,MACI;IACD;IACA,QAAA,IAAIZ,OAAO,CAACkB,KAAK,YAAYC,UAAU,EAAE;IACrC,UAAA,MAAMS,MAAM,GAAG,MAAMvE,IAAI,CAACmE,OAAO,CAAC/C,GAAG,CAACuB,OAAO,CAACkB,KAAK,CAACW,QAAQ,CAAC;IAC7DD,UAAAA,MAAM,KAAK,IAAI,IAAIA,MAAM,KAAK,MAAM,GAAG,MAAM,GAAGA,MAAM,CAACD,WAAW,CAACf,WAAW,CAAC;IACnF,QAAA;IACJ,MAAA;IACJ,IAAA;IACJ,EAAA;IACJ;;IClKA;IACA;;IAEA;IACA;IACA;IACA;IAIA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMkB,qBAAqB,CAAC;IACxB;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;MACIrC,WAAWA,CAACO,OAAO,EAAE;IACjB;IACR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACQ,IAAA,IAAI,CAAC+B,cAAc,GAAG,MAAO/B,OAAO,IAAK;UACrCgC,0BAAW,CAAC,IAAI,CAACC,gBAAgB,CAAClC,eAAe,CAACC,OAAO,CAAC,CAAC;QAC/D,CAAC;IACD,IAAA,IAAI,CAACiC,gBAAgB,GAAG,IAAIzC,oBAAoB,CAACQ,OAAO,CAAC;IAC7D,EAAA;IACJ;;;;;;;;;;;;"}
node_modules/workbox-broadcast-update/build/workbox-broadcast-update.prod.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t,s,a,e){"use strict";try{self["workbox:broadcast-update:7.4.0"]&&_()}catch(t){}const n=(t,s,a)=>!a.some((a=>t.headers.has(a)&&s.headers.has(a)))||a.every((a=>{const e=t.headers.has(a)===s.headers.has(a),n=t.headers.get(a)===s.headers.get(a);return e&&n})),i=["content-length","etag","last-modified"],o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function c(t){return{cacheName:t.cacheName,updatedURL:t.request.url}}class r{constructor({generatePayload:t,headersToCheck:s,notifyAllClients:a}={}){this.ht=s||i,this.ft=t||c,this.lt=null==a||a}async notifyIfUpdated(t){if(t.oldResponse&&!n(t.oldResponse,t.newResponse,this.ht)){const e={type:"CACHE_UPDATED",meta:"workbox-broadcast-update",payload:this.ft(t)};if("navigate"===t.request.mode){let e;t.event instanceof FetchEvent&&(e=t.event.resultingClientId);await a.resultingClientExists(e)&&!o||await s.timeout(3500)}if(this.lt){const t=await self.clients.matchAll({type:"window"});for(const s of t)s.postMessage(e)}else if(t.event instanceof FetchEvent){const s=await self.clients.get(t.event.clientId);null==s||s.postMessage(e)}}}}return t.BroadcastCacheUpdate=r,t.BroadcastUpdatePlugin=class{constructor(t){this.cacheDidUpdate=async t=>{e.dontWaitFor(this.dt.notifyIfUpdated(t))},this.dt=new r(t)}},t.responsesAreSame=n,t}({},workbox.core._private,workbox.core._private,workbox.core._private);
2
+ //# sourceMappingURL=workbox-broadcast-update.prod.js.map
node_modules/workbox-broadcast-update/build/workbox-broadcast-update.prod.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"workbox-broadcast-update.prod.js","sources":["../_version.js","../responsesAreSame.js","../utils/constants.js","../BroadcastCacheUpdate.js","../BroadcastUpdatePlugin.js"],"sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n self['workbox:broadcast-update:7.4.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 { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport './_version.js';\n/**\n * Given two `Response's`, compares several header values to see if they are\n * the same or not.\n *\n * @param {Response} firstResponse\n * @param {Response} secondResponse\n * @param {Array<string>} headersToCheck\n * @return {boolean}\n *\n * @memberof workbox-broadcast-update\n */\nconst responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {\n if (process.env.NODE_ENV !== 'production') {\n if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {\n throw new WorkboxError('invalid-responses-are-same-args');\n }\n }\n const atLeastOneHeaderAvailable = headersToCheck.some((header) => {\n return (firstResponse.headers.has(header) && secondResponse.headers.has(header));\n });\n if (!atLeastOneHeaderAvailable) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to determine where the response has been updated ` +\n `because none of the headers that would be checked are present.`);\n logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);\n }\n // Just return true, indicating the that responses are the same, since we\n // can't determine otherwise.\n return true;\n }\n return headersToCheck.every((header) => {\n const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);\n const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);\n return headerStateComparison && headerValueComparison;\n });\n};\nexport { responsesAreSame };\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 CACHE_UPDATED_MESSAGE_TYPE = 'CACHE_UPDATED';\nexport const CACHE_UPDATED_MESSAGE_META = 'workbox-broadcast-update';\nexport const NOTIFY_ALL_CLIENTS = true;\nexport const DEFAULT_HEADERS_TO_CHECK = [\n 'content-length',\n 'etag',\n 'last-modified',\n];\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { timeout } from 'workbox-core/_private/timeout.js';\nimport { resultingClientExists } from 'workbox-core/_private/resultingClientExists.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { responsesAreSame } from './responsesAreSame.js';\nimport { CACHE_UPDATED_MESSAGE_META, CACHE_UPDATED_MESSAGE_TYPE, DEFAULT_HEADERS_TO_CHECK, NOTIFY_ALL_CLIENTS, } from './utils/constants.js';\nimport './_version.js';\n// UA-sniff Safari: https://stackoverflow.com/questions/7944460/detect-safari-browser\n// TODO(philipwalton): remove once this Safari bug fix has been released.\n// https://bugs.webkit.org/show_bug.cgi?id=201169\nconst isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n/**\n * Generates the default payload used in update messages. By default the\n * payload includes the `cacheName` and `updatedURL` fields.\n *\n * @return Object\n * @private\n */\nfunction defaultPayloadGenerator(data) {\n return {\n cacheName: data.cacheName,\n updatedURL: data.request.url,\n };\n}\n/**\n * Uses the `postMessage()` API to inform any open windows/tabs when a cached\n * response has been updated.\n *\n * For efficiency's sake, the underlying response bodies are not compared;\n * only specific response headers are checked.\n *\n * @memberof workbox-broadcast-update\n */\nclass BroadcastCacheUpdate {\n /**\n * Construct a BroadcastCacheUpdate instance with a specific `channelName` to\n * broadcast messages on\n *\n * @param {Object} [options]\n * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]\n * A list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.generatePayload] A function whose return value\n * will be used as the `payload` field in any cache update messages sent\n * to the window clients.\n * @param {boolean} [options.notifyAllClients=true] If true (the default) then\n * all open clients will receive a message. If false, then only the client\n * that make the original request will be notified of the update.\n */\n constructor({ generatePayload, headersToCheck, notifyAllClients, } = {}) {\n this._headersToCheck = headersToCheck || DEFAULT_HEADERS_TO_CHECK;\n this._generatePayload = generatePayload || defaultPayloadGenerator;\n this._notifyAllClients = notifyAllClients !== null && notifyAllClients !== void 0 ? notifyAllClients : NOTIFY_ALL_CLIENTS;\n }\n /**\n * Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)\n * and sends a message (via `postMessage()`) to all window clients if the\n * responses differ. Neither of the Responses can be\n * [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).\n *\n * The message that's posted has the following format (where `payload` can\n * be customized via the `generatePayload` option the instance is created\n * with):\n *\n * ```\n * {\n * type: 'CACHE_UPDATED',\n * meta: 'workbox-broadcast-update',\n * payload: {\n * cacheName: 'the-cache-name',\n * updatedURL: 'https://example.com/'\n * }\n * }\n * ```\n *\n * @param {Object} options\n * @param {Response} [options.oldResponse] Cached response to compare.\n * @param {Response} options.newResponse Possibly updated response to compare.\n * @param {Request} options.request The request.\n * @param {string} options.cacheName Name of the cache the responses belong\n * to. This is included in the broadcast message.\n * @param {Event} options.event event The event that triggered\n * this possible cache update.\n * @return {Promise} Resolves once the update is sent.\n */\n async notifyIfUpdated(options) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(options.cacheName, 'string', {\n moduleName: 'workbox-broadcast-update',\n className: 'BroadcastCacheUpdate',\n funcName: 'notifyIfUpdated',\n paramName: 'cacheName',\n });\n assert.isInstance(options.newResponse, Response, {\n moduleName: 'workbox-broadcast-update',\n className: 'BroadcastCacheUpdate',\n funcName: 'notifyIfUpdated',\n paramName: 'newResponse',\n });\n assert.isInstance(options.request, Request, {\n moduleName: 'workbox-broadcast-update',\n className: 'BroadcastCacheUpdate',\n funcName: 'notifyIfUpdated',\n paramName: 'request',\n });\n }\n // Without two responses there is nothing to compare.\n if (!options.oldResponse) {\n return;\n }\n if (!responsesAreSame(options.oldResponse, options.newResponse, this._headersToCheck)) {\n if (process.env.NODE_ENV !== 'production') {\n logger.log(`Newer response found (and cached) for:`, options.request.url);\n }\n const messageData = {\n type: CACHE_UPDATED_MESSAGE_TYPE,\n meta: CACHE_UPDATED_MESSAGE_META,\n payload: this._generatePayload(options),\n };\n // For navigation requests, wait until the new window client exists\n // before sending the message\n if (options.request.mode === 'navigate') {\n let resultingClientId;\n if (options.event instanceof FetchEvent) {\n resultingClientId = options.event.resultingClientId;\n }\n const resultingWin = await resultingClientExists(resultingClientId);\n // Safari does not currently implement postMessage buffering and\n // there's no good way to feature detect that, so to increase the\n // chances of the message being delivered in Safari, we add a timeout.\n // We also do this if `resultingClientExists()` didn't return a client,\n // which means it timed out, so it's worth waiting a bit longer.\n if (!resultingWin || isSafari) {\n // 3500 is chosen because (according to CrUX data) 80% of mobile\n // websites hit the DOMContentLoaded event in less than 3.5 seconds.\n // And presumably sites implementing service worker are on the\n // higher end of the performance spectrum.\n await timeout(3500);\n }\n }\n if (this._notifyAllClients) {\n const windows = await self.clients.matchAll({ type: 'window' });\n for (const win of windows) {\n win.postMessage(messageData);\n }\n }\n else {\n // See https://github.com/GoogleChrome/workbox/issues/2895\n if (options.event instanceof FetchEvent) {\n const client = await self.clients.get(options.event.clientId);\n client === null || client === void 0 ? void 0 : client.postMessage(messageData);\n }\n }\n }\n }\n}\nexport { BroadcastCacheUpdate };\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 { dontWaitFor } from 'workbox-core/_private/dontWaitFor.js';\nimport { BroadcastCacheUpdate, } from './BroadcastCacheUpdate.js';\nimport './_version.js';\n/**\n * This plugin will automatically broadcast a message whenever a cached response\n * is updated.\n *\n * @memberof workbox-broadcast-update\n */\nclass BroadcastUpdatePlugin {\n /**\n * Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with\n * the passed options and calls its `notifyIfUpdated` method whenever the\n * plugin's `cacheDidUpdate` callback is invoked.\n *\n * @param {Object} [options]\n * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]\n * A list of headers that will be used to determine whether the responses\n * differ.\n * @param {string} [options.generatePayload] A function whose return value\n * will be used as the `payload` field in any cache update messages sent\n * to the window clients.\n */\n constructor(options) {\n /**\n * A \"lifecycle\" callback that will be triggered automatically by the\n * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is\n * added to a cache.\n *\n * @private\n * @param {Object} options The input object to this function.\n * @param {string} options.cacheName Name of the cache being updated.\n * @param {Response} [options.oldResponse] The previous cached value, if any.\n * @param {Response} options.newResponse The new value in the cache.\n * @param {Request} options.request The request that triggered the update.\n * @param {Request} options.event The event that triggered the update.\n */\n this.cacheDidUpdate = async (options) => {\n dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options));\n };\n this._broadcastUpdate = new BroadcastCacheUpdate(options);\n }\n}\nexport { BroadcastUpdatePlugin };\n"],"names":["self","_","e","responsesAreSame","firstResponse","secondResponse","headersToCheck","some","header","headers","has","every","headerStateComparison","headerValueComparison","get","DEFAULT_HEADERS_TO_CHECK","isSafari","test","navigator","userAgent","defaultPayloadGenerator","data","cacheName","updatedURL","request","url","BroadcastCacheUpdate","constructor","generatePayload","notifyAllClients","this","_headersToCheck","_generatePayload","_notifyAllClients","async","options","oldResponse","newResponse","messageData","type","meta","payload","mode","resultingClientId","event","FetchEvent","resultingClientExists","timeout","windows","clients","matchAll","win","postMessage","client","clientId","cacheDidUpdate","dontWaitFor","_broadcastUpdate","notifyIfUpdated"],"mappings":"0FAEA,IACIA,KAAK,mCAAqCC,GAC9C,CACA,MAAOC,GAAK,CCgBZ,MAAMC,EAAmBA,CAACC,EAAeC,EAAgBC,KAMnBA,EAAeC,MAAMC,GAC3CJ,EAAcK,QAAQC,IAAIF,IAAWH,EAAeI,QAAQC,IAAIF,MAYrEF,EAAeK,OAAOH,IACzB,MAAMI,EAAwBR,EAAcK,QAAQC,IAAIF,KAAYH,EAAeI,QAAQC,IAAIF,GACzFK,EAAwBT,EAAcK,QAAQK,IAAIN,KAAYH,EAAeI,QAAQK,IAAIN,GAC/F,OAAOI,GAAyBC,CAAqB,IChChDE,EAA2B,CACpC,iBACA,OACA,iBCGEC,EAAW,iCAAiCC,KAAKC,UAAUC,WAQjE,SAASC,EAAwBC,GAC7B,MAAO,CACHC,UAAWD,EAAKC,UAChBC,WAAYF,EAAKG,QAAQC,IAEjC,CAUA,MAAMC,EAgBFC,aAAYC,gBAAEA,EAAetB,eAAEA,EAAcuB,iBAAEA,GAAsB,IACjEC,KAAKC,GAAkBzB,GAAkBS,EACzCe,KAAKE,GAAmBJ,GAAmBR,EAC3CU,KAAKG,GAAoBJ,SAA2DA,CACxF,CAgCAK,sBAAsBC,GAsBlB,GAAKA,EAAQC,cAGRjC,EAAiBgC,EAAQC,YAAaD,EAAQE,YAAaP,KAAKC,IAAkB,CAInF,MAAMO,EAAc,CAChBC,KDlH0B,gBCmH1BC,KDlH0B,2BCmH1BC,QAASX,KAAKE,GAAiBG,IAInC,GAA6B,aAAzBA,EAAQX,QAAQkB,KAAqB,CACrC,IAAIC,EACAR,EAAQS,iBAAiBC,aACzBF,EAAoBR,EAAQS,MAAMD,yBAEXG,EAAAA,sBAAsBH,KAM5B3B,SAKX+B,EAAAA,QAAQ,KAEtB,CACA,GAAIjB,KAAKG,GAAmB,CACxB,MAAMe,QAAgBhD,KAAKiD,QAAQC,SAAS,CAAEX,KAAM,WACpD,IAAK,MAAMY,KAAOH,EACdG,EAAIC,YAAYd,EAExB,MAGI,GAAIH,EAAQS,iBAAiBC,WAAY,CACrC,MAAMQ,QAAerD,KAAKiD,QAAQnC,IAAIqB,EAAQS,MAAMU,UACpDD,SAAgDA,EAAOD,YAAYd,EACvE,CAER,CACJ,0DCjJJ,MAcIX,YAAYQ,GAcRL,KAAKyB,eAAiBrB,UAClBsB,EAAAA,YAAY1B,KAAK2B,GAAiBC,gBAAgBvB,GAAS,EAE/DL,KAAK2B,GAAmB,IAAI/B,EAAqBS,EACrD"}
node_modules/workbox-broadcast-update/index.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import { BroadcastCacheUpdate, BroadcastCacheUpdateOptions } from './BroadcastCacheUpdate.js';
2
+ import { BroadcastUpdatePlugin } from './BroadcastUpdatePlugin.js';
3
+ import { responsesAreSame } from './responsesAreSame.js';
4
+ import './_version.js';
5
+ /**
6
+ * @module workbox-broadcast-update
7
+ */
8
+ export { BroadcastCacheUpdate, BroadcastCacheUpdateOptions, BroadcastUpdatePlugin, responsesAreSame, };
node_modules/workbox-broadcast-update/index.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+ import { BroadcastCacheUpdate, } from './BroadcastCacheUpdate.js';
9
+ import { BroadcastUpdatePlugin } from './BroadcastUpdatePlugin.js';
10
+ import { responsesAreSame } from './responsesAreSame.js';
11
+ import './_version.js';
12
+ /**
13
+ * @module workbox-broadcast-update
14
+ */
15
+ export { BroadcastCacheUpdate, BroadcastUpdatePlugin, responsesAreSame, };
node_modules/workbox-broadcast-update/index.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from './index.js';
node_modules/workbox-broadcast-update/package.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "workbox-broadcast-update",
3
+ "version": "7.4.1",
4
+ "license": "MIT",
5
+ "author": "Google's Web DevRel Team and Google's Aurora Team",
6
+ "description": "A service worker helper library that uses the Broadcast Channel API to announce when a cached response has updated",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/googlechrome/workbox.git"
10
+ },
11
+ "bugs": "https://github.com/googlechrome/workbox/issues",
12
+ "homepage": "https://github.com/GoogleChrome/workbox",
13
+ "keywords": [
14
+ "workbox",
15
+ "workboxjs",
16
+ "service worker",
17
+ "sw",
18
+ "workbox-plugin"
19
+ ],
20
+ "workbox": {
21
+ "browserNamespace": "workbox.broadcastUpdate",
22
+ "packageType": "sw"
23
+ },
24
+ "main": "index.js",
25
+ "module": "index.mjs",
26
+ "types": "index.d.ts",
27
+ "dependencies": {
28
+ "workbox-core": "7.4.1"
29
+ },
30
+ "gitHead": "62b9d8ba8eb3c1a2ab8aac9d84c90cda7865d6a3"
31
+ }
node_modules/workbox-broadcast-update/responsesAreSame.d.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './_version.js';
2
+ /**
3
+ * Given two `Response's`, compares several header values to see if they are
4
+ * the same or not.
5
+ *
6
+ * @param {Response} firstResponse
7
+ * @param {Response} secondResponse
8
+ * @param {Array<string>} headersToCheck
9
+ * @return {boolean}
10
+ *
11
+ * @memberof workbox-broadcast-update
12
+ */
13
+ declare const responsesAreSame: (firstResponse: Response, secondResponse: Response, headersToCheck: string[]) => boolean;
14
+ export { responsesAreSame };
node_modules/workbox-broadcast-update/responsesAreSame.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+ import { WorkboxError } from 'workbox-core/_private/WorkboxError.js';
9
+ import { logger } from 'workbox-core/_private/logger.js';
10
+ import './_version.js';
11
+ /**
12
+ * Given two `Response's`, compares several header values to see if they are
13
+ * the same or not.
14
+ *
15
+ * @param {Response} firstResponse
16
+ * @param {Response} secondResponse
17
+ * @param {Array<string>} headersToCheck
18
+ * @return {boolean}
19
+ *
20
+ * @memberof workbox-broadcast-update
21
+ */
22
+ const responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {
23
+ if (process.env.NODE_ENV !== 'production') {
24
+ if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {
25
+ throw new WorkboxError('invalid-responses-are-same-args');
26
+ }
27
+ }
28
+ const atLeastOneHeaderAvailable = headersToCheck.some((header) => {
29
+ return (firstResponse.headers.has(header) && secondResponse.headers.has(header));
30
+ });
31
+ if (!atLeastOneHeaderAvailable) {
32
+ if (process.env.NODE_ENV !== 'production') {
33
+ logger.warn(`Unable to determine where the response has been updated ` +
34
+ `because none of the headers that would be checked are present.`);
35
+ logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);
36
+ }
37
+ // Just return true, indicating the that responses are the same, since we
38
+ // can't determine otherwise.
39
+ return true;
40
+ }
41
+ return headersToCheck.every((header) => {
42
+ const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);
43
+ const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);
44
+ return headerStateComparison && headerValueComparison;
45
+ });
46
+ };
47
+ export { responsesAreSame };
node_modules/workbox-broadcast-update/responsesAreSame.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from './responsesAreSame.js';
node_modules/workbox-broadcast-update/src/BroadcastCacheUpdate.ts ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ import {assert} from 'workbox-core/_private/assert.js';
10
+ import {timeout} from 'workbox-core/_private/timeout.js';
11
+ import {resultingClientExists} from 'workbox-core/_private/resultingClientExists.js';
12
+ import {CacheDidUpdateCallbackParam} from 'workbox-core/types.js';
13
+ import {logger} from 'workbox-core/_private/logger.js';
14
+ import {responsesAreSame} from './responsesAreSame.js';
15
+ import {
16
+ CACHE_UPDATED_MESSAGE_META,
17
+ CACHE_UPDATED_MESSAGE_TYPE,
18
+ DEFAULT_HEADERS_TO_CHECK,
19
+ NOTIFY_ALL_CLIENTS,
20
+ } from './utils/constants.js';
21
+
22
+ import './_version.js';
23
+
24
+ // UA-sniff Safari: https://stackoverflow.com/questions/7944460/detect-safari-browser
25
+ // TODO(philipwalton): remove once this Safari bug fix has been released.
26
+ // https://bugs.webkit.org/show_bug.cgi?id=201169
27
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
28
+
29
+ // Give TypeScript the correct global.
30
+ declare let self: ServiceWorkerGlobalScope;
31
+
32
+ export interface BroadcastCacheUpdateOptions {
33
+ headersToCheck?: string[];
34
+ generatePayload?: (
35
+ options: CacheDidUpdateCallbackParam,
36
+ ) => Record<string, any>;
37
+ notifyAllClients?: boolean;
38
+ }
39
+
40
+ /**
41
+ * Generates the default payload used in update messages. By default the
42
+ * payload includes the `cacheName` and `updatedURL` fields.
43
+ *
44
+ * @return Object
45
+ * @private
46
+ */
47
+ function defaultPayloadGenerator(
48
+ data: CacheDidUpdateCallbackParam,
49
+ ): Record<string, any> {
50
+ return {
51
+ cacheName: data.cacheName,
52
+ updatedURL: data.request.url,
53
+ };
54
+ }
55
+
56
+ /**
57
+ * Uses the `postMessage()` API to inform any open windows/tabs when a cached
58
+ * response has been updated.
59
+ *
60
+ * For efficiency's sake, the underlying response bodies are not compared;
61
+ * only specific response headers are checked.
62
+ *
63
+ * @memberof workbox-broadcast-update
64
+ */
65
+ class BroadcastCacheUpdate {
66
+ private readonly _headersToCheck: string[];
67
+ private readonly _generatePayload: (
68
+ options: CacheDidUpdateCallbackParam,
69
+ ) => Record<string, any>;
70
+ private readonly _notifyAllClients: boolean;
71
+
72
+ /**
73
+ * Construct a BroadcastCacheUpdate instance with a specific `channelName` to
74
+ * broadcast messages on
75
+ *
76
+ * @param {Object} [options]
77
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
78
+ * A list of headers that will be used to determine whether the responses
79
+ * differ.
80
+ * @param {string} [options.generatePayload] A function whose return value
81
+ * will be used as the `payload` field in any cache update messages sent
82
+ * to the window clients.
83
+ * @param {boolean} [options.notifyAllClients=true] If true (the default) then
84
+ * all open clients will receive a message. If false, then only the client
85
+ * that make the original request will be notified of the update.
86
+ */
87
+ constructor({
88
+ generatePayload,
89
+ headersToCheck,
90
+ notifyAllClients,
91
+ }: BroadcastCacheUpdateOptions = {}) {
92
+ this._headersToCheck = headersToCheck || DEFAULT_HEADERS_TO_CHECK;
93
+ this._generatePayload = generatePayload || defaultPayloadGenerator;
94
+ this._notifyAllClients = notifyAllClients ?? NOTIFY_ALL_CLIENTS;
95
+ }
96
+
97
+ /**
98
+ * Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)
99
+ * and sends a message (via `postMessage()`) to all window clients if the
100
+ * responses differ. Neither of the Responses can be
101
+ * [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
102
+ *
103
+ * The message that's posted has the following format (where `payload` can
104
+ * be customized via the `generatePayload` option the instance is created
105
+ * with):
106
+ *
107
+ * ```
108
+ * {
109
+ * type: 'CACHE_UPDATED',
110
+ * meta: 'workbox-broadcast-update',
111
+ * payload: {
112
+ * cacheName: 'the-cache-name',
113
+ * updatedURL: 'https://example.com/'
114
+ * }
115
+ * }
116
+ * ```
117
+ *
118
+ * @param {Object} options
119
+ * @param {Response} [options.oldResponse] Cached response to compare.
120
+ * @param {Response} options.newResponse Possibly updated response to compare.
121
+ * @param {Request} options.request The request.
122
+ * @param {string} options.cacheName Name of the cache the responses belong
123
+ * to. This is included in the broadcast message.
124
+ * @param {Event} options.event event The event that triggered
125
+ * this possible cache update.
126
+ * @return {Promise} Resolves once the update is sent.
127
+ */
128
+ async notifyIfUpdated(options: CacheDidUpdateCallbackParam): Promise<void> {
129
+ if (process.env.NODE_ENV !== 'production') {
130
+ assert!.isType(options.cacheName, 'string', {
131
+ moduleName: 'workbox-broadcast-update',
132
+ className: 'BroadcastCacheUpdate',
133
+ funcName: 'notifyIfUpdated',
134
+ paramName: 'cacheName',
135
+ });
136
+ assert!.isInstance(options.newResponse, Response, {
137
+ moduleName: 'workbox-broadcast-update',
138
+ className: 'BroadcastCacheUpdate',
139
+ funcName: 'notifyIfUpdated',
140
+ paramName: 'newResponse',
141
+ });
142
+ assert!.isInstance(options.request, Request, {
143
+ moduleName: 'workbox-broadcast-update',
144
+ className: 'BroadcastCacheUpdate',
145
+ funcName: 'notifyIfUpdated',
146
+ paramName: 'request',
147
+ });
148
+ }
149
+
150
+ // Without two responses there is nothing to compare.
151
+ if (!options.oldResponse) {
152
+ return;
153
+ }
154
+
155
+ if (
156
+ !responsesAreSame(
157
+ options.oldResponse,
158
+ options.newResponse,
159
+ this._headersToCheck,
160
+ )
161
+ ) {
162
+ if (process.env.NODE_ENV !== 'production') {
163
+ logger.log(
164
+ `Newer response found (and cached) for:`,
165
+ options.request.url,
166
+ );
167
+ }
168
+
169
+ const messageData = {
170
+ type: CACHE_UPDATED_MESSAGE_TYPE,
171
+ meta: CACHE_UPDATED_MESSAGE_META,
172
+ payload: this._generatePayload(options),
173
+ };
174
+
175
+ // For navigation requests, wait until the new window client exists
176
+ // before sending the message
177
+ if (options.request.mode === 'navigate') {
178
+ let resultingClientId: string | undefined;
179
+ if (options.event instanceof FetchEvent) {
180
+ resultingClientId = options.event.resultingClientId;
181
+ }
182
+
183
+ const resultingWin = await resultingClientExists(resultingClientId);
184
+
185
+ // Safari does not currently implement postMessage buffering and
186
+ // there's no good way to feature detect that, so to increase the
187
+ // chances of the message being delivered in Safari, we add a timeout.
188
+ // We also do this if `resultingClientExists()` didn't return a client,
189
+ // which means it timed out, so it's worth waiting a bit longer.
190
+ if (!resultingWin || isSafari) {
191
+ // 3500 is chosen because (according to CrUX data) 80% of mobile
192
+ // websites hit the DOMContentLoaded event in less than 3.5 seconds.
193
+ // And presumably sites implementing service worker are on the
194
+ // higher end of the performance spectrum.
195
+ await timeout(3500);
196
+ }
197
+ }
198
+
199
+ if (this._notifyAllClients) {
200
+ const windows = await self.clients.matchAll({type: 'window'});
201
+ for (const win of windows) {
202
+ win.postMessage(messageData);
203
+ }
204
+ } else {
205
+ // See https://github.com/GoogleChrome/workbox/issues/2895
206
+ if (options.event instanceof FetchEvent) {
207
+ const client = await self.clients.get(options.event.clientId);
208
+ client?.postMessage(messageData);
209
+ }
210
+ }
211
+ }
212
+ }
213
+ }
214
+
215
+ export {BroadcastCacheUpdate};
node_modules/workbox-broadcast-update/src/BroadcastUpdatePlugin.ts ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ import {dontWaitFor} from 'workbox-core/_private/dontWaitFor.js';
10
+ import {WorkboxPlugin} from 'workbox-core/types.js';
11
+
12
+ import {
13
+ BroadcastCacheUpdate,
14
+ BroadcastCacheUpdateOptions,
15
+ } from './BroadcastCacheUpdate.js';
16
+
17
+ import './_version.js';
18
+
19
+ /**
20
+ * This plugin will automatically broadcast a message whenever a cached response
21
+ * is updated.
22
+ *
23
+ * @memberof workbox-broadcast-update
24
+ */
25
+ class BroadcastUpdatePlugin implements WorkboxPlugin {
26
+ private readonly _broadcastUpdate: BroadcastCacheUpdate;
27
+
28
+ /**
29
+ * Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with
30
+ * the passed options and calls its `notifyIfUpdated` method whenever the
31
+ * plugin's `cacheDidUpdate` callback is invoked.
32
+ *
33
+ * @param {Object} [options]
34
+ * @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]
35
+ * A list of headers that will be used to determine whether the responses
36
+ * differ.
37
+ * @param {string} [options.generatePayload] A function whose return value
38
+ * will be used as the `payload` field in any cache update messages sent
39
+ * to the window clients.
40
+ */
41
+ constructor(options?: BroadcastCacheUpdateOptions) {
42
+ this._broadcastUpdate = new BroadcastCacheUpdate(options);
43
+ }
44
+
45
+ /**
46
+ * A "lifecycle" callback that will be triggered automatically by the
47
+ * `workbox-sw` and `workbox-runtime-caching` handlers when an entry is
48
+ * added to a cache.
49
+ *
50
+ * @private
51
+ * @param {Object} options The input object to this function.
52
+ * @param {string} options.cacheName Name of the cache being updated.
53
+ * @param {Response} [options.oldResponse] The previous cached value, if any.
54
+ * @param {Response} options.newResponse The new value in the cache.
55
+ * @param {Request} options.request The request that triggered the update.
56
+ * @param {Request} options.event The event that triggered the update.
57
+ */
58
+ cacheDidUpdate: WorkboxPlugin['cacheDidUpdate'] = async (options) => {
59
+ dontWaitFor(this._broadcastUpdate.notifyIfUpdated(options));
60
+ };
61
+ }
62
+
63
+ export {BroadcastUpdatePlugin};
node_modules/workbox-broadcast-update/src/_version.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ // @ts-ignore
2
+ try{self['workbox:broadcast-update:7.4.1']&&_()}catch(e){}
node_modules/workbox-broadcast-update/src/index.ts ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ import {
10
+ BroadcastCacheUpdate,
11
+ BroadcastCacheUpdateOptions,
12
+ } from './BroadcastCacheUpdate.js';
13
+ import {BroadcastUpdatePlugin} from './BroadcastUpdatePlugin.js';
14
+ import {responsesAreSame} from './responsesAreSame.js';
15
+
16
+ import './_version.js';
17
+
18
+ /**
19
+ * @module workbox-broadcast-update
20
+ */
21
+
22
+ export {
23
+ BroadcastCacheUpdate,
24
+ BroadcastCacheUpdateOptions,
25
+ BroadcastUpdatePlugin,
26
+ responsesAreSame,
27
+ };
node_modules/workbox-broadcast-update/src/responsesAreSame.ts ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ import {WorkboxError} from 'workbox-core/_private/WorkboxError.js';
10
+ import {logger} from 'workbox-core/_private/logger.js';
11
+ import './_version.js';
12
+
13
+ /**
14
+ * Given two `Response's`, compares several header values to see if they are
15
+ * the same or not.
16
+ *
17
+ * @param {Response} firstResponse
18
+ * @param {Response} secondResponse
19
+ * @param {Array<string>} headersToCheck
20
+ * @return {boolean}
21
+ *
22
+ * @memberof workbox-broadcast-update
23
+ */
24
+ const responsesAreSame = (
25
+ firstResponse: Response,
26
+ secondResponse: Response,
27
+ headersToCheck: string[],
28
+ ): boolean => {
29
+ if (process.env.NODE_ENV !== 'production') {
30
+ if (
31
+ !(firstResponse instanceof Response && secondResponse instanceof Response)
32
+ ) {
33
+ throw new WorkboxError('invalid-responses-are-same-args');
34
+ }
35
+ }
36
+
37
+ const atLeastOneHeaderAvailable = headersToCheck.some((header) => {
38
+ return (
39
+ firstResponse.headers.has(header) && secondResponse.headers.has(header)
40
+ );
41
+ });
42
+
43
+ if (!atLeastOneHeaderAvailable) {
44
+ if (process.env.NODE_ENV !== 'production') {
45
+ logger.warn(
46
+ `Unable to determine where the response has been updated ` +
47
+ `because none of the headers that would be checked are present.`,
48
+ );
49
+ logger.debug(
50
+ `Attempting to compare the following: `,
51
+ firstResponse,
52
+ secondResponse,
53
+ headersToCheck,
54
+ );
55
+ }
56
+
57
+ // Just return true, indicating the that responses are the same, since we
58
+ // can't determine otherwise.
59
+ return true;
60
+ }
61
+
62
+ return headersToCheck.every((header) => {
63
+ const headerStateComparison =
64
+ firstResponse.headers.has(header) === secondResponse.headers.has(header);
65
+ const headerValueComparison =
66
+ firstResponse.headers.get(header) === secondResponse.headers.get(header);
67
+
68
+ return headerStateComparison && headerValueComparison;
69
+ });
70
+ };
71
+
72
+ export {responsesAreSame};
node_modules/workbox-broadcast-update/src/utils/constants.ts ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ import '../_version.js';
10
+
11
+ export const CACHE_UPDATED_MESSAGE_TYPE = 'CACHE_UPDATED';
12
+ export const CACHE_UPDATED_MESSAGE_META = 'workbox-broadcast-update';
13
+ export const NOTIFY_ALL_CLIENTS = true;
14
+ export const DEFAULT_HEADERS_TO_CHECK: string[] = [
15
+ 'content-length',
16
+ 'etag',
17
+ 'last-modified',
18
+ ];
node_modules/workbox-broadcast-update/tsconfig.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "extends": "../../tsconfig",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "outDir": "./",
6
+ "rootDir": "./src",
7
+ "tsBuildInfoFile": "./tsconfig.tsbuildinfo"
8
+ },
9
+ "include": ["src/**/*.ts"],
10
+ "references": [{"path": "../workbox-core/"}]
11
+ }
node_modules/workbox-broadcast-update/utils/constants.d.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import '../_version.js';
2
+ export declare const CACHE_UPDATED_MESSAGE_TYPE = "CACHE_UPDATED";
3
+ export declare const CACHE_UPDATED_MESSAGE_META = "workbox-broadcast-update";
4
+ export declare const NOTIFY_ALL_CLIENTS = true;
5
+ export declare const DEFAULT_HEADERS_TO_CHECK: string[];
node_modules/workbox-broadcast-update/utils/constants.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2018 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+ import '../_version.js';
9
+ export const CACHE_UPDATED_MESSAGE_TYPE = 'CACHE_UPDATED';
10
+ export const CACHE_UPDATED_MESSAGE_META = 'workbox-broadcast-update';
11
+ export const NOTIFY_ALL_CLIENTS = true;
12
+ export const DEFAULT_HEADERS_TO_CHECK = [
13
+ 'content-length',
14
+ 'etag',
15
+ 'last-modified',
16
+ ];
node_modules/workbox-broadcast-update/utils/constants.mjs ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from './constants.js';
node_modules/workbox-build/.ncurc.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2020 Google LLC
3
+
4
+ Use of this source code is governed by an MIT-style
5
+ license that can be found in the LICENSE file or at
6
+ https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ // We use `npx npm-check-updates` to find updates to dependencies.
10
+ // Some dependencies have breaking changes that we can't resolve.
11
+ // This config file excludes those dependencies from the checks
12
+ // until we're able to remediate our code to deal with them.
13
+ module.exports = {
14
+ reject: [
15
+ // joi v16 is the last release to support Node v10:
16
+ // https://github.com/sideway/joi/issues/2262
17
+ '@hapi/joi',
18
+ ],
19
+ };
node_modules/workbox-build/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright 2018 Google LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
node_modules/workbox-build/README.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This module's documentation can be found at https://developer.chrome.com/docs/workbox/modules/workbox-build
node_modules/workbox-build/build/cdn-details.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "origin": "https://storage.googleapis.com",
3
+ "bucketName": "workbox-cdn",
4
+ "releasesDir": "releases",
5
+ "latestVersion": "7.4.1"
6
+ }
node_modules/workbox-build/build/generate-sw.d.ts ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BuildResult, GenerateSWOptions } from './types';
2
+ /**
3
+ * This method creates a list of URLs to precache, referred to as a "precache
4
+ * manifest", based on the options you provide.
5
+ *
6
+ * It also takes in additional options that configures the service worker's
7
+ * behavior, like any `runtimeCaching` rules it should use.
8
+ *
9
+ * Based on the precache manifest and the additional configuration, it writes
10
+ * a ready-to-use service worker file to disk at `swDest`.
11
+ *
12
+ * ```
13
+ * // The following lists some common options; see the rest of the documentation
14
+ * // for the full set of options and defaults.
15
+ * const {count, size, warnings} = await generateSW({
16
+ * dontCacheBustURLsMatching: [new RegExp('...')],
17
+ * globDirectory: '...',
18
+ * globPatterns: ['...', '...'],
19
+ * maximumFileSizeToCacheInBytes: ...,
20
+ * navigateFallback: '...',
21
+ * runtimeCaching: [{
22
+ * // Routing via a matchCallback function:
23
+ * urlPattern: ({request, url}) => ...,
24
+ * handler: '...',
25
+ * options: {
26
+ * cacheName: '...',
27
+ * expiration: {
28
+ * maxEntries: ...,
29
+ * },
30
+ * },
31
+ * }, {
32
+ * // Routing via a RegExp:
33
+ * urlPattern: new RegExp('...'),
34
+ * handler: '...',
35
+ * options: {
36
+ * cacheName: '...',
37
+ * plugins: [..., ...],
38
+ * },
39
+ * }],
40
+ * skipWaiting: ...,
41
+ * swDest: '...',
42
+ * });
43
+ * ```
44
+ *
45
+ * @memberof workbox-build
46
+ */
47
+ export declare function generateSW(config: GenerateSWOptions): Promise<BuildResult>;
node_modules/workbox-build/build/generate-sw.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /*
3
+ Copyright 2018 Google LLC
4
+
5
+ Use of this source code is governed by an MIT-style
6
+ license that can be found in the LICENSE file or at
7
+ https://opensource.org/licenses/MIT.
8
+ */
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.generateSW = void 0;
14
+ const upath_1 = __importDefault(require("upath"));
15
+ const get_file_manifest_entries_1 = require("./lib/get-file-manifest-entries");
16
+ const rebase_path_1 = require("./lib/rebase-path");
17
+ const validate_options_1 = require("./lib/validate-options");
18
+ const write_sw_using_default_template_1 = require("./lib/write-sw-using-default-template");
19
+ /**
20
+ * This method creates a list of URLs to precache, referred to as a "precache
21
+ * manifest", based on the options you provide.
22
+ *
23
+ * It also takes in additional options that configures the service worker's
24
+ * behavior, like any `runtimeCaching` rules it should use.
25
+ *
26
+ * Based on the precache manifest and the additional configuration, it writes
27
+ * a ready-to-use service worker file to disk at `swDest`.
28
+ *
29
+ * ```
30
+ * // The following lists some common options; see the rest of the documentation
31
+ * // for the full set of options and defaults.
32
+ * const {count, size, warnings} = await generateSW({
33
+ * dontCacheBustURLsMatching: [new RegExp('...')],
34
+ * globDirectory: '...',
35
+ * globPatterns: ['...', '...'],
36
+ * maximumFileSizeToCacheInBytes: ...,
37
+ * navigateFallback: '...',
38
+ * runtimeCaching: [{
39
+ * // Routing via a matchCallback function:
40
+ * urlPattern: ({request, url}) => ...,
41
+ * handler: '...',
42
+ * options: {
43
+ * cacheName: '...',
44
+ * expiration: {
45
+ * maxEntries: ...,
46
+ * },
47
+ * },
48
+ * }, {
49
+ * // Routing via a RegExp:
50
+ * urlPattern: new RegExp('...'),
51
+ * handler: '...',
52
+ * options: {
53
+ * cacheName: '...',
54
+ * plugins: [..., ...],
55
+ * },
56
+ * }],
57
+ * skipWaiting: ...,
58
+ * swDest: '...',
59
+ * });
60
+ * ```
61
+ *
62
+ * @memberof workbox-build
63
+ */
64
+ async function generateSW(config) {
65
+ const options = (0, validate_options_1.validateGenerateSWOptions)(config);
66
+ let entriesResult;
67
+ if (options.globDirectory) {
68
+ // Make sure we leave swDest out of the precache manifest.
69
+ options.globIgnores.push((0, rebase_path_1.rebasePath)({
70
+ baseDirectory: options.globDirectory,
71
+ file: options.swDest,
72
+ }));
73
+ // If we create an extra external runtime file, ignore that, too.
74
+ // See https://rollupjs.org/guide/en/#outputchunkfilenames for naming.
75
+ if (!options.inlineWorkboxRuntime) {
76
+ const swDestDir = upath_1.default.dirname(options.swDest);
77
+ const workboxRuntimeFile = upath_1.default.join(swDestDir, 'workbox-*.js');
78
+ options.globIgnores.push((0, rebase_path_1.rebasePath)({
79
+ baseDirectory: options.globDirectory,
80
+ file: workboxRuntimeFile,
81
+ }));
82
+ }
83
+ // We've previously asserted that options.globDirectory is set, so this
84
+ // should be a safe cast.
85
+ entriesResult = await (0, get_file_manifest_entries_1.getFileManifestEntries)(options);
86
+ }
87
+ else {
88
+ entriesResult = {
89
+ count: 0,
90
+ manifestEntries: [],
91
+ size: 0,
92
+ warnings: [],
93
+ };
94
+ }
95
+ const filePaths = await (0, write_sw_using_default_template_1.writeSWUsingDefaultTemplate)(Object.assign({
96
+ manifestEntries: entriesResult.manifestEntries,
97
+ }, options));
98
+ return {
99
+ filePaths,
100
+ count: entriesResult.count,
101
+ size: entriesResult.size,
102
+ warnings: entriesResult.warnings,
103
+ };
104
+ }
105
+ exports.generateSW = generateSW;
node_modules/workbox-build/build/get-manifest.d.ts ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { GetManifestOptions, GetManifestResult } from './types';
2
+ /**
3
+ * This method returns a list of URLs to precache, referred to as a "precache
4
+ * manifest", along with details about the number of entries and their size,
5
+ * based on the options you provide.
6
+ *
7
+ * ```
8
+ * // The following lists some common options; see the rest of the documentation
9
+ * // for the full set of options and defaults.
10
+ * const {count, manifestEntries, size, warnings} = await getManifest({
11
+ * dontCacheBustURLsMatching: [new RegExp('...')],
12
+ * globDirectory: '...',
13
+ * globPatterns: ['...', '...'],
14
+ * maximumFileSizeToCacheInBytes: ...,
15
+ * });
16
+ * ```
17
+ *
18
+ * @memberof workbox-build
19
+ */
20
+ export declare function getManifest(config: GetManifestOptions): Promise<GetManifestResult>;
node_modules/workbox-build/build/get-manifest.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /*
3
+ Copyright 2018 Google LLC
4
+
5
+ Use of this source code is governed by an MIT-style
6
+ license that can be found in the LICENSE file or at
7
+ https://opensource.org/licenses/MIT.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getManifest = void 0;
11
+ const get_file_manifest_entries_1 = require("./lib/get-file-manifest-entries");
12
+ const validate_options_1 = require("./lib/validate-options");
13
+ /**
14
+ * This method returns a list of URLs to precache, referred to as a "precache
15
+ * manifest", along with details about the number of entries and their size,
16
+ * based on the options you provide.
17
+ *
18
+ * ```
19
+ * // The following lists some common options; see the rest of the documentation
20
+ * // for the full set of options and defaults.
21
+ * const {count, manifestEntries, size, warnings} = await getManifest({
22
+ * dontCacheBustURLsMatching: [new RegExp('...')],
23
+ * globDirectory: '...',
24
+ * globPatterns: ['...', '...'],
25
+ * maximumFileSizeToCacheInBytes: ...,
26
+ * });
27
+ * ```
28
+ *
29
+ * @memberof workbox-build
30
+ */
31
+ async function getManifest(config) {
32
+ const options = (0, validate_options_1.validateGetManifestOptions)(config);
33
+ return await (0, get_file_manifest_entries_1.getFileManifestEntries)(options);
34
+ }
35
+ exports.getManifest = getManifest;
node_modules/workbox-build/build/index.d.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import { copyWorkboxLibraries } from './lib/copy-workbox-libraries';
2
+ import { getModuleURL } from './lib/cdn-utils';
3
+ import { generateSW } from './generate-sw';
4
+ import { getManifest } from './get-manifest';
5
+ import { injectManifest } from './inject-manifest';
6
+ /**
7
+ * @module workbox-build
8
+ */
9
+ export { copyWorkboxLibraries, generateSW, getManifest, getModuleURL, injectManifest, };
10
+ export * from './types';
node_modules/workbox-build/build/index.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /*
3
+ Copyright 2018 Google LLC
4
+
5
+ Use of this source code is governed by an MIT-style
6
+ license that can be found in the LICENSE file or at
7
+ https://opensource.org/licenses/MIT.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.injectManifest = exports.getModuleURL = exports.getManifest = exports.generateSW = exports.copyWorkboxLibraries = void 0;
25
+ const copy_workbox_libraries_1 = require("./lib/copy-workbox-libraries");
26
+ Object.defineProperty(exports, "copyWorkboxLibraries", { enumerable: true, get: function () { return copy_workbox_libraries_1.copyWorkboxLibraries; } });
27
+ const cdn_utils_1 = require("./lib/cdn-utils");
28
+ Object.defineProperty(exports, "getModuleURL", { enumerable: true, get: function () { return cdn_utils_1.getModuleURL; } });
29
+ const generate_sw_1 = require("./generate-sw");
30
+ Object.defineProperty(exports, "generateSW", { enumerable: true, get: function () { return generate_sw_1.generateSW; } });
31
+ const get_manifest_1 = require("./get-manifest");
32
+ Object.defineProperty(exports, "getManifest", { enumerable: true, get: function () { return get_manifest_1.getManifest; } });
33
+ const inject_manifest_1 = require("./inject-manifest");
34
+ Object.defineProperty(exports, "injectManifest", { enumerable: true, get: function () { return inject_manifest_1.injectManifest; } });
35
+ __exportStar(require("./types"), exports);
node_modules/workbox-build/build/inject-manifest.d.ts ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BuildResult, InjectManifestOptions } from './types';
2
+ /**
3
+ * This method creates a list of URLs to precache, referred to as a "precache
4
+ * manifest", based on the options you provide.
5
+ *
6
+ * The manifest is injected into the `swSrc` file, and the placeholder string
7
+ * `injectionPoint` determines where in the file the manifest should go.
8
+ *
9
+ * The final service worker file, with the manifest injected, is written to
10
+ * disk at `swDest`.
11
+ *
12
+ * This method will not compile or bundle your `swSrc` file; it just handles
13
+ * injecting the manifest.
14
+ *
15
+ * ```
16
+ * // The following lists some common options; see the rest of the documentation
17
+ * // for the full set of options and defaults.
18
+ * const {count, size, warnings} = await injectManifest({
19
+ * dontCacheBustURLsMatching: [new RegExp('...')],
20
+ * globDirectory: '...',
21
+ * globPatterns: ['...', '...'],
22
+ * maximumFileSizeToCacheInBytes: ...,
23
+ * swDest: '...',
24
+ * swSrc: '...',
25
+ * });
26
+ * ```
27
+ *
28
+ * @memberof workbox-build
29
+ */
30
+ export declare function injectManifest(config: InjectManifestOptions): Promise<BuildResult>;
node_modules/workbox-build/build/inject-manifest.js ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /*
3
+ Copyright 2018 Google LLC
4
+
5
+ Use of this source code is governed by an MIT-style
6
+ license that can be found in the LICENSE file or at
7
+ https://opensource.org/licenses/MIT.
8
+ */
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.injectManifest = void 0;
14
+ const assert_1 = __importDefault(require("assert"));
15
+ const fs_extra_1 = __importDefault(require("fs-extra"));
16
+ const fast_json_stable_stringify_1 = __importDefault(require("fast-json-stable-stringify"));
17
+ const upath_1 = __importDefault(require("upath"));
18
+ const errors_1 = require("./lib/errors");
19
+ const escape_regexp_1 = require("./lib/escape-regexp");
20
+ const get_file_manifest_entries_1 = require("./lib/get-file-manifest-entries");
21
+ const get_source_map_url_1 = require("./lib/get-source-map-url");
22
+ const rebase_path_1 = require("./lib/rebase-path");
23
+ const replace_and_update_source_map_1 = require("./lib/replace-and-update-source-map");
24
+ const translate_url_to_sourcemap_paths_1 = require("./lib/translate-url-to-sourcemap-paths");
25
+ const validate_options_1 = require("./lib/validate-options");
26
+ /**
27
+ * This method creates a list of URLs to precache, referred to as a "precache
28
+ * manifest", based on the options you provide.
29
+ *
30
+ * The manifest is injected into the `swSrc` file, and the placeholder string
31
+ * `injectionPoint` determines where in the file the manifest should go.
32
+ *
33
+ * The final service worker file, with the manifest injected, is written to
34
+ * disk at `swDest`.
35
+ *
36
+ * This method will not compile or bundle your `swSrc` file; it just handles
37
+ * injecting the manifest.
38
+ *
39
+ * ```
40
+ * // The following lists some common options; see the rest of the documentation
41
+ * // for the full set of options and defaults.
42
+ * const {count, size, warnings} = await injectManifest({
43
+ * dontCacheBustURLsMatching: [new RegExp('...')],
44
+ * globDirectory: '...',
45
+ * globPatterns: ['...', '...'],
46
+ * maximumFileSizeToCacheInBytes: ...,
47
+ * swDest: '...',
48
+ * swSrc: '...',
49
+ * });
50
+ * ```
51
+ *
52
+ * @memberof workbox-build
53
+ */
54
+ async function injectManifest(config) {
55
+ const options = (0, validate_options_1.validateInjectManifestOptions)(config);
56
+ // Make sure we leave swSrc and swDest out of the precache manifest.
57
+ for (const file of [options.swSrc, options.swDest]) {
58
+ options.globIgnores.push((0, rebase_path_1.rebasePath)({
59
+ file,
60
+ baseDirectory: options.globDirectory,
61
+ }));
62
+ }
63
+ const globalRegexp = new RegExp((0, escape_regexp_1.escapeRegExp)(options.injectionPoint), 'g');
64
+ const { count, size, manifestEntries, warnings } = await (0, get_file_manifest_entries_1.getFileManifestEntries)(options);
65
+ let swFileContents;
66
+ try {
67
+ swFileContents = await fs_extra_1.default.readFile(options.swSrc, 'utf8');
68
+ }
69
+ catch (error) {
70
+ throw new Error(`${errors_1.errors['invalid-sw-src']} ${error instanceof Error && error.message ? error.message : ''}`);
71
+ }
72
+ const injectionResults = swFileContents.match(globalRegexp);
73
+ // See https://github.com/GoogleChrome/workbox/issues/2230
74
+ const injectionPoint = options.injectionPoint ? options.injectionPoint : '';
75
+ if (!injectionResults) {
76
+ if (upath_1.default.resolve(options.swSrc) === upath_1.default.resolve(options.swDest)) {
77
+ throw new Error(`${errors_1.errors['same-src-and-dest']} ${injectionPoint}`);
78
+ }
79
+ throw new Error(`${errors_1.errors['injection-point-not-found']} ${injectionPoint}`);
80
+ }
81
+ (0, assert_1.default)(injectionResults.length === 1, `${errors_1.errors['multiple-injection-points']} ${injectionPoint}`);
82
+ const manifestString = (0, fast_json_stable_stringify_1.default)(manifestEntries);
83
+ const filesToWrite = {};
84
+ const url = (0, get_source_map_url_1.getSourceMapURL)(swFileContents);
85
+ // See https://github.com/GoogleChrome/workbox/issues/2957
86
+ const { destPath, srcPath, warning } = (0, translate_url_to_sourcemap_paths_1.translateURLToSourcemapPaths)(url, options.swSrc, options.swDest);
87
+ if (warning) {
88
+ warnings.push(warning);
89
+ }
90
+ // If our swSrc file contains a sourcemap, we would invalidate that
91
+ // mapping if we just replaced injectionPoint with the stringified manifest.
92
+ // Instead, we need to update the swDest contents as well as the sourcemap
93
+ // (assuming it's a real file, not a data: URL) at the same time.
94
+ // See https://github.com/GoogleChrome/workbox/issues/2235
95
+ // and https://github.com/GoogleChrome/workbox/issues/2648
96
+ if (srcPath && destPath) {
97
+ const originalMap = (await fs_extra_1.default.readJSON(srcPath, {
98
+ encoding: 'utf8',
99
+ }));
100
+ const { map, source } = await (0, replace_and_update_source_map_1.replaceAndUpdateSourceMap)({
101
+ originalMap,
102
+ jsFilename: upath_1.default.basename(options.swDest),
103
+ originalSource: swFileContents,
104
+ replaceString: manifestString,
105
+ searchString: options.injectionPoint,
106
+ });
107
+ filesToWrite[options.swDest] = source;
108
+ filesToWrite[destPath] = map;
109
+ }
110
+ else {
111
+ // If there's no sourcemap associated with swSrc, a simple string
112
+ // replacement will suffice.
113
+ filesToWrite[options.swDest] = swFileContents.replace(globalRegexp, manifestString);
114
+ }
115
+ for (const [file, contents] of Object.entries(filesToWrite)) {
116
+ try {
117
+ await fs_extra_1.default.mkdirp(upath_1.default.dirname(file));
118
+ }
119
+ catch (error) {
120
+ throw new Error(errors_1.errors['unable-to-make-sw-directory'] +
121
+ ` '${error instanceof Error && error.message ? error.message : ''}'`);
122
+ }
123
+ await fs_extra_1.default.writeFile(file, contents);
124
+ }
125
+ return {
126
+ count,
127
+ size,
128
+ warnings,
129
+ // Use upath.resolve() to make all the paths absolute.
130
+ filePaths: Object.keys(filesToWrite).map((f) => upath_1.default.resolve(f)),
131
+ };
132
+ }
133
+ exports.injectManifest = injectManifest;
node_modules/workbox-build/build/lib/additional-manifest-entries-transform.d.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { ManifestEntry } from '../types';
2
+ type AdditionalManifestEntriesTransform = {
3
+ (manifest: Array<ManifestEntry & {
4
+ size: number;
5
+ }>): {
6
+ manifest: Array<ManifestEntry & {
7
+ size: number;
8
+ }>;
9
+ warnings: string[];
10
+ };
11
+ };
12
+ export declare function additionalManifestEntriesTransform(additionalManifestEntries: Array<ManifestEntry | string>): AdditionalManifestEntriesTransform;
13
+ export {};
node_modules/workbox-build/build/lib/additional-manifest-entries-transform.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ /*
3
+ Copyright 2019 Google LLC
4
+
5
+ Use of this source code is governed by an MIT-style
6
+ license that can be found in the LICENSE file or at
7
+ https://opensource.org/licenses/MIT.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.additionalManifestEntriesTransform = void 0;
11
+ const errors_1 = require("./errors");
12
+ function additionalManifestEntriesTransform(additionalManifestEntries) {
13
+ return (manifest) => {
14
+ const warnings = [];
15
+ const stringEntries = new Set();
16
+ for (const additionalEntry of additionalManifestEntries) {
17
+ // Warn about either a string or an object that lacks a revision property.
18
+ // (An object with a revision property set to null is okay.)
19
+ if (typeof additionalEntry === 'string') {
20
+ stringEntries.add(additionalEntry);
21
+ manifest.push({
22
+ revision: null,
23
+ size: 0,
24
+ url: additionalEntry,
25
+ });
26
+ }
27
+ else {
28
+ if (additionalEntry && additionalEntry.revision === undefined) {
29
+ stringEntries.add(additionalEntry.url);
30
+ }
31
+ manifest.push(Object.assign({ size: 0 }, additionalEntry));
32
+ }
33
+ }
34
+ if (stringEntries.size > 0) {
35
+ let urls = '\n';
36
+ for (const stringEntry of stringEntries) {
37
+ urls += ` - ${stringEntry}\n`;
38
+ }
39
+ warnings.push(errors_1.errors['string-entry-warning'] + urls);
40
+ }
41
+ return {
42
+ manifest,
43
+ warnings,
44
+ };
45
+ };
46
+ }
47
+ exports.additionalManifestEntriesTransform = additionalManifestEntriesTransform;
node_modules/workbox-build/build/lib/bundle.d.ts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import { GeneratePartial, RequiredSWDestPartial } from '../types';
2
+ interface NameAndContents {
3
+ contents: string | Uint8Array;
4
+ name: string;
5
+ }
6
+ export declare function bundle({ babelPresetEnvTargets, inlineWorkboxRuntime, mode, sourcemap, swDest, unbundledCode, }: Omit<GeneratePartial, 'runtimeCaching'> & RequiredSWDestPartial & {
7
+ unbundledCode: string;
8
+ }): Promise<Array<NameAndContents>>;
9
+ export {};