Socket
Socket
Sign inDemoInstall

workbox-core

Package Overview
Dependencies
Maintainers
6
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-core - npm Package Compare versions

Comparing version 7.0.0 to 7.1.0

158

build/workbox-core.dev.js

@@ -5,2 +5,3 @@ this.workbox = this.workbox || {};

// @ts-ignore
try {

@@ -22,3 +23,2 @@ self['workbox:core:7.0.0'] && _();

}
let inGroup = false;

@@ -32,5 +32,3 @@ const methodToColorMap = {

groupEnd: null // No colored prefix on groupEnd
};
const print = function (method, args) {

@@ -40,3 +38,2 @@ if (self.__WB_DISABLE_DEV_LOGS) {

}
if (method === 'groupCollapsed') {

@@ -50,24 +47,18 @@ // Safari doesn't print all console.groupCollapsed() arguments:

}
const styles = [`background: ${methodToColorMap[method]}`, `border-radius: 0.5em`, `color: white`, `font-weight: bold`, `padding: 2px 0.5em`]; // When in a group, the workbox prefix is not displayed.
const styles = [`background: ${methodToColorMap[method]}`, `border-radius: 0.5em`, `color: white`, `font-weight: bold`, `padding: 2px 0.5em`];
// When in a group, the workbox prefix is not displayed.
const logPrefix = inGroup ? [] : ['%cworkbox', styles.join(';')];
console[method](...logPrefix, ...args);
if (method === 'groupCollapsed') {
inGroup = true;
}
if (method === 'groupEnd') {
inGroup = false;
}
}; // eslint-disable-next-line @typescript-eslint/ban-types
};
// eslint-disable-next-line @typescript-eslint/ban-types
const api = {};
const loggerMethods = Object.keys(methodToColorMap);
for (const key of loggerMethods) {
const method = key;
api[method] = (...args) => {

@@ -77,3 +68,2 @@ print(method, args);

}
return api;

@@ -98,3 +88,2 @@ })();

}
return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;

@@ -111,3 +100,2 @@ },

}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;

@@ -125,3 +113,2 @@ },

}
const classNameStr = className ? `${className}.` : '';

@@ -141,9 +128,6 @@ return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}` + `${funcName}()' must be of type ${expectedType}.`;

}
const classNameStr = className ? `${className}.` : '';
if (isReturnValueProblem) {
return `The return value from ` + `'${moduleName}.${classNameStr}${funcName}()' ` + `must be an instance of class ${expectedClassName}.`;
}
return `The parameter '${paramName}' passed into ` + `'${moduleName}.${classNameStr}${funcName}()' ` + `must be an instance of class ${expectedClassName}.`;

@@ -161,3 +145,2 @@ },

}
return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;

@@ -177,3 +160,2 @@ },

}
return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had the URL ` + `${firstEntry} but different revision details. Workbox is ` + `unable to cache and version the asset correctly. Please remove one ` + `of the entries.`;

@@ -187,3 +169,2 @@ },

}
return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownErrorMessage}'.`;

@@ -198,3 +179,2 @@ },

}
return `You must provide a name containing at least one character for ` + `setCacheDetails({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;

@@ -208,3 +188,2 @@ },

}
return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;

@@ -271,3 +250,2 @@ },

}
return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${funcName}() for ` + `more info.`;

