workbox-core
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -60,3 +60,3 @@ /* | ||
} | ||
for (let item of value) { | ||
for (const item of value) { | ||
if (!(item instanceof expectedClass)) { | ||
@@ -63,0 +63,0 @@ throw error; |
@@ -16,9 +16,39 @@ /* | ||
/** | ||
* Wrapper around cache.put(). | ||
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and | ||
* executes any of those callbacks found in sequence. The final `Request` object | ||
* returned by the last plugin is treated as the cache key for cache reads | ||
* and/or writes. | ||
* | ||
* Will call `cacheDidUpdate` on plugins if the cache was updated, using | ||
* `matchOptions` when determining what the old entry is. | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
* @param {string} options.mode | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Request>} | ||
* | ||
* @private | ||
* @memberof module:workbox-core | ||
*/ | ||
const _getEffectiveRequest = async ({ request, mode, plugins = [], }) => { | ||
const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, "cacheKeyWillBeUsed" /* CACHE_KEY_WILL_BE_USED */); | ||
let effectiveRequest = request; | ||
for (const plugin of cacheKeyWillBeUsedPlugins) { | ||
effectiveRequest = await plugin["cacheKeyWillBeUsed" /* CACHE_KEY_WILL_BE_USED */].call(plugin, { mode, request: effectiveRequest }); | ||
if (typeof effectiveRequest === 'string') { | ||
effectiveRequest = new Request(effectiveRequest); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
assert.isInstance(effectiveRequest, Request, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheKeyWillBeUsed" /* CACHE_KEY_WILL_BE_USED */, | ||
isReturnValueProblem: true, | ||
}); | ||
} | ||
} | ||
return effectiveRequest; | ||
}; | ||
/** | ||
* This method will call cacheWillUpdate on the available plugins (or use | ||
* status === 200) to determine if the Response is safe and valid to cache. | ||
* | ||
* @param {Object} options | ||
* @param {string} options.cacheName | ||
* @param {Request} options.request | ||
@@ -28,3 +58,3 @@ * @param {Response} options.response | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @param {Object} [options.matchOptions] | ||
* @return {Promise<Response>} | ||
* | ||
@@ -34,64 +64,49 @@ * @private | ||
*/ | ||
const putWrapper = async ({ cacheName, request, response, event, plugins = [], matchOptions, }) => { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (request.method && request.method !== 'GET') { | ||
throw new WorkboxError('attempt-to-cache-non-get-request', { | ||
url: getFriendlyURL(request.url), | ||
method: request.method, | ||
const _isResponseSafeToCache = async ({ request, response, event, plugins = [], }) => { | ||
let responseToCache = response; | ||
let pluginsUsed = false; | ||
for (const plugin of plugins) { | ||
if ("cacheWillUpdate" /* CACHE_WILL_UPDATE */ in plugin) { | ||
pluginsUsed = true; | ||
const pluginMethod = plugin["cacheWillUpdate" /* CACHE_WILL_UPDATE */]; | ||
responseToCache = await pluginMethod.call(plugin, { | ||
request, | ||
response: responseToCache, | ||
event, | ||
}); | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (responseToCache) { | ||
assert.isInstance(responseToCache, Response, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheWillUpdate" /* CACHE_WILL_UPDATE */, | ||
isReturnValueProblem: true, | ||
}); | ||
} | ||
} | ||
if (!responseToCache) { | ||
break; | ||
} | ||
} | ||
} | ||
const effectiveRequest = await _getEffectiveRequest({ | ||
plugins, request, mode: 'write' | ||
}); | ||
if (!response) { | ||
if (!pluginsUsed) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.error(`Cannot cache non-existent response for ` + | ||
`'${getFriendlyURL(effectiveRequest.url)}'.`); | ||
if (responseToCache) { | ||
if (responseToCache.status !== 200) { | ||
if (responseToCache.status === 0) { | ||
logger.warn(`The response for '${request.url}' is an opaque ` + | ||
`response. The caching strategy that you're using will not ` + | ||
`cache opaque responses by default.`); | ||
} | ||
else { | ||
logger.debug(`The response for '${request.url}' returned ` + | ||
`a status code of '${response.status}' and won't be cached as a ` + | ||
`result.`); | ||
} | ||
} | ||
} | ||
} | ||
throw new WorkboxError('cache-put-with-no-response', { | ||
url: getFriendlyURL(effectiveRequest.url), | ||
}); | ||
responseToCache = responseToCache && responseToCache.status === 200 ? | ||
responseToCache : undefined; | ||
} | ||
let responseToCache = await _isResponseSafeToCache({ | ||
event, | ||
plugins, | ||
response, | ||
request: effectiveRequest, | ||
}); | ||
if (!responseToCache) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + | ||
`not be cached.`, responseToCache); | ||
} | ||
return; | ||
} | ||
const cache = await self.caches.open(cacheName); | ||
const updatePlugins = pluginUtils.filter(plugins, "cacheDidUpdate" /* CACHE_DID_UPDATE */); | ||
let oldResponse = updatePlugins.length > 0 ? | ||
await matchWrapper({ cacheName, matchOptions, request: effectiveRequest }) : | ||
null; | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + | ||
`${getFriendlyURL(effectiveRequest.url)}.`); | ||
} | ||
try { | ||
await cache.put(effectiveRequest, responseToCache); | ||
} | ||
catch (error) { | ||
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError | ||
if (error.name === 'QuotaExceededError') { | ||
await executeQuotaErrorCallbacks(); | ||
} | ||
throw error; | ||
} | ||
for (let plugin of updatePlugins) { | ||
await plugin["cacheDidUpdate" /* CACHE_DID_UPDATE */].call(plugin, { | ||
cacheName, | ||
event, | ||
oldResponse, | ||
newResponse: responseToCache, | ||
request: effectiveRequest, | ||
}); | ||
} | ||
return responseToCache ? responseToCache : null; | ||
}; | ||
@@ -151,6 +166,9 @@ /** | ||
/** | ||
* This method will call cacheWillUpdate on the available plugins (or use | ||
* status === 200) to determine if the Response is safe and valid to cache. | ||
* Wrapper around cache.put(). | ||
* | ||
* Will call `cacheDidUpdate` on plugins if the cache was updated, using | ||
* `matchOptions` when determining what the old entry is. | ||
* | ||
* @param {Object} options | ||
* @param {string} options.cacheName | ||
* @param {Request} options.request | ||
@@ -160,3 +178,3 @@ * @param {Response} options.response | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Response>} | ||
* @param {Object} [options.matchOptions] | ||
* | ||
@@ -166,82 +184,64 @@ * @private | ||
*/ | ||
const _isResponseSafeToCache = async ({ request, response, event, plugins = [], }) => { | ||
let responseToCache = response; | ||
let pluginsUsed = false; | ||
for (let plugin of plugins) { | ||
if ("cacheWillUpdate" /* CACHE_WILL_UPDATE */ in plugin) { | ||
pluginsUsed = true; | ||
const pluginMethod = plugin["cacheWillUpdate" /* CACHE_WILL_UPDATE */]; | ||
responseToCache = await pluginMethod.call(plugin, { | ||
request, | ||
response: responseToCache, | ||
event, | ||
const putWrapper = async ({ cacheName, request, response, event, plugins = [], matchOptions, }) => { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (request.method && request.method !== 'GET') { | ||
throw new WorkboxError('attempt-to-cache-non-get-request', { | ||
url: getFriendlyURL(request.url), | ||
method: request.method, | ||
}); | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (responseToCache) { | ||
assert.isInstance(responseToCache, Response, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheWillUpdate" /* CACHE_WILL_UPDATE */, | ||
isReturnValueProblem: true, | ||
}); | ||
} | ||
} | ||
if (!responseToCache) { | ||
break; | ||
} | ||
} | ||
} | ||
if (!pluginsUsed) { | ||
const effectiveRequest = await _getEffectiveRequest({ | ||
plugins, request, mode: 'write' | ||
}); | ||
if (!response) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (responseToCache) { | ||
if (responseToCache.status !== 200) { | ||
if (responseToCache.status === 0) { | ||
logger.warn(`The response for '${request.url}' is an opaque ` + | ||
`response. The caching strategy that you're using will not ` + | ||
`cache opaque responses by default.`); | ||
} | ||
else { | ||
logger.debug(`The response for '${request.url}' returned ` + | ||
`a status code of '${response.status}' and won't be cached as a ` + | ||
`result.`); | ||
} | ||
} | ||
} | ||
logger.error(`Cannot cache non-existent response for ` + | ||
`'${getFriendlyURL(effectiveRequest.url)}'.`); | ||
} | ||
responseToCache = responseToCache && responseToCache.status === 200 ? | ||
responseToCache : undefined; | ||
throw new WorkboxError('cache-put-with-no-response', { | ||
url: getFriendlyURL(effectiveRequest.url), | ||
}); | ||
} | ||
return responseToCache ? responseToCache : null; | ||
}; | ||
/** | ||
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and | ||
* executes any of those callbacks found in sequence. The final `Request` object | ||
* returned by the last plugin is treated as the cache key for cache reads | ||
* and/or writes. | ||
* | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
* @param {string} options.mode | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Request>} | ||
* | ||
* @private | ||
* @memberof module:workbox-core | ||
*/ | ||
const _getEffectiveRequest = async ({ request, mode, plugins = [], }) => { | ||
const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, "cacheKeyWillBeUsed" /* CACHE_KEY_WILL_BE_USED */); | ||
let effectiveRequest = request; | ||
for (const plugin of cacheKeyWillBeUsedPlugins) { | ||
effectiveRequest = await plugin["cacheKeyWillBeUsed" /* CACHE_KEY_WILL_BE_USED */].call(plugin, { mode, request: effectiveRequest }); | ||
if (typeof effectiveRequest === 'string') { | ||
effectiveRequest = new Request(effectiveRequest); | ||
} | ||
const responseToCache = await _isResponseSafeToCache({ | ||
event, | ||
plugins, | ||
response, | ||
request: effectiveRequest, | ||
}); | ||
if (!responseToCache) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
assert.isInstance(effectiveRequest, Request, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheKeyWillBeUsed" /* CACHE_KEY_WILL_BE_USED */, | ||
isReturnValueProblem: true, | ||
}); | ||
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + | ||
`not be cached.`, responseToCache); | ||
} | ||
return; | ||
} | ||
return effectiveRequest; | ||
const cache = await self.caches.open(cacheName); | ||
const updatePlugins = pluginUtils.filter(plugins, "cacheDidUpdate" /* CACHE_DID_UPDATE */); | ||
const oldResponse = updatePlugins.length > 0 ? | ||
await matchWrapper({ cacheName, matchOptions, request: effectiveRequest }) : | ||
null; | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + | ||
`${getFriendlyURL(effectiveRequest.url)}.`); | ||
} | ||
try { | ||
await cache.put(effectiveRequest, responseToCache); | ||
} | ||
catch (error) { | ||
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError | ||
if (error.name === 'QuotaExceededError') { | ||
await executeQuotaErrorCallbacks(); | ||
} | ||
throw error; | ||
} | ||
for (const plugin of updatePlugins) { | ||
await plugin["cacheDidUpdate" /* CACHE_DID_UPDATE */].call(plugin, { | ||
cacheName, | ||
event, | ||
oldResponse, | ||
newResponse: responseToCache, | ||
request: effectiveRequest, | ||
}); | ||
} | ||
}; | ||
@@ -248,0 +248,0 @@ export const cacheWrapper = { |
@@ -23,6 +23,6 @@ import '../_version.js'; | ||
export declare class DBWrapper { | ||
private _name; | ||
private _version; | ||
private _onupgradeneeded?; | ||
private _onversionchange; | ||
private readonly _name; | ||
private readonly _version; | ||
private readonly _onupgradeneeded?; | ||
private readonly _onversionchange; | ||
private _db; | ||
@@ -52,3 +52,3 @@ add?: Function; | ||
*/ | ||
readonly db: IDBDatabase | null; | ||
get db(): IDBDatabase | null; | ||
/** | ||
@@ -55,0 +55,0 @@ * Opens a connected to an IDBDatabase, invokes any onupgradedneeded |
@@ -12,4 +12,4 @@ import '../_version.js'; | ||
promise: Promise<T>; | ||
resolve?: (value?: T) => void; | ||
reject?: (reason?: any) => void; | ||
resolve: (value?: T) => void; | ||
reject: (reason?: any) => void; | ||
/** | ||
@@ -16,0 +16,0 @@ * Creates a promise and exposes its resolve and reject functions as methods. |
@@ -62,10 +62,10 @@ /* | ||
try { | ||
for (let plugin of plugins) { | ||
for (const plugin of plugins) { | ||
if ("requestWillFetch" /* REQUEST_WILL_FETCH */ in plugin) { | ||
const pluginMethod = plugin["requestWillFetch" /* REQUEST_WILL_FETCH */]; | ||
const requestClone = request.clone(); | ||
request = (await pluginMethod.call(plugin, { | ||
request = await pluginMethod.call(plugin, { | ||
request: requestClone, | ||
event, | ||
})); | ||
}); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -91,3 +91,3 @@ if (request) { | ||
// to the Request we make. Pass both to `fetchDidFail` to aid debugging. | ||
let pluginFilteredRequest = request.clone(); | ||
const pluginFilteredRequest = request.clone(); | ||
try { | ||
@@ -94,0 +94,0 @@ let fetchResponse; |
@@ -11,7 +11,6 @@ /* | ||
const urlObj = new URL(String(url), location.href); | ||
if (urlObj.origin === location.origin) { | ||
return urlObj.pathname; | ||
} | ||
return urlObj.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}`), ''); | ||
}; | ||
export { getFriendlyURL }; |
@@ -29,3 +29,3 @@ /* | ||
constructor(errorCode, details) { | ||
let message = messageGenerator(errorCode, details); | ||
const message = messageGenerator(errorCode, details); | ||
super(message); | ||
@@ -32,0 +32,0 @@ this.name = errorCode; |
"use strict"; | ||
// @ts-ignore | ||
try { | ||
self['workbox:core:5.0.0'] && _(); | ||
self['workbox:core:5.1.0'] && _(); | ||
} | ||
catch (e) { } |
@@ -6,3 +6,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self['workbox:core:5.0.0'] && _(); | ||
self['workbox:core:5.1.0'] && _(); | ||
} catch (e) {} | ||
@@ -404,3 +404,3 @@ | ||
constructor(errorCode, details) { | ||
let message = messageGenerator(errorCode, details); | ||
const message = messageGenerator(errorCode, details); | ||
super(message); | ||
@@ -482,3 +482,3 @@ this.name = errorCode; | ||
for (let item of value) { | ||
for (const item of value) { | ||
if (!(item instanceof expectedClass)) { | ||
@@ -633,9 +633,6 @@ throw error; | ||
const getFriendlyURL = url => { | ||
const urlObj = new URL(String(url), location.href); | ||
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. | ||
if (urlObj.origin === location.origin) { | ||
return urlObj.pathname; | ||
} | ||
return urlObj.href; | ||
return urlObj.href.replace(new RegExp(`^${location.origin}`), ''); | ||
}; | ||
@@ -664,9 +661,57 @@ | ||
/** | ||
* Wrapper around cache.put(). | ||
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and | ||
* executes any of those callbacks found in sequence. The final `Request` object | ||
* returned by the last plugin is treated as the cache key for cache reads | ||
* and/or writes. | ||
* | ||
* Will call `cacheDidUpdate` on plugins if the cache was updated, using | ||
* `matchOptions` when determining what the old entry is. | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
* @param {string} options.mode | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Request>} | ||
* | ||
* @private | ||
* @memberof module:workbox-core | ||
*/ | ||
const _getEffectiveRequest = async ({ | ||
request, | ||
mode, | ||
plugins = [] | ||
}) => { | ||
const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, "cacheKeyWillBeUsed" | ||
/* CACHE_KEY_WILL_BE_USED */ | ||
); | ||
let effectiveRequest = request; | ||
for (const plugin of cacheKeyWillBeUsedPlugins) { | ||
effectiveRequest = await plugin["cacheKeyWillBeUsed" | ||
/* CACHE_KEY_WILL_BE_USED */ | ||
].call(plugin, { | ||
mode, | ||
request: effectiveRequest | ||
}); | ||
if (typeof effectiveRequest === 'string') { | ||
effectiveRequest = new Request(effectiveRequest); | ||
} | ||
{ | ||
finalAssertExports.isInstance(effectiveRequest, Request, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheKeyWillBeUsed" | ||
/* CACHE_KEY_WILL_BE_USED */ | ||
, | ||
isReturnValueProblem: true | ||
}); | ||
} | ||
} | ||
return effectiveRequest; | ||
}; | ||
/** | ||
* This method will call cacheWillUpdate on the available plugins (or use | ||
* status === 200) to determine if the Response is safe and valid to cache. | ||
* | ||
* @param {Object} options | ||
* @param {string} options.cacheName | ||
* @param {Request} options.request | ||
@@ -676,3 +721,3 @@ * @param {Response} options.response | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @param {Object} [options.matchOptions] | ||
* @return {Promise<Response>} | ||
* | ||
@@ -683,86 +728,61 @@ * @private | ||
const putWrapper = async ({ | ||
cacheName, | ||
const _isResponseSafeToCache = async ({ | ||
request, | ||
response, | ||
event, | ||
plugins = [], | ||
matchOptions | ||
plugins = [] | ||
}) => { | ||
{ | ||
if (request.method && request.method !== 'GET') { | ||
throw new WorkboxError('attempt-to-cache-non-get-request', { | ||
url: getFriendlyURL(request.url), | ||
method: request.method | ||
let responseToCache = response; | ||
let pluginsUsed = false; | ||
for (const plugin of plugins) { | ||
if ("cacheWillUpdate" | ||
/* CACHE_WILL_UPDATE */ | ||
in plugin) { | ||
pluginsUsed = true; | ||
const pluginMethod = plugin["cacheWillUpdate" | ||
/* CACHE_WILL_UPDATE */ | ||
]; | ||
responseToCache = await pluginMethod.call(plugin, { | ||
request, | ||
response: responseToCache, | ||
event | ||
}); | ||
} | ||
} | ||
const effectiveRequest = await _getEffectiveRequest({ | ||
plugins, | ||
request, | ||
mode: 'write' | ||
}); | ||
{ | ||
if (responseToCache) { | ||
finalAssertExports.isInstance(responseToCache, Response, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheWillUpdate" | ||
/* CACHE_WILL_UPDATE */ | ||
, | ||
isReturnValueProblem: true | ||
}); | ||
} | ||
} | ||
if (!response) { | ||
{ | ||
logger.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(effectiveRequest.url)}'.`); | ||
if (!responseToCache) { | ||
break; | ||
} | ||
} | ||
throw new WorkboxError('cache-put-with-no-response', { | ||
url: getFriendlyURL(effectiveRequest.url) | ||
}); | ||
} | ||
let responseToCache = await _isResponseSafeToCache({ | ||
event, | ||
plugins, | ||
response, | ||
request: effectiveRequest | ||
}); | ||
if (!responseToCache) { | ||
if (!pluginsUsed) { | ||
{ | ||
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + `not be cached.`, responseToCache); | ||
if (responseToCache) { | ||
if (responseToCache.status !== 200) { | ||
if (responseToCache.status === 0) { | ||
logger.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`); | ||
} else { | ||
logger.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`); | ||
} | ||
} | ||
} | ||
} | ||
return; | ||
responseToCache = responseToCache && responseToCache.status === 200 ? responseToCache : undefined; | ||
} | ||
const cache = await self.caches.open(cacheName); | ||
const updatePlugins = pluginUtils.filter(plugins, "cacheDidUpdate" | ||
/* CACHE_DID_UPDATE */ | ||
); | ||
let oldResponse = updatePlugins.length > 0 ? await matchWrapper({ | ||
cacheName, | ||
matchOptions, | ||
request: effectiveRequest | ||
}) : null; | ||
{ | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(effectiveRequest.url)}.`); | ||
} | ||
try { | ||
await cache.put(effectiveRequest, responseToCache); | ||
} catch (error) { | ||
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError | ||
if (error.name === 'QuotaExceededError') { | ||
await executeQuotaErrorCallbacks(); | ||
} | ||
throw error; | ||
} | ||
for (let plugin of updatePlugins) { | ||
await plugin["cacheDidUpdate" | ||
/* CACHE_DID_UPDATE */ | ||
].call(plugin, { | ||
cacheName, | ||
event, | ||
oldResponse, | ||
newResponse: responseToCache, | ||
request: effectiveRequest | ||
}); | ||
} | ||
return responseToCache ? responseToCache : null; | ||
}; | ||
@@ -841,6 +861,9 @@ /** | ||
/** | ||
* This method will call cacheWillUpdate on the available plugins (or use | ||
* status === 200) to determine if the Response is safe and valid to cache. | ||
* Wrapper around cache.put(). | ||
* | ||
* Will call `cacheDidUpdate` on plugins if the cache was updated, using | ||
* `matchOptions` when determining what the old entry is. | ||
* | ||
* @param {Object} options | ||
* @param {string} options.cacheName | ||
* @param {Request} options.request | ||
@@ -850,3 +873,3 @@ * @param {Response} options.response | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Response>} | ||
* @param {Object} [options.matchOptions] | ||
* | ||
@@ -858,112 +881,86 @@ * @private | ||
const _isResponseSafeToCache = async ({ | ||
const putWrapper = async ({ | ||
cacheName, | ||
request, | ||
response, | ||
event, | ||
plugins = [] | ||
plugins = [], | ||
matchOptions | ||
}) => { | ||
let responseToCache = response; | ||
let pluginsUsed = false; | ||
for (let plugin of plugins) { | ||
if ("cacheWillUpdate" | ||
/* CACHE_WILL_UPDATE */ | ||
in plugin) { | ||
pluginsUsed = true; | ||
const pluginMethod = plugin["cacheWillUpdate" | ||
/* CACHE_WILL_UPDATE */ | ||
]; | ||
responseToCache = await pluginMethod.call(plugin, { | ||
request, | ||
response: responseToCache, | ||
event | ||
{ | ||
if (request.method && request.method !== 'GET') { | ||
throw new WorkboxError('attempt-to-cache-non-get-request', { | ||
url: getFriendlyURL(request.url), | ||
method: request.method | ||
}); | ||
} | ||
} | ||
{ | ||
if (responseToCache) { | ||
finalAssertExports.isInstance(responseToCache, Response, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheWillUpdate" | ||
/* CACHE_WILL_UPDATE */ | ||
, | ||
isReturnValueProblem: true | ||
}); | ||
} | ||
} | ||
const effectiveRequest = await _getEffectiveRequest({ | ||
plugins, | ||
request, | ||
mode: 'write' | ||
}); | ||
if (!responseToCache) { | ||
break; | ||
} | ||
if (!response) { | ||
{ | ||
logger.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(effectiveRequest.url)}'.`); | ||
} | ||
throw new WorkboxError('cache-put-with-no-response', { | ||
url: getFriendlyURL(effectiveRequest.url) | ||
}); | ||
} | ||
if (!pluginsUsed) { | ||
const responseToCache = await _isResponseSafeToCache({ | ||
event, | ||
plugins, | ||
response, | ||
request: effectiveRequest | ||
}); | ||
if (!responseToCache) { | ||
{ | ||
if (responseToCache) { | ||
if (responseToCache.status !== 200) { | ||
if (responseToCache.status === 0) { | ||
logger.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`); | ||
} else { | ||
logger.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`); | ||
} | ||
} | ||
} | ||
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + `not be cached.`, responseToCache); | ||
} | ||
responseToCache = responseToCache && responseToCache.status === 200 ? responseToCache : undefined; | ||
return; | ||
} | ||
return responseToCache ? responseToCache : null; | ||
}; | ||
/** | ||
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and | ||
* executes any of those callbacks found in sequence. The final `Request` object | ||
* returned by the last plugin is treated as the cache key for cache reads | ||
* and/or writes. | ||
* | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
* @param {string} options.mode | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Request>} | ||
* | ||
* @private | ||
* @memberof module:workbox-core | ||
*/ | ||
const cache = await self.caches.open(cacheName); | ||
const updatePlugins = pluginUtils.filter(plugins, "cacheDidUpdate" | ||
/* CACHE_DID_UPDATE */ | ||
); | ||
const oldResponse = updatePlugins.length > 0 ? await matchWrapper({ | ||
cacheName, | ||
matchOptions, | ||
request: effectiveRequest | ||
}) : null; | ||
{ | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(effectiveRequest.url)}.`); | ||
} | ||
const _getEffectiveRequest = async ({ | ||
request, | ||
mode, | ||
plugins = [] | ||
}) => { | ||
const cacheKeyWillBeUsedPlugins = pluginUtils.filter(plugins, "cacheKeyWillBeUsed" | ||
/* CACHE_KEY_WILL_BE_USED */ | ||
); | ||
let effectiveRequest = request; | ||
try { | ||
await cache.put(effectiveRequest, responseToCache); | ||
} catch (error) { | ||
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError | ||
if (error.name === 'QuotaExceededError') { | ||
await executeQuotaErrorCallbacks(); | ||
} | ||
for (const plugin of cacheKeyWillBeUsedPlugins) { | ||
effectiveRequest = await plugin["cacheKeyWillBeUsed" | ||
/* CACHE_KEY_WILL_BE_USED */ | ||
throw error; | ||
} | ||
for (const plugin of updatePlugins) { | ||
await plugin["cacheDidUpdate" | ||
/* CACHE_DID_UPDATE */ | ||
].call(plugin, { | ||
mode, | ||
cacheName, | ||
event, | ||
oldResponse, | ||
newResponse: responseToCache, | ||
request: effectiveRequest | ||
}); | ||
if (typeof effectiveRequest === 'string') { | ||
effectiveRequest = new Request(effectiveRequest); | ||
} | ||
{ | ||
finalAssertExports.isInstance(effectiveRequest, Request, { | ||
moduleName: 'Plugin', | ||
funcName: "cacheKeyWillBeUsed" | ||
/* CACHE_KEY_WILL_BE_USED */ | ||
, | ||
isReturnValueProblem: true | ||
}); | ||
} | ||
} | ||
return effectiveRequest; | ||
}; | ||
@@ -1493,3 +1490,3 @@ | ||
try { | ||
for (let plugin of plugins) { | ||
for (const plugin of plugins) { | ||
if ("requestWillFetch" | ||
@@ -1529,3 +1526,3 @@ /* REQUEST_WILL_FETCH */ | ||
let pluginFilteredRequest = request.clone(); | ||
const pluginFilteredRequest = request.clone(); | ||
@@ -1679,2 +1676,3 @@ try { | ||
var _private = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
assert: finalAssertExports, | ||
@@ -1681,0 +1679,0 @@ cacheNames: cacheNames, |
@@ -1,2 +0,2 @@ | ||
this.workbox=this.workbox||{},this.workbox.core=function(e){"use strict";try{self["workbox:core:5.0.0"]&&_()}catch(e){}const t=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n};class n extends Error{constructor(e,n){super(t(e,n)),this.name=e,this.details=n}}const s=new Set;const r={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},i=e=>[r.prefix,e,r.suffix].filter(e=>e&&e.length>0).join("-"),a={updateDetails:e=>{(e=>{for(const t of Object.keys(r))e(t)})(t=>{"string"==typeof e[t]&&(r[t]=e[t])})},getGoogleAnalyticsName:e=>e||i(r.googleAnalytics),getPrecacheName:e=>e||i(r.precache),getPrefix:()=>r.prefix,getRuntimeName:e=>e||i(r.runtime),getSuffix:()=>r.suffix};async function o(){for(const e of s)await e()}const c=e=>{const t=new URL(String(e),location.href);return t.origin===location.origin?t.pathname:t.href},u=(e,t)=>e.filter(e=>t in e),l=async({cacheName:e,request:t,event:n,matchOptions:s,plugins:r=[]})=>{const i=await self.caches.open(e),a=await h({plugins:r,request:t,mode:"read"});let o=await i.match(a,s);for(const t of r)if("cachedResponseWillBeUsed"in t){const r=t.cachedResponseWillBeUsed;o=await r.call(t,{cacheName:e,event:n,matchOptions:s,cachedResponse:o,request:a})}return o},f=async({request:e,response:t,event:n,plugins:s=[]})=>{let r=t,i=!1;for(let t of s)if("cacheWillUpdate"in t){i=!0;const s=t.cacheWillUpdate;if(!(r=await s.call(t,{request:e,response:r,event:n})))break}return i||(r=r&&200===r.status?r:void 0),r||null},h=async({request:e,mode:t,plugins:n=[]})=>{const s=u(n,"cacheKeyWillBeUsed");let r=e;for(const e of s)"string"==typeof(r=await e.cacheKeyWillBeUsed.call(e,{mode:t,request:r}))&&(r=new Request(r));return r},w={put:async({cacheName:e,request:t,response:s,event:r,plugins:i=[],matchOptions:a})=>{const w=await h({plugins:i,request:t,mode:"write"});if(!s)throw new n("cache-put-with-no-response",{url:c(w.url)});let d=await f({event:r,plugins:i,response:s,request:w});if(!d)return;const p=await self.caches.open(e),g=u(i,"cacheDidUpdate");let y=g.length>0?await l({cacheName:e,matchOptions:a,request:w}):null;try{await p.put(w,d)}catch(e){throw"QuotaExceededError"===e.name&&await o(),e}for(let t of g)await t.cacheDidUpdate.call(t,{cacheName:e,event:r,oldResponse:y,newResponse:d,request:w})},match:l};let d,p;function g(){if(void 0===p){const e=new Response("");if("body"in e)try{new Response(e.body),p=!0}catch(e){p=!1}p=!1}return p}class y{constructor(e,t,{onupgradeneeded:n,onversionchange:s}={}){this.t=null,this.s=e,this.i=t,this.o=n,this.u=s||(()=>this.close())}get db(){return this.t}async open(){if(!this.t)return this.t=await new Promise((e,t)=>{let n=!1;setTimeout(()=>{n=!0,t(new Error("The open request was blocked and timed out"))},this.OPEN_TIMEOUT);const s=indexedDB.open(this.s,this.i);s.onerror=(()=>t(s.error)),s.onupgradeneeded=(e=>{n?(s.transaction.abort(),s.result.close()):"function"==typeof this.o&&this.o(e)}),s.onsuccess=(()=>{const t=s.result;n?t.close():(t.onversionchange=this.u.bind(this),e(t))})}),this}async getKey(e,t){return(await this.getAllKeys(e,t,1))[0]}async getAll(e,t,n){return await this.getAllMatching(e,{query:t,count:n})}async getAllKeys(e,t,n){return(await this.getAllMatching(e,{query:t,count:n,includeKeys:!0})).map(e=>e.key)}async getAllMatching(e,{index:t,query:n=null,direction:s="next",count:r,includeKeys:i=!1}={}){return await this.transaction([e],"readonly",(a,o)=>{const c=a.objectStore(e),u=t?c.index(t):c,l=[],f=u.openCursor(n,s);f.onsuccess=(()=>{const e=f.result;e?(l.push(i?e:e.value),r&&l.length>=r?o(l):e.continue()):o(l)})})}async transaction(e,t,n){return await this.open(),await new Promise((s,r)=>{const i=this.t.transaction(e,t);i.onabort=(()=>r(i.error)),i.oncomplete=(()=>s()),n(i,e=>s(e))})}async l(e,t,n,...s){return await this.transaction([t],n,(n,r)=>{const i=n.objectStore(t),a=i[e].apply(i,s);a.onsuccess=(()=>r(a.result))})}close(){this.t&&(this.t.close(),this.t=null)}}y.prototype.OPEN_TIMEOUT=2e3;const m={readonly:["get","count","getKey","getAll","getAllKeys"],readwrite:["add","put","clear","delete"]};for(const[e,t]of Object.entries(m))for(const n of t)n in IDBObjectStore.prototype&&(y.prototype[n]=async function(t,...s){return await this.l(n,t,e,...s)});const q={fetch:async({request:e,fetchOptions:t,event:s,plugins:r=[]})=>{if("string"==typeof e&&(e=new Request(e)),s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const i=u(r,"fetchDidFail"),a=i.length>0?e.clone():null;try{for(let t of r)if("requestWillFetch"in t){const n=t.requestWillFetch,r=e.clone();e=await n.call(t,{request:r,event:s})}}catch(e){throw new n("plugin-error-request-will-fetch",{thrownError:e})}let o=e.clone();try{let n;n="navigate"===e.mode?await fetch(e):await fetch(e,t);for(const e of r)"fetchDidSucceed"in e&&(n=await e.fetchDidSucceed.call(e,{event:s,request:o,response:n}));return n}catch(e){for(const t of i)await t.fetchDidFail.call(t,{error:e,event:s,originalRequest:a.clone(),request:o.clone()});throw e}}};function v(e){return new Promise(t=>setTimeout(t,e))}const x=2e3;var R=Object.freeze({assert:null,cacheNames:a,cacheWrapper:w,canConstructReadableStream:function(){if(void 0===d)try{new ReadableStream({start(){}}),d=!0}catch(e){d=!1}return d},canConstructResponseFromBodyStream:g,dontWaitFor:function(e){e.then(()=>{})},DBWrapper:y,Deferred:class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},deleteDatabase:async e=>{await new Promise((t,n)=>{const s=indexedDB.deleteDatabase(e);s.onerror=(()=>{n(s.error)}),s.onblocked=(()=>{n(new Error("Delete blocked"))}),s.onsuccess=(()=>{t()})})},executeQuotaErrorCallbacks:o,fetchWrapper:q,getFriendlyURL:c,logger:null,resultingClientExists:async function(e){if(!e)return;let t=await self.clients.matchAll({type:"window"});const n=new Set(t.map(e=>e.id));let s;const r=performance.now();for(;performance.now()-r<x&&!(s=(t=await self.clients.matchAll({type:"window"})).find(t=>e?t.id===e:!n.has(t.id)));)await v(100);return s},timeout:v,WorkboxError:n});const b={get googleAnalytics(){return a.getGoogleAnalyticsName()},get precache(){return a.getPrecacheName()},get prefix(){return a.getPrefix()},get runtime(){return a.getRuntimeName()},get suffix(){return a.getSuffix()}};return e._private=R,e.cacheNames=b,e.clientsClaim=function(){self.addEventListener("activate",()=>self.clients.claim())},e.copyResponse=async function(e,t){const n=e.clone(),s={headers:new Headers(n.headers),status:n.status,statusText:n.statusText},r=t?t(s):s,i=g()?n.body:await n.blob();return new Response(i,r)},e.registerQuotaErrorCallback=function(e){s.add(e)},e.setCacheNameDetails=function(e){a.updateDetails(e)},e.skipWaiting=function(){self.addEventListener("install",()=>self.skipWaiting())},e}({}); | ||
this.workbox=this.workbox||{},this.workbox.core=function(e){"use strict";try{self["workbox:core:5.1.0"]&&_()}catch(e){}const t=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n};class n extends Error{constructor(e,n){super(t(e,n)),this.name=e,this.details=n}}const s=new Set;const r={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},i=e=>[r.prefix,e,r.suffix].filter(e=>e&&e.length>0).join("-"),o={updateDetails:e=>{(e=>{for(const t of Object.keys(r))e(t)})(t=>{"string"==typeof e[t]&&(r[t]=e[t])})},getGoogleAnalyticsName:e=>e||i(r.googleAnalytics),getPrecacheName:e=>e||i(r.precache),getPrefix:()=>r.prefix,getRuntimeName:e=>e||i(r.runtime),getSuffix:()=>r.suffix};async function a(){for(const e of s)await e()}const c=e=>new URL(String(e),location.href).href.replace(new RegExp(`^${location.origin}`),""),u=(e,t)=>e.filter(e=>t in e),l=async({request:e,mode:t,plugins:n=[]})=>{const s=u(n,"cacheKeyWillBeUsed");let r=e;for(const e of s)r=await e.cacheKeyWillBeUsed.call(e,{mode:t,request:r}),"string"==typeof r&&(r=new Request(r));return r},f=async({cacheName:e,request:t,event:n,matchOptions:s,plugins:r=[]})=>{const i=await self.caches.open(e),o=await l({plugins:r,request:t,mode:"read"});let a=await i.match(o,s);for(const t of r)if("cachedResponseWillBeUsed"in t){const r=t.cachedResponseWillBeUsed;a=await r.call(t,{cacheName:e,event:n,matchOptions:s,cachedResponse:a,request:o})}return a},h={put:async({cacheName:e,request:t,response:s,event:r,plugins:i=[],matchOptions:o})=>{const h=await l({plugins:i,request:t,mode:"write"});if(!s)throw new n("cache-put-with-no-response",{url:c(h.url)});const w=await(async({request:e,response:t,event:n,plugins:s=[]})=>{let r=t,i=!1;for(const t of s)if("cacheWillUpdate"in t){i=!0;const s=t.cacheWillUpdate;if(r=await s.call(t,{request:e,response:r,event:n}),!r)break}return i||(r=r&&200===r.status?r:void 0),r||null})({event:r,plugins:i,response:s,request:h});if(!w)return;const p=await self.caches.open(e),d=u(i,"cacheDidUpdate"),g=d.length>0?await f({cacheName:e,matchOptions:o,request:h}):null;try{await p.put(h,w)}catch(e){throw"QuotaExceededError"===e.name&&await a(),e}for(const t of d)await t.cacheDidUpdate.call(t,{cacheName:e,event:r,oldResponse:g,newResponse:w,request:h})},match:f};let w,p;function d(){if(void 0===p){const e=new Response("");if("body"in e)try{new Response(e.body),p=!0}catch(e){p=!1}p=!1}return p}class g{constructor(e,t,{onupgradeneeded:n,onversionchange:s}={}){this.t=null,this.s=e,this.i=t,this.o=n,this.u=s||(()=>this.close())}get db(){return this.t}async open(){if(!this.t)return this.t=await new Promise((e,t)=>{let n=!1;setTimeout(()=>{n=!0,t(new Error("The open request was blocked and timed out"))},this.OPEN_TIMEOUT);const s=indexedDB.open(this.s,this.i);s.onerror=()=>t(s.error),s.onupgradeneeded=e=>{n?(s.transaction.abort(),s.result.close()):"function"==typeof this.o&&this.o(e)},s.onsuccess=()=>{const t=s.result;n?t.close():(t.onversionchange=this.u.bind(this),e(t))}}),this}async getKey(e,t){return(await this.getAllKeys(e,t,1))[0]}async getAll(e,t,n){return await this.getAllMatching(e,{query:t,count:n})}async getAllKeys(e,t,n){return(await this.getAllMatching(e,{query:t,count:n,includeKeys:!0})).map(e=>e.key)}async getAllMatching(e,{index:t,query:n=null,direction:s="next",count:r,includeKeys:i=!1}={}){return await this.transaction([e],"readonly",(o,a)=>{const c=o.objectStore(e),u=t?c.index(t):c,l=[],f=u.openCursor(n,s);f.onsuccess=()=>{const e=f.result;e?(l.push(i?e:e.value),r&&l.length>=r?a(l):e.continue()):a(l)}})}async transaction(e,t,n){return await this.open(),await new Promise((s,r)=>{const i=this.t.transaction(e,t);i.onabort=()=>r(i.error),i.oncomplete=()=>s(),n(i,e=>s(e))})}async l(e,t,n,...s){return await this.transaction([t],n,(n,r)=>{const i=n.objectStore(t),o=i[e].apply(i,s);o.onsuccess=()=>r(o.result)})}close(){this.t&&(this.t.close(),this.t=null)}}g.prototype.OPEN_TIMEOUT=2e3;const y={readonly:["get","count","getKey","getAll","getAllKeys"],readwrite:["add","put","clear","delete"]};for(const[e,t]of Object.entries(y))for(const n of t)n in IDBObjectStore.prototype&&(g.prototype[n]=async function(t,...s){return await this.l(n,t,e,...s)});const m={fetch:async({request:e,fetchOptions:t,event:s,plugins:r=[]})=>{if("string"==typeof e&&(e=new Request(e)),s instanceof FetchEvent&&s.preloadResponse){const e=await s.preloadResponse;if(e)return e}const i=u(r,"fetchDidFail"),o=i.length>0?e.clone():null;try{for(const t of r)if("requestWillFetch"in t){const n=t.requestWillFetch,r=e.clone();e=await n.call(t,{request:r,event:s})}}catch(e){throw new n("plugin-error-request-will-fetch",{thrownError:e})}const a=e.clone();try{let n;n="navigate"===e.mode?await fetch(e):await fetch(e,t);for(const e of r)"fetchDidSucceed"in e&&(n=await e.fetchDidSucceed.call(e,{event:s,request:a,response:n}));return n}catch(e){for(const t of i)await t.fetchDidFail.call(t,{error:e,event:s,originalRequest:o.clone(),request:a.clone()});throw e}}};function q(e){return new Promise(t=>setTimeout(t,e))}var v=Object.freeze({__proto__:null,assert:null,cacheNames:o,cacheWrapper:h,canConstructReadableStream:function(){if(void 0===w)try{new ReadableStream({start(){}}),w=!0}catch(e){w=!1}return w},canConstructResponseFromBodyStream:d,dontWaitFor:function(e){e.then(()=>{})},DBWrapper:g,Deferred:class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},deleteDatabase:async e=>{await new Promise((t,n)=>{const s=indexedDB.deleteDatabase(e);s.onerror=()=>{n(s.error)},s.onblocked=()=>{n(new Error("Delete blocked"))},s.onsuccess=()=>{t()}})},executeQuotaErrorCallbacks:a,fetchWrapper:m,getFriendlyURL:c,logger:null,resultingClientExists:async function(e){if(!e)return;let t=await self.clients.matchAll({type:"window"});const n=new Set(t.map(e=>e.id));let s;const r=performance.now();for(;performance.now()-r<2e3&&(t=await self.clients.matchAll({type:"window"}),s=t.find(t=>e?t.id===e:!n.has(t.id)),!s);)await q(100);return s},timeout:q,WorkboxError:n});const x={get googleAnalytics(){return o.getGoogleAnalyticsName()},get precache(){return o.getPrecacheName()},get prefix(){return o.getPrefix()},get runtime(){return o.getRuntimeName()},get suffix(){return o.getSuffix()}};return e._private=v,e.cacheNames=x,e.clientsClaim=function(){self.addEventListener("activate",()=>self.clients.claim())},e.copyResponse=async function(e,t){const n=e.clone(),s={headers:new Headers(n.headers),status:n.status,statusText:n.statusText},r=t?t(s):s,i=d()?n.body:await n.blob();return new Response(i,r)},e.registerQuotaErrorCallback=function(e){s.add(e)},e.setCacheNameDetails=function(e){o.updateDetails(e)},e.skipWaiting=function(){self.addEventListener("install",()=>self.skipWaiting())},e}({}); | ||
//# sourceMappingURL=workbox-core.prod.js.map |
@@ -18,3 +18,2 @@ /* | ||
} | ||
; | ||
export { clientsClaim }; |
@@ -43,3 +43,2 @@ /* | ||
} | ||
; | ||
export { copyResponse }; |
import '../../_version.js'; | ||
export declare const messageGenerator: (code: string, details?: {}) => string; | ||
export declare const messageGenerator: ((code: string, ...args: any[]) => string) | ((code: string, details?: {}) => string); |
@@ -19,2 +19,1 @@ /* | ||
})(pluginEvents || (pluginEvents = {})); | ||
; |
{ | ||
"name": "workbox-core", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"license": "MIT", | ||
@@ -28,3 +28,3 @@ "author": "Google's Web DevRel Team", | ||
"types": "index.d.ts", | ||
"gitHead": "571ffded1872309a305f108a99a5a36982fde342" | ||
"gitHead": "2a6b84b892b5c404671b898e926bf37b65d261da" | ||
} |
@@ -59,3 +59,2 @@ /* | ||
} | ||
; | ||
export { setCacheNameDetails }; |
@@ -21,3 +21,2 @@ /* | ||
} | ||
; | ||
export { skipWaiting }; |
@@ -92,3 +92,3 @@ /* | ||
for (let item of value) { | ||
for (const item of value) { | ||
if (!(item instanceof expectedClass)) { | ||
@@ -95,0 +95,0 @@ throw error; |
@@ -12,3 +12,3 @@ /* | ||
declare var registration : ServiceWorkerRegistration|undefined; | ||
declare let registration: ServiceWorkerRegistration|undefined; | ||
@@ -36,3 +36,3 @@ export interface CacheNameDetails { | ||
runtime: 'runtime', | ||
suffix: typeof registration !== 'undefined' ? registration!.scope : '', | ||
suffix: typeof registration !== 'undefined' ? registration.scope : '', | ||
}; | ||
@@ -48,3 +48,3 @@ | ||
for (const key of Object.keys(_cacheNameDetails)) { | ||
fn(<CacheNameDetailsProp> key); | ||
fn(key as CacheNameDetailsProp); | ||
} | ||
@@ -57,3 +57,3 @@ } | ||
if (typeof details[key] === 'string') { | ||
_cacheNameDetails[key] = <string> details[key]; | ||
_cacheNameDetails[key] = details[key]; | ||
} | ||
@@ -60,0 +60,0 @@ }) |
@@ -29,19 +29,60 @@ /* | ||
interface PutWrapperOptions extends MatchWrapperOptions { | ||
response: Response, | ||
response: Response; | ||
} | ||
interface GetEffectiveRequestOptions { | ||
request: Request, | ||
mode: string, | ||
plugins?: WorkboxPlugin[], | ||
request: Request; | ||
mode: string; | ||
plugins?: WorkboxPlugin[]; | ||
} | ||
/** | ||
* Wrapper around cache.put(). | ||
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and | ||
* executes any of those callbacks found in sequence. The final `Request` object | ||
* returned by the last plugin is treated as the cache key for cache reads | ||
* and/or writes. | ||
* | ||
* Will call `cacheDidUpdate` on plugins if the cache was updated, using | ||
* `matchOptions` when determining what the old entry is. | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
* @param {string} options.mode | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Request>} | ||
* | ||
* @private | ||
* @memberof module:workbox-core | ||
*/ | ||
const _getEffectiveRequest = async ({ | ||
request, | ||
mode, | ||
plugins = [], | ||
}: GetEffectiveRequestOptions) => { | ||
const cacheKeyWillBeUsedPlugins = pluginUtils.filter( | ||
plugins, pluginEvents.CACHE_KEY_WILL_BE_USED); | ||
let effectiveRequest: Request | string = request; | ||
for (const plugin of cacheKeyWillBeUsedPlugins) { | ||
effectiveRequest = await plugin[pluginEvents.CACHE_KEY_WILL_BE_USED]!.call( | ||
plugin, {mode, request: effectiveRequest}); | ||
if (typeof effectiveRequest === 'string') { | ||
effectiveRequest = new Request(effectiveRequest); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
assert!.isInstance(effectiveRequest, Request, { | ||
moduleName: 'Plugin', | ||
funcName: pluginEvents.CACHE_KEY_WILL_BE_USED, | ||
isReturnValueProblem: true, | ||
}); | ||
} | ||
} | ||
return effectiveRequest; | ||
}; | ||
/** | ||
* This method will call cacheWillUpdate on the available plugins (or use | ||
* status === 200) to determine if the Response is safe and valid to cache. | ||
* | ||
* @param {Object} options | ||
* @param {string} options.cacheName | ||
* @param {Request} options.request | ||
@@ -51,3 +92,3 @@ * @param {Response} options.response | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @param {Object} [options.matchOptions] | ||
* @return {Promise<Response>} | ||
* | ||
@@ -57,4 +98,3 @@ * @private | ||
*/ | ||
const putWrapper = async ({ | ||
cacheName, | ||
const _isResponseSafeToCache = async ({ | ||
request, | ||
@@ -64,75 +104,59 @@ response, | ||
plugins = [], | ||
matchOptions, | ||
} : PutWrapperOptions) : Promise<void> => { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (request.method && request.method !== 'GET') { | ||
throw new WorkboxError('attempt-to-cache-non-get-request', { | ||
url: getFriendlyURL(request.url), | ||
method: request.method, | ||
}: { | ||
request: Request; | ||
response: Response; | ||
event?: Event; | ||
plugins?: WorkboxPlugin[]; | ||
}) => { | ||
let responseToCache: Response|undefined = response; | ||
let pluginsUsed = false; | ||
for (const plugin of plugins) { | ||
if (pluginEvents.CACHE_WILL_UPDATE in plugin) { | ||
pluginsUsed = true; | ||
const pluginMethod = plugin[pluginEvents.CACHE_WILL_UPDATE] as Function; | ||
responseToCache = await pluginMethod.call(plugin, { | ||
request, | ||
response: responseToCache, | ||
event, | ||
}); | ||
} | ||
} | ||
const effectiveRequest = await _getEffectiveRequest({ | ||
plugins, request, mode: 'write'}); | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (responseToCache) { | ||
assert!.isInstance(responseToCache, Response, { | ||
moduleName: 'Plugin', | ||
funcName: pluginEvents.CACHE_WILL_UPDATE, | ||
isReturnValueProblem: true, | ||
}); | ||
} | ||
} | ||
if (!response) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.error(`Cannot cache non-existent response for ` + | ||
`'${getFriendlyURL(effectiveRequest.url)}'.`); | ||
if (!responseToCache) { | ||
break; | ||
} | ||
} | ||
throw new WorkboxError('cache-put-with-no-response', { | ||
url: getFriendlyURL(effectiveRequest.url), | ||
}); | ||
} | ||
let responseToCache = await _isResponseSafeToCache({ | ||
event, | ||
plugins, | ||
response, | ||
request: effectiveRequest, | ||
}); | ||
if (!responseToCache) { | ||
if (!pluginsUsed) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + | ||
`not be cached.`, responseToCache); | ||
if (responseToCache) { | ||
if (responseToCache.status !== 200) { | ||
if (responseToCache.status === 0) { | ||
logger.warn(`The response for '${request.url}' is an opaque ` + | ||
`response. The caching strategy that you're using will not ` + | ||
`cache opaque responses by default.`); | ||
} else { | ||
logger.debug(`The response for '${request.url}' returned ` + | ||
`a status code of '${response.status}' and won't be cached as a ` + | ||
`result.`); | ||
} | ||
} | ||
} | ||
} | ||
return; | ||
} | ||
const cache = await self.caches.open(cacheName); | ||
const updatePlugins = pluginUtils.filter( | ||
plugins, pluginEvents.CACHE_DID_UPDATE); | ||
let oldResponse = updatePlugins.length > 0 ? | ||
await matchWrapper({cacheName, matchOptions, request: effectiveRequest}) : | ||
null; | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + | ||
`${getFriendlyURL(effectiveRequest.url)}.`); | ||
responseToCache = responseToCache && responseToCache.status === 200 ? | ||
responseToCache : undefined; | ||
} | ||
try { | ||
await cache.put(effectiveRequest, responseToCache); | ||
} catch (error) { | ||
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError | ||
if (error.name === 'QuotaExceededError') { | ||
await executeQuotaErrorCallbacks(); | ||
} | ||
throw error; | ||
} | ||
for (let plugin of updatePlugins) { | ||
await plugin[pluginEvents.CACHE_DID_UPDATE]!.call(plugin, { | ||
cacheName, | ||
event, | ||
oldResponse, | ||
newResponse: responseToCache, | ||
request: effectiveRequest, | ||
}); | ||
} | ||
return responseToCache ? responseToCache : null; | ||
}; | ||
@@ -161,3 +185,3 @@ | ||
plugins = [], | ||
} : MatchWrapperOptions) : Promise<Response|undefined> => { | ||
}: MatchWrapperOptions): Promise<Response|undefined> => { | ||
const cache = await self.caches.open(cacheName); | ||
@@ -180,3 +204,3 @@ | ||
const pluginMethod = | ||
<Function> plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED]; | ||
plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED] as Function; | ||
@@ -207,6 +231,9 @@ cachedResponse = await pluginMethod.call(plugin, { | ||
/** | ||
* This method will call cacheWillUpdate on the available plugins (or use | ||
* status === 200) to determine if the Response is safe and valid to cache. | ||
* Wrapper around cache.put(). | ||
* | ||
* Will call `cacheDidUpdate` on plugins if the cache was updated, using | ||
* `matchOptions` when determining what the old entry is. | ||
* | ||
* @param {Object} options | ||
* @param {string} options.cacheName | ||
* @param {Request} options.request | ||
@@ -216,3 +243,3 @@ * @param {Response} options.response | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Response>} | ||
* @param {Object} [options.matchOptions] | ||
* | ||
@@ -222,3 +249,4 @@ * @private | ||
*/ | ||
const _isResponseSafeToCache = async ({ | ||
const putWrapper = async ({ | ||
cacheName, | ||
request, | ||
@@ -228,103 +256,75 @@ response, | ||
plugins = [], | ||
} : { | ||
request: Request, | ||
response: Response, | ||
event?: Event, | ||
plugins?: WorkboxPlugin[], | ||
}) => { | ||
let responseToCache: Response|undefined = response; | ||
let pluginsUsed = false; | ||
for (let plugin of plugins) { | ||
if (pluginEvents.CACHE_WILL_UPDATE in plugin) { | ||
pluginsUsed = true; | ||
const pluginMethod = <Function> plugin[pluginEvents.CACHE_WILL_UPDATE]; | ||
responseToCache = await pluginMethod.call(plugin, { | ||
request, | ||
response: responseToCache, | ||
event, | ||
matchOptions, | ||
}: PutWrapperOptions): Promise<void> => { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (request.method && request.method !== 'GET') { | ||
throw new WorkboxError('attempt-to-cache-non-get-request', { | ||
url: getFriendlyURL(request.url), | ||
method: request.method, | ||
}); | ||
} | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (responseToCache) { | ||
assert!.isInstance(responseToCache, Response, { | ||
moduleName: 'Plugin', | ||
funcName: pluginEvents.CACHE_WILL_UPDATE, | ||
isReturnValueProblem: true, | ||
}); | ||
} | ||
} | ||
const effectiveRequest = await _getEffectiveRequest({ | ||
plugins, request, mode: 'write'}); | ||
if (!responseToCache) { | ||
break; | ||
} | ||
if (!response) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.error(`Cannot cache non-existent response for ` + | ||
`'${getFriendlyURL(effectiveRequest.url)}'.`); | ||
} | ||
throw new WorkboxError('cache-put-with-no-response', { | ||
url: getFriendlyURL(effectiveRequest.url), | ||
}); | ||
} | ||
if (!pluginsUsed) { | ||
const responseToCache = await _isResponseSafeToCache({ | ||
event, | ||
plugins, | ||
response, | ||
request: effectiveRequest, | ||
}); | ||
if (!responseToCache) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (responseToCache) { | ||
if (responseToCache.status !== 200) { | ||
if (responseToCache.status === 0) { | ||
logger.warn(`The response for '${request.url}' is an opaque ` + | ||
`response. The caching strategy that you're using will not ` + | ||
`cache opaque responses by default.`); | ||
} else { | ||
logger.debug(`The response for '${request.url}' returned ` + | ||
`a status code of '${response.status}' and won't be cached as a ` + | ||
`result.`); | ||
} | ||
} | ||
} | ||
logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' will ` + | ||
`not be cached.`, responseToCache); | ||
} | ||
responseToCache = responseToCache && responseToCache.status === 200 ? | ||
responseToCache : undefined; | ||
return; | ||
} | ||
return responseToCache ? responseToCache : null; | ||
}; | ||
const cache = await self.caches.open(cacheName); | ||
/** | ||
* Checks the list of plugins for the cacheKeyWillBeUsed callback, and | ||
* executes any of those callbacks found in sequence. The final `Request` object | ||
* returned by the last plugin is treated as the cache key for cache reads | ||
* and/or writes. | ||
* | ||
* @param {Object} options | ||
* @param {Request} options.request | ||
* @param {string} options.mode | ||
* @param {Array<Object>} [options.plugins=[]] | ||
* @return {Promise<Request>} | ||
* | ||
* @private | ||
* @memberof module:workbox-core | ||
*/ | ||
const _getEffectiveRequest = async ({ | ||
request, | ||
mode, | ||
plugins = [], | ||
} : GetEffectiveRequestOptions) => { | ||
const cacheKeyWillBeUsedPlugins = pluginUtils.filter( | ||
plugins, pluginEvents.CACHE_KEY_WILL_BE_USED); | ||
const updatePlugins = pluginUtils.filter( | ||
plugins, pluginEvents.CACHE_DID_UPDATE); | ||
let effectiveRequest: Request | string = request; | ||
for (const plugin of cacheKeyWillBeUsedPlugins) { | ||
effectiveRequest = await plugin[pluginEvents.CACHE_KEY_WILL_BE_USED]!.call( | ||
plugin, {mode, request: effectiveRequest}); | ||
const oldResponse = updatePlugins.length > 0 ? | ||
await matchWrapper({cacheName, matchOptions, request: effectiveRequest}) : | ||
null; | ||
if (typeof effectiveRequest === 'string') { | ||
effectiveRequest = new Request(effectiveRequest); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
logger.debug(`Updating the '${cacheName}' cache with a new Response for ` + | ||
`${getFriendlyURL(effectiveRequest.url)}.`); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
assert!.isInstance(effectiveRequest, Request, { | ||
moduleName: 'Plugin', | ||
funcName: pluginEvents.CACHE_KEY_WILL_BE_USED, | ||
isReturnValueProblem: true, | ||
}); | ||
try { | ||
await cache.put(effectiveRequest, responseToCache); | ||
} catch (error) { | ||
// See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError | ||
if (error.name === 'QuotaExceededError') { | ||
await executeQuotaErrorCallbacks(); | ||
} | ||
throw error; | ||
} | ||
return effectiveRequest; | ||
for (const plugin of updatePlugins) { | ||
await plugin[pluginEvents.CACHE_DID_UPDATE]!.call(plugin, { | ||
cacheName, | ||
event, | ||
oldResponse, | ||
newResponse: responseToCache, | ||
request: effectiveRequest, | ||
}); | ||
} | ||
}; | ||
@@ -331,0 +331,0 @@ |
@@ -23,7 +23,7 @@ /* | ||
interface GetAllMatchingOptions { | ||
index?: string, | ||
query?: Query, | ||
direction?: IDBCursorDirection, | ||
count?: number, | ||
includeKeys?: boolean, | ||
index?: string; | ||
query?: Query; | ||
direction?: IDBCursorDirection; | ||
count?: number; | ||
includeKeys?: boolean; | ||
} | ||
@@ -39,6 +39,6 @@ | ||
export class DBWrapper { | ||
private _name: string; | ||
private _version: number; | ||
private _onupgradeneeded?: DBWrapperOptions['onupgradeneeded']; | ||
private _onversionchange: DBWrapperOptions['onversionchange']; | ||
private readonly _name: string; | ||
private readonly _version: number; | ||
private readonly _onupgradeneeded?: DBWrapperOptions['onupgradeneeded']; | ||
private readonly _onversionchange: DBWrapperOptions['onversionchange']; | ||
private _db: IDBDatabase | null = null; | ||
@@ -68,3 +68,3 @@ | ||
onversionchange, | ||
} : DBWrapperOptions = {}) { | ||
}: DBWrapperOptions = {}) { | ||
this._name = name; | ||
@@ -82,3 +82,3 @@ this._version = version; | ||
*/ | ||
get db() : IDBDatabase | null { | ||
get db(): IDBDatabase | null { | ||
return this._db; | ||
@@ -201,3 +201,3 @@ } | ||
includeKeys = false, | ||
} : GetAllMatchingOptions = {}) : Promise<Array<IDBCursor | any>> { | ||
}: GetAllMatchingOptions = {}): Promise<Array<IDBCursor | any>> { | ||
return await this.transaction([storeName], 'readonly', (txn, done) => { | ||
@@ -246,3 +246,3 @@ const store = txn.objectStore(storeName); | ||
callback: (txn: IDBTransaction, done: Function) => void, | ||
) : Promise<any> { | ||
): Promise<any> { | ||
await this.open(); | ||
@@ -278,3 +278,3 @@ return await new Promise((resolve, reject) => { | ||
// @ts-ignore | ||
const request = <IDBRequest> objStore[method].apply(objStore, args); | ||
const request = objStore[method].apply(objStore, args); | ||
@@ -322,8 +322,8 @@ request.onsuccess = () => done(request.result); | ||
// Don't use arrow functions here since we're outside of the class. | ||
DBWrapper.prototype[<IDBObjectStoreMethods> method] = | ||
DBWrapper.prototype[method as IDBObjectStoreMethods] = | ||
async function(storeName: string, ...args: any[]) { | ||
return await this._call( | ||
<IDBObjectStoreMethods> method, | ||
method as IDBObjectStoreMethods, | ||
storeName, | ||
<IDBTransactionMode> mode, | ||
mode as IDBTransactionMode, | ||
...args); | ||
@@ -330,0 +330,0 @@ }; |
@@ -22,5 +22,5 @@ /* | ||
promise: Promise<T>; | ||
resolve?: (value?: T) => void; | ||
reject?: (reason?: any) => void; | ||
resolve!: (value?: T) => void; | ||
reject!: (reason?: any) => void; | ||
/** | ||
@@ -27,0 +27,0 @@ * Creates a promise and exposes its resolve and reject functions as methods. |
@@ -46,3 +46,3 @@ /* | ||
plugins = [], | ||
} : WrappedFetchOptions) => { | ||
}: WrappedFetchOptions) => { | ||
@@ -87,11 +87,11 @@ if (typeof request === 'string') { | ||
try { | ||
for (let plugin of plugins) { | ||
for (const plugin of plugins) { | ||
if (pluginEvents.REQUEST_WILL_FETCH in plugin) { | ||
const pluginMethod = plugin[pluginEvents.REQUEST_WILL_FETCH]!; | ||
const requestClone = (<Request> request).clone(); | ||
const requestClone = request.clone(); | ||
request = <Request> (await pluginMethod.call(plugin, { | ||
request = await pluginMethod.call(plugin, { | ||
request: requestClone, | ||
event, | ||
})); | ||
}) as Request; | ||
@@ -118,3 +118,3 @@ if (process.env.NODE_ENV !== 'production') { | ||
// to the Request we make. Pass both to `fetchDidFail` to aid debugging. | ||
let pluginFilteredRequest = request.clone(); | ||
const pluginFilteredRequest = request.clone(); | ||
@@ -121,0 +121,0 @@ try { |
@@ -13,8 +13,7 @@ /* | ||
const urlObj = new URL(String(url), location.href); | ||
if (urlObj.origin === location.origin) { | ||
return urlObj.pathname; | ||
} | ||
return urlObj.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}`), ''); | ||
}; | ||
export {getFriendlyURL}; |
@@ -23,6 +23,6 @@ /* | ||
const logger = <Console> (process.env.NODE_ENV === 'production' ? null : (() => { | ||
const logger = (process.env.NODE_ENV === 'production' ? null : (() => { | ||
// Don't overwrite this value if it's already set. | ||
// See https://github.com/GoogleChrome/workbox/pull/2284#issuecomment-560470923 | ||
if (!('__WB_DISABLE_DEV_LOGS' in self!)) { | ||
if (!('__WB_DISABLE_DEV_LOGS' in self)) { | ||
self.__WB_DISABLE_DEV_LOGS = false; | ||
@@ -81,3 +81,3 @@ } | ||
for (const key of loggerMethods) { | ||
const method = <LoggerMethods> key; | ||
const method = key as LoggerMethods; | ||
@@ -89,5 +89,5 @@ api[method] = (...args: any[]) => { | ||
return <unknown> api; | ||
})()); | ||
return api as unknown; | ||
})()) as Console; | ||
export {logger}; |
@@ -13,3 +13,3 @@ /* | ||
// Give TypeScript the correct global. | ||
declare var self: ServiceWorkerGlobalScope; | ||
declare let self: ServiceWorkerGlobalScope; | ||
@@ -16,0 +16,0 @@ const MAX_RETRY_TIME = 2000; |
@@ -40,3 +40,3 @@ /* | ||
constructor(errorCode: string, details?: WorkboxErrorDetails) { | ||
let message = messageGenerator(errorCode, details); | ||
const message = messageGenerator(errorCode, details); | ||
@@ -43,0 +43,0 @@ super(message); |
// @ts-ignore | ||
try{self['workbox:core:5.0.0']&&_()}catch(e){} | ||
try{self['workbox:core:5.1.0']&&_()}catch(e){} |
@@ -13,3 +13,3 @@ /* | ||
// Give TypeScript the correct global. | ||
declare var self: ServiceWorkerGlobalScope; | ||
declare let self: ServiceWorkerGlobalScope; | ||
@@ -24,4 +24,4 @@ /** | ||
self.addEventListener('activate', () => self.clients.claim()); | ||
}; | ||
} | ||
export {clientsClaim} |
@@ -52,4 +52,4 @@ /* | ||
return new Response(body, modifiedResponseInit); | ||
}; | ||
} | ||
export {copyResponse} |
@@ -20,3 +20,3 @@ /* | ||
export const messages : MessageMap = { | ||
export const messages: MessageMap = { | ||
'invalid-value': ({paramName, validValueDescription, value}) => { | ||
@@ -23,0 +23,0 @@ if (!paramName || !validValueDescription) { |
@@ -20,2 +20,2 @@ /* | ||
REQUEST_WILL_FETCH = 'requestWillFetch', | ||
}; | ||
} |
@@ -65,4 +65,4 @@ /* | ||
cacheNames.updateDetails(details); | ||
}; | ||
} | ||
export {setCacheNameDetails} |
@@ -13,3 +13,3 @@ /* | ||
// Give TypeScript the correct global. | ||
declare var self: ServiceWorkerGlobalScope; | ||
declare let self: ServiceWorkerGlobalScope; | ||
@@ -27,4 +27,4 @@ /** | ||
self.addEventListener('install', () => self.skipWaiting()); | ||
}; | ||
} | ||
export {skipWaiting} |
@@ -135,3 +135,3 @@ /* | ||
export interface FetchDidSucceedCallback { | ||
(param: FetchDidSucceedCallbackParam): Promise<Response> | ||
(param: FetchDidSucceedCallbackParam): Promise<Response>; | ||
} | ||
@@ -144,3 +144,3 @@ | ||
export interface RequestWillFetchCallback { | ||
(param: RequestWillFetchCallbackParam): Promise<Request | void | null | undefined> | ||
(param: RequestWillFetchCallbackParam): Promise<Request | void | null | undefined>; | ||
} | ||
@@ -147,0 +147,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
488599
5997