v1.0 with SW PWA enabled
This commit is contained in:
45
frontend/node_modules/workbox-cacheable-response/CacheableResponse.d.ts
generated
vendored
Normal file
45
frontend/node_modules/workbox-cacheable-response/CacheableResponse.d.ts
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import './_version.js';
|
||||
export interface CacheableResponseOptions {
|
||||
statuses?: number[];
|
||||
headers?: {
|
||||
[headerName: string]: string;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
declare class CacheableResponse {
|
||||
private readonly _statuses?;
|
||||
private readonly _headers?;
|
||||
/**
|
||||
* 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?: CacheableResponseOptions);
|
||||
/**
|
||||
* 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: Response): boolean;
|
||||
}
|
||||
export { CacheableResponse };
|
||||
119
frontend/node_modules/workbox-cacheable-response/CacheableResponse.js
generated
vendored
Normal file
119
frontend/node_modules/workbox-cacheable-response/CacheableResponse.js
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
import { assert } from 'workbox-core/_private/assert.js';
|
||||
import { WorkboxError } from 'workbox-core/_private/WorkboxError.js';
|
||||
import { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';
|
||||
import { logger } from 'workbox-core/_private/logger.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
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 (process.env.NODE_ENV !== 'production') {
|
||||
if (!(config.statuses || config.headers)) {
|
||||
throw new WorkboxError('statuses-or-headers-required', {
|
||||
moduleName: 'workbox-cacheable-response',
|
||||
className: 'CacheableResponse',
|
||||
funcName: 'constructor',
|
||||
});
|
||||
}
|
||||
if (config.statuses) {
|
||||
assert.isArray(config.statuses, {
|
||||
moduleName: 'workbox-cacheable-response',
|
||||
className: 'CacheableResponse',
|
||||
funcName: 'constructor',
|
||||
paramName: 'config.statuses',
|
||||
});
|
||||
}
|
||||
if (config.headers) {
|
||||
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) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
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 (process.env.NODE_ENV !== 'production') {
|
||||
if (!cacheable) {
|
||||
logger.groupCollapsed(`The request for ` +
|
||||
`'${getFriendlyURL(response.url)}' returned a response that does ` +
|
||||
`not meet the criteria for being cached.`);
|
||||
logger.groupCollapsed(`View cacheability criteria here.`);
|
||||
logger.log(`Cacheable statuses: ` + JSON.stringify(this._statuses));
|
||||
logger.log(`Cacheable headers: ` + JSON.stringify(this._headers, null, 2));
|
||||
logger.groupEnd();
|
||||
const logFriendlyHeaders = {};
|
||||
response.headers.forEach((value, key) => {
|
||||
logFriendlyHeaders[key] = value;
|
||||
});
|
||||
logger.groupCollapsed(`View response status and headers here.`);
|
||||
logger.log(`Response status: ${response.status}`);
|
||||
logger.log(`Response headers: ` + JSON.stringify(logFriendlyHeaders, null, 2));
|
||||
logger.groupEnd();
|
||||
logger.groupCollapsed(`View full response details here.`);
|
||||
logger.log(response.headers);
|
||||
logger.log(response);
|
||||
logger.groupEnd();
|
||||
logger.groupEnd();
|
||||
}
|
||||
}
|
||||
return cacheable;
|
||||
}
|
||||
}
|
||||
export { CacheableResponse };
|
||||
1
frontend/node_modules/workbox-cacheable-response/CacheableResponse.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/CacheableResponse.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './CacheableResponse.js';
|
||||
36
frontend/node_modules/workbox-cacheable-response/CacheableResponsePlugin.d.ts
generated
vendored
Normal file
36
frontend/node_modules/workbox-cacheable-response/CacheableResponsePlugin.d.ts
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
import { WorkboxPlugin } from 'workbox-core/types.js';
|
||||
import { CacheableResponseOptions } from './CacheableResponse.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
declare class CacheableResponsePlugin implements WorkboxPlugin {
|
||||
private readonly _cacheableResponse;
|
||||
/**
|
||||
* To construct a new CacheableResponsePlugin 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: CacheableResponseOptions);
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @param {Response} options.response
|
||||
* @return {Response|null}
|
||||
* @private
|
||||
*/
|
||||
cacheWillUpdate: WorkboxPlugin['cacheWillUpdate'];
|
||||
}
|
||||
export { CacheableResponsePlugin };
|
||||
48
frontend/node_modules/workbox-cacheable-response/CacheableResponsePlugin.js
generated
vendored
Normal file
48
frontend/node_modules/workbox-cacheable-response/CacheableResponsePlugin.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
import { CacheableResponse, } from './CacheableResponse.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
class CacheableResponsePlugin {
|
||||
/**
|
||||
* To construct a new CacheableResponsePlugin 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) {
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @param {Response} options.response
|
||||
* @return {Response|null}
|
||||
* @private
|
||||
*/
|
||||
this.cacheWillUpdate = async ({ response }) => {
|
||||
if (this._cacheableResponse.isResponseCacheable(response)) {
|
||||
return response;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
this._cacheableResponse = new CacheableResponse(config);
|
||||
}
|
||||
}
|
||||
export { CacheableResponsePlugin };
|
||||
1
frontend/node_modules/workbox-cacheable-response/CacheableResponsePlugin.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/CacheableResponsePlugin.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './CacheableResponsePlugin.js';
|
||||
19
frontend/node_modules/workbox-cacheable-response/LICENSE
generated
vendored
Normal file
19
frontend/node_modules/workbox-cacheable-response/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
1
frontend/node_modules/workbox-cacheable-response/README.md
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/README.md
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
This module's documentation can be found at https://developers.google.com/web/tools/workbox/modules/workbox-cacheable-response
|
||||
0
frontend/node_modules/workbox-cacheable-response/_version.d.ts
generated
vendored
Normal file
0
frontend/node_modules/workbox-cacheable-response/_version.d.ts
generated
vendored
Normal file
6
frontend/node_modules/workbox-cacheable-response/_version.js
generated
vendored
Normal file
6
frontend/node_modules/workbox-cacheable-response/_version.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
// @ts-ignore
|
||||
try {
|
||||
self['workbox:cacheable-response:7.3.0'] && _();
|
||||
}
|
||||
catch (e) { }
|
||||
1
frontend/node_modules/workbox-cacheable-response/_version.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/_version.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
try{self['workbox:cacheable-response:7.4.0']&&_()}catch(e){}// eslint-disable-line
|
||||
176
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.dev.js
generated
vendored
Normal file
176
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.dev.js
generated
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
this.workbox = this.workbox || {};
|
||||
this.workbox.cacheableResponse = (function (exports, assert_js, WorkboxError_js, getFriendlyURL_js, logger_js) {
|
||||
'use strict';
|
||||
|
||||
// @ts-ignore
|
||||
try {
|
||||
self['workbox:cacheable-response:7.3.0'] && _();
|
||||
} catch (e) {}
|
||||
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
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_js.WorkboxError('statuses-or-headers-required', {
|
||||
moduleName: 'workbox-cacheable-response',
|
||||
className: 'CacheableResponse',
|
||||
funcName: 'constructor'
|
||||
});
|
||||
}
|
||||
if (config.statuses) {
|
||||
assert_js.assert.isArray(config.statuses, {
|
||||
moduleName: 'workbox-cacheable-response',
|
||||
className: 'CacheableResponse',
|
||||
funcName: 'constructor',
|
||||
paramName: 'config.statuses'
|
||||
});
|
||||
}
|
||||
if (config.headers) {
|
||||
assert_js.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_js.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_js.logger.groupCollapsed(`The request for ` + `'${getFriendlyURL_js.getFriendlyURL(response.url)}' returned a response that does ` + `not meet the criteria for being cached.`);
|
||||
logger_js.logger.groupCollapsed(`View cacheability criteria here.`);
|
||||
logger_js.logger.log(`Cacheable statuses: ` + JSON.stringify(this._statuses));
|
||||
logger_js.logger.log(`Cacheable headers: ` + JSON.stringify(this._headers, null, 2));
|
||||
logger_js.logger.groupEnd();
|
||||
const logFriendlyHeaders = {};
|
||||
response.headers.forEach((value, key) => {
|
||||
logFriendlyHeaders[key] = value;
|
||||
});
|
||||
logger_js.logger.groupCollapsed(`View response status and headers here.`);
|
||||
logger_js.logger.log(`Response status: ${response.status}`);
|
||||
logger_js.logger.log(`Response headers: ` + JSON.stringify(logFriendlyHeaders, null, 2));
|
||||
logger_js.logger.groupEnd();
|
||||
logger_js.logger.groupCollapsed(`View full response details here.`);
|
||||
logger_js.logger.log(response.headers);
|
||||
logger_js.logger.log(response);
|
||||
logger_js.logger.groupEnd();
|
||||
logger_js.logger.groupEnd();
|
||||
}
|
||||
}
|
||||
return cacheable;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
class CacheableResponsePlugin {
|
||||
/**
|
||||
* To construct a new CacheableResponsePlugin 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) {
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @param {Response} options.response
|
||||
* @return {Response|null}
|
||||
* @private
|
||||
*/
|
||||
this.cacheWillUpdate = async ({
|
||||
response
|
||||
}) => {
|
||||
if (this._cacheableResponse.isResponseCacheable(response)) {
|
||||
return response;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
this._cacheableResponse = new CacheableResponse(config);
|
||||
}
|
||||
}
|
||||
|
||||
exports.CacheableResponse = CacheableResponse;
|
||||
exports.CacheableResponsePlugin = CacheableResponsePlugin;
|
||||
|
||||
return exports;
|
||||
|
||||
})({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private);
|
||||
//# sourceMappingURL=workbox-cacheable-response.dev.js.map
|
||||
1
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.dev.js.map
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.dev.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.prod.js
generated
vendored
Normal file
2
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.prod.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
this.workbox=this.workbox||{},this.workbox.cacheableResponse=function(s){"use strict";try{self["workbox:cacheable-response:7.3.0"]&&_()}catch(s){}class t{constructor(s={}){this.ss=s.statuses,this.ts=s.headers}isResponseCacheable(s){let t=!0;return this.ss&&(t=this.ss.includes(s.status)),this.ts&&t&&(t=Object.keys(this.ts).some((t=>s.headers.get(t)===this.ts[t]))),t}}return s.CacheableResponse=t,s.CacheableResponsePlugin=class{constructor(s){this.cacheWillUpdate=async({response:s})=>this.hs.isResponseCacheable(s)?s:null,this.hs=new t(s)}},s}({});
|
||||
//# sourceMappingURL=workbox-cacheable-response.prod.js.map
|
||||
1
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.prod.js.map
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/build/workbox-cacheable-response.prod.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
frontend/node_modules/workbox-cacheable-response/index.d.ts
generated
vendored
Normal file
7
frontend/node_modules/workbox-cacheable-response/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import { CacheableResponse, CacheableResponseOptions } from './CacheableResponse.js';
|
||||
import { CacheableResponsePlugin } from './CacheableResponsePlugin.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* @module workbox-cacheable-response
|
||||
*/
|
||||
export { CacheableResponse, CacheableResponseOptions, CacheableResponsePlugin };
|
||||
14
frontend/node_modules/workbox-cacheable-response/index.js
generated
vendored
Normal file
14
frontend/node_modules/workbox-cacheable-response/index.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
import { CacheableResponse, } from './CacheableResponse.js';
|
||||
import { CacheableResponsePlugin } from './CacheableResponsePlugin.js';
|
||||
import './_version.js';
|
||||
/**
|
||||
* @module workbox-cacheable-response
|
||||
*/
|
||||
export { CacheableResponse, CacheableResponsePlugin };
|
||||
1
frontend/node_modules/workbox-cacheable-response/index.mjs
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/index.mjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * from './index.js';
|
||||
31
frontend/node_modules/workbox-cacheable-response/package.json
generated
vendored
Executable file
31
frontend/node_modules/workbox-cacheable-response/package.json
generated
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "workbox-cacheable-response",
|
||||
"version": "7.4.0",
|
||||
"license": "MIT",
|
||||
"author": "Google's Web DevRel Team and Google's Aurora Team",
|
||||
"description": "This library takes a Response object and determines whether it's cacheable based on a specific configuration.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/googlechrome/workbox.git"
|
||||
},
|
||||
"bugs": "https://github.com/googlechrome/workbox/issues",
|
||||
"homepage": "https://github.com/GoogleChrome/workbox",
|
||||
"keywords": [
|
||||
"workbox",
|
||||
"workboxjs",
|
||||
"service worker",
|
||||
"sw",
|
||||
"workbox-plugin"
|
||||
],
|
||||
"workbox": {
|
||||
"browserNamespace": "workbox.cacheableResponse",
|
||||
"packageType": "sw"
|
||||
},
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"types": "index.d.ts",
|
||||
"dependencies": {
|
||||
"workbox-core": "7.4.0"
|
||||
},
|
||||
"gitHead": "fa702feeddd417fcdfa495cd9428fb4a28632e92"
|
||||
}
|
||||
150
frontend/node_modules/workbox-cacheable-response/src/CacheableResponse.ts
generated
vendored
Normal file
150
frontend/node_modules/workbox-cacheable-response/src/CacheableResponse.ts
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
import {assert} from 'workbox-core/_private/assert.js';
|
||||
import {WorkboxError} from 'workbox-core/_private/WorkboxError.js';
|
||||
import {getFriendlyURL} from 'workbox-core/_private/getFriendlyURL.js';
|
||||
import {logger} from 'workbox-core/_private/logger.js';
|
||||
import './_version.js';
|
||||
|
||||
export interface CacheableResponseOptions {
|
||||
statuses?: number[];
|
||||
headers?: {[headerName: string]: string};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
class CacheableResponse {
|
||||
private readonly _statuses?: CacheableResponseOptions['statuses'];
|
||||
private readonly _headers?: CacheableResponseOptions['headers'];
|
||||
|
||||
/**
|
||||
* 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: CacheableResponseOptions = {}) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!(config.statuses || config.headers)) {
|
||||
throw new WorkboxError('statuses-or-headers-required', {
|
||||
moduleName: 'workbox-cacheable-response',
|
||||
className: 'CacheableResponse',
|
||||
funcName: 'constructor',
|
||||
});
|
||||
}
|
||||
|
||||
if (config.statuses) {
|
||||
assert!.isArray(config.statuses, {
|
||||
moduleName: 'workbox-cacheable-response',
|
||||
className: 'CacheableResponse',
|
||||
funcName: 'constructor',
|
||||
paramName: 'config.statuses',
|
||||
});
|
||||
}
|
||||
|
||||
if (config.headers) {
|
||||
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: Response): boolean {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
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 (process.env.NODE_ENV !== 'production') {
|
||||
if (!cacheable) {
|
||||
logger.groupCollapsed(
|
||||
`The request for ` +
|
||||
`'${getFriendlyURL(response.url)}' returned a response that does ` +
|
||||
`not meet the criteria for being cached.`,
|
||||
);
|
||||
|
||||
logger.groupCollapsed(`View cacheability criteria here.`);
|
||||
logger.log(`Cacheable statuses: ` + JSON.stringify(this._statuses));
|
||||
logger.log(
|
||||
`Cacheable headers: ` + JSON.stringify(this._headers, null, 2),
|
||||
);
|
||||
logger.groupEnd();
|
||||
|
||||
const logFriendlyHeaders: {[key: string]: string} = {};
|
||||
response.headers.forEach((value, key) => {
|
||||
logFriendlyHeaders[key] = value;
|
||||
});
|
||||
|
||||
logger.groupCollapsed(`View response status and headers here.`);
|
||||
logger.log(`Response status: ${response.status}`);
|
||||
logger.log(
|
||||
`Response headers: ` + JSON.stringify(logFriendlyHeaders, null, 2),
|
||||
);
|
||||
logger.groupEnd();
|
||||
|
||||
logger.groupCollapsed(`View full response details here.`);
|
||||
logger.log(response.headers);
|
||||
logger.log(response);
|
||||
logger.groupEnd();
|
||||
|
||||
logger.groupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
return cacheable;
|
||||
}
|
||||
}
|
||||
|
||||
export {CacheableResponse};
|
||||
58
frontend/node_modules/workbox-cacheable-response/src/CacheableResponsePlugin.ts
generated
vendored
Normal file
58
frontend/node_modules/workbox-cacheable-response/src/CacheableResponsePlugin.ts
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
import {WorkboxPlugin} from 'workbox-core/types.js';
|
||||
import {
|
||||
CacheableResponse,
|
||||
CacheableResponseOptions,
|
||||
} from './CacheableResponse.js';
|
||||
import './_version.js';
|
||||
|
||||
/**
|
||||
* 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-cacheable-response
|
||||
*/
|
||||
class CacheableResponsePlugin implements WorkboxPlugin {
|
||||
private readonly _cacheableResponse: CacheableResponse;
|
||||
|
||||
/**
|
||||
* To construct a new CacheableResponsePlugin 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: CacheableResponseOptions) {
|
||||
this._cacheableResponse = new CacheableResponse(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @param {Response} options.response
|
||||
* @return {Response|null}
|
||||
* @private
|
||||
*/
|
||||
cacheWillUpdate: WorkboxPlugin['cacheWillUpdate'] = async ({response}) => {
|
||||
if (this._cacheableResponse.isResponseCacheable(response)) {
|
||||
return response;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
export {CacheableResponsePlugin};
|
||||
2
frontend/node_modules/workbox-cacheable-response/src/_version.ts
generated
vendored
Normal file
2
frontend/node_modules/workbox-cacheable-response/src/_version.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// @ts-ignore
|
||||
try{self['workbox:cacheable-response:7.4.0']&&_()}catch(e){}
|
||||
21
frontend/node_modules/workbox-cacheable-response/src/index.ts
generated
vendored
Normal file
21
frontend/node_modules/workbox-cacheable-response/src/index.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2018 Google LLC
|
||||
|
||||
Use of this source code is governed by an MIT-style
|
||||
license that can be found in the LICENSE file or at
|
||||
https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
import {
|
||||
CacheableResponse,
|
||||
CacheableResponseOptions,
|
||||
} from './CacheableResponse.js';
|
||||
import {CacheableResponsePlugin} from './CacheableResponsePlugin.js';
|
||||
|
||||
import './_version.js';
|
||||
|
||||
/**
|
||||
* @module workbox-cacheable-response
|
||||
*/
|
||||
|
||||
export {CacheableResponse, CacheableResponseOptions, CacheableResponsePlugin};
|
||||
11
frontend/node_modules/workbox-cacheable-response/tsconfig.json
generated
vendored
Normal file
11
frontend/node_modules/workbox-cacheable-response/tsconfig.json
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"outDir": "./",
|
||||
"rootDir": "./src",
|
||||
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"references": [{"path": "../workbox-core/"}]
|
||||
}
|
||||
1
frontend/node_modules/workbox-cacheable-response/tsconfig.tsbuildinfo
generated
vendored
Normal file
1
frontend/node_modules/workbox-cacheable-response/tsconfig.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user