@@ -290,3 +268,2 @@ },

}
return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was "${normalizedRangeHeader}"`;

@@ -300,3 +277,2 @@ },

}
return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `"${normalizedRangeHeader}"`;

@@ -310,3 +286,2 @@ },

}
return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `"${normalizedRangeHeader}"`;

@@ -340,7 +315,5 @@ },

let message = `The strategy could not generate a response for '${url}'.`;
if (error) {
message += ` The underlying error is ${error}.`;
}
return message;

@@ -379,7 +352,5 @@ },

const message = `One of the workbox-streams sources resulted in an ` + `'${type}' response.`;
if (type === 'opaqueredirect') {
return `${message} Please do not use a navigation request that results ` + `in a redirect as a source.`;
}
return `${message} Please ensure your sources are CORS-enabled.`;

@@ -396,13 +367,9 @@ }

*/
const generatorFunction = (code, details = {}) => {
const message = messages[code];
if (!message) {
throw new Error(`Unable to find message for code '${code}'.`);
}
return message(details);
};
const messageGenerator = generatorFunction;

@@ -426,3 +393,2 @@

*/
class WorkboxError extends Error {

@@ -443,3 +409,2 @@ /**

}
}

@@ -460,3 +425,2 @@

*/
const isArray = (value, details) => {

@@ -467,6 +431,4 @@ if (!Array.isArray(value)) {

};
const hasMethod = (object, expectedMethod, details) => {
const type = typeof object[expectedMethod];
if (type !== 'function') {

@@ -477,3 +439,2 @@ details['expectedMethod'] = expectedMethod;

};
const isType = (object, expectedType, details) => {

@@ -485,4 +446,4 @@ if (typeof object !== expectedType) {

};
const isInstance = (object, // Need the general type to do the check later.
const isInstance = (object,
// Need the general type to do the check later.
// eslint-disable-next-line @typescript-eslint/ban-types

@@ -495,3 +456,2 @@ expectedClass, details) => {

};
const isOneOf = (value, validValues, details) => {

@@ -503,12 +463,11 @@ if (!validValues.includes(value)) {

};
const isArrayOfClass = (value, // Need general type to do check later.
expectedClass, // eslint-disable-line
const isArrayOfClass = (value,
// Need general type to do check later.
expectedClass,
// eslint-disable-line
details) => {
const error = new WorkboxError('not-array-of-class', details);
if (!Array.isArray(value)) {
throw error;
}
for (const item of value) {

@@ -520,3 +479,2 @@ if (!(item instanceof expectedClass)) {

};
const finalAssertExports = {

@@ -538,5 +496,5 @@ hasMethod,

*/
// Callbacks to be executed whenever there's a quota error.
// Can't change Function type right now.
// eslint-disable-next-line @typescript-eslint/ban-types
const quotaErrorCallbacks = new Set();

@@ -560,3 +518,2 @@

// eslint-disable-next-line @typescript-eslint/ban-types
function registerQuotaErrorCallback(callback) {

@@ -570,5 +527,3 @@ {

}
quotaErrorCallbacks.add(callback);
{

@@ -593,7 +548,5 @@ logger.log('Registered a callback to respond to quota errors.', callback);

};
const _createCacheName = cacheName => {
return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value && value.length > 0).join('-');
};
const eachCacheNameDetail = fn => {

@@ -604,3 +557,2 @@ for (const key of Object.keys(_cacheNameDetails)) {

};
const cacheNames$1 = {

@@ -637,10 +589,7 @@ updateDetails: details => {

*/
function stripParams(fullURL, ignoreParams) {
const strippedURL = new URL(fullURL);
for (const param of ignoreParams) {
strippedURL.searchParams.delete(param);
}
return strippedURL.href;

@@ -660,12 +609,9 @@ }

*/
async function cacheMatchIgnoreParams(cache, request, ignoreParams, matchOptions) {
const strippedRequestURL = stripParams(request.url, ignoreParams); // If the request doesn't include any ignored params, match as normal.
const strippedRequestURL = stripParams(request.url, ignoreParams);
// If the request doesn't include any ignored params, match as normal.
if (request.url === strippedRequestURL) {
return cache.match(request, matchOptions);
} // Otherwise, match by comparing keys
}
// Otherwise, match by comparing keys
const keysOptions = Object.assign(Object.assign({}, matchOptions), {

@@ -675,6 +621,4 @@ ignoreSearch: true

const cacheKeys = await cache.keys(request, keysOptions);
for (const cacheKey of cacheKeys) {
const strippedCacheKeyURL = stripParams(cacheKey.url, ignoreParams);
if (strippedRequestURL === strippedCacheKeyURL) {

@@ -684,3 +628,2 @@ return cache.match(cacheKey, matchOptions);

}
return;

@@ -707,3 +650,2 @@ }

*/
function canConstructReadableStream() {

@@ -715,3 +657,2 @@ if (supportStatus$1 === undefined) {

start() {}
});

@@ -723,3 +664,2 @@ supportStatus$1 = true;

}
return supportStatus$1;

@@ -745,7 +685,5 @@ }

*/
function canConstructResponseFromBodyStream() {
if (supportStatus === undefined) {
const testResponse = new Response('');
if ('body' in testResponse) {

@@ -759,6 +697,4 @@ try {

}
supportStatus = false;
}
return supportStatus;

@@ -778,3 +714,2 @@ }

**/
function dontWaitFor(promise) {

@@ -800,3 +735,2 @@ // Effective no-op.

*/
class Deferred {

@@ -812,3 +746,2 @@ /**

}
}

@@ -830,3 +763,2 @@

*/
async function executeQuotaErrorCallbacks() {

@@ -836,6 +768,4 @@ {

}
for (const callback of quotaErrorCallbacks) {
await callback();
{

@@ -845,3 +775,2 @@ logger.log(callback, 'is complete.');

}
{

@@ -859,7 +788,6 @@ logger.log('Finished running callbacks.');

*/
const getFriendlyURL = url => {
const urlObj = new URL(String(url), location.href); // See https://github.com/GoogleChrome/workbox/issues/2323
const urlObj = new URL(String(url), location.href);
// See https://github.com/GoogleChrome/workbox/issues/2323
// We want to include everything, except for the origin if it's same-origin.
return urlObj.href.replace(new RegExp(`^${location.origin}`), '');

@@ -882,3 +810,2 @@ };

*/
function timeout(ms) {

@@ -905,3 +832,2 @@ return new Promise(resolve => setTimeout(resolve, ms));

*/
async function resultingClientExists(resultingClientId) {

@@ -911,3 +837,2 @@ if (!resultingClientId) {

}
let existingWindows = await self.clients.matchAll({

@@ -918,4 +843,4 @@ type: 'window'

let resultingWindow;
const startTime = performance.now(); // Only wait up to `MAX_RETRY_TIME` to find a matching client.
const startTime = performance.now();
// Only wait up to `MAX_RETRY_TIME` to find a matching client.
while (performance.now() - startTime < MAX_RETRY_TIME) {

@@ -934,11 +859,8 @@ existingWindows = await self.clients.matchAll({

});
if (resultingWindow) {
break;
} // Sleep for 100ms and retry.
}
// Sleep for 100ms and retry.
await timeout(100);
}
return resultingWindow;

@@ -962,3 +884,2 @@ }

*/
function waitUntil(event, asyncFn) {

@@ -1018,3 +939,2 @@ const returnPromise = asyncFn();

*/
const cacheNames = {

@@ -1024,19 +944,14 @@ get googleAnalytics() {

},
get precache() {
return cacheNames$1.getPrecacheName();
},
get prefix() {
return cacheNames$1.getPrefix();
},
get runtime() {
return cacheNames$1.getRuntimeName();
},
get suffix() {
return cacheNames$1.getSuffix();
}
};

@@ -1070,6 +985,5 @@

*/
async function copyResponse(response, modifier) {
let origin = null; // If response.url isn't set, assume it's cross-origin and keep origin null.
let origin = null;
// If response.url isn't set, assume it's cross-origin and keep origin null.
if (response.url) {

@@ -1079,3 +993,2 @@ const responseURL = new URL(response.url);

}
if (origin !== self.location.origin) {

@@ -1086,5 +999,4 @@ throw new WorkboxError('cross-origin-copy-response', {

}
const clonedResponse = response.clone(); // Create a fresh `ResponseInit` object by cloning the headers.
const clonedResponse = response.clone();
// Create a fresh `ResponseInit` object by cloning the headers.
const responseInit = {

@@ -1094,8 +1006,8 @@ headers: new Headers(clonedResponse.headers),

statusText: clonedResponse.statusText
}; // Apply any user modifications.
const modifiedResponseInit = modifier ? modifier(responseInit) : responseInit; // Create the new response from the body stream and `ResponseInit`
};
// Apply any user modifications.
const modifiedResponseInit = modifier ? modifier(responseInit) : responseInit;
// Create the new response from the body stream and `ResponseInit`
// modifications. Note: not all browsers support the Response.body stream,
// so fall back to reading the entire body into memory as a blob.
const body = canConstructResponseFromBodyStream() ? clonedResponse.body : await clonedResponse.blob();

@@ -1118,3 +1030,2 @@ return new Response(body, modifiedResponseInit);

*/
function clientsClaim() {

@@ -1148,3 +1059,2 @@ self.addEventListener('activate', () => self.clients.claim());

*/
function setCacheNameDetails(details) {

@@ -1159,3 +1069,2 @@ {

});
if ('precache' in details && details['precache'].length === 0) {

@@ -1167,3 +1076,2 @@ throw new WorkboxError('invalid-cache-name', {

}
if ('runtime' in details && details['runtime'].length === 0) {

@@ -1175,3 +1083,2 @@ throw new WorkboxError('invalid-cache-name', {

}
if ('googleAnalytics' in details && details['googleAnalytics'].length === 0) {

@@ -1184,3 +1091,2 @@ throw new WorkboxError('invalid-cache-name', {

}
cacheNames$1.updateDetails(details);

@@ -1203,3 +1109,2 @@ }

*/
function skipWaiting() {

@@ -1211,3 +1116,2 @@ // Just call self.skipWaiting() directly.

}
void self.skipWaiting();

@@ -1226,3 +1130,3 @@ }

}({}));
})({});
//# sourceMappingURL=workbox-core.dev.js.map

4

package.json
{
"name": "workbox-core",
"version": "7.0.0",
"version": "7.1.0",
"license": "MIT",

@@ -23,3 +23,3 @@ "author": "Google's Web DevRel Team",

"types": "index.d.ts",
"gitHead": "c1d11636823e5e3a89520f7a531970a39304b14a"
"gitHead": "9e69c4269c35e2db9fbba4d13e4e6206c7b66d2a"
}
// @ts-ignore
try{self['workbox:core:7.0.0']&&_()}catch(e){}
try{self['workbox:core:7.1.0']&&_()}catch(e){}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc