Updated 78 files via CloudCannon

This commit is contained in:
CloudCannon 2020-08-12 15:39:56 +00:00
parent 2a3d70ce1b
commit 0d62baecf8
78 changed files with 49 additions and 8526 deletions

View file

@ -124,7 +124,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -422,17 +422,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -421,17 +421,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -426,17 +426,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -606,17 +606,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -658,17 +658,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -688,17 +688,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -618,17 +618,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -618,17 +618,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -611,17 +611,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -677,17 +677,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -652,17 +652,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -648,17 +648,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -99,7 +99,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../../../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -629,17 +629,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -1,593 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.backgroundSync = (function (DBWrapper_mjs,WorkboxError_mjs,logger_mjs,assert_mjs,getFriendlyURL_mjs) {
'use strict';
try {
self.workbox.v['workbox:background-sync:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const serializableProperties = ['method', 'referrer', 'referrerPolicy', 'mode', 'credentials', 'cache', 'redirect', 'integrity', 'keepalive'];
/**
* A class to make it easier to serialize and de-serialize requests so they
* can be stored in IndexedDB.
*
* @private
*/
class StorableRequest {
/**
* Converts a Request object to a plain object that can be structured
* cloned or JSON-stringified.
*
* @param {Request} request
* @return {Promise<StorableRequest>}
*
* @private
*/
static fromRequest(request) {
return babelHelpers.asyncToGenerator(function* () {
const requestInit = { headers: {} };
// Set the body if present.
if (request.method !== 'GET') {
// Use blob to support non-text request bodies,
// and clone first in case the caller still needs the request.
requestInit.body = yield request.clone().blob();
}
// Convert the headers from an iterable to an object.
for (const [key, value] of request.headers.entries()) {
requestInit.headers[key] = value;
}
// Add all other serializable request properties
for (const prop of serializableProperties) {
if (request[prop] !== undefined) {
requestInit[prop] = request[prop];
}
}
return new StorableRequest({ url: request.url, requestInit });
})();
}
/**
* Accepts a URL and RequestInit dictionary that can be used to create a
* new Request object. A timestamp is also generated so consumers can
* reference when the object was created.
*
* @param {Object} param1
* @param {string} param1.url
* @param {Object} param1.requestInit
* See: https://fetch.spec.whatwg.org/#requestinit
* @param {number} param1.timestamp The time the request was created,
* defaulting to the current time if not specified.
*
* @private
*/
constructor({ url, requestInit, timestamp = Date.now() }) {
this.url = url;
this.requestInit = requestInit;
// "Private"
this._timestamp = timestamp;
}
/**
* Gets the private _timestamp property.
*
* @return {number}
*
* @private
*/
get timestamp() {
return this._timestamp;
}
/**
* Coverts this instance to a plain Object.
*
* @return {Object}
*
* @private
*/
toObject() {
return {
url: this.url,
timestamp: this.timestamp,
requestInit: this.requestInit
};
}
/**
* Converts this instance to a Request.
*
* @return {Request}
*
* @private
*/
toRequest() {
return new Request(this.url, this.requestInit);
}
/**
* Creates and returns a deep clone of the instance.
*
* @return {StorableRequest}
*
* @private
*/
clone() {
const requestInit = Object.assign({}, this.requestInit);
requestInit.headers = Object.assign({}, this.requestInit.headers);
if (this.requestInit.body) {
requestInit.body = this.requestInit.body.slice();
}
return new StorableRequest({
url: this.url,
timestamp: this.timestamp,
requestInit
});
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const DB_NAME = 'workbox-background-sync';
const OBJECT_STORE_NAME = 'requests';
const INDEXED_PROP = 'queueName';
const TAG_PREFIX = 'workbox-background-sync';
const MAX_RETENTION_TIME = 60 * 24 * 7; // 7 days in minutes
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* A class to manage storing requests from a Queue in IndexedbDB,
* indexed by their queue name for easier access.
*
* @private
*/
class QueueStore {
/**
* Associates this instance with a Queue instance, so entries added can be
* identified by their queue name.
*
* @param {Queue} queue
*
* @private
*/
constructor(queue) {
this._queue = queue;
this._db = new DBWrapper_mjs.DBWrapper(DB_NAME, 1, {
onupgradeneeded: evt => evt.target.result.createObjectStore(OBJECT_STORE_NAME, { autoIncrement: true }).createIndex(INDEXED_PROP, INDEXED_PROP, { unique: false })
});
}
/**
* Takes a StorableRequest instance, converts it to an object and adds it
* as an entry in the object store.
*
* @param {StorableRequest} storableRequest
*
* @private
*/
addEntry(storableRequest) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
yield _this._db.add(OBJECT_STORE_NAME, {
queueName: _this._queue.name,
storableRequest: storableRequest.toObject()
});
})();
}
/**
* Gets the oldest entry in the object store, removes it, and returns the
* value as a StorableRequest instance. If no entry exists, it returns
* undefined.
*
* @return {StorableRequest|undefined}
*
* @private
*/
getAndRemoveOldestEntry() {
var _this2 = this;
return babelHelpers.asyncToGenerator(function* () {
const [entry] = yield _this2._db.getAllMatching(OBJECT_STORE_NAME, {
index: INDEXED_PROP,
query: IDBKeyRange.only(_this2._queue.name),
count: 1,
includeKeys: true
});
if (entry) {
yield _this2._db.delete(OBJECT_STORE_NAME, entry.primaryKey);
return new StorableRequest(entry.value.storableRequest);
}
})();
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const queueNames = new Set();
/**
* A class to manage storing failed requests in IndexedDB and retrying them
* later. All parts of the storing and replaying process are observable via
* callbacks.
*
* @memberof workbox.backgroundSync
*/
class Queue {
/**
* Creates an instance of Queue with the given options
*
* @param {string} name The unique name for this queue. This name must be
* unique as it's used to register sync events and store requests
* in IndexedDB specific to this instance. An error will be thrown if
* a duplicate name is detected.
* @param {Object} [options]
* @param {Object} [options.callbacks] Callbacks to observe the lifecycle of
* queued requests. Use these to respond to or modify the requests
* during the replay process.
* @param {function(StorableRequest):undefined}
* [options.callbacks.requestWillEnqueue]
* Invoked immediately before the request is stored to IndexedDB. Use
* this callback to modify request data at store time.
* @param {function(StorableRequest):undefined}
* [options.callbacks.requestWillReplay]
* Invoked immediately before the request is re-fetched. Use this
* callback to modify request data at fetch time.
* @param {function(Array<StorableRequest>):undefined}
* [options.callbacks.queueDidReplay]
* Invoked after all requests in the queue have successfully replayed.
* @param {number} [options.maxRetentionTime = 7 days] The amount of time (in
* minutes) a request may be retried. After this amount of time has
* passed, the request will be deleted from the queue.
*/
constructor(name, {
callbacks = {},
maxRetentionTime = MAX_RETENTION_TIME
} = {}) {
// Ensure the store name is not already being used
if (queueNames.has(name)) {
throw new WorkboxError_mjs.WorkboxError('duplicate-queue-name', { name });
} else {
queueNames.add(name);
}
this._name = name;
this._callbacks = callbacks;
this._maxRetentionTime = maxRetentionTime;
this._queueStore = new QueueStore(this);
this._addSyncListener();
}
/**
* @return {string}
*/
get name() {
return this._name;
}
/**
* Stores the passed request into IndexedDB. The database used is
* `workbox-background-sync` and the object store name is the same as
* the name this instance was created with (to guarantee it's unique).
*
* @param {Request} request The request object to store.
*/
addRequest(request) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
{
assert_mjs.assert.isInstance(request, Request, {
moduleName: 'workbox-background-sync',
className: 'Queue',
funcName: 'addRequest',
paramName: 'request'
});
}
const storableRequest = yield StorableRequest.fromRequest(request.clone());
yield _this._runCallback('requestWillEnqueue', storableRequest);
yield _this._queueStore.addEntry(storableRequest);
yield _this._registerSync();
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}' has been
added to background sync queue '${_this._name}'.`);
}
})();
}
/**
* Retrieves all stored requests in IndexedDB and retries them. If the
* queue contained requests that were successfully replayed, the
* `queueDidReplay` callback is invoked (which implies the queue is
* now empty). If any of the requests fail, a new sync registration is
* created to retry again later.
*/
replayRequests() {
var _this2 = this;
return babelHelpers.asyncToGenerator(function* () {
const now = Date.now();
const replayedRequests = [];
const failedRequests = [];
let storableRequest;
while (storableRequest = yield _this2._queueStore.getAndRemoveOldestEntry()) {
// Make a copy so the unmodified request can be stored
// in the event of a replay failure.
const storableRequestClone = storableRequest.clone();
// Ignore requests older than maxRetentionTime.
const maxRetentionTimeInMs = _this2._maxRetentionTime * 60 * 1000;
if (now - storableRequest.timestamp > maxRetentionTimeInMs) {
continue;
}
yield _this2._runCallback('requestWillReplay', storableRequest);
const replay = { request: storableRequest.toRequest() };
try {
// Clone the request before fetching so callbacks get an unused one.
replay.response = yield fetch(replay.request.clone());
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'
has been replayed`);
}
} catch (err) {
{
logger_mjs.logger.log(`Request for '${getFriendlyURL_mjs.getFriendlyURL(storableRequest.url)}'
failed to replay`);
}
replay.error = err;
failedRequests.push(storableRequestClone);
}
replayedRequests.push(replay);
}
yield _this2._runCallback('queueDidReplay', replayedRequests);
// If any requests failed, put the failed requests back in the queue
// and rethrow the failed requests count.
if (failedRequests.length) {
yield Promise.all(failedRequests.map(function (storableRequest) {
return _this2._queueStore.addEntry(storableRequest);
}));
throw new WorkboxError_mjs.WorkboxError('queue-replay-failed', { name: _this2._name, count: failedRequests.length });
}
})();
}
/**
* Runs the passed callback if it exists.
*
* @private
* @param {string} name The name of the callback on this._callbacks.
* @param {...*} args The arguments to invoke the callback with.
*/
_runCallback(name, ...args) {
var _this3 = this;
return babelHelpers.asyncToGenerator(function* () {
if (typeof _this3._callbacks[name] === 'function') {
yield _this3._callbacks[name].apply(null, args);
}
})();
}
/**
* In sync-supporting browsers, this adds a listener for the sync event.
* In non-sync-supporting browsers, this will retry the queue on service
* worker startup.
*
* @private
*/
_addSyncListener() {
if ('sync' in registration) {
self.addEventListener('sync', event => {
if (event.tag === `${TAG_PREFIX}:${this._name}`) {
{
logger_mjs.logger.log(`Background sync for tag '${event.tag}'
has been received, starting replay now`);
}
event.waitUntil(this.replayRequests());
}
});
} else {
{
logger_mjs.logger.log(`Background sync replaying without background sync event`);
}
// If the browser doesn't support background sync, retry
// every time the service worker starts up as a fallback.
this.replayRequests();
}
}
/**
* Registers a sync event with a tag unique to this instance.
*
* @private
*/
_registerSync() {
var _this4 = this;
return babelHelpers.asyncToGenerator(function* () {
if ('sync' in registration) {
try {
yield registration.sync.register(`${TAG_PREFIX}:${_this4._name}`);
} catch (err) {
// This means the registration failed for some reason, possibly due to
// the user disabling it.
{
logger_mjs.logger.warn(`Unable to register sync event for '${_this4._name}'.`, err);
}
}
}
})();
}
/**
* Returns the set of queue names. This is primarily used to reset the list
* of queue names in tests.
*
* @return {Set}
*
* @private
*/
static get _queueNames() {
return queueNames;
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* A class implementing the `fetchDidFail` lifecycle callback. This makes it
* easier to add failed requests to a background sync Queue.
*
* @memberof workbox.backgroundSync
*/
class Plugin {
/**
* @param {...*} queueArgs Args to forward to the composed Queue instance.
* See the [Queue]{@link workbox.backgroundSync.Queue} documentation for
* parameter details.
*/
constructor(...queueArgs) {
this._queue = new Queue(...queueArgs);
this.fetchDidFail = this.fetchDidFail.bind(this);
}
/**
* @param {Object} options
* @param {Request} options.request
* @private
*/
fetchDidFail({ request }) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
yield _this._queue.addRequest(request);
})();
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var publicAPI = /*#__PURE__*/Object.freeze({
Queue: Queue,
Plugin: Plugin
});
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
return publicAPI;
}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-background-sync.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){"use strict";try{self.workbox.v["workbox:background-sync:3.6.3"]=1}catch(e){}const r=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};"GET"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const e=Object.assign({},this.requestInit);return e.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(e.body=this.requestInit.body.slice()),new s({url:this.url,timestamp:this.timestamp,requestInit:e})}}const i="workbox-background-sync",n="requests",u="queueName",c="workbox-background-sync",o=10080;class l{constructor(t){this.t=t,this.r=new e.DBWrapper(i,1,{onupgradeneeded:e=>e.target.result.createObjectStore(n,{autoIncrement:!0}).createIndex(u,u,{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add(n,{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching(n,{index:u,query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete(n,t.primaryKey),new s(t.value.storableRequest)})()}}const a=new Set;class h{constructor(e,{callbacks:r={},maxRetentionTime:s=o}={}){if(a.has(e))throw new t.WorkboxError("duplicate-queue-name",{name:e});a.add(e),this.s=e,this.i=r,this.n=s,this.u=new l(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.o("requestWillEnqueue",r),yield t.u.addEntry(r),yield t.l()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const r=Date.now(),s=[],i=[];let n;for(;n=yield e.u.getAndRemoveOldestEntry();){const t=n.clone(),u=60*e.n*1e3;if(r-n.timestamp>u)continue;yield e.o("requestWillReplay",n);const c={request:n.toRequest()};try{c.response=yield fetch(c.request.clone())}catch(e){c.error=e,i.push(t)}s.push(c)}if(yield e.o("queueDidReplay",s),i.length)throw yield Promise.all(i.map(function(t){return e.u.addEntry(t)})),new t.WorkboxError("queue-replay-failed",{name:e.s,count:i.length})})()}o(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){"function"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){"sync"in registration?self.addEventListener("sync",e=>{e.tag===`${c}:${this.s}`&&e.waitUntil(this.replayRequests())}):this.replayRequests()}l(){var e=this;return babelHelpers.asyncToGenerator(function*(){if("sync"in registration)try{yield registration.sync.register(`${c}:${e.s}`)}catch(e){}})()}static get a(){return a}}return Object.freeze({Queue:h,Plugin:class{constructor(...e){this.t=new h(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}})}(workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-background-sync.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-background-sync/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.backgroundSync=function(e,t){\"use strict\";try{self.workbox.v[\"workbox:background-sync:3.6.3\"]=1}catch(e){}const r=[\"method\",\"referrer\",\"referrerPolicy\",\"mode\",\"credentials\",\"cache\",\"redirect\",\"integrity\",\"keepalive\"];class s{static fromRequest(e){return babelHelpers.asyncToGenerator(function*(){const t={headers:{}};\"GET\"!==e.method&&(t.body=yield e.clone().blob());for(const[r,s]of e.headers.entries())t.headers[r]=s;for(const s of r)void 0!==e[s]&&(t[s]=e[s]);return new s({url:e.url,requestInit:t})})()}constructor({url:e,requestInit:t,timestamp:r=Date.now()}){this.url=e,this.requestInit=t,this.e=r}get timestamp(){return this.e}toObject(){return{url:this.url,timestamp:this.timestamp,requestInit:this.requestInit}}toRequest(){return new Request(this.url,this.requestInit)}clone(){const e=Object.assign({},this.requestInit);return e.headers=Object.assign({},this.requestInit.headers),this.requestInit.body&&(e.body=this.requestInit.body.slice()),new s({url:this.url,timestamp:this.timestamp,requestInit:e})}}const i=\"workbox-background-sync\",n=\"requests\",u=\"queueName\",c=\"workbox-background-sync\",o=10080;class l{constructor(t){this.t=t,this.r=new e.DBWrapper(i,1,{onupgradeneeded:e=>e.target.result.createObjectStore(n,{autoIncrement:!0}).createIndex(u,u,{unique:!1})})}addEntry(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.add(n,{queueName:t.t.name,storableRequest:e.toObject()})})()}getAndRemoveOldestEntry(){var e=this;return babelHelpers.asyncToGenerator(function*(){const[t]=yield e.r.getAllMatching(n,{index:u,query:IDBKeyRange.only(e.t.name),count:1,includeKeys:!0});if(t)return yield e.r.delete(n,t.primaryKey),new s(t.value.storableRequest)})()}}const a=new Set;class h{constructor(e,{callbacks:r={},maxRetentionTime:s=o}={}){if(a.has(e))throw new t.WorkboxError(\"duplicate-queue-name\",{name:e});a.add(e),this.s=e,this.i=r,this.n=s,this.u=new l(this),this.c()}get name(){return this.s}addRequest(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield s.fromRequest(e.clone());yield t.o(\"requestWillEnqueue\",r),yield t.u.addEntry(r),yield t.l()})()}replayRequests(){var e=this;return babelHelpers.asyncToGenerator(function*(){const r=Date.now(),s=[],i=[];let n;for(;n=yield e.u.getAndRemoveOldestEntry();){const t=n.clone(),u=60*e.n*1e3;if(r-n.timestamp>u)continue;yield e.o(\"requestWillReplay\",n);const c={request:n.toRequest()};try{c.response=yield fetch(c.request.clone())}catch(e){c.error=e,i.push(t)}s.push(c)}if(yield e.o(\"queueDidReplay\",s),i.length)throw yield Promise.all(i.map(function(t){return e.u.addEntry(t)})),new t.WorkboxError(\"queue-replay-failed\",{name:e.s,count:i.length})})()}o(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){\"function\"==typeof r.i[e]&&(yield r.i[e].apply(null,t))})()}c(){\"sync\"in registration?self.addEventListener(\"sync\",e=>{e.tag===`${c}:${this.s}`&&e.waitUntil(this.replayRequests())}):this.replayRequests()}l(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(\"sync\"in registration)try{yield registration.sync.register(`${c}:${e.s}`)}catch(e){}})()}static get a(){return a}}return Object.freeze({Queue:h,Plugin:class{constructor(...e){this.t=new h(...e),this.fetchDidFail=this.fetchDidFail.bind(this)}fetchDidFail({request:e}){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.t.addRequest(e)})()}}})}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-background-sync.prod.js"}

View file

@ -1,395 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.broadcastUpdate = (function (exports,WorkboxError_mjs,logger_mjs,assert_mjs) {
'use strict';
try {
self.workbox.v['workbox:broadcast-cache-update:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Given two `Response's`, compares several header values to see if they are
* the same or not.
*
* @param {Response} firstResponse
* @param {Response} secondResponse
* @param {Array<string>} headersToCheck
* @return {boolean}
*
* @memberof workbox.broadcastUpdate
* @private
*/
const responsesAreSame = (firstResponse, secondResponse, headersToCheck) => {
{
if (!(firstResponse instanceof Response && secondResponse instanceof Response)) {
throw new WorkboxError_mjs.WorkboxError('invalid-responses-are-same-args');
}
}
const atLeastOneHeaderAvailable = headersToCheck.some(header => {
return firstResponse.headers.has(header) && secondResponse.headers.has(header);
});
if (!atLeastOneHeaderAvailable) {
{
logger_mjs.logger.warn(`Unable to determine where the response has been updated ` + `because none of the headers that would be checked are present.`);
logger_mjs.logger.debug(`Attempting to compare the following: `, firstResponse, secondResponse, headersToCheck);
}
// Just return true, indicating the that responses are the same, since we
// can't determine otherwise.
return true;
}
return headersToCheck.every(header => {
const headerStateComparison = firstResponse.headers.has(header) === secondResponse.headers.has(header);
const headerValueComparison = firstResponse.headers.get(header) === secondResponse.headers.get(header);
return headerStateComparison && headerValueComparison;
});
};
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var messageTypes = {
CACHE_UPDATED: 'CACHE_UPDATED'
};
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* You would not normally call this method directly; it's called automatically
* by an instance of the {@link BroadcastCacheUpdate} class. It's exposed here
* for the benefit of developers who would rather not use the full
* `BroadcastCacheUpdate` implementation.
*
* Calling this will dispatch a message on the provided
* {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel}
* to notify interested subscribers about a change to a cached resource.
*
* The message that's posted has a formation inspired by the
* [Flux standard action](https://github.com/acdlite/flux-standard-action#introduction)
* format like so:
*
* ```
* {
* type: 'CACHE_UPDATED',
* meta: 'workbox-broadcast-cache-update',
* payload: {
* cacheName: 'the-cache-name',
* updatedUrl: 'https://example.com/'
* }
* }
* ```
*
* (Usage of [Flux](https://facebook.github.io/flux/) itself is not at
* all required.)
*
* @param {BroadcastChannel} channel The `BroadcastChannel` to use.
* @param {string} cacheName The name of the cache in which the updated
* `Response` was stored.
* @param {string} url The URL associated with the updated `Response`.
* @param {string} source A string identifying this library as the source
* of the update message.
*
* @memberof workbox.broadcastUpdate
*/
const broadcastUpdate = (channel, cacheName, url, source) => {
// There are browsers which support service workers but don't support the
// Broadcast Channel API.
// See https://github.com/GoogleChrome/workbox/issues/1304
if (!('BroadcastChannel' in self && channel)) {
{
logger_mjs.logger.debug(`${url} was updated, but the Broadcast Channel API is not ` + `available in the current browser.`);
}
return;
}
{
assert_mjs.assert.isInstance(channel, BroadcastChannel, {
moduleName: 'workbox-broadcast-cache-update',
className: '~',
funcName: 'broadcastUpdate',
paramName: 'channel'
});
assert_mjs.assert.isType(cacheName, 'string', {
moduleName: 'workbox-broadcast-cache-update',
className: '~',
funcName: 'broadcastUpdate',
paramName: 'cacheName'
});
assert_mjs.assert.isType(url, 'string', {
moduleName: 'workbox-broadcast-cache-update',
className: '~',
funcName: 'broadcastUpdate',
paramName: 'url'
});
assert_mjs.assert.isType(source, 'string', {
moduleName: 'workbox-broadcast-cache-update',
className: '~',
funcName: 'broadcastUpdate',
paramName: 'source'
});
}
channel.postMessage({
type: messageTypes.CACHE_UPDATED,
meta: source,
payload: {
cacheName: cacheName,
updatedUrl: url
}
});
};
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Uses the [Broadcast Channel API]{@link https://developers.google.com/web/updates/2016/09/broadcastchannel}
* to notify interested parties when a cached response has been updated.
*
* For efficiency's sake, the underlying response bodies are not compared;
* only specific response headers are checked.
*
* @memberof workbox.broadcastUpdate
*/
class BroadcastCacheUpdate {
/**
* Construct a BroadcastCacheUpdate instance with a specific `channelName` to
* broadcast messages on
*
* @param {string} channelName The name that will be used when creating
* the `BroadcastChannel`.
* @param {Object} options
* @param {Array<string>}
* [options.headersToCheck=['content-length', 'etag', 'last-modified']] A
* list of headers that will be used to determine whether the responses
* differ.
* @param {string} [options.source='workbox-broadcast-cache-update'] An
* attribution value that indicates where the update originated.
*/
constructor(channelName, { headersToCheck, source } = {}) {
{
if (typeof channelName !== 'string' || channelName.length === 0) {
throw new WorkboxError_mjs.WorkboxError('channel-name-required');
}
}
this._channelName = channelName;
this._headersToCheck = headersToCheck || ['content-length', 'etag', 'last-modified'];
this._source = source || 'workbox-broadcast-cache-update';
// TODO assert typeof headersToCheck instanceof Array
}
/**
* @return {BroadcastChannel|undefined} The BroadcastChannel instance used for
* broadcasting updates, or undefined if the browser doesn't support the
* Broadcast Channel API.
*
* @private
*/
_getChannel() {
if ('BroadcastChannel' in self && !this._channel) {
this._channel = new BroadcastChannel(this._channelName);
}
return this._channel;
}
/**
* Compare two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)
* and send a message via the
* {@link https://developers.google.com/web/updates/2016/09/broadcastchannel|Broadcast Channel API}
* if they differ.
*
* Neither of the Responses can be {@link http://stackoverflow.com/questions/39109789|opaque}.
*
* @param {Response} firstResponse First responses to compare.
* @param {Response} secondResponse Second responses to compare.
* @param {string} url The URL of the updated request.
* @param {string} cacheName Name of the cache the responses belong to.
* This is included in the message posted on the broadcast channel.
*/
notifyIfUpdated(firstResponse, secondResponse, url, cacheName) {
if (!responsesAreSame(firstResponse, secondResponse, this._headersToCheck)) {
broadcastUpdate(this._getChannel(), cacheName, url, this._source);
}
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* This plugin will automatically broadcast a message whenever a cached response
* is updated.
*
* @memberof workbox.broadcastUpdate
*/
class Plugin {
/**
* Construct a new instance with a specific `channelName` to
* broadcast messages on
*
* @param {string} channelName The name that will be used when creating
* the `BroadcastChannel`.
* @param {Object} options
* @param {Array<string>}
* [options.headersToCheck=['content-length', 'etag', 'last-modified']] A
* list of headers that will be used to determine whether the responses
* differ.
* @param {string} [options.source='workbox-broadcast-cache-update'] An
* attribution value that indicates where the update originated.
*/
constructor(channelName, options) {
this._broadcastUpdate = new BroadcastCacheUpdate(channelName, options);
}
/**
* A "lifecycle" callback that will be triggered automatically by the
* `workbox-sw` and `workbox-runtime-caching` handlers when an entry is
* added to a cache.
*
* @private
* @param {Object} options The input object to this function.
* @param {string} options.cacheName Name of the cache being updated.
* @param {Response} [options.oldResponse] The previous cached value, if any.
* @param {Response} options.newResponse The new value in the cache.
*/
cacheDidUpdate({ cacheName, oldResponse, newResponse, request }) {
{
assert_mjs.assert.isType(cacheName, 'string', {
moduleName: 'workbox-broadcast-cache-update',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'cacheName'
});
assert_mjs.assert.isInstance(newResponse, Response, {
moduleName: 'workbox-broadcast-cache-update',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'newResponse'
});
assert_mjs.assert.isInstance(request, Request, {
moduleName: 'workbox-broadcast-cache-update',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'request'
});
}
if (!oldResponse) {
// Without a two responses there is nothing to compare.
return;
}
this._broadcastUpdate.notifyIfUpdated(oldResponse, newResponse, request.url, cacheName);
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.BroadcastCacheUpdate = BroadcastCacheUpdate;
exports.Plugin = Plugin;
exports.broadcastUpdate = broadcastUpdate;
exports.messageTypes = messageTypes;
return exports;
}({},workbox.core._private,workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-broadcast-cache-update.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t){"use strict";try{self.workbox.v["workbox:broadcast-cache-update:3.6.3"]=1}catch(t){}const e=(t,e,s)=>{return!s.some(s=>t.headers.has(s)&&e.headers.has(s))||s.every(s=>{const a=t.headers.has(s)===e.headers.has(s),n=t.headers.get(s)===e.headers.get(s);return a&&n})};var s={CACHE_UPDATED:"CACHE_UPDATED"};const a=(t,e,a,n)=>{"BroadcastChannel"in self&&t&&t.postMessage({type:s.CACHE_UPDATED,meta:n,payload:{cacheName:e,updatedUrl:a}})};class n{constructor(t,{headersToCheck:e,source:s}={}){this.t=t,this.e=e||["content-length","etag","last-modified"],this.s=s||"workbox-broadcast-cache-update"}a(){return"BroadcastChannel"in self&&!this.n&&(this.n=new BroadcastChannel(this.t)),this.n}notifyIfUpdated(t,s,n,c){e(t,s,this.e)||a(this.a(),c,n,this.s)}}return t.BroadcastCacheUpdate=n,t.Plugin=class{constructor(t,e){this.c=new n(t,e)}cacheDidUpdate({cacheName:t,oldResponse:e,newResponse:s,request:a}){e&&this.c.notifyIfUpdated(e,s,a.url,t)}},t.broadcastUpdate=a,t.messageTypes=s,t}({});
//# sourceMappingURL=workbox-broadcast-cache-update.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-broadcast-cache-update/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.broadcastUpdate=function(t){\"use strict\";try{self.workbox.v[\"workbox:broadcast-cache-update:3.6.3\"]=1}catch(t){}const e=(t,e,s)=>{return!s.some(s=>t.headers.has(s)&&e.headers.has(s))||s.every(s=>{const a=t.headers.has(s)===e.headers.has(s),n=t.headers.get(s)===e.headers.get(s);return a&&n})};var s={CACHE_UPDATED:\"CACHE_UPDATED\"};const a=(t,e,a,n)=>{\"BroadcastChannel\"in self&&t&&t.postMessage({type:s.CACHE_UPDATED,meta:n,payload:{cacheName:e,updatedUrl:a}})};class n{constructor(t,{headersToCheck:e,source:s}={}){this.t=t,this.e=e||[\"content-length\",\"etag\",\"last-modified\"],this.s=s||\"workbox-broadcast-cache-update\"}a(){return\"BroadcastChannel\"in self&&!this.n&&(this.n=new BroadcastChannel(this.t)),this.n}notifyIfUpdated(t,s,n,c){e(t,s,this.e)||a(this.a(),c,n,this.s)}}return t.BroadcastCacheUpdate=n,t.Plugin=class{constructor(t,e){this.c=new n(t,e)}cacheDidUpdate({cacheName:t,oldResponse:e,newResponse:s,request:a}){e&&this.c.notifyIfUpdated(e,s,a.url,t)}},t.broadcastUpdate=a,t.messageTypes=s,t}({});\n"],"file":"workbox-broadcast-cache-update.prod.js"}

View file

@ -1,740 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.expiration = (function (exports,DBWrapper_mjs,WorkboxError_mjs,assert_mjs,logger_mjs,cacheNames_mjs,index_mjs) {
'use strict';
try {
self.workbox.v['workbox:cache-expiration:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const URL_KEY = 'url';
const TIMESTAMP_KEY = 'timestamp';
/**
* Returns the timestamp model.
*
* @private
*/
class CacheTimestampsModel {
/**
*
* @param {string} cacheName
*
* @private
*/
constructor(cacheName) {
// TODO Check cacheName
this._cacheName = cacheName;
this._storeName = cacheName;
this._db = new DBWrapper_mjs.DBWrapper(this._cacheName, 2, {
onupgradeneeded: evt => this._handleUpgrade(evt)
});
}
/**
* Should perform an upgrade of indexedDB.
*
* @param {Event} evt
*
* @private
*/
_handleUpgrade(evt) {
const db = evt.target.result;
if (evt.oldVersion < 2) {
// Remove old databases.
if (db.objectStoreNames.contains('workbox-cache-expiration')) {
db.deleteObjectStore('workbox-cache-expiration');
}
}
db.createObjectStore(this._storeName, { keyPath: URL_KEY }).createIndex(TIMESTAMP_KEY, TIMESTAMP_KEY, { unique: false });
}
/**
* @param {string} url
* @param {number} timestamp
*
* @private
*/
setTimestamp(url, timestamp) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
yield _this._db.put(_this._storeName, {
[URL_KEY]: new URL(url, location).href,
[TIMESTAMP_KEY]: timestamp
});
})();
}
/**
* Get all of the timestamps in the indexedDB.
*
* @return {Array<Objects>}
*
* @private
*/
getAllTimestamps() {
var _this2 = this;
return babelHelpers.asyncToGenerator(function* () {
return yield _this2._db.getAllMatching(_this2._storeName, {
index: TIMESTAMP_KEY
});
})();
}
/**
* Returns the timestamp stored for a given URL.
*
* @param {string} url
* @return {number}
*
* @private
*/
getTimestamp(url) {
var _this3 = this;
return babelHelpers.asyncToGenerator(function* () {
const timestampObject = yield _this3._db.get(_this3._storeName, url);
return timestampObject.timestamp;
})();
}
/**
* @param {string} url
*
* @private
*/
deleteUrl(url) {
var _this4 = this;
return babelHelpers.asyncToGenerator(function* () {
yield _this4._db.delete(_this4._storeName, new URL(url, location).href);
})();
}
/**
* Removes the underlying IndexedDB object store entirely.
*/
delete() {
var _this5 = this;
return babelHelpers.asyncToGenerator(function* () {
yield _this5._db.deleteDatabase();
_this5._db = null;
})();
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* The `CacheExpiration` class allows you define an expiration and / or
* limit on the number of responses stored in a
* [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache).
*
* @memberof workbox.expiration
*/
class CacheExpiration {
/**
* To construct a new CacheExpiration instance you must provide at least
* one of the `config` properties.
*
* @param {string} cacheName Name of the cache to apply restrictions to.
* @param {Object} config
* @param {number} [config.maxEntries] The maximum number of entries to cache.
* Entries used the least will be removed as the maximum is reached.
* @param {number} [config.maxAgeSeconds] The maximum age of an entry before
* it's treated as stale and removed.
*/
constructor(cacheName, config = {}) {
{
assert_mjs.assert.isType(cacheName, 'string', {
moduleName: 'workbox-cache-expiration',
className: 'CacheExpiration',
funcName: 'constructor',
paramName: 'cacheName'
});
if (!(config.maxEntries || config.maxAgeSeconds)) {
throw new WorkboxError_mjs.WorkboxError('max-entries-or-age-required', {
moduleName: 'workbox-cache-expiration',
className: 'CacheExpiration',
funcName: 'constructor'
});
}
if (config.maxEntries) {
assert_mjs.assert.isType(config.maxEntries, 'number', {
moduleName: 'workbox-cache-expiration',
className: 'CacheExpiration',
funcName: 'constructor',
paramName: 'config.maxEntries'
});
// TODO: Assert is positive
}
if (config.maxAgeSeconds) {
assert_mjs.assert.isType(config.maxAgeSeconds, 'number', {
moduleName: 'workbox-cache-expiration',
className: 'CacheExpiration',
funcName: 'constructor',
paramName: 'config.maxAgeSeconds'
});
// TODO: Assert is positive
}
}
this._isRunning = false;
this._rerunRequested = false;
this._maxEntries = config.maxEntries;
this._maxAgeSeconds = config.maxAgeSeconds;
this._cacheName = cacheName;
this._timestampModel = new CacheTimestampsModel(cacheName);
}
/**
* Expires entries for the given cache and given criteria.
*/
expireEntries() {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
if (_this._isRunning) {
_this._rerunRequested = true;
return;
}
_this._isRunning = true;
const now = Date.now();
// First, expire old entries, if maxAgeSeconds is set.
const oldEntries = yield _this._findOldEntries(now);
// Once that's done, check for the maximum size.
const extraEntries = yield _this._findExtraEntries();
// Use a Set to remove any duplicates following the concatenation, then
// convert back into an array.
const allUrls = [...new Set(oldEntries.concat(extraEntries))];
yield Promise.all([_this._deleteFromCache(allUrls), _this._deleteFromIDB(allUrls)]);
{
// TODO: break apart entries deleted due to expiration vs size restraints
if (allUrls.length > 0) {
logger_mjs.logger.groupCollapsed(`Expired ${allUrls.length} ` + `${allUrls.length === 1 ? 'entry' : 'entries'} and removed ` + `${allUrls.length === 1 ? 'it' : 'them'} from the ` + `'${_this._cacheName}' cache.`);
logger_mjs.logger.log(`Expired the following ${allUrls.length === 1 ? 'URL' : 'URLs'}:`);
allUrls.forEach(function (url) {
return logger_mjs.logger.log(` ${url}`);
});
logger_mjs.logger.groupEnd();
} else {
logger_mjs.logger.debug(`Cache expiration ran and found no entries to remove.`);
}
}
_this._isRunning = false;
if (_this._rerunRequested) {
_this._rerunRequested = false;
_this.expireEntries();
}
})();
}
/**
* Expires entries based on the maximum age.
*
* @param {number} expireFromTimestamp A timestamp.
* @return {Promise<Array<string>>} A list of the URLs that were expired.
*
* @private
*/
_findOldEntries(expireFromTimestamp) {
var _this2 = this;
return babelHelpers.asyncToGenerator(function* () {
{
assert_mjs.assert.isType(expireFromTimestamp, 'number', {
moduleName: 'workbox-cache-expiration',
className: 'CacheExpiration',
funcName: '_findOldEntries',
paramName: 'expireFromTimestamp'
});
}
if (!_this2._maxAgeSeconds) {
return [];
}
const expireOlderThan = expireFromTimestamp - _this2._maxAgeSeconds * 1000;
const timestamps = yield _this2._timestampModel.getAllTimestamps();
const expiredUrls = [];
timestamps.forEach(function (timestampDetails) {
if (timestampDetails.timestamp < expireOlderThan) {
expiredUrls.push(timestampDetails.url);
}
});
return expiredUrls;
})();
}
/**
* @return {Promise<Array>}
*
* @private
*/
_findExtraEntries() {
var _this3 = this;
return babelHelpers.asyncToGenerator(function* () {
const extraUrls = [];
if (!_this3._maxEntries) {
return [];
}
const timestamps = yield _this3._timestampModel.getAllTimestamps();
while (timestamps.length > _this3._maxEntries) {
const lastUsed = timestamps.shift();
extraUrls.push(lastUsed.url);
}
return extraUrls;
})();
}
/**
* @param {Array<string>} urls Array of URLs to delete from cache.
*
* @private
*/
_deleteFromCache(urls) {
var _this4 = this;
return babelHelpers.asyncToGenerator(function* () {
const cache = yield caches.open(_this4._cacheName);
for (const url of urls) {
yield cache.delete(url);
}
})();
}
/**
* @param {Array<string>} urls Array of URLs to delete from IDB
*
* @private
*/
_deleteFromIDB(urls) {
var _this5 = this;
return babelHelpers.asyncToGenerator(function* () {
for (const url of urls) {
yield _this5._timestampModel.deleteUrl(url);
}
})();
}
/**
* Update the timestamp for the given URL. This ensures the when
* removing entries based on maximum entries, most recently used
* is accurate or when expiring, the timestamp is up-to-date.
*
* @param {string} url
*/
updateTimestamp(url) {
var _this6 = this;
return babelHelpers.asyncToGenerator(function* () {
{
assert_mjs.assert.isType(url, 'string', {
moduleName: 'workbox-cache-expiration',
className: 'CacheExpiration',
funcName: 'updateTimestamp',
paramName: 'url'
});
}
const urlObject = new URL(url, location);
urlObject.hash = '';
yield _this6._timestampModel.setTimestamp(urlObject.href, Date.now());
})();
}
/**
* Can be used to check if a URL has expired or not before it's used.
*
* This requires a look up from IndexedDB, so can be slow.
*
* Note: This method will not remove the cached entry, call
* `expireEntries()` to remove indexedDB and Cache entries.
*
* @param {string} url
* @return {boolean}
*/
isURLExpired(url) {
var _this7 = this;
return babelHelpers.asyncToGenerator(function* () {
if (!_this7._maxAgeSeconds) {
throw new WorkboxError_mjs.WorkboxError(`expired-test-without-max-age`, {
methodName: 'isURLExpired',
paramName: 'maxAgeSeconds'
});
}
const urlObject = new URL(url, location);
urlObject.hash = '';
const timestamp = yield _this7._timestampModel.getTimestamp(urlObject.href);
const expireOlderThan = Date.now() - _this7._maxAgeSeconds * 1000;
return timestamp < expireOlderThan;
})();
}
/**
* Removes the IndexedDB object store used to keep track of cache expiration
* metadata.
*/
delete() {
var _this8 = this;
return babelHelpers.asyncToGenerator(function* () {
// Make sure we don't attempt another rerun if we're called in the middle of
// a cache expiration.
_this8._rerunRequested = false;
yield _this8._timestampModel.delete();
})();
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* This plugin can be used in the Workbox APIs to regularly enforce a
* limit on the age and / or the number of cached requests.
*
* Whenever a cached request is used or updated, this plugin will look
* at the used Cache and remove any old or extra requests.
*
* When using `maxAgeSeconds`, requests may be used *once* after expiring
* because the expiration clean up will not have occurred until *after* the
* cached request has been used. If the request has a "Date" header, then
* a light weight expiration check is performed and the request will not be
* used immediately.
*
* When using `maxEntries`, the last request to be used will be the request
* that is removed from the Cache.
*
* @memberof workbox.expiration
*/
class Plugin {
/**
* @param {Object} config
* @param {number} [config.maxEntries] The maximum number of entries to cache.
* Entries used the least will be removed as the maximum is reached.
* @param {number} [config.maxAgeSeconds] The maximum age of an entry before
* it's treated as stale and removed.
* @param {boolean} [config.purgeOnQuotaError] Whether to opt this cache in to
* automatic deletion if the available storage quota has been exceeded.
*/
constructor(config = {}) {
{
if (!(config.maxEntries || config.maxAgeSeconds)) {
throw new WorkboxError_mjs.WorkboxError('max-entries-or-age-required', {
moduleName: 'workbox-cache-expiration',
className: 'Plugin',
funcName: 'constructor'
});
}
if (config.maxEntries) {
assert_mjs.assert.isType(config.maxEntries, 'number', {
moduleName: 'workbox-cache-expiration',
className: 'Plugin',
funcName: 'constructor',
paramName: 'config.maxEntries'
});
}
if (config.maxAgeSeconds) {
assert_mjs.assert.isType(config.maxAgeSeconds, 'number', {
moduleName: 'workbox-cache-expiration',
className: 'Plugin',
funcName: 'constructor',
paramName: 'config.maxAgeSeconds'
});
}
}
this._config = config;
this._maxAgeSeconds = config.maxAgeSeconds;
this._cacheExpirations = new Map();
if (config.purgeOnQuotaError) {
index_mjs.registerQuotaErrorCallback(() => this.deleteCacheAndMetadata());
}
}
/**
* A simple helper method to return a CacheExpiration instance for a given
* cache name.
*
* @param {string} cacheName
* @return {CacheExpiration}
*
* @private
*/
_getCacheExpiration(cacheName) {
if (cacheName === cacheNames_mjs.cacheNames.getRuntimeName()) {
throw new WorkboxError_mjs.WorkboxError('expire-custom-caches-only');
}
let cacheExpiration = this._cacheExpirations.get(cacheName);
if (!cacheExpiration) {
cacheExpiration = new CacheExpiration(cacheName, this._config);
this._cacheExpirations.set(cacheName, cacheExpiration);
}
return cacheExpiration;
}
/**
* A "lifecycle" callback that will be triggered automatically by the
* `workbox.runtimeCaching` handlers when a `Response` is about to be returned
* from a [Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache) to
* the handler. It allows the `Response` to be inspected for freshness and
* prevents it from being used if the `Response`'s `Date` header value is
* older than the configured `maxAgeSeconds`.
*
* @param {Object} options
* @param {string} options.cacheName Name of the cache the response is in.
* @param {Response} options.cachedResponse The `Response` object that's been
* read from a cache and whose freshness should be checked.
* @return {Response} Either the `cachedResponse`, if it's
* fresh, or `null` if the `Response` is older than `maxAgeSeconds`.
*
* @private
*/
cachedResponseWillBeUsed({ cacheName, cachedResponse }) {
if (!cachedResponse) {
return null;
}
let isFresh = this._isResponseDateFresh(cachedResponse);
// Expire entries to ensure that even if the expiration date has
// expired, it'll only be used once.
const cacheExpiration = this._getCacheExpiration(cacheName);
cacheExpiration.expireEntries();
return isFresh ? cachedResponse : null;
}
/**
* @param {Response} cachedResponse
* @return {boolean}
*
* @private
*/
_isResponseDateFresh(cachedResponse) {
if (!this._maxAgeSeconds) {
// We aren't expiring by age, so return true, it's fresh
return true;
}
// Check if the 'date' header will suffice a quick expiration check.
// See https://github.com/GoogleChromeLabs/sw-toolbox/issues/164 for
// discussion.
const dateHeaderTimestamp = this._getDateHeaderTimestamp(cachedResponse);
if (dateHeaderTimestamp === null) {
// Unable to parse date, so assume it's fresh.
return true;
}
// If we have a valid headerTime, then our response is fresh iff the
// headerTime plus maxAgeSeconds is greater than the current time.
const now = Date.now();
return dateHeaderTimestamp >= now - this._maxAgeSeconds * 1000;
}
/**
* This method will extract the data header and parse it into a useful
* value.
*
* @param {Response} cachedResponse
* @return {number}
*
* @private
*/
_getDateHeaderTimestamp(cachedResponse) {
if (!cachedResponse.headers.has('date')) {
return null;
}
const dateHeader = cachedResponse.headers.get('date');
const parsedDate = new Date(dateHeader);
const headerTime = parsedDate.getTime();
// If the Date header was invalid for some reason, parsedDate.getTime()
// will return NaN.
if (isNaN(headerTime)) {
return null;
}
return headerTime;
}
/**
* A "lifecycle" callback that will be triggered automatically by the
* `workbox.runtimeCaching` handlers when an entry is added to a cache.
*
* @param {Object} options
* @param {string} options.cacheName Name of the cache that was updated.
* @param {string} options.request The Request for the cached entry.
*
* @private
*/
cacheDidUpdate({ cacheName, request }) {
var _this = this;
return babelHelpers.asyncToGenerator(function* () {
{
assert_mjs.assert.isType(cacheName, 'string', {
moduleName: 'workbox-cache-expiration',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'cacheName'
});
assert_mjs.assert.isInstance(request, Request, {
moduleName: 'workbox-cache-expiration',
className: 'Plugin',
funcName: 'cacheDidUpdate',
paramName: 'request'
});
}
const cacheExpiration = _this._getCacheExpiration(cacheName);
yield cacheExpiration.updateTimestamp(request.url);
yield cacheExpiration.expireEntries();
})();
}
/**
* This is a helper method that performs two operations:
*
* - Deletes *all* the underlying Cache instances associated with this plugin
* instance, by calling caches.delete() on you behalf.
* - Deletes the metadata from IndexedDB used to keep track of expiration
* details for each Cache instance.
*
* When using cache expiration, calling this method is preferable to calling
* `caches.delete()` directly, since this will ensure that the IndexedDB
* metadata is also cleanly removed and open IndexedDB instances are deleted.
*
* Note that if you're *not* using cache expiration for a given cache, calling
* `caches.delete()` and passing in the cache's name should be sufficient.
* There is no Workbox-specific method needed for cleanup in that case.
*/
deleteCacheAndMetadata() {
var _this2 = this;
return babelHelpers.asyncToGenerator(function* () {
// Do this one at a time instead of all at once via `Promise.all()` to
// reduce the chance of inconsistency if a promise rejects.
for (const [cacheName, cacheExpiration] of _this2._cacheExpirations) {
yield caches.delete(cacheName);
yield cacheExpiration.delete();
}
// Reset this._cacheExpirations to its initial state.
_this2._cacheExpirations = new Map();
})();
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.CacheExpiration = CacheExpiration;
exports.Plugin = Plugin;
return exports;
}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core));
//# sourceMappingURL=workbox-cache-expiration.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.expiration=function(e,t,r,n,i){"use strict";try{self.workbox.v["workbox:cache-expiration:3.6.3"]=1}catch(e){}const s="url",a="timestamp";class l{constructor(e){this.e=e,this.t=e,this.r=new t.DBWrapper(this.e,2,{onupgradeneeded:e=>this.n(e)})}n(e){const t=e.target.result;e.oldVersion<2&&t.objectStoreNames.contains("workbox-cache-expiration")&&t.deleteObjectStore("workbox-cache-expiration"),t.createObjectStore(this.t,{keyPath:s}).createIndex(a,a,{unique:!1})}setTimestamp(e,t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.r.put(r.t,{[s]:new URL(e,location).href,[a]:t})})()}getAllTimestamps(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.r.getAllMatching(e.t,{index:a})})()}getTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.r.get(t.t,e)).timestamp})()}deleteUrl(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.delete(t.t,new URL(e,location).href)})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){yield e.r.deleteDatabase(),e.r=null})()}}class o{constructor(e,t={}){this.i=!1,this.s=!1,this.a=t.maxEntries,this.l=t.maxAgeSeconds,this.e=e,this.o=new l(e)}expireEntries(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(e.i)return void(e.s=!0);e.i=!0;const t=Date.now(),r=yield e.c(t),n=yield e.u(),i=[...new Set(r.concat(n))];yield Promise.all([e.h(i),e.d(i)]),e.i=!1,e.s&&(e.s=!1,e.expireEntries())})()}c(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)return[];const r=e-1e3*t.l,n=[];return(yield t.o.getAllTimestamps()).forEach(function(e){e.timestamp<r&&n.push(e.url)}),n})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];if(!e.a)return[];const r=yield e.o.getAllTimestamps();for(;r.length>e.a;){const e=r.shift();t.push(e.url)}return t})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield caches.open(t.e);for(const t of e)yield r.delete(t)})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){for(const r of e)yield t.o.deleteUrl(r)})()}updateTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=new URL(e,location);r.hash="",yield t.o.setTimestamp(r.href,Date.now())})()}isURLExpired(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)throw new r.WorkboxError("expired-test-without-max-age",{methodName:"isURLExpired",paramName:"maxAgeSeconds"});const n=new URL(e,location);return n.hash="",(yield t.o.getTimestamp(n.href))<Date.now()-1e3*t.l})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.s=!1,yield e.o.delete()})()}}return e.CacheExpiration=o,e.Plugin=class{constructor(e={}){this.p=e,this.l=e.maxAgeSeconds,this.b=new Map,e.purgeOnQuotaError&&i.registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata())}f(e){if(e===n.cacheNames.getRuntimeName())throw new r.WorkboxError("expire-custom-caches-only");let t=this.b.get(e);return t||(t=new o(e,this.p),this.b.set(e,t)),t}cachedResponseWillBeUsed({cacheName:e,cachedResponse:t}){if(!t)return null;let r=this.m(t);return this.f(e).expireEntries(),r?t:null}m(e){if(!this.l)return!0;const t=this.y(e);return null===t||t>=Date.now()-1e3*this.l}y(e){if(!e.headers.has("date"))return null;const t=e.headers.get("date"),r=new Date(t).getTime();return isNaN(r)?null:r}cacheDidUpdate({cacheName:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.f(e);yield n.updateTimestamp(t.url),yield n.expireEntries()})()}deleteCacheAndMetadata(){var e=this;return babelHelpers.asyncToGenerator(function*(){for(const[t,r]of e.b)yield caches.delete(t),yield r.delete();e.b=new Map})()}},e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core);
//# sourceMappingURL=workbox-cache-expiration.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-cache-expiration/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.expiration=function(e,t,r,n,i){\"use strict\";try{self.workbox.v[\"workbox:cache-expiration:3.6.3\"]=1}catch(e){}const s=\"url\",a=\"timestamp\";class l{constructor(e){this.e=e,this.t=e,this.r=new t.DBWrapper(this.e,2,{onupgradeneeded:e=>this.n(e)})}n(e){const t=e.target.result;e.oldVersion<2&&t.objectStoreNames.contains(\"workbox-cache-expiration\")&&t.deleteObjectStore(\"workbox-cache-expiration\"),t.createObjectStore(this.t,{keyPath:s}).createIndex(a,a,{unique:!1})}setTimestamp(e,t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.r.put(r.t,{[s]:new URL(e,location).href,[a]:t})})()}getAllTimestamps(){var e=this;return babelHelpers.asyncToGenerator(function*(){return yield e.r.getAllMatching(e.t,{index:a})})()}getTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){return(yield t.r.get(t.t,e)).timestamp})()}deleteUrl(e){var t=this;return babelHelpers.asyncToGenerator(function*(){yield t.r.delete(t.t,new URL(e,location).href)})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){yield e.r.deleteDatabase(),e.r=null})()}}class o{constructor(e,t={}){this.i=!1,this.s=!1,this.a=t.maxEntries,this.l=t.maxAgeSeconds,this.e=e,this.o=new l(e)}expireEntries(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(e.i)return void(e.s=!0);e.i=!0;const t=Date.now(),r=yield e.c(t),n=yield e.u(),i=[...new Set(r.concat(n))];yield Promise.all([e.h(i),e.d(i)]),e.i=!1,e.s&&(e.s=!1,e.expireEntries())})()}c(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)return[];const r=e-1e3*t.l,n=[];return(yield t.o.getAllTimestamps()).forEach(function(e){e.timestamp<r&&n.push(e.url)}),n})()}u(){var e=this;return babelHelpers.asyncToGenerator(function*(){const t=[];if(!e.a)return[];const r=yield e.o.getAllTimestamps();for(;r.length>e.a;){const e=r.shift();t.push(e.url)}return t})()}h(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=yield caches.open(t.e);for(const t of e)yield r.delete(t)})()}d(e){var t=this;return babelHelpers.asyncToGenerator(function*(){for(const r of e)yield t.o.deleteUrl(r)})()}updateTimestamp(e){var t=this;return babelHelpers.asyncToGenerator(function*(){const r=new URL(e,location);r.hash=\"\",yield t.o.setTimestamp(r.href,Date.now())})()}isURLExpired(e){var t=this;return babelHelpers.asyncToGenerator(function*(){if(!t.l)throw new r.WorkboxError(\"expired-test-without-max-age\",{methodName:\"isURLExpired\",paramName:\"maxAgeSeconds\"});const n=new URL(e,location);return n.hash=\"\",(yield t.o.getTimestamp(n.href))<Date.now()-1e3*t.l})()}delete(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.s=!1,yield e.o.delete()})()}}return e.CacheExpiration=o,e.Plugin=class{constructor(e={}){this.p=e,this.l=e.maxAgeSeconds,this.b=new Map,e.purgeOnQuotaError&&i.registerQuotaErrorCallback(()=>this.deleteCacheAndMetadata())}f(e){if(e===n.cacheNames.getRuntimeName())throw new r.WorkboxError(\"expire-custom-caches-only\");let t=this.b.get(e);return t||(t=new o(e,this.p),this.b.set(e,t)),t}cachedResponseWillBeUsed({cacheName:e,cachedResponse:t}){if(!t)return null;let r=this.m(t);return this.f(e).expireEntries(),r?t:null}m(e){if(!this.l)return!0;const t=this.y(e);return null===t||t>=Date.now()-1e3*this.l}y(e){if(!e.headers.has(\"date\"))return null;const t=e.headers.get(\"date\"),r=new Date(t).getTime();return isNaN(r)?null:r}cacheDidUpdate({cacheName:e,request:t}){var r=this;return babelHelpers.asyncToGenerator(function*(){const n=r.f(e);yield n.updateTimestamp(t.url),yield n.expireEntries()})()}deleteCacheAndMetadata(){var e=this;return babelHelpers.asyncToGenerator(function*(){for(const[t,r]of e.b)yield caches.delete(t),yield r.delete();e.b=new Map})()}},e}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core);\n"],"file":"workbox-cache-expiration.prod.js"}

View file

@ -1,236 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.cacheableResponse = (function (exports,WorkboxError_mjs,assert_mjs,getFriendlyURL_mjs,logger_mjs) {
'use strict';
try {
self.workbox.v['workbox:cacheable-response:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* This class allows you to set up rules determining what
* status codes and/or headers need to be present in order for a
* [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
* to be considered cacheable.
*
* @memberof workbox.cacheableResponse
*/
class CacheableResponse {
/**
* To construct a new CacheableResponse instance you must provide at least
* one of the `config` properties.
*
* If both `statuses` and `headers` are specified, then both conditions must
* be met for the `Response` to be considered cacheable.
*
* @param {Object} config
* @param {Array<number>} [config.statuses] One or more status codes that a
* `Response` can have and be considered cacheable.
* @param {Object<string,string>} [config.headers] A mapping of header names
* and expected values that a `Response` can have and be considered cacheable.
* If multiple headers are provided, only one needs to be present.
*/
constructor(config = {}) {
{
if (!(config.statuses || config.headers)) {
throw new WorkboxError_mjs.WorkboxError('statuses-or-headers-required', {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'constructor'
});
}
if (config.statuses) {
assert_mjs.assert.isArray(config.statuses, {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'constructor',
paramName: 'config.statuses'
});
}
if (config.headers) {
assert_mjs.assert.isType(config.headers, 'object', {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'constructor',
paramName: 'config.headers'
});
}
}
this._statuses = config.statuses;
this._headers = config.headers;
}
/**
* Checks a response to see whether it's cacheable or not, based on this
* object's configuration.
*
* @param {Response} response The response whose cacheability is being
* checked.
* @return {boolean} `true` if the `Response` is cacheable, and `false`
* otherwise.
*/
isResponseCacheable(response) {
{
assert_mjs.assert.isInstance(response, Response, {
moduleName: 'workbox-cacheable-response',
className: 'CacheableResponse',
funcName: 'isResponseCacheable',
paramName: 'response'
});
}
let cacheable = true;
if (this._statuses) {
cacheable = this._statuses.includes(response.status);
}
if (this._headers && cacheable) {
cacheable = Object.keys(this._headers).some(headerName => {
return response.headers.get(headerName) === this._headers[headerName];
});
}
{
if (!cacheable) {
logger_mjs.logger.groupCollapsed(`The request for ` + `'${getFriendlyURL_mjs.getFriendlyURL(response.url)}' returned a response that does ` + `not meet the criteria for being cached.`);
logger_mjs.logger.groupCollapsed(`View cacheability criteria here.`);
logger_mjs.logger.unprefixed.log(`Cacheable statuses: ` + JSON.stringify(this._statuses));
logger_mjs.logger.unprefixed.log(`Cacheable headers: ` + JSON.stringify(this._headers, null, 2));
logger_mjs.logger.groupEnd();
const logFriendlyHeaders = {};
response.headers.forEach((value, key) => {
logFriendlyHeaders[key] = value;
});
logger_mjs.logger.groupCollapsed(`View response status and headers here.`);
logger_mjs.logger.unprefixed.log(`Response status: ` + response.status);
logger_mjs.logger.unprefixed.log(`Response headers: ` + JSON.stringify(logFriendlyHeaders, null, 2));
logger_mjs.logger.groupEnd();
logger_mjs.logger.groupCollapsed(`View full response details here.`);
logger_mjs.logger.unprefixed.log(response.headers);
logger_mjs.logger.unprefixed.log(response);
logger_mjs.logger.groupEnd();
logger_mjs.logger.groupEnd();
}
}
return cacheable;
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* A class implementing the `cacheWillUpdate` lifecycle callback. This makes it
* easier to add in cacheability checks to requests made via Workbox's built-in
* strategies.
*
* @memberof workbox.cacheableResponse
*/
class Plugin {
/**
* To construct a new cacheable response Plugin instance you must provide at
* least one of the `config` properties.
*
* If both `statuses` and `headers` are specified, then both conditions must
* be met for the `Response` to be considered cacheable.
*
* @param {Object} config
* @param {Array<number>} [config.statuses] One or more status codes that a
* `Response` can have and be considered cacheable.
* @param {Object<string,string>} [config.headers] A mapping of header names
* and expected values that a `Response` can have and be considered cacheable.
* If multiple headers are provided, only one needs to be present.
*/
constructor(config) {
this._cacheableResponse = new CacheableResponse(config);
}
/**
* @param {Object} options
* @param {Response} options.response
* @return {boolean}
* @private
*/
cacheWillUpdate({ response }) {
if (this._cacheableResponse.isResponseCacheable(response)) {
return response;
}
return null;
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.CacheableResponse = CacheableResponse;
exports.Plugin = Plugin;
return exports;
}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-cacheable-response.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(t){"use strict";try{self.workbox.v["workbox:cacheable-response:3.6.3"]=1}catch(t){}class s{constructor(t={}){this.t=t.statuses,this.s=t.headers}isResponseCacheable(t){let s=!0;return this.t&&(s=this.t.includes(t.status)),this.s&&s&&(s=Object.keys(this.s).some(s=>t.headers.get(s)===this.s[s])),s}}return t.CacheableResponse=s,t.Plugin=class{constructor(t){this.e=new s(t)}cacheWillUpdate({response:t}){return this.e.isResponseCacheable(t)?t:null}},t}({});
//# sourceMappingURL=workbox-cacheable-response.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-cacheable-response/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(t){\"use strict\";try{self.workbox.v[\"workbox:cacheable-response:3.6.3\"]=1}catch(t){}class s{constructor(t={}){this.t=t.statuses,this.s=t.headers}isResponseCacheable(t){let s=!0;return this.t&&(s=this.t.includes(t.status)),this.s&&s&&(s=Object.keys(this.s).some(s=>t.headers.get(s)===this.s[s])),s}}return t.CacheableResponse=s,t.Plugin=class{constructor(t){this.e=new s(t)}cacheWillUpdate({response:t}){return this.e.isResponseCacheable(t)?t:null}},t}({});\n"],"file":"workbox-cacheable-response.prod.js"}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,255 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Route_mjs,Router_mjs,NetworkFirst_mjs,NetworkOnly_mjs) {
'use strict';
try {
self.workbox.v['workbox:google-analytics:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const QUEUE_NAME = 'workbox-google-analytics';
const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes
const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';
const GTM_HOST = 'www.googletagmanager.com';
const ANALYTICS_JS_PATH = '/analytics.js';
const GTAG_JS_PATH = '/gtag/js';
// This RegExp matches all known Measurement Protocol single-hit collect
// endpoints. Most of the time the default path (/collect) is used, but
// occasionally an experimental endpoint is used when testing new features,
// (e.g. /r/collect or /j/collect)
const COLLECT_PATHS_REGEX = /^\/(\w+\/)?collect/;
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Promisifies the FileReader API to await a text response from a Blob.
*
* @param {Blob} blob
* @return {Promise<string>}
*
* @private
*/
const getTextFromBlob = (() => {
var _ref = babelHelpers.asyncToGenerator(function* (blob) {
// This usage of `return await new Promise...` is intentional to work around
// a bug in the transpiled/minified output.
// See https://github.com/GoogleChrome/workbox/issues/1186
return yield new Promise(function (resolve, reject) {
const reader = new FileReader();
reader.onloadend = function () {
return resolve(reader.result);
};
reader.onerror = function () {
return reject(reader.error);
};
reader.readAsText(blob);
});
});
return function getTextFromBlob(_x) {
return _ref.apply(this, arguments);
};
})();
/**
* Creates the requestWillDequeue callback to be used with the background
* sync queue plugin. The callback takes the failed request and adds the
* `qt` param based on the current time, as well as applies any other
* user-defined hit modifications.
*
* @param {Object} config See workbox.googleAnalytics.initialize.
* @return {Function} The requestWillDequeu callback function.
*
* @private
*/
const createRequestWillReplayCallback = config => {
return (() => {
var _ref2 = babelHelpers.asyncToGenerator(function* (storableRequest) {
let { url, requestInit, timestamp } = storableRequest;
url = new URL(url);
// Measurement protocol requests can set their payload parameters in either
// the URL query string (for GET requests) or the POST body.
let params;
if (requestInit.body) {
const payload = requestInit.body instanceof Blob ? yield getTextFromBlob(requestInit.body) : requestInit.body;
params = new URLSearchParams(payload);
} else {
params = url.searchParams;
}
// Calculate the qt param, accounting for the fact that an existing
// qt param may be present and should be updated rather than replaced.
const originalHitTime = timestamp - (Number(params.get('qt')) || 0);
const queueTime = Date.now() - originalHitTime;
// Set the qt param prior to applying the hitFilter or parameterOverrides.
params.set('qt', queueTime);
if (config.parameterOverrides) {
for (const param of Object.keys(config.parameterOverrides)) {
const value = config.parameterOverrides[param];
params.set(param, value);
}
}
if (typeof config.hitFilter === 'function') {
config.hitFilter.call(null, params);
}
requestInit.body = params.toString();
requestInit.method = 'POST';
requestInit.mode = 'cors';
requestInit.credentials = 'omit';
requestInit.headers = { 'Content-Type': 'text/plain' };
// Ignore URL search params as they're now in the post body.
storableRequest.url = `${url.origin}${url.pathname}`;
});
return function (_x2) {
return _ref2.apply(this, arguments);
};
})();
};
/**
* Creates GET and POST routes to catch failed Measurement Protocol hits.
*
* @param {Plugin} queuePlugin
* @return {Array<Route>} The created routes.
*
* @private
*/
const createCollectRoutes = queuePlugin => {
const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);
const handler = new NetworkOnly_mjs.NetworkOnly({
plugins: [queuePlugin]
});
return [new Route_mjs.Route(match, handler, 'GET'), new Route_mjs.Route(match, handler, 'POST')];
};
/**
* Creates a route with a network first strategy for the analytics.js script.
*
* @param {string} cacheName
* @return {Route} The created route.
*
* @private
*/
const createAnalyticsJsRoute = cacheName => {
const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;
const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });
return new Route_mjs.Route(match, handler, 'GET');
};
/**
* Creates a route with a network first strategy for the gtag.js script.
*
* @param {string} cacheName
* @return {Route} The created route.
*
* @private
*/
const createGtagJsRoute = cacheName => {
const match = ({ url }) => url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;
const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });
return new Route_mjs.Route(match, handler, 'GET');
};
/**
* @param {Object=} [options]
* @param {Object} [options.cacheName] The cache name to store and retrieve
* analytics.js. Defaults to the cache names provided by `workbox-core`.
* @param {Object} [options.parameterOverrides]
* [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),
* expressed as key/value pairs, to be added to replayed Google Analytics
* requests. This can be used to, e.g., set a custom dimension indicating
* that the request was replayed.
* @param {Function} [options.hitFilter] A function that allows you to modify
* the hit parameters prior to replaying
* the hit. The function is invoked with the original hit's URLSearchParams
* object as its only argument.
*
* @memberof workbox.googleAnalytics
*/
const initialize = (options = {}) => {
const cacheName = cacheNames_mjs.cacheNames.getGoogleAnalyticsName(options.cacheName);
const queuePlugin = new Plugin_mjs.Plugin(QUEUE_NAME, {
maxRetentionTime: MAX_RETENTION_TIME,
callbacks: {
requestWillReplay: createRequestWillReplayCallback(options)
}
});
const routes = [createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];
const router = new Router_mjs.Router();
for (const route of routes) {
router.registerRoute(route);
}
self.addEventListener('fetch', evt => {
const responsePromise = router.handleRequest(evt);
if (responsePromise) {
evt.respondWith(responsePromise);
}
});
};
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.initialize = initialize;
return exports;
}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies));
//# sourceMappingURL=workbox-google-analytics.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.6.3"]=1}catch(e){}const l=/^\/(\w+\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get("qt"))||0),l=Date.now()-s;if(t.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method="POST",r.mode="cors",r.credentials="omit",r.headers={"Content-Type":"text/plain"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.google-analytics.com"===e.hostname&&"/analytics.js"===e.pathname,n,"GET")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(i),...(e=>{const n=({url:e})=>"www.google-analytics.com"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener("fetch",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
//# sourceMappingURL=workbox-google-analytics.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){\"use strict\";try{self.workbox.v[\"workbox:google-analytics:3.6.3\"]=1}catch(e){}const l=/^\\/(\\w+\\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get(\"qt\"))||0),l=Date.now()-s;if(t.set(\"qt\",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}\"function\"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method=\"POST\",r.mode=\"cors\",r.credentials=\"omit\",r.headers={\"Content-Type\":\"text/plain\"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin(\"workbox-google-analytics\",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.google-analytics.com\"===e.hostname&&\"/analytics.js\"===e.pathname,n,\"GET\")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.googletagmanager.com\"===e.hostname&&\"/gtag/js\"===e.pathname,n,\"GET\")})(i),...(e=>{const n=({url:e})=>\"www.google-analytics.com\"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,\"GET\"),new o.Route(n,t,\"POST\")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener(\"fetch\",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);\n"],"file":"workbox-google-analytics.prod.js"}

View file

@ -1,159 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.navigationPreload = (function (exports,logger_mjs) {
'use strict';
try {
self.workbox.v['workbox:navigation-preload:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @return {boolean} Whether or not the current browser supports enabling
* navigation preload.
*
* @memberof workbox.navigationPreload
*/
function isSupported() {
return Boolean(self.registration && self.registration.navigationPreload);
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* If the browser supports Navigation Preload, then this will disable it.
*
* @memberof workbox.navigationPreload
*/
function disable() {
if (isSupported()) {
self.addEventListener('activate', event => {
event.waitUntil(self.registration.navigationPreload.disable().then(() => {
{
logger_mjs.logger.log(`Navigation preload is disabled.`);
}
}));
});
} else {
{
logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
}
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* If the browser supports Navigation Preload, then this will enable it.
*
* @param {string} [headerValue] Optionally, allows developers to
* [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)
* the value of the `Service-Worker-Navigation-Preload` header which will be
* sent to the server when making the navigation request.
*
* @memberof workbox.navigationPreload
*/
function enable(headerValue) {
if (isSupported()) {
self.addEventListener('activate', event => {
event.waitUntil(self.registration.navigationPreload.enable().then(() => {
// Defaults to Service-Worker-Navigation-Preload: true if not set.
if (headerValue) {
self.registration.navigationPreload.setHeaderValue(headerValue);
}
{
logger_mjs.logger.log(`Navigation preload is enabled.`);
}
}));
});
} else {
{
logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
}
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.disable = disable;
exports.enable = enable;
exports.isSupported = isSupported;
return exports;
}({},workbox.core._private));
//# sourceMappingURL=workbox-navigation-preload.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){"use strict";try{self.workbox.v["workbox:navigation-preload:3.6.3"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});
//# sourceMappingURL=workbox-navigation-preload.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){\"use strict\";try{self.workbox.v[\"workbox:navigation-preload:3.6.3\"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener(\"activate\",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener(\"activate\",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});\n"],"file":"workbox-navigation-preload.prod.js"}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,299 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.rangeRequests = (function (exports,WorkboxError_mjs,assert_mjs,logger_mjs) {
'use strict';
try {
self.workbox.v['workbox:range-requests:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @param {Blob} blob A source blob.
* @param {number|null} start The offset to use as the start of the
* slice.
* @param {number|null} end The offset to use as the end of the slice.
* @return {Object} An object with `start` and `end` properties, reflecting
* the effective boundaries to use given the size of the blob.
*
* @private
*/
function calculateEffectiveBoundaries(blob, start, end) {
{
assert_mjs.assert.isInstance(blob, Blob, {
moduleName: 'workbox-range-requests',
funcName: 'calculateEffectiveBoundaries',
paramName: 'blob'
});
}
const blobSize = blob.size;
if (end > blobSize || start < 0) {
throw new WorkboxError_mjs.WorkboxError('range-not-satisfiable', {
size: blobSize,
end,
start
});
}
let effectiveStart;
let effectiveEnd;
if (start === null) {
effectiveStart = blobSize - end;
effectiveEnd = blobSize;
} else if (end === null) {
effectiveStart = start;
effectiveEnd = blobSize;
} else {
effectiveStart = start;
// Range values are inclusive, so add 1 to the value.
effectiveEnd = end + 1;
}
return {
start: effectiveStart,
end: effectiveEnd
};
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @param {string} rangeHeader A Range: header value.
* @return {Object} An object with `start` and `end` properties, reflecting
* the parsed value of the Range: header. If either the `start` or `end` are
* omitted, then `null` will be returned.
*
* @private
*/
function parseRangeHeader(rangeHeader) {
{
assert_mjs.assert.isType(rangeHeader, 'string', {
moduleName: 'workbox-range-requests',
funcName: 'parseRangeHeader',
paramName: 'rangeHeader'
});
}
const normalizedRangeHeader = rangeHeader.trim().toLowerCase();
if (!normalizedRangeHeader.startsWith('bytes=')) {
throw new WorkboxError_mjs.WorkboxError('unit-must-be-bytes', { normalizedRangeHeader });
}
// Specifying multiple ranges separate by commas is valid syntax, but this
// library only attempts to handle a single, contiguous sequence of bytes.
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax
if (normalizedRangeHeader.includes(',')) {
throw new WorkboxError_mjs.WorkboxError('single-range-only', { normalizedRangeHeader });
}
const rangeParts = /(\d*)-(\d*)/.exec(normalizedRangeHeader);
// We need either at least one of the start or end values.
if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {
throw new WorkboxError_mjs.WorkboxError('invalid-range-values', { normalizedRangeHeader });
}
return {
start: rangeParts[1] === '' ? null : Number(rangeParts[1]),
end: rangeParts[2] === '' ? null : Number(rangeParts[2])
};
}
/**
* Given a `Request` and `Response` objects as input, this will return a
* promise for a new `Response`.
*
* @param {Request} request A request, which should contain a Range:
* header.
* @param {Response} originalResponse An original response containing the full
* content.
* @return {Promise<Response>} Either a `206 Partial Content` response, with
* the response body set to the slice of content specified by the request's
* `Range:` header, or a `416 Range Not Satisfiable` response if the
* conditions of the `Range:` header can't be met.
*
* @memberof workbox.rangeRequests
*/
let createPartialResponse = (() => {
var _ref = babelHelpers.asyncToGenerator(function* (request, originalResponse) {
try {
{
assert_mjs.assert.isInstance(request, Request, {
moduleName: 'workbox-range-requests',
funcName: 'createPartialResponse',
paramName: 'request'
});
assert_mjs.assert.isInstance(originalResponse, Response, {
moduleName: 'workbox-range-requests',
funcName: 'createPartialResponse',
paramName: 'originalResponse'
});
}
const rangeHeader = request.headers.get('range');
if (!rangeHeader) {
throw new WorkboxError_mjs.WorkboxError('no-range-header');
}
const boundaries = parseRangeHeader(rangeHeader);
const originalBlob = yield originalResponse.blob();
const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);
const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);
const slicedBlobSize = slicedBlob.size;
const slicedResponse = new Response(slicedBlob, {
// Status code 206 is for a Partial Content response.
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206
status: 206,
statusText: 'Partial Content',
headers: originalResponse.headers
});
slicedResponse.headers.set('Content-Length', slicedBlobSize);
slicedResponse.headers.set('Content-Range', `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` + originalBlob.size);
return slicedResponse;
} catch (error) {
{
logger_mjs.logger.warn(`Unable to construct a partial response; returning a ` + `416 Range Not Satisfiable response instead.`);
logger_mjs.logger.groupCollapsed(`View details here.`);
logger_mjs.logger.unprefixed.log(error);
logger_mjs.logger.unprefixed.log(request);
logger_mjs.logger.unprefixed.log(originalResponse);
logger_mjs.logger.groupEnd();
}
return new Response('', {
status: 416,
statusText: 'Range Not Satisfiable'
});
}
});
return function createPartialResponse(_x, _x2) {
return _ref.apply(this, arguments);
};
})();
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* The range request plugin makes it easy for a request with a 'Range' header to
* be fulfilled by a cached response.
*
* It does this by intercepting the `cachedResponseWillBeUsed` plugin callback
* and returning the appropriate subset of the cached response body.
*
* @memberof workbox.rangeRequests
*/
class Plugin {
/**
* @param {Object} options
* @param {Request} options.request The original request, which may or may not
* contain a Range: header.
* @param {Response} options.cachedResponse The complete cached response.
* @return {Promise<Response>} If request contains a 'Range' header, then a
* new response with status 206 whose body is a subset of `cachedResponse` is
* returned. Otherwise, `cachedResponse` is returned as-is.
*
* @private
*/
cachedResponseWillBeUsed({ request, cachedResponse }) {
return babelHelpers.asyncToGenerator(function* () {
// Only return a sliced response if there's something valid in the cache,
// and there's a Range: header in the request.
if (cachedResponse && request.headers.has('range')) {
return yield createPartialResponse(request, cachedResponse);
}
// If there was no Range: header, or if cachedResponse wasn't valid, just
// pass it through as-is.
return cachedResponse;
})();
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.createPartialResponse = createPartialResponse;
exports.Plugin = Plugin;
return exports;
}({},workbox.core._private,workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-range-requests.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){"use strict";try{self.workbox.v["workbox:range-requests:3.6.3"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get("range");if(!r)throw new n.WorkboxError("no-range-header");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new n.WorkboxError("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new n.WorkboxError("single-range-only",{normalizedRangeHeader:t});const r=/(\d*)-(\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError("invalid-range-values",{normalizedRangeHeader:t});return{start:""===r[1]?null:Number(r[1]),end:""===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError("range-not-satisfiable",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:"Partial Content",headers:t.headers});return u.headers.set("Content-Length",o),u.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has("range")?yield t(e,n):n})()}},e}({},workbox.core._private);
//# sourceMappingURL=workbox-range-requests.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-range-requests/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){\"use strict\";try{self.workbox.v[\"workbox:range-requests:3.6.3\"]=1}catch(e){}let t=(r=babelHelpers.asyncToGenerator(function*(e,t){try{const r=e.headers.get(\"range\");if(!r)throw new n.WorkboxError(\"no-range-header\");const s=function(e){const t=e.trim().toLowerCase();if(!t.startsWith(\"bytes=\"))throw new n.WorkboxError(\"unit-must-be-bytes\",{normalizedRangeHeader:t});if(t.includes(\",\"))throw new n.WorkboxError(\"single-range-only\",{normalizedRangeHeader:t});const r=/(\\d*)-(\\d*)/.exec(t);if(null===r||!r[1]&&!r[2])throw new n.WorkboxError(\"invalid-range-values\",{normalizedRangeHeader:t});return{start:\"\"===r[1]?null:Number(r[1]),end:\"\"===r[2]?null:Number(r[2])}}(r),a=yield t.blob(),i=function(e,t,r){const s=e.size;if(r>s||t<0)throw new n.WorkboxError(\"range-not-satisfiable\",{size:s,end:r,start:t});let a,i;return null===t?(a=s-r,i=s):null===r?(a=t,i=s):(a=t,i=r+1),{start:a,end:i}}(a,s.start,s.end),l=a.slice(i.start,i.end),o=l.size,u=new Response(l,{status:206,statusText:\"Partial Content\",headers:t.headers});return u.headers.set(\"Content-Length\",o),u.headers.set(\"Content-Range\",`bytes ${i.start}-${i.end-1}/`+a.size),u}catch(e){return new Response(\"\",{status:416,statusText:\"Range Not Satisfiable\"})}}),function(e,n){return r.apply(this,arguments)});var r;return e.createPartialResponse=t,e.Plugin=class{cachedResponseWillBeUsed({request:e,cachedResponse:n}){return babelHelpers.asyncToGenerator(function*(){return n&&e.headers.has(\"range\")?yield t(e,n):n})()}},e}({},workbox.core._private);\n"],"file":"workbox-range-requests.prod.js"}

View file

@ -1,863 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.routing = (function (assert_mjs,logger_mjs,WorkboxError_mjs,getFriendlyURL_mjs,cacheNames_mjs) {
'use strict';
try {
self.workbox.v['workbox:routing:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* The default HTTP method, 'GET', used when there's no specific method
* configured for a route.
*
* @type {string}
*
* @private
*/
const defaultMethod = 'GET';
/**
* The list of valid HTTP methods associated with requests that could be routed.
*
* @type {Array<string>}
*
* @private
*/
const validMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* @param {function()|Object} handler Either a function, or an object with a
* 'handle' method.
* @return {Object} An object with a handle method.
*
* @private
*/
var normalizeHandler = (handler => {
if (handler && typeof handler === 'object') {
{
assert_mjs.assert.hasMethod(handler, 'handle', {
moduleName: 'workbox-routing',
className: 'Route',
funcName: 'constructor',
paramName: 'handler'
});
}
return handler;
} else {
{
assert_mjs.assert.isType(handler, 'function', {
moduleName: 'workbox-routing',
className: 'Route',
funcName: 'constructor',
paramName: 'handler'
});
}
return { handle: handler };
}
});
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* A `Route` consists of a pair of callback functions, "match" and "handler".
* The "match" callback determine if a route should be used to "handle" a
* request by returning a non-falsy value if it can. The "handler" callback
* is called when there is a match and should return a Promise that resolves
* to a `Response`.
*
* @memberof workbox.routing
*/
class Route {
/**
* Constructor for Route class.
*
* @param {workbox.routing.Route~matchCallback} match
* A callback function that determines whether the route matches a given
* `fetch` event by returning a non-falsy value.
* @param {workbox.routing.Route~handlerCallback} handler A callback
* function that returns a Promise resolving to a Response.
* @param {string} [method='GET'] The HTTP method to match the Route
* against.
*/
constructor(match, handler, method) {
{
assert_mjs.assert.isType(match, 'function', {
moduleName: 'workbox-routing',
className: 'Route',
funcName: 'constructor',
paramName: 'match'
});
if (method) {
assert_mjs.assert.isOneOf(method, validMethods, { paramName: 'method' });
}
}
// These values are referenced directly by Router so cannot be
// altered by minifification.
this.handler = normalizeHandler(handler);
this.match = match;
this.method = method || defaultMethod;
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* RegExpRoute makes it easy to create a regular expression based
* [Route]{@link workbox.routing.Route}.
*
* For same-origin requests the RegExp only needs to match part of the URL. For
* requests against third-party servers, you must define a RegExp that matches
* the start of the URL.
*
* [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}
*
* @memberof workbox.routing
* @extends workbox.routing.Route
*/
class RegExpRoute extends Route {
/**
* If the regulard expression contains
* [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},
* th ecaptured values will be passed to the
* [handler's]{@link workbox.routing.Route~handlerCallback} `params`
* argument.
*
* @param {RegExp} regExp The regular expression to match against URLs.
* @param {workbox.routing.Route~handlerCallback} handler A callback
* function that returns a Promise resulting in a Response.
* @param {string} [method='GET'] The HTTP method to match the Route
* against.
*/
constructor(regExp, handler, method) {
{
assert_mjs.assert.isInstance(regExp, RegExp, {
moduleName: 'workbox-routing',
className: 'RegExpRoute',
funcName: 'constructor',
paramName: 'pattern'
});
}
const match = ({ url }) => {
const result = regExp.exec(url.href);
// Return null immediately if there's no match.
if (!result) {
return null;
}
// Require that the match start at the first character in the URL string
// if it's a cross-origin request.
// See https://github.com/GoogleChrome/workbox/issues/281 for the context
// behind this behavior.
if (url.origin !== location.origin && result.index !== 0) {
{
logger_mjs.logger.debug(`The regular expression '${regExp}' only partially matched ` + `against the cross-origin URL '${url}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);
}
return null;
}
// If the route matches, but there aren't any capture groups defined, then
// this will return [], which is truthy and therefore sufficient to
// indicate a match.
// If there are capture groups, then it will return their values.
return result.slice(1);
};
super(match, handler, method);
}
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* The Router can be used to process a FetchEvent through one or more
* [Routes]{@link workbox.routing.Route} responding with a Request if
* a matching route exists.
*
* If no route matches a given a request, the Router will use a "default"
* handler if one is defined.
*
* Should the matching Route throw an error, the Router will use a "catch"
* handler if one is defined to gracefully deal with issues and respond with a
* Request.
*
* If a request matches multiple routes, the **earliest** registered route will
* be used to respond to the request.
*
* @memberof workbox.routing
*/
class Router {
/**
* Initializes a new Router.
*/
constructor() {
// _routes will contain a mapping of HTTP method name ('GET', etc.) to an
// array of all the corresponding Route instances that are registered.
this._routes = new Map();
}
/**
* Apply the routing rules to a FetchEvent object to get a Response from an
* appropriate Route's handler.
*
* @param {FetchEvent} event The event from a service worker's 'fetch' event
* listener.
* @return {Promise<Response>|undefined} A promise is returned if a
* registered route can handle the FetchEvent's request. If there is no
* matching route and there's no `defaultHandler`, `undefined` is returned.
*/
handleRequest(event) {
{
assert_mjs.assert.isInstance(event, FetchEvent, {
moduleName: 'workbox-routing',
className: 'Router',
funcName: 'handleRequest',
paramName: 'event'
});
}
const url = new URL(event.request.url);
if (!url.protocol.startsWith('http')) {
{
logger_mjs.logger.debug(`Workbox Router only supports URLs that start with 'http'.`);
}
return;
}
let route = null;
let handler = null;
let params = null;
let debugMessages = [];
const result = this._findHandlerAndParams(event, url);
handler = result.handler;
params = result.params;
route = result.route;
{
if (handler) {
debugMessages.push([`Found a route to handle this request:`, route]);
if (params) {
debugMessages.push([`Passing the following params to the route's handler:`, params]);
}
}
}
// If we don't have a handler because there was no matching route, then
// fall back to defaultHandler if that's defined.
if (!handler && this._defaultHandler) {
{
debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler.`);
// This is used for debugging in logs in the case of an error.
route = '[Default Handler]';
}
handler = this._defaultHandler;
}
if (!handler) {
{
// No handler so Workbox will do nothing. If logs is set of debug
// i.e. verbose, we should print out this information.
logger_mjs.logger.debug(`No route found for: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);
}
return;
}
{
// We have a handler, meaning Workbox is going to handle the route.
// print the routing details to the console.
logger_mjs.logger.groupCollapsed(`Router is responding to: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);
debugMessages.forEach(msg => {
if (Array.isArray(msg)) {
logger_mjs.logger.log(...msg);
} else {
logger_mjs.logger.log(msg);
}
});
// The Request and Response objects contains a great deal of information,
// hide it under a group in case developers want to see it.
logger_mjs.logger.groupCollapsed(`View request details here.`);
logger_mjs.logger.unprefixed.log(event.request);
logger_mjs.logger.groupEnd();
logger_mjs.logger.groupEnd();
}
// Wrap in try and catch in case the handle method throws a synchronous
// error. It should still callback to the catch handler.
let responsePromise;
try {
responsePromise = handler.handle({ url, event, params });
} catch (err) {
responsePromise = Promise.reject(err);
}
if (responsePromise && this._catchHandler) {
responsePromise = responsePromise.catch(err => {
{
// Still include URL here as it will be async from the console group
// and may not make sense without the URL
logger_mjs.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_mjs.getFriendlyURL(url)}. Falling back to Catch Handler.`);
logger_mjs.logger.unprefixed.error(`Error thrown by:`, route);
logger_mjs.logger.unprefixed.error(err);
logger_mjs.logger.groupEnd();
}
return this._catchHandler.handle({ url, event, err });
});
}
return responsePromise;
}
/**
* Checks the incoming `event.request` against the registered routes, and if
* there's a match, returns the corresponding handler along with any params
* generated by the match.
*
* @param {FetchEvent} event
* @param {URL} url
* @return {Object} Returns an object with `handler` and `params` properties.
* They are populated if a matching route was found or `undefined` otherwise.
*
* @private
*/
_findHandlerAndParams(event, url) {
const routes = this._routes.get(event.request.method) || [];
for (const route of routes) {
let matchResult = route.match({ url, event });
if (matchResult) {
if (Array.isArray(matchResult) && matchResult.length === 0) {
// Instead of passing an empty array in as params, use undefined.
matchResult = undefined;
} else if (matchResult.constructor === Object && Object.keys(matchResult).length === 0 || matchResult === true) {
// Instead of passing an empty object in as params, use undefined.
matchResult = undefined;
}
// Break out of the loop and return the appropriate values as soon as
// we have a match.
return {
route,
params: matchResult,
handler: route.handler
};
}
}
// If we didn't have a match, then return undefined values.
return { handler: undefined, params: undefined };
}
/**
* Define a default `handler` that's called when no routes explicitly
* match the incoming request.
*
* Without a default handler, unmatched requests will go against the
* network as if there were no service worker present.
*
* @param {workbox.routing.Route~handlerCallback} handler A callback
* function that returns a Promise resulting in a Response.
*/
setDefaultHandler(handler) {
this._defaultHandler = normalizeHandler(handler);
}
/**
* If a Route throws an error while handling a request, this `handler`
* will be called and given a chance to provide a response.
*
* @param {workbox.routing.Route~handlerCallback} handler A callback
* function that returns a Promise resulting in a Response.
*/
setCatchHandler(handler) {
this._catchHandler = normalizeHandler(handler);
}
/**
* Registers a route with the router.
*
* @param {workbox.routing.Route} route The route to register.
*/
registerRoute(route) {
{
assert_mjs.assert.isType(route, 'object', {
moduleName: 'workbox-routing',
className: 'Router',
funcName: 'registerRoute',
paramName: 'route'
});
assert_mjs.assert.hasMethod(route, 'match', {
moduleName: 'workbox-routing',
className: 'Router',
funcName: 'registerRoute',
paramName: 'route'
});
assert_mjs.assert.isType(route.handler, 'object', {
moduleName: 'workbox-routing',
className: 'Router',
funcName: 'registerRoute',
paramName: 'route'
});
assert_mjs.assert.hasMethod(route.handler, 'handle', {
moduleName: 'workbox-routing',
className: 'Router',
funcName: 'registerRoute',
paramName: 'route.handler'
});
assert_mjs.assert.isType(route.method, 'string', {
moduleName: 'workbox-routing',
className: 'Router',
funcName: 'registerRoute',
paramName: 'route.method'
});
}
if (!this._routes.has(route.method)) {
this._routes.set(route.method, []);
}
// Give precedence to all of the earlier routes by adding this additional
// route to the end of the array.
this._routes.get(route.method).push(route);
}
/**
* Unregisters a route with the router.
*
* @param {workbox.routing.Route} route The route to unregister.
*/
unregisterRoute(route) {
if (!this._routes.has(route.method)) {
throw new WorkboxError_mjs.WorkboxError('unregister-route-but-not-found-with-method', {
method: route.method
});
}
const routeIndex = this._routes.get(route.method).indexOf(route);
if (routeIndex > -1) {
this._routes.get(route.method).splice(routeIndex, 1);
} else {
throw new WorkboxError_mjs.WorkboxError('unregister-route-route-not-registered');
}
}
}
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* NavigationRoute makes it easy to create a [Route]{@link
* workbox.routing.Route} that matches for browser
* [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.
*
* It will only match incoming Requests whose
* [`mode`]{@link https://fetch.spec.whatwg.org/#concept-request-mode}
* is set to `navigate`.
*
* You can optionally only apply this route to a subset of navigation requests
* by using one or both of the `blacklist` and `whitelist` parameters.
*
* @memberof workbox.routing
* @extends workbox.routing.Route
*/
class NavigationRoute extends Route {
/**
* If both `blacklist` and `whiltelist` are provided, the `blacklist` will
* take precedence and the request will not match this route.
*
* The regular expressions in `whitelist` and `blacklist`
* are matched against the concatenated
* [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}
* and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}
* portions of the requested URL.
*
* @param {workbox.routing.Route~handlerCallback} handler A callback
* function that returns a Promise resulting in a Response.
* @param {Object} options
* @param {Array<RegExp>} [options.blacklist] If any of these patterns match,
* the route will not handle the request (even if a whitelist RegExp matches).
* @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns
* match the URL's pathname and search parameter, the route will handle the
* request (assuming the blacklist doesn't match).
*/
constructor(handler, { whitelist = [/./], blacklist = [] } = {}) {
{
assert_mjs.assert.isArrayOfClass(whitelist, RegExp, {
moduleName: 'workbox-routing',
className: 'NavigationRoute',
funcName: 'constructor',
paramName: 'options.whitelist'
});
assert_mjs.assert.isArrayOfClass(blacklist, RegExp, {
moduleName: 'workbox-routing',
className: 'NavigationRoute',
funcName: 'constructor',
paramName: 'options.blacklist'
});
}
super((...args) => this._match(...args), handler);
this._whitelist = whitelist;
this._blacklist = blacklist;
}
/**
* Routes match handler.
*
* @param {Object} options
* @param {FetchEvent} options.event
* @param {URL} options.url
* @return {boolean}
*
* @private
*/
_match({ event, url }) {
if (event.request.mode !== 'navigate') {
return false;
}
const pathnameAndSearch = url.pathname + url.search;
if (this._blacklist.some(regExp => regExp.test(pathnameAndSearch))) {
{
logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `request URL matches both the whitelist and blacklist.`);
}
return false;
}
if (this._whitelist.some(regExp => regExp.test(pathnameAndSearch))) {
{
logger_mjs.logger.debug(`The navigation route is being used.`);
}
return true;
} else {
{
logger_mjs.logger.debug(`The navigation route is not being used, since the ` + `URL being navigated to doesn't match the whitelist.`);
}
}
return false;
}
}
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var publicAPI = /*#__PURE__*/Object.freeze({
RegExpRoute: RegExpRoute,
Route: Route,
Router: Router,
NavigationRoute: NavigationRoute
});
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
{
assert_mjs.assert.isSwEnv('workbox-routing');
}
/**
* @private
*/
class DefaultRouter extends Router {
/**
* Easily register a RegExp, string, or function with a caching
* strategy to the Router.
*
* This method will generate a Route for you if needed and
* call [Router.registerRoute()]{@link
* workbox.routing.Router#registerRoute}.
*
* @param {
* RegExp|
* string|
* workbox.routing.Route~matchCallback|
* workbox.routing.Route
* } capture
* If the capture param is a `Route`, all other arguments will be ignored.
* @param {workbox.routing.Route~handlerCallback} handler A callback
* function that returns a Promise resulting in a Response.
* @param {string} [method='GET'] The HTTP method to match the Route
* against.
* @return {workbox.routing.Route} The generated `Route`(Useful for
* unregistering).
*
* @alias workbox.routing.registerRoute
*/
registerRoute(capture, handler, method = 'GET') {
let route;
if (typeof capture === 'string') {
const captureUrl = new URL(capture, location);
{
if (!(capture.startsWith('/') || capture.startsWith('http'))) {
throw new WorkboxError_mjs.WorkboxError('invalid-string', {
moduleName: 'workbox-routing',
className: 'DefaultRouter',
funcName: 'registerRoute',
paramName: 'capture'
});
}
// We want to check if Express-style wildcards are in the pathname only.
// TODO: Remove this log message in v4.
const valueToCheck = capture.startsWith('http') ? captureUrl.pathname : capture;
// See https://github.com/pillarjs/path-to-regexp#parameters
const wildcards = '[*:?+]';
if (valueToCheck.match(new RegExp(`${wildcards}`))) {
logger_mjs.logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);
}
}
const matchCallback = ({ url }) => {
{
if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {
logger_mjs.logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);
}
}
return url.href === captureUrl.href;
};
route = new Route(matchCallback, handler, method);
} else if (capture instanceof RegExp) {
route = new RegExpRoute(capture, handler, method);
} else if (typeof capture === 'function') {
route = new Route(capture, handler, method);
} else if (capture instanceof Route) {
route = capture;
} else {
throw new WorkboxError_mjs.WorkboxError('unsupported-route-type', {
moduleName: 'workbox-routing',
className: 'DefaultRouter',
funcName: 'registerRoute',
paramName: 'capture'
});
}
super.registerRoute(route);
return route;
}
/**
* Register a route that will return a precached file for a navigation
* request. This is useful for the
* [application shell pattern]{@link https://developers.google.com/web/fundamentals/architecture/app-shell}.
*
* This method will generate a
* [NavigationRoute]{@link workbox.routing.NavigationRoute}
* and call
* [Router.registerRoute()]{@link workbox.routing.Router#registerRoute}
* .
*
* @param {string} cachedAssetUrl
* @param {Object} [options]
* @param {string} [options.cacheName] Cache name to store and retrieve
* requests. Defaults to precache cache name provided by
* [workbox-core.cacheNames]{@link workbox.core.cacheNames}.
* @param {Array<RegExp>} [options.blacklist=[]] If any of these patterns
* match, the route will not handle the request (even if a whitelist entry
* matches).
* @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns
* match the URL's pathname and search parameter, the route will handle the
* request (assuming the blacklist doesn't match).
* @return {workbox.routing.NavigationRoute} Returns the generated
* Route.
*
* @alias workbox.routing.registerNavigationRoute
*/
registerNavigationRoute(cachedAssetUrl, options = {}) {
{
assert_mjs.assert.isType(cachedAssetUrl, 'string', {
moduleName: 'workbox-routing',
className: '[default export]',
funcName: 'registerNavigationRoute',
paramName: 'cachedAssetUrl'
});
}
const cacheName = cacheNames_mjs.cacheNames.getPrecacheName(options.cacheName);
const handler = () => caches.match(cachedAssetUrl, { cacheName }).then(response => {
if (response) {
return response;
}
// This shouldn't normally happen, but there are edge cases:
// https://github.com/GoogleChrome/workbox/issues/1441
throw new Error(`The cache ${cacheName} did not have an entry for ` + `${cachedAssetUrl}.`);
}).catch(error => {
// If there's either a cache miss, or the caches.match() call threw
// an exception, then attempt to fulfill the navigation request with
// a response from the network rather than leaving the user with a
// failed navigation.
{
logger_mjs.logger.debug(`Unable to respond to navigation request with cached ` + `response: ${error.message}. Falling back to network.`);
}
// This might still fail if the browser is offline...
return fetch(cachedAssetUrl);
});
const route = new NavigationRoute(handler, {
whitelist: options.whitelist,
blacklist: options.blacklist
});
super.registerRoute(route);
return route;
}
}
const router = new DefaultRouter();
// By default, register a fetch event listener that will respond to a request
// only if there's a matching route.
self.addEventListener('fetch', event => {
const responsePromise = router.handleRequest(event);
if (responsePromise) {
event.respondWith(responsePromise);
}
});
/*
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const finalExport = Object.assign(router, publicAPI);
return finalExport;
}(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-routing.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.routing=function(t,e){"use strict";try{self.workbox.v["workbox:routing:3.6.3"]=1}catch(t){}const r="GET";var s=t=>t&&"object"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith("http"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError("unregister-route-but-not-found-with-method",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError("unregister-route-route-not-registered");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if("navigate"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s="GET"){let i;if("string"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if("function"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError("unsupported-route-type",{moduleName:"workbox-routing",className:"DefaultRouter",funcName:"registerRoute",paramName:"capture"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener("fetch",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);
//# sourceMappingURL=workbox-routing.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-routing/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.routing=function(t,e){\"use strict\";try{self.workbox.v[\"workbox:routing:3.6.3\"]=1}catch(t){}const r=\"GET\";var s=t=>t&&\"object\"==typeof t?t:{handle:t};class n{constructor(t,e,n){this.handler=s(e),this.match=t,this.method=n||r}}class o extends n{constructor(t,e,r){super(({url:e})=>{const r=t.exec(e.href);return r?e.origin!==location.origin&&0!==r.index?null:r.slice(1):null},e,r)}}class i{constructor(){this.t=new Map}handleRequest(t){const e=new URL(t.request.url);if(!e.protocol.startsWith(\"http\"))return;let r=null,s=null,n=null;const o=this.e(t,e);if(s=o.handler,n=o.params,r=o.route,!s&&this.r&&(s=this.r),!s)return;let i;try{i=s.handle({url:e,event:t,params:n})}catch(t){i=Promise.reject(t)}return i&&this.s&&(i=i.catch(r=>this.s.handle({url:e,event:t,err:r}))),i}e(t,e){const r=this.t.get(t.request.method)||[];for(const s of r){let r=s.match({url:e,event:t});if(r)return Array.isArray(r)&&0===r.length?r=void 0:(r.constructor===Object&&0===Object.keys(r).length||!0===r)&&(r=void 0),{route:s,params:r,handler:s.handler}}return{handler:void 0,params:void 0}}setDefaultHandler(t){this.r=s(t)}setCatchHandler(t){this.s=s(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(e){if(!this.t.has(e.method))throw new t.WorkboxError(\"unregister-route-but-not-found-with-method\",{method:e.method});const r=this.t.get(e.method).indexOf(e);if(!(r>-1))throw new t.WorkboxError(\"unregister-route-route-not-registered\");this.t.get(e.method).splice(r,1)}}class u extends n{constructor(t,{whitelist:e=[/./],blacklist:r=[]}={}){super((...t)=>this.n(...t),t),this.o=e,this.i=r}n({event:t,url:e}){if(\"navigate\"!==t.request.mode)return!1;const r=e.pathname+e.search;return!this.i.some(t=>t.test(r))&&!!this.o.some(t=>t.test(r))}}var a=Object.freeze({RegExpRoute:o,Route:n,Router:i,NavigationRoute:u});const c=new class extends i{registerRoute(e,r,s=\"GET\"){let i;if(\"string\"==typeof e){const t=new URL(e,location);i=new n(({url:e})=>e.href===t.href,r,s)}else if(e instanceof RegExp)i=new o(e,r,s);else if(\"function\"==typeof e)i=new n(e,r,s);else{if(!(e instanceof n))throw new t.WorkboxError(\"unsupported-route-type\",{moduleName:\"workbox-routing\",className:\"DefaultRouter\",funcName:\"registerRoute\",paramName:\"capture\"});i=e}return super.registerRoute(i),i}registerNavigationRoute(t,r={}){const s=e.cacheNames.getPrecacheName(r.cacheName),n=new u(()=>caches.match(t,{cacheName:s}).then(e=>{if(e)return e;throw new Error(`The cache ${s} did not have an entry for `+`${t}.`)}).catch(e=>fetch(t)),{whitelist:r.whitelist,blacklist:r.blacklist});return super.registerRoute(n),n}};return self.addEventListener(\"fetch\",t=>{const e=c.handleRequest(t);e&&t.respondWith(e)}),Object.assign(c,a)}(workbox.core._private,workbox.core._private);\n"],"file":"workbox-routing.prod.js"}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,380 +0,0 @@
this.workbox = this.workbox || {};
this.workbox.streams = (function (exports,logger_mjs,assert_mjs) {
'use strict';
try {
self.workbox.v['workbox:streams:3.6.3'] = 1;
} catch (e) {} // eslint-disable-line
/*
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Takes either a Response, a ReadableStream, or a
* [BodyInit](https://fetch.spec.whatwg.org/#bodyinit) and returns the
* ReadableStreamReader object associated with it.
*
* @param {workbox.streams.StreamSource} source
* @return {ReadableStreamReader}
* @private
*/
function _getReaderFromSource(source) {
if (source.body && source.body.getReader) {
return source.body.getReader();
}
if (source.getReader) {
return source.getReader();
}
// TODO: This should be possible to do by constructing a ReadableStream, but
// I can't get it to work. As a hack, construct a new Response, and use the
// reader associated with its body.
return new Response(source).body.getReader();
}
/**
* Takes multiple source Promises, each of which could resolve to a Response, a
* ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit).
*
* Returns an object exposing a ReadableStream with each individual stream's
* data returned in sequence, along with a Promise which signals when the
* stream is finished (useful for passing to a FetchEvent's waitUntil()).
*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @return {Object<{done: Promise, stream: ReadableStream}>}
*
* @memberof workbox.streams
*/
function concatenate(sourcePromises) {
{
assert_mjs.assert.isArray(sourcePromises, {
moduleName: 'workbox-streams',
funcName: 'concatenate',
paramName: 'sourcePromises'
});
}
const readerPromises = sourcePromises.map(sourcePromise => {
return Promise.resolve(sourcePromise).then(source => {
return _getReaderFromSource(source);
});
});
let fullyStreamedResolve;
let fullyStreamedReject;
const done = new Promise((resolve, reject) => {
fullyStreamedResolve = resolve;
fullyStreamedReject = reject;
});
let i = 0;
const logMessages = [];
const stream = new ReadableStream({
pull(controller) {
return readerPromises[i].then(reader => reader.read()).then(result => {
if (result.done) {
{
logMessages.push(['Reached the end of source:', sourcePromises[i]]);
}
i++;
if (i >= readerPromises.length) {
// Log all the messages in the group at once in a single group.
{
logger_mjs.logger.groupCollapsed(`Concatenating ${readerPromises.length} sources.`);
for (const message of logMessages) {
if (Array.isArray(message)) {
logger_mjs.logger.log(...message);
} else {
logger_mjs.logger.log(message);
}
}
logger_mjs.logger.log('Finished reading all sources.');
logger_mjs.logger.groupEnd();
}
controller.close();
fullyStreamedResolve();
return;
}
return this.pull(controller);
} else {
controller.enqueue(result.value);
}
}).catch(error => {
{
logger_mjs.logger.error('An error occurred:', error);
}
fullyStreamedReject(error);
throw error;
});
},
cancel() {
{
logger_mjs.logger.warn('The ReadableStream was cancelled.');
}
fullyStreamedResolve();
}
});
return { done, stream };
}
/*
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* This is a utility method that determines whether the current browser supports
* the features required to create streamed responses. Currently, it checks if
* [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
* is available.
*
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
* `'text/html'` will be used by default.
* @return {boolean} `true`, if the current browser meets the requirements for
* streaming responses, and `false` otherwise.
*
* @memberof workbox.streams
*/
function createHeaders(headersInit = {}) {
// See https://github.com/GoogleChrome/workbox/issues/1461
const headers = new Headers(headersInit);
if (!headers.has('content-type')) {
headers.set('content-type', 'text/html');
}
return headers;
}
/*
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* Takes multiple source Promises, each of which could resolve to a Response, a
* ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
* along with a
* [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).
*
* Returns an object exposing a Response whose body consists of each individual
* stream's data returned in sequence, along with a Promise which signals when
* the stream is finished (useful for passing to a FetchEvent's waitUntil()).
*
* @param {Array<Promise<workbox.streams.StreamSource>>} sourcePromises
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
* `'text/html'` will be used by default.
* @return {Object<{done: Promise, response: Response}>}
*
* @memberof workbox.streams
*/
function concatenateToResponse(sourcePromises, headersInit) {
const { done, stream } = concatenate(sourcePromises);
const headers = createHeaders(headersInit);
const response = new Response(stream, { headers });
return { done, response };
}
/*
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
let cachedIsSupported = undefined;
/**
* This is a utility method that determines whether the current browser supports
* the features required to create streamed responses. Currently, it checks if
* [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream)
* can be created.
*
* @return {boolean} `true`, if the current browser meets the requirements for
* streaming responses, and `false` otherwise.
*
* @memberof workbox.streams
*/
function isSupported() {
if (cachedIsSupported === undefined) {
// See https://github.com/GoogleChrome/workbox/issues/1473
try {
new ReadableStream({ start() {} });
cachedIsSupported = true;
} catch (error) {
cachedIsSupported = false;
}
}
return cachedIsSupported;
}
/*
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* A shortcut to create a strategy that could be dropped-in to Workbox's router.
*
* On browsers that do not support constructing new `ReadableStream`s, this
* strategy will automatically wait for all the `sourceFunctions` to complete,
* and create a final response that concatenates their values together.
*
* @param {
* Array<function(workbox.routing.Route~handlerCallback)>} sourceFunctions
* Each function should return a {@link workbox.streams.StreamSource} (or a
* Promise which resolves to one).
* @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
* `'text/html'` will be used by default.
* @return {workbox.routing.Route~handlerCallback}
*
* @memberof workbox.streams
*/
function strategy(sourceFunctions, headersInit) {
return (() => {
var _ref = babelHelpers.asyncToGenerator(function* ({ event, url, params }) {
if (isSupported()) {
const { done, response } = concatenateToResponse(sourceFunctions.map(function (sourceFunction) {
return sourceFunction({ event, url, params });
}), headersInit);
event.waitUntil(done);
return response;
}
{
logger_mjs.logger.log(`The current browser doesn't support creating response ` + `streams. Falling back to non-streaming response instead.`);
}
// Fallback to waiting for everything to finish, and concatenating the
// responses.
const parts = yield Promise.all(sourceFunctions.map(function (sourceFunction) {
return sourceFunction({ event, url, params });
}).map((() => {
var _ref2 = babelHelpers.asyncToGenerator(function* (responsePromise) {
const response = yield responsePromise;
if (response instanceof Response) {
return response.blob();
}
// Otherwise, assume it's something like a string which can be used
// as-is when constructing the final composite blob.
return response;
});
return function (_x2) {
return _ref2.apply(this, arguments);
};
})()));
const headers = createHeaders(headersInit);
// Constructing a new Response from a Blob source is well-supported.
// So is constructing a new Blob from multiple source Blobs or strings.
return new Response(new Blob(parts), { headers });
});
return function (_x) {
return _ref.apply(this, arguments);
};
})();
}
/*
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
exports.concatenate = concatenate;
exports.concatenateToResponse = concatenateToResponse;
exports.isSupported = isSupported;
exports.strategy = strategy;
return exports;
}({},workbox.core._private,workbox.core._private));
//# sourceMappingURL=workbox-streams.dev.js.map

File diff suppressed because one or more lines are too long

View file

@ -1,3 +0,0 @@
this.workbox=this.workbox||{},this.workbox.streams=function(e){"use strict";try{self.workbox.v["workbox:streams:3.6.3"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has("content-type")||n.set("content-type","text/html"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});
//# sourceMappingURL=workbox-streams.prod.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-streams/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.streams=function(e){\"use strict\";try{self.workbox.v[\"workbox:streams:3.6.3\"]=1}catch(e){}function n(e){const n=e.map(e=>Promise.resolve(e).then(e=>(e=e).body&&e.body.getReader?e.body.getReader():e.getReader?e.getReader():new Response(e).body.getReader()));var t;let r,s;let o=0;return{done:new Promise((e,n)=>{r=e,s=n}),stream:new ReadableStream({pull(e){return n[o].then(e=>e.read()).then(t=>{if(t.done)return++o>=n.length?(e.close(),void r()):this.pull(e);e.enqueue(t.value)}).catch(e=>{throw s(e),e})},cancel(){r()}})}}function t(e={}){const n=new Headers(e);return n.has(\"content-type\")||n.set(\"content-type\",\"text/html\"),n}function r(e,r){const{done:s,stream:o}=n(e),u=t(r);return{done:s,response:new Response(o,{headers:u})}}let s=void 0;function o(){if(void 0===s)try{new ReadableStream({start(){}}),s=!0}catch(e){s=!1}return s}return e.concatenate=n,e.concatenateToResponse=r,e.isSupported=o,e.strategy=function(e,n){return s=babelHelpers.asyncToGenerator(function*({event:s,url:u,params:i}){if(o()){const{done:t,response:o}=r(e.map(function(e){return e({event:s,url:u,params:i})}),n);return s.waitUntil(t),o}const c=yield Promise.all(e.map(function(e){return e({event:s,url:u,params:i})}).map((a=babelHelpers.asyncToGenerator(function*(e){const n=yield e;return n instanceof Response?n.blob():n}),function(e){return a.apply(this,arguments)})));var a;const l=t(n);return new Response(new Blob(c),{headers:l})}),function(e){return s.apply(this,arguments)};var s},e}({});\n"],"file":"workbox-streams.prod.js"}

View file

@ -1,3 +0,0 @@
var workbox=function(){"use strict";try{self.workbox.v["workbox:sw:3.6.3"]=1}catch(t){}const t="https://storage.googleapis.com/workbox-cdn/releases/3.6.3",e={backgroundSync:"background-sync",broadcastUpdate:"broadcast-cache-update",cacheableResponse:"cacheable-response",core:"core",expiration:"cache-expiration",googleAnalytics:"google-analytics",navigationPreload:"navigation-preload",precaching:"precaching",rangeRequests:"range-requests",routing:"routing",strategies:"strategies",streams:"streams"};return new class{constructor(){return this.v={},this.t={debug:"localhost"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?"dev":"prod",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error("Config must be set before accessing workbox.* modules");Object.assign(this.t,t),this.e=this.t.debug?"dev":"prod"}skipWaiting(){self.addEventListener("install",()=>self.skipWaiting())}clientsClaim(){self.addEventListener("activate",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&""===(s=r.split("/"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join("/")}}}();
//# sourceMappingURL=workbox-sw.js.map

View file

@ -1 +0,0 @@
{"version":3,"names":[],"mappings":"","sources":["packages/workbox-sw/browser.mjs"],"sourcesContent":["var workbox=function(){\"use strict\";try{self.workbox.v[\"workbox:sw:3.6.3\"]=1}catch(t){}const t=\"https://storage.googleapis.com/workbox-cdn/releases/3.6.3\",e={backgroundSync:\"background-sync\",broadcastUpdate:\"broadcast-cache-update\",cacheableResponse:\"cacheable-response\",core:\"core\",expiration:\"cache-expiration\",googleAnalytics:\"google-analytics\",navigationPreload:\"navigation-preload\",precaching:\"precaching\",rangeRequests:\"range-requests\",routing:\"routing\",strategies:\"strategies\",streams:\"streams\"};return new class{constructor(){return this.v={},this.t={debug:\"localhost\"===self.location.hostname,modulePathPrefix:null,modulePathCb:null},this.e=this.t.debug?\"dev\":\"prod\",this.s=!1,new Proxy(this,{get(t,s){if(t[s])return t[s];const o=e[s];return o&&t.loadModule(`workbox-${o}`),t[s]}})}setConfig(t={}){if(this.s)throw new Error(\"Config must be set before accessing workbox.* modules\");Object.assign(this.t,t),this.e=this.t.debug?\"dev\":\"prod\"}skipWaiting(){self.addEventListener(\"install\",()=>self.skipWaiting())}clientsClaim(){self.addEventListener(\"activate\",()=>self.clients.claim())}loadModule(t){const e=this.o(t);try{importScripts(e),this.s=!0}catch(s){throw console.error(`Unable to import module '${t}' from '${e}'.`),s}}o(e){if(this.t.modulePathCb)return this.t.modulePathCb(e,this.t.debug);let s=[t];const o=`${e}.${this.e}.js`,r=this.t.modulePathPrefix;return r&&\"\"===(s=r.split(\"/\"))[s.length-1]&&s.splice(s.length-1,1),s.push(o),s.join(\"/\")}}}();\n"],"file":"workbox-sw.js"}

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -576,17 +576,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -110,7 +110,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -723,17 +723,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -110,7 +110,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -902,17 +902,6 @@ _paq.push(['enableLinkTracking']);
</video> </video>
</div> </div>
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -532,17 +532,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -6,7 +6,7 @@
<atom:link href="https://setto.basspistol.com/rss.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://setto.basspistol.com/rss.xml" rel="self" type="application/rss+xml" />
<link>https://setto.basspistol.com</link> <link>https://setto.basspistol.com</link>
<description>Set, Party, Gang! &amp;#35;Cybersoul.</description> <description>Set, Party, Gang! &amp;#35;Cybersoul.</description>
<lastBuildDate>Wed, 12 Aug 2020 15:34:40 +0000</lastBuildDate> <lastBuildDate>Wed, 12 Aug 2020 15:39:53 +0000</lastBuildDate>
<language>en-US</language> <language>en-US</language>
<sy:updatePeriod>hourly</sy:updatePeriod> <sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency> <sy:updateFrequency>1</sy:updateFrequency>

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="./assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="./assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -688,17 +688,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -503,17 +503,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -110,7 +110,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -732,17 +732,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -447,17 +447,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -1,85 +0,0 @@
{
"short_name": "徒 setto セット",
"name": "徒 setto セット Music PWA",
"lang": "en",
"description": "Music of 徒 setto セット in your phone",
"start_url": "/",
"background_color": "#3c2a52",
"theme_color": "#3c2a52",
"dir": "ltr",
"display": "standalone",
"orientation": "portrait",
"icons": [
{
"src": "/setto-webapp.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "/android-icon-192x192-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "/apple-icon-180x180-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "180x180"
},
{
"src": "/apple-icon-152x152-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "152x152"
},
{
"src": "/apple-icon-144x144-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "144x144"
},
{
"src": "/apple-icon-120x120-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "120x120"
},
{
"src": "/apple-icon-114x114-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "114x114"
},
{
"src": "/favicon-96x96-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "96x96"
},
{
"src": "/apple-icon-76x76-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "76x76"
},
{
"src": "/apple-icon-72x72-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "72x72"
},
{
"src": "/apple-icon-60x60-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "60x60"
},
{
"src": "/apple-icon-57x57-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "57x57"
},
{
"src": "/favicon-32x32-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "32x32"
},
{
"src": "/favicon-16x16-dunplab-manifest-9805.png",
"type": "image/png",
"sizes": "16x16"
}
],
"prefer_related_applications": "false"
}

View file

@ -110,7 +110,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -808,17 +808,6 @@ _paq.push(['enableLinkTracking']);
</video> </video>
</div> </div>
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -1,45 +0,0 @@
importScripts("/assets/js/workbox-v3.6.3/workbox-sw.js");
workbox.setConfig({modulePathPrefix: "/assets/js/workbox-v3.6.3"});
self.__precacheManifest = [{"url":"/assets/js/set-20200805.js","revision":"517470941a809ec5c83021184f35da41"},{"url":"/assets/js/zafari.js","revision":"04d22f981da4fc66a439636aba1b715b"},{"url":"/assets/js/jquery-3.5.1.min.js","revision":"dc5e7f18c8d36ac1d3d4753a87c98d0a"},{"url":"/assets/css/noscripts-20200812.css","revision":"6fde9658c41a199f8b7b7e413fe3ea89"},{"url":"/assets/css/all.min.css","revision":"84d8ad2b4fcdc0f0c58247e778133b3a"},{"url":"/assets/css/main-20200812.css","revision":"f4f7395d7b2bd999552db40aaa89140f"},{"url":"/assets/css/colors.css","revision":"8023633bc61386e533e8512c23224ce0"},{"url":"/assets/fonts/Staatliches-Regular.ttf","revision":"d5746e3b20453d6cee99ab27a0bdf949"},{"url":"/assets/fonts/Astloch-Bold.ttf","revision":"3176f98d79118ba60dea5cad816a330c"},{"url":"/assets/fonts/JetBrainsMono_Italic.ttf","revision":"8d0942fbfa63674fa465f104ca33e043"},{"url":"/assets/fonts/JetBrainsMono_ExtraBold_Italic.ttf","revision":"052f9246bfdfa8a9edc7e626845a6ee6"},{"url":"/assets/fonts/JetBrainsMono_ExtraBold.ttf","revision":"131dbc72ef3af778e86d34efb1fc8972"},{"url":"/assets/fonts/JetBrainsMono_Bold.ttf","revision":"d8af470e44be6c1d2d07dee84db355f6"},{"url":"/assets/fonts/JetBrainsMono_Bold_Italic.ttf","revision":"111bcb2a39ae6140cb21daa3ecd052d1"},{"url":"/assets/fonts/JetBrainsMono_Regular.ttf","revision":"e1caef645de334fee2f25834b0d03c28"},{"url":"/images/setto-logo.svg","revision":"7569ca4090da48547a54fa0ddedda3fd"},{"url":"/images/setto_logo.svg","revision":"5bf66a9e824036039f132a2c99608cfc"},{"url":"/images/setto-logo-dark.svg","revision":"609edc224ff5d3b8ded04619ae9f50a1"},{"url":"/images/setto-logoicon.svg","revision":"e7dc833aac730977d63da33840f5d2ce"},{"url":"/images/posts/final-pingnucover1220x1200.jpg","revision":"40bf2aa467fc998f16966f6299772aa3"},{"url":"/images/posts/333mix.jpg","revision":"8370744fc4e6bd11153f05bdae4d017f"},{"url":"/images/posts/1-ep-life-of-a-dudelini.jpeg","revision":"5f0556d93f8df15b7283d7184e7e205f"},{"url":"/images/posts/1-grandma-got-the-ssh-keys.jpeg","revision":"f17c4fa35cfd429715093fc170ff37db"},{"url":"/images/posts/1-k-as-tu-fait-de-nous-.jpeg","revision":"c75a92953e880cca8ae26b4ab73265e2"},{"url":"/images/posts/2-darkweb-instrumental-.jpeg","revision":"25b1ed36880f9afef45b6f969ff63f72"},{"url":"/images/pages/pingu.jpg","revision":"fdbcbb8a73099a784a0e39caf322a404"},{"url":"/images/pages/creds.jpg","revision":"c0d61d2dcc2820989b445da52d984a11"},{"url":"/images/pages/phone.jpg","revision":"28c71c2f34dd924836522ea99a0330b0"},{"url":"/images/pages/jack-hamilton-CMnNiQBkwBI-unsplash.jpg","revision":"05b685c77386c247340abecb8eaf3218"},{"url":"/images/pages/arget-zvhhkivur9m-unsplash.jpg","revision":"e80d8b7d0899415327d46c345e95571e"},{"url":"/images/pages/kaur-kristjan-cppf4w5pb1c-unsplash.jpg","revision":"982d5e7565ea6fb7211305c12048a94e"},{"url":"/images/pages/4-darkweb-instrumental-.jpeg","revision":"25b1ed36880f9afef45b6f969ff63f72"},{"url":"/index.html","revision":"07ea7c703b529cdcee8276df444aede0"},{"url":"/333mix/","revision":"6acd43ac354a52d3248f8ea9dc36405d"},{"url":"/unmet-dependencies/","revision":"abf15a089c9232faa369fb4e5f13b50d"},{"url":"/live-with-hardware/","revision":"ce07900a964783eda05d0515d169d5d1"},{"url":"/cyber-grany/","revision":"e78f9e99f3e2c609d1545ba7f7d3c848"},{"url":"/darkweb/","revision":"3f3333f1ddfbec03dd8194e2745f3ffe"}];
// service-worker.js
// set names for both precache & runtime cache
workbox.core.setCacheNameDetails({
prefix: 'SettoPWA',
suffix: 'v1',
precache: 'precache',
runtime: 'runtime-cache'
});
// let Service Worker take control of pages ASAP
workbox.skipWaiting();
workbox.clientsClaim();
// let Workbox handle our precache list
workbox.precaching.precacheAndRoute(self.__precacheManifest);
// use `networkFirst` strategy for `*.html`, like all my posts
workbox.routing.registerRoute(
/\.html$/,
workbox.strategies.networkFirst()
);
// use `cacheFirst` strategy for images and static assets
workbox.routing.registerRoute(
/assets\/(img|icons|fonts|webfonts)/,
workbox.strategies.cacheFirst()
);
workbox.routing.registerRoute(
/videos/,
workbox.strategies.cacheFirst()
);
workbox.routing.registerRoute(
/images\/(posts|pages)/,
workbox.strategies.cacheFirst()
);
// third party files
workbox.routing.registerRoute(
/^https?:\/\/media.basspistol.com/,
workbox.strategies.staleWhileRevalidate()
);

View file

@ -1,20 +0,0 @@
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js?v=1597246480').then(function(reg) {
reg.onupdatefound = function() {
var installingWorker = reg.installing;
installingWorker.onstatechange = function() {
switch (installingWorker.state) {
case 'installed':
if (navigator.serviceWorker.controller) {
var event = document.createEvent('Event');
event.initEvent('sw.update', true, true);
window.dispatchEvent(event);
}
break;
}
};
};
}).catch(function(e) {
console.error('Error during service worker registration:', e);
});
}

View file

@ -110,7 +110,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -803,17 +803,6 @@ _paq.push(['enableLinkTracking']);
</video> </video>
</div> </div>
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>

View file

@ -122,7 +122,7 @@
<link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192"> <link rel="icon" type="image/png" href="https://setto.basspistol.com/touch-icon.png" sizes="192x192">
<link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" /> <link rel="shortcut icon" href="https://setto.basspistol.com/images/setto-logoicon.svg" type="image/png" />
<noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript> <noscript><link rel="stylesheet" href="../assets/css/noscripts-20200812.css" /></noscript>
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#3c2a52"/> <meta name="theme-color" content="#3c2a52"/>
</head> </head>
@ -430,17 +430,6 @@ _paq.push(['enableLinkTracking']);
<script> </body>
window.onload = function () {
var script = document.createElement('script');
var firstScript = document.getElementsByTagName('script')[0];
script.type = 'text/javascript';
script.async = true;
script.src = '/sw-register.js?v=' + Date.now();
firstScript.parentNode.insertBefore(script, firstScript);
};
</script>
</body>
</html> </html>