From 9a1210dd59e104dac649c0c161ab5a630169541b Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 21 Feb 2023 13:28:55 -0800 Subject: [PATCH 1/2] deps: pacote@15.1.1 --- node_modules/pacote/lib/fetcher.js | 6 +++--- node_modules/pacote/package.json | 2 +- package-lock.json | 8 ++++---- package.json | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/node_modules/pacote/lib/fetcher.js b/node_modules/pacote/lib/fetcher.js index fe5679f00a0a1..4852564d0445d 100644 --- a/node_modules/pacote/lib/fetcher.js +++ b/node_modules/pacote/lib/fetcher.js @@ -425,7 +425,7 @@ class FetcherBase { return ((mode | m) & ~this.umask) | exe | 0o600 } - [_tarxOptions] ({ cwd, uid, gid }) { + [_tarxOptions] ({ cwd }) { const sawIgnores = new Set() return { cwd, @@ -460,9 +460,9 @@ class FetcherBase { log.warn('tar', code, msg) log.silly('tar', code, msg, data) }, - uid, - gid, umask: this.umask, + // always ignore ownership info from tarball metadata + preserveOwner: false, } } } diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index c09fbda86aa1d..8a89a1dd612c8 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "15.1.0", + "version": "15.1.1", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { diff --git a/package-lock.json b/package-lock.json index 4cc9c0d86c4c2..8ce9d061a6eeb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -133,7 +133,7 @@ "npm-user-validate": "^2.0.0", "npmlog": "^7.0.1", "p-map": "^4.0.0", - "pacote": "^15.1.0", + "pacote": "^15.1.1", "parse-conflict-json": "^3.0.0", "proc-log": "^3.0.0", "qrcode-terminal": "^0.12.0", @@ -9870,9 +9870,9 @@ } }, "node_modules/pacote": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.1.0.tgz", - "integrity": "sha512-FFcjtIl+BQNfeliSm7MZz5cpdohvUV1yjGnqgVM4UnVF7JslRY0ImXAygdaCDV0jjUADEWu4y5xsDV8brtrTLg==", + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-15.1.1.tgz", + "integrity": "sha512-eeqEe77QrA6auZxNHIp+1TzHQ0HBKf5V6c8zcaYZ134EJe1lCi+fjXATkNiEEfbG+e50nu02GLvUtmZcGOYabQ==", "inBundle": true, "dependencies": { "@npmcli/git": "^4.0.0", diff --git a/package.json b/package.json index ec375de8794d2..f82165796b18c 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "npm-user-validate": "^2.0.0", "npmlog": "^7.0.1", "p-map": "^4.0.0", - "pacote": "^15.1.0", + "pacote": "^15.1.1", "parse-conflict-json": "^3.0.0", "proc-log": "^3.0.0", "qrcode-terminal": "^0.12.0", From b2a11bc9e814fe6d0cde96d193b077cdb5bf4de3 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 21 Feb 2023 13:33:59 -0800 Subject: [PATCH 2/2] deps: npm update - lru-cache@7.16.2 --- node_modules/lru-cache/LICENSE | 2 +- node_modules/lru-cache/index.d.ts | 262 ++++--- node_modules/lru-cache/index.js | 95 ++- node_modules/lru-cache/index.mjs | 1053 +++++++++++++++++++++++++++ node_modules/lru-cache/package.json | 32 +- package-lock.json | 261 +++---- 6 files changed, 1441 insertions(+), 264 deletions(-) create mode 100644 node_modules/lru-cache/index.mjs diff --git a/node_modules/lru-cache/LICENSE b/node_modules/lru-cache/LICENSE index 9b58a3e03d1df..f785757cd63f8 100644 --- a/node_modules/lru-cache/LICENSE +++ b/node_modules/lru-cache/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors +Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/node_modules/lru-cache/index.d.ts b/node_modules/lru-cache/index.d.ts index ceed413c70919..e8af7c4de82f9 100644 --- a/node_modules/lru-cache/index.d.ts +++ b/node_modules/lru-cache/index.d.ts @@ -31,21 +31,36 @@ // Changes by Isaac Z. Schlueter released under the terms found in the // LICENSE file within this project. -//tslint:disable:member-access +/** + * Integer greater than 0, representing some number of milliseconds, or the + * time at which a TTL started counting from. + */ +declare type LRUMilliseconds = number + +/** + * An integer greater than 0, reflecting the calculated size of items + */ +declare type LRUSize = number + +/** + * An integer greater than 0, reflecting a number of items + */ +declare type LRUCount = number + declare class LRUCache implements Iterable<[K, V]> { constructor(options: LRUCache.Options) /** * Number of items in the cache. - * Alias for `cache.size` + * Alias for {@link size} * - * @deprecated since 7.0 use `cache.size` instead + * @deprecated since 7.0 use {@link size} instead */ - public readonly length: number + public readonly length: LRUCount - public readonly max: number - public readonly maxSize: number - public readonly maxEntrySize: number + public readonly max: LRUCount + public readonly maxSize: LRUSize + public readonly maxEntrySize: LRUSize public readonly sizeCalculation: | LRUCache.SizeCalculator | undefined @@ -55,8 +70,8 @@ declare class LRUCache implements Iterable<[K, V]> { */ public readonly disposeAfter: LRUCache.Disposer | null public readonly noDisposeOnSet: boolean - public readonly ttl: number - public readonly ttlResolution: number + public readonly ttl: LRUMilliseconds + public readonly ttlResolution: LRUMilliseconds public readonly ttlAutopurge: boolean public readonly allowStale: boolean public readonly updateAgeOnGet: boolean @@ -72,12 +87,12 @@ declare class LRUCache implements Iterable<[K, V]> { /** * The total number of items held in the cache at the current moment. */ - public readonly size: number + public readonly size: LRUCount /** * The total size of items in cache when using size tracking. */ - public readonly calculatedSize: number + public readonly calculatedSize: LRUSize /** * Add a value to the cache. @@ -89,36 +104,30 @@ declare class LRUCache implements Iterable<[K, V]> { ): this /** - * Return a value from the cache. - * Will update the recency of the cache entry found. - * If the key is not found, `get()` will return `undefined`. - * This can be confusing when setting values specifically to `undefined`, - * as in `cache.set(key, undefined)`. Use `cache.has()` to determine - * whether a key is present in the cache at all. + * Return a value from the cache. Will update the recency of the cache entry + * found. + * + * If the key is not found, {@link get} will return `undefined`. This can be + * confusing when setting values specifically to `undefined`, as in + * `cache.set(key, undefined)`. Use {@link has} to determine whether a key is + * present in the cache at all. */ - // tslint:disable-next-line:no-unnecessary-generics - public get( - key: K, - options?: LRUCache.GetOptions - ): T | undefined + public get(key: K, options?: LRUCache.GetOptions): V | undefined /** - * Like `get()` but doesn't update recency or delete stale items. - * Returns `undefined` if the item is stale, unless `allowStale` is set + * Like {@link get} but doesn't update recency or delete stale items. + * Returns `undefined` if the item is stale, unless {@link allowStale} is set * either on the cache or in the options object. */ - // tslint:disable-next-line:no-unnecessary-generics - public peek( - key: K, - options?: LRUCache.PeekOptions - ): T | undefined + public peek(key: K, options?: LRUCache.PeekOptions): V | undefined /** * Check if a key is in the cache, without updating the recency of use. * Will return false if the item is stale, even though it is technically * in the cache. - * Will not update item age unless `updateAgeOnHas` is set in the options - * or constructor. + * + * Will not update item age unless {@link updateAgeOnHas} is set in the + * options or constructor. */ public has(key: K, options?: LRUCache.HasOptions): boolean @@ -143,15 +152,14 @@ declare class LRUCache implements Iterable<[K, V]> { * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). */ - // tslint:disable-next-line:no-unnecessary-generics - public find( + public find( callbackFn: ( value: V, key: K, cache: this ) => boolean | undefined | void, options?: LRUCache.GetOptions - ): T + ): V | undefined /** * Call the supplied function on each item in the cache, in order from @@ -164,7 +172,7 @@ declare class LRUCache implements Iterable<[K, V]> { ): void /** - * The same as `cache.forEach(...)` but items are iterated over in reverse + * The same as {@link forEach} but items are iterated over in reverse * order. (ie, less recently used items are iterated over first.) */ public rforEach( @@ -176,46 +184,49 @@ declare class LRUCache implements Iterable<[K, V]> { * Return a generator yielding the keys in the cache, * in order from most recently used to least recently used. */ - public keys(): Generator + public keys(): Generator /** - * Inverse order version of `cache.keys()` + * Inverse order version of {@link keys} + * * Return a generator yielding the keys in the cache, * in order from least recently used to most recently used. */ - public rkeys(): Generator + public rkeys(): Generator /** * Return a generator yielding the values in the cache, * in order from most recently used to least recently used. */ - public values(): Generator + public values(): Generator /** - * Inverse order version of `cache.values()` + * Inverse order version of {@link values} + * * Return a generator yielding the values in the cache, * in order from least recently used to most recently used. */ - public rvalues(): Generator + public rvalues(): Generator /** * Return a generator yielding `[key, value]` pairs, * in order from most recently used to least recently used. */ - public entries(): Generator<[K, V]> + public entries(): Generator<[K, V], void, void> /** - * Inverse order version of `cache.entries()` + * Inverse order version of {@link entries} + * * Return a generator yielding `[key, value]` pairs, * in order from least recently used to most recently used. */ - public rentries(): Generator<[K, V]> + public rentries(): Generator<[K, V], void, void> /** * Iterating over the cache itself yields the same results as - * `cache.entries()` + * {@link entries} */ - public [Symbol.iterator](): Iterator<[K, V]> + public [Symbol.iterator](): Generator<[K, V], void, void> /** * Return an array of [key, entry] objects which can be passed to @@ -262,23 +273,21 @@ declare class LRUCache implements Iterable<[K, V]> { /** * since: 7.6.0 */ - // tslint:disable-next-line:no-unnecessary-generics - public fetch( + public fetch( key: K, options?: LRUCache.FetchOptions - ): Promise + ): Promise /** * since: 7.6.0 */ - public getRemainingTTL(key: K): number + public getRemainingTTL(key: K): LRUMilliseconds } declare namespace LRUCache { - type LRUMilliseconds = number type DisposeReason = 'evict' | 'set' | 'delete' - type SizeCalculator = (value: V, key: K) => number + type SizeCalculator = (value: V, key: K) => LRUSize type Disposer = ( value: V, key: K, @@ -286,7 +295,7 @@ declare namespace LRUCache { ) => void type Fetcher = ( key: K, - staleValue: V, + staleValue: V | undefined, options: FetcherOptions ) => Promise | V | void | undefined @@ -296,12 +305,12 @@ declare namespace LRUCache { * * @deprecated since 7.0 use options.ttl instead */ - maxAge?: number + maxAge?: LRUMilliseconds /** - * alias for sizeCalculation + * alias for {@link sizeCalculation} * - * @deprecated since 7.0 use options.sizeCalculation instead + * @deprecated since 7.0 use {@link sizeCalculation} instead */ length?: SizeCalculator @@ -318,12 +327,18 @@ declare namespace LRUCache { * The number of most recently used items to keep. * Note that we may store fewer items than this if maxSize is hit. */ - max: number + max: LRUCount } type MaybeMaxEntrySizeLimit = | { - maxEntrySize: number + /** + * The maximum allowed size for any single item in the cache. + * + * If a larger item is passed to {@link set} or returned by a + * {@link fetchMethod}, then it will not be stored in the cache. + */ + maxEntrySize: LRUSize sizeCalculation?: SizeCalculator } | {} @@ -336,16 +351,22 @@ declare namespace LRUCache { * to be stored. At the extreme, a single item of maxSize size * will cause everything else in the cache to be dropped when it * is added. Use with caution! + * * Note also that size tracking can negatively impact performance, * though for most cases, only minimally. */ - maxSize: number + maxSize: LRUSize /** * Function to calculate size of items. Useful if storing strings or * buffers or other items where memory size depends on the object itself. - * Also note that oversized items do NOT immediately get dropped from - * the cache, though they will cause faster turnover in the storage. + * + * Items larger than {@link maxEntrySize} will not be stored in the cache. + * + * Note that when {@link maxSize} or {@link maxEntrySize} are set, every + * item added MUST have a size specified, either via a `sizeCalculation` in + * the constructor, or `sizeCalculation` or {@link size} options to + * {@link set}. */ sizeCalculation?: SizeCalculator } @@ -363,7 +384,7 @@ declare namespace LRUCache { * * Must be an integer number of ms, defaults to 0, which means "no TTL" */ - ttl: number + ttl: LRUMilliseconds /** * Boolean flag to tell the cache to not update the TTL when @@ -386,12 +407,12 @@ declare namespace LRUCache { * * Setting this to a higher value will improve performance somewhat * while using ttl tracking, albeit at the expense of keeping stale - * items around a bit longer than intended. + * items around a bit longer than their TTLs would indicate. * * @default 1 * @since 7.1.0 */ - ttlResolution?: number + ttlResolution?: LRUMilliseconds /** * Preemptively remove stale items from the cache. @@ -400,7 +421,7 @@ declare namespace LRUCache { * It is almost always best to just leave the stale items in * the cache, and let them fall out as new items are added. * - * Note that this means that allowStale is a bit pointless, + * Note that this means that {@link allowStale} is a bit pointless, * as stale items will be deleted almost as soon as they expire. * * Use with caution! @@ -411,24 +432,24 @@ declare namespace LRUCache { ttlAutopurge?: boolean /** - * Return stale items from cache.get() before disposing of them. - * Return stale values from cache.fetch() while performing a call - * to the `fetchMethod` in the background. + * Return stale items from {@link get} before disposing of them. + * Return stale values from {@link fetch} while performing a call + * to the {@link fetchMethod} in the background. * * @default false */ allowStale?: boolean /** - * Update the age of items on cache.get(), renewing their TTL + * Update the age of items on {@link get}, renewing their TTL * * @default false */ updateAgeOnGet?: boolean /** - * Do not delete stale items when they are retrieved with cache.get() - * Note that the get() return value will still be `undefined` unless + * Do not delete stale items when they are retrieved with {@link get}. + * Note that the {@link get} return value will still be `undefined` unless * allowStale is true. * * @default false @@ -437,7 +458,7 @@ declare namespace LRUCache { noDeleteOnStaleGet?: boolean /** - * Update the age of items on cache.has(), renewing their TTL + * Update the age of items on {@link has}, renewing their TTL * * @default false */ @@ -457,8 +478,8 @@ declare namespace LRUCache { * cleanup tasks when items are no longer accessible. Called with `key, * value`. It's called before actually removing the item from the * internal cache, so it is *NOT* safe to re-add them. - * Use `disposeAfter` if you wish to dispose items after they have been - * full removed, when it is safe to add them back to the cache. + * Use {@link disposeAfter} if you wish to dispose items after they have + * been full removed, when it is safe to add them back to the cache. */ dispose?: Disposer @@ -476,27 +497,29 @@ declare namespace LRUCache { /** * Set to true to suppress calling the dispose() function if the entry * key is still accessible within the cache. - * This may be overridden by passing an options object to cache.set(). + * This may be overridden by passing an options object to {@link set}. * * @default false */ noDisposeOnSet?: boolean /** - * `fetchMethod` Function that is used to make background asynchronous - * fetches. Called with `fetchMethod(key, staleValue)`. May return a - * Promise. + * Function that is used to make background asynchronous fetches. Called + * with `fetchMethod(key, staleValue, { signal, options, context })`. * - * If `fetchMethod` is not provided, then `cache.fetch(key)` is + * If `fetchMethod` is not provided, then {@link fetch} is * equivalent to `Promise.resolve(cache.get(key))`. * + * The `fetchMethod` should ONLY return `undefined` in cases where the + * abort controller has sent an abort signal. + * * @since 7.6.0 */ fetchMethod?: LRUCache.Fetcher /** * Set to true to suppress the deletion of stale data when a - * `fetchMethod` throws an error or returns a rejected promise + * {@link fetchMethod} throws an error or returns a rejected promise * * @default false * @since 7.10.0 @@ -504,9 +527,21 @@ declare namespace LRUCache { noDeleteOnFetchRejection?: boolean /** - * Set to any value in the constructor or fetch() options to - * pass arbitrary data to the fetch() method in the options.context - * field. + * Set to true to allow returning stale data when a {@link fetchMethod} + * throws an error or returns a rejected promise. Note that this + * differs from using {@link allowStale} in that stale data will + * ONLY be returned in the case that the fetch fails, not any other + * times. + * + * @default false + * @since 7.16.0 + */ + allowStaleOnFetchRejection?: boolean + + /** + * Set to any value in the constructor or {@link fetch} options to + * pass arbitrary data to the {@link fetchMethod} in the {@link context} + * options field. * * @since 7.12.0 */ @@ -520,24 +555,41 @@ declare namespace LRUCache { /** * options which override the options set in the LRUCache constructor - * when making `cache.set()` calls. + * when making calling {@link set}. */ interface SetOptions { /** * A value for the size of the entry, prevents calls to - * `sizeCalculation` function. + * {@link sizeCalculation}. + * + * Items larger than {@link maxEntrySize} will not be stored in the cache. + * + * Note that when {@link maxSize} or {@link maxEntrySize} are set, every + * item added MUST have a size specified, either via a `sizeCalculation` in + * the constructor, or {@link sizeCalculation} or `size` options to + * {@link set}. + */ + size?: LRUSize + /** + * Overrides the {@link sizeCalculation} method set in the constructor. + * + * Items larger than {@link maxEntrySize} will not be stored in the cache. + * + * Note that when {@link maxSize} or {@link maxEntrySize} are set, every + * item added MUST have a size specified, either via a `sizeCalculation` in + * the constructor, or `sizeCalculation` or {@link size} options to + * {@link set}. */ - size?: number sizeCalculation?: SizeCalculator - ttl?: number - start?: number + ttl?: LRUMilliseconds + start?: LRUMilliseconds noDisposeOnSet?: boolean noUpdateTTL?: boolean } /** * options which override the options set in the LRUCAche constructor - * when making `cache.has()` calls. + * when calling {@link has}. */ interface HasOptions { updateAgeOnHas?: boolean @@ -545,7 +597,7 @@ declare namespace LRUCache { /** * options which override the options set in the LRUCache constructor - * when making `cache.get()` calls. + * when calling {@link get}. */ interface GetOptions { allowStale?: boolean @@ -555,29 +607,40 @@ declare namespace LRUCache { /** * options which override the options set in the LRUCache constructor - * when making `cache.peek()` calls. + * when calling {@link peek}. */ interface PeekOptions { allowStale?: boolean } + /** + * Options object passed to the {@link fetchMethod} + * + * May be mutated by the {@link fetchMethod} to affect the behavior of the + * resulting {@link set} operation on resolution, or in the case of + * {@link noDeleteOnFetchRejection} and {@link allowStaleOnFetchRejection}, + * the handling of failure. + */ interface FetcherFetchOptions { allowStale?: boolean updateAgeOnGet?: boolean noDeleteOnStaleGet?: boolean - size?: number + size?: LRUSize sizeCalculation?: SizeCalculator - ttl?: number + ttl?: LRUMilliseconds noDisposeOnSet?: boolean noUpdateTTL?: boolean noDeleteOnFetchRejection?: boolean + allowStaleOnFetchRejection?: boolean } /** * options which override the options set in the LRUCache constructor - * when making `cache.fetch()` calls. + * when calling {@link fetch}. + * * This is the union of GetOptions and SetOptions, plus - * `noDeleteOnFetchRejection`, `forceRefresh`, and `fetchContext` + * {@link noDeleteOnFetchRejection}, {@link allowStaleOnFetchRejection}, + * {@link forceRefresh}, and {@link fetchContext} */ interface FetchOptions extends FetcherFetchOptions { forceRefresh?: boolean @@ -587,14 +650,17 @@ declare namespace LRUCache { interface FetcherOptions { signal: AbortSignal options: FetcherFetchOptions + /** + * Object provided in the {@link fetchContext} option + */ context: any } interface Entry { value: V - ttl?: number - size?: number - start?: number + ttl?: LRUMilliseconds + size?: LRUSize + start?: LRUMilliseconds } } diff --git a/node_modules/lru-cache/index.js b/node_modules/lru-cache/index.js index fa53c12096cf6..f4be3476d4dbc 100644 --- a/node_modules/lru-cache/index.js +++ b/node_modules/lru-cache/index.js @@ -17,8 +17,12 @@ const AC = hasAbortController constructor() { this.signal = new AS() } - abort() { - this.signal.dispatchEvent('abort') + abort(reason = new Error('This operation was aborted')) { + this.signal.reason = reason + this.signal.dispatchEvent({ + type: 'abort', + target: this.signal, + }) } } @@ -31,13 +35,13 @@ const AS = hasAbortSignal ? AC.AbortController : class AbortSignal { constructor() { + this.reason = undefined this.aborted = false this._listeners = [] } - dispatchEvent(type) { - if (type === 'abort') { + dispatchEvent(e) { + if (e.type === 'abort') { this.aborted = true - const e = { type, target: this } this.onabort(e) this._listeners.forEach(f => f(e), this) } @@ -163,6 +167,7 @@ class LRUCache { fetchContext, noDeleteOnFetchRejection, noDeleteOnStaleGet, + allowStaleOnFetchRejection, } = options // deprecated options, don't trigger a warning for getting them if @@ -232,6 +237,7 @@ class LRUCache { this.noDisposeOnSet = !!noDisposeOnSet this.noUpdateTTL = !!noUpdateTTL this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection + this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection // NB: maxEntrySize is set to maxSize if it's set if (this.maxEntrySize !== 0) { @@ -365,9 +371,9 @@ class LRUCache { ) } } - updateItemAge(index) {} - setItemTTL(index, ttl, start) {} - isStale(index) { + updateItemAge(_index) {} + setItemTTL(_index, _ttl, _start) {} + isStale(_index) { return false } @@ -397,7 +403,9 @@ class LRUCache { } } else { throw new TypeError( - 'invalid size value (must be positive integer)' + 'invalid size value (must be positive integer). ' + + 'When maxSize or maxEntrySize is used, sizeCalculation or size ' + + 'must be set.' ) } } @@ -414,9 +422,9 @@ class LRUCache { this.calculatedSize += this.sizes[index] } } - removeItemSize(index) {} - addItemSize(index, size) {} - requireSize(k, v, size, sizeCalculation) { + removeItemSize(_index) {} + addItemSize(_index, _size) {} + requireSize(_k, _v, size, sizeCalculation) { if (size || sizeCalculation) { throw new TypeError( 'cannot set size without setting maxSize or maxEntrySize on cache' @@ -466,34 +474,46 @@ class LRUCache { *entries() { for (const i of this.indexes()) { - yield [this.keyList[i], this.valList[i]] + if (!this.isBackgroundFetch(this.valList[i])) { + yield [this.keyList[i], this.valList[i]] + } } } *rentries() { for (const i of this.rindexes()) { - yield [this.keyList[i], this.valList[i]] + if (!this.isBackgroundFetch(this.valList[i])) { + yield [this.keyList[i], this.valList[i]] + } } } *keys() { for (const i of this.indexes()) { - yield this.keyList[i] + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.keyList[i] + } } } *rkeys() { for (const i of this.rindexes()) { - yield this.keyList[i] + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.keyList[i] + } } } *values() { for (const i of this.indexes()) { - yield this.valList[i] + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.valList[i] + } } } *rvalues() { for (const i of this.rindexes()) { - yield this.valList[i] + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.valList[i] + } } } @@ -545,6 +565,7 @@ class LRUCache { const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v + if (value === undefined) continue const entry = { value } if (this.ttls) { entry.ttl = this.ttls[i] @@ -575,7 +596,7 @@ class LRUCache { } } - dispose(v, k, reason) {} + dispose(_v, _k, _reason) {} set( k, @@ -613,10 +634,11 @@ class LRUCache { noUpdateTTL = false } else { // update + this.moveToTail(index) const oldVal = this.valList[index] if (v !== oldVal) { if (this.isBackgroundFetch(oldVal)) { - oldVal.__abortController.abort() + oldVal.__abortController.abort(new Error('replaced')) } else { if (!noDisposeOnSet) { this.dispose(oldVal, k, 'set') @@ -629,7 +651,6 @@ class LRUCache { this.valList[index] = v this.addItemSize(index, size) } - this.moveToTail(index) } if (ttl !== 0 && this.ttl === 0 && !this.ttls) { this.initializeTTLTracking() @@ -672,7 +693,7 @@ class LRUCache { const k = this.keyList[head] const v = this.valList[head] if (this.isBackgroundFetch(v)) { - v.__abortController.abort() + v.__abortController.abort(new Error('evicted')) } else { this.dispose(v, k, 'evict') if (this.disposeAfter) { @@ -729,14 +750,19 @@ class LRUCache { const cb = v => { if (!ac.signal.aborted) { this.set(k, v, fetchOpts.options) + return v + } else { + return eb(ac.signal.reason) } - return v } const eb = er => { if (this.valList[index] === p) { - const del = - !options.noDeleteOnFetchRejection || - p.__staleWhileFetching === undefined + // if we allow stale on fetch rejections, then we need to ensure that + // the stale value is not removed from the cache when the fetch fails. + const noDelete = + options.noDeleteOnFetchRejection || + options.allowStaleOnFetchRejection + const del = !noDelete || p.__staleWhileFetching === undefined if (del) { this.delete(k) } else { @@ -745,11 +771,16 @@ class LRUCache { this.valList[index] = p.__staleWhileFetching } } - if (p.__returned === p) { + if (options.allowStaleOnFetchRejection) { + return p.__staleWhileFetching + } else if (p.__returned === p) { throw er } } - const pcall = res => res(this.fetchMethod(k, v, fetchOpts)) + const pcall = (res, rej) => { + ac.signal.addEventListener('abort', () => res()) + this.fetchMethod(k, v, fetchOpts).then(res, rej) + } const p = new Promise(pcall).then(cb, eb) p.__abortController = ac p.__staleWhileFetching = v @@ -793,8 +824,10 @@ class LRUCache { noUpdateTTL = this.noUpdateTTL, // fetch exclusive options noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, + allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, fetchContext = this.fetchContext, forceRefresh = false, + signal, } = {} ) { if (!this.fetchMethod) { @@ -815,6 +848,8 @@ class LRUCache { sizeCalculation, noUpdateTTL, noDeleteOnFetchRejection, + allowStaleOnFetchRejection, + signal, } let index = this.keyMap.get(k) @@ -929,7 +964,7 @@ class LRUCache { this.removeItemSize(index) const v = this.valList[index] if (this.isBackgroundFetch(v)) { - v.__abortController.abort() + v.__abortController.abort(new Error('deleted')) } else { this.dispose(v, k, 'delete') if (this.disposeAfter) { @@ -964,7 +999,7 @@ class LRUCache { for (const index of this.rindexes({ allowStale: true })) { const v = this.valList[index] if (this.isBackgroundFetch(v)) { - v.__abortController.abort() + v.__abortController.abort(new Error('deleted')) } else { const k = this.keyList[index] this.dispose(v, k, 'delete') diff --git a/node_modules/lru-cache/index.mjs b/node_modules/lru-cache/index.mjs new file mode 100644 index 0000000000000..e69e77fbb3456 --- /dev/null +++ b/node_modules/lru-cache/index.mjs @@ -0,0 +1,1053 @@ +const perf = + typeof performance === 'object' && + performance && + typeof performance.now === 'function' + ? performance + : Date + +const hasAbortController = typeof AbortController === 'function' + +// minimal backwards-compatibility polyfill +// this doesn't have nearly all the checks and whatnot that +// actual AbortController/Signal has, but it's enough for +// our purposes, and if used properly, behaves the same. +const AC = hasAbortController + ? AbortController + : class AbortController { + constructor() { + this.signal = new AS() + } + abort(reason = new Error('This operation was aborted')) { + this.signal.reason = reason + this.signal.dispatchEvent({ + type: 'abort', + target: this.signal, + }) + } + } + +const hasAbortSignal = typeof AbortSignal === 'function' +// Some polyfills put this on the AC class, not global +const hasACAbortSignal = typeof AC.AbortSignal === 'function' +const AS = hasAbortSignal + ? AbortSignal + : hasACAbortSignal + ? AC.AbortController + : class AbortSignal { + constructor() { + this.reason = undefined + this.aborted = false + this._listeners = [] + } + dispatchEvent(e) { + if (e.type === 'abort') { + this.aborted = true + this.onabort(e) + this._listeners.forEach(f => f(e), this) + } + } + onabort() {} + addEventListener(ev, fn) { + if (ev === 'abort') { + this._listeners.push(fn) + } + } + removeEventListener(ev, fn) { + if (ev === 'abort') { + this._listeners = this._listeners.filter(f => f !== fn) + } + } + } + +const warned = new Set() +const deprecatedOption = (opt, instead) => { + const code = `LRU_CACHE_OPTION_${opt}` + if (shouldWarn(code)) { + warn(code, `${opt} option`, `options.${instead}`, LRUCache) + } +} +const deprecatedMethod = (method, instead) => { + const code = `LRU_CACHE_METHOD_${method}` + if (shouldWarn(code)) { + const { prototype } = LRUCache + const { get } = Object.getOwnPropertyDescriptor(prototype, method) + warn(code, `${method} method`, `cache.${instead}()`, get) + } +} +const deprecatedProperty = (field, instead) => { + const code = `LRU_CACHE_PROPERTY_${field}` + if (shouldWarn(code)) { + const { prototype } = LRUCache + const { get } = Object.getOwnPropertyDescriptor(prototype, field) + warn(code, `${field} property`, `cache.${instead}`, get) + } +} + +const emitWarning = (...a) => { + typeof process === 'object' && + process && + typeof process.emitWarning === 'function' + ? process.emitWarning(...a) + : console.error(...a) +} + +const shouldWarn = code => !warned.has(code) + +const warn = (code, what, instead, fn) => { + warned.add(code) + const msg = `The ${what} is deprecated. Please use ${instead} instead.` + emitWarning(msg, 'DeprecationWarning', code, fn) +} + +const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n) + +/* istanbul ignore next - This is a little bit ridiculous, tbh. + * The maximum array length is 2^32-1 or thereabouts on most JS impls. + * And well before that point, you're caching the entire world, I mean, + * that's ~32GB of just integers for the next/prev links, plus whatever + * else to hold that many keys and values. Just filling the memory with + * zeroes at init time is brutal when you get that big. + * But why not be complete? + * Maybe in the future, these limits will have expanded. */ +const getUintArray = max => + !isPosInt(max) + ? null + : max <= Math.pow(2, 8) + ? Uint8Array + : max <= Math.pow(2, 16) + ? Uint16Array + : max <= Math.pow(2, 32) + ? Uint32Array + : max <= Number.MAX_SAFE_INTEGER + ? ZeroArray + : null + +class ZeroArray extends Array { + constructor(size) { + super(size) + this.fill(0) + } +} + +class Stack { + constructor(max) { + if (max === 0) { + return [] + } + const UintArray = getUintArray(max) + this.heap = new UintArray(max) + this.length = 0 + } + push(n) { + this.heap[this.length++] = n + } + pop() { + return this.heap[--this.length] + } +} + +class LRUCache { + constructor(options = {}) { + const { + max = 0, + ttl, + ttlResolution = 1, + ttlAutopurge, + updateAgeOnGet, + updateAgeOnHas, + allowStale, + dispose, + disposeAfter, + noDisposeOnSet, + noUpdateTTL, + maxSize = 0, + maxEntrySize = 0, + sizeCalculation, + fetchMethod, + fetchContext, + noDeleteOnFetchRejection, + noDeleteOnStaleGet, + allowStaleOnFetchRejection, + } = options + + // deprecated options, don't trigger a warning for getting them if + // the thing being passed in is another LRUCache we're copying. + const { length, maxAge, stale } = + options instanceof LRUCache ? {} : options + + if (max !== 0 && !isPosInt(max)) { + throw new TypeError('max option must be a nonnegative integer') + } + + const UintArray = max ? getUintArray(max) : Array + if (!UintArray) { + throw new Error('invalid max value: ' + max) + } + + this.max = max + this.maxSize = maxSize + this.maxEntrySize = maxEntrySize || this.maxSize + this.sizeCalculation = sizeCalculation || length + if (this.sizeCalculation) { + if (!this.maxSize && !this.maxEntrySize) { + throw new TypeError( + 'cannot set sizeCalculation without setting maxSize or maxEntrySize' + ) + } + if (typeof this.sizeCalculation !== 'function') { + throw new TypeError('sizeCalculation set to non-function') + } + } + + this.fetchMethod = fetchMethod || null + if (this.fetchMethod && typeof this.fetchMethod !== 'function') { + throw new TypeError( + 'fetchMethod must be a function if specified' + ) + } + + this.fetchContext = fetchContext + if (!this.fetchMethod && fetchContext !== undefined) { + throw new TypeError( + 'cannot set fetchContext without fetchMethod' + ) + } + + this.keyMap = new Map() + this.keyList = new Array(max).fill(null) + this.valList = new Array(max).fill(null) + this.next = new UintArray(max) + this.prev = new UintArray(max) + this.head = 0 + this.tail = 0 + this.free = new Stack(max) + this.initialFill = 1 + this.size = 0 + + if (typeof dispose === 'function') { + this.dispose = dispose + } + if (typeof disposeAfter === 'function') { + this.disposeAfter = disposeAfter + this.disposed = [] + } else { + this.disposeAfter = null + this.disposed = null + } + this.noDisposeOnSet = !!noDisposeOnSet + this.noUpdateTTL = !!noUpdateTTL + this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection + this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection + + // NB: maxEntrySize is set to maxSize if it's set + if (this.maxEntrySize !== 0) { + if (this.maxSize !== 0) { + if (!isPosInt(this.maxSize)) { + throw new TypeError( + 'maxSize must be a positive integer if specified' + ) + } + } + if (!isPosInt(this.maxEntrySize)) { + throw new TypeError( + 'maxEntrySize must be a positive integer if specified' + ) + } + this.initializeSizeTracking() + } + + this.allowStale = !!allowStale || !!stale + this.noDeleteOnStaleGet = !!noDeleteOnStaleGet + this.updateAgeOnGet = !!updateAgeOnGet + this.updateAgeOnHas = !!updateAgeOnHas + this.ttlResolution = + isPosInt(ttlResolution) || ttlResolution === 0 + ? ttlResolution + : 1 + this.ttlAutopurge = !!ttlAutopurge + this.ttl = ttl || maxAge || 0 + if (this.ttl) { + if (!isPosInt(this.ttl)) { + throw new TypeError( + 'ttl must be a positive integer if specified' + ) + } + this.initializeTTLTracking() + } + + // do not allow completely unbounded caches + if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) { + throw new TypeError( + 'At least one of max, maxSize, or ttl is required' + ) + } + if (!this.ttlAutopurge && !this.max && !this.maxSize) { + const code = 'LRU_CACHE_UNBOUNDED' + if (shouldWarn(code)) { + warned.add(code) + const msg = + 'TTL caching without ttlAutopurge, max, or maxSize can ' + + 'result in unbounded memory consumption.' + emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache) + } + } + + if (stale) { + deprecatedOption('stale', 'allowStale') + } + if (maxAge) { + deprecatedOption('maxAge', 'ttl') + } + if (length) { + deprecatedOption('length', 'sizeCalculation') + } + } + + getRemainingTTL(key) { + return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0 + } + + initializeTTLTracking() { + this.ttls = new ZeroArray(this.max) + this.starts = new ZeroArray(this.max) + + this.setItemTTL = (index, ttl, start = perf.now()) => { + this.starts[index] = ttl !== 0 ? start : 0 + this.ttls[index] = ttl + if (ttl !== 0 && this.ttlAutopurge) { + const t = setTimeout(() => { + if (this.isStale(index)) { + this.delete(this.keyList[index]) + } + }, ttl + 1) + /* istanbul ignore else - unref() not supported on all platforms */ + if (t.unref) { + t.unref() + } + } + } + + this.updateItemAge = index => { + this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0 + } + + // debounce calls to perf.now() to 1s so we're not hitting + // that costly call repeatedly. + let cachedNow = 0 + const getNow = () => { + const n = perf.now() + if (this.ttlResolution > 0) { + cachedNow = n + const t = setTimeout( + () => (cachedNow = 0), + this.ttlResolution + ) + /* istanbul ignore else - not available on all platforms */ + if (t.unref) { + t.unref() + } + } + return n + } + + this.getRemainingTTL = key => { + const index = this.keyMap.get(key) + if (index === undefined) { + return 0 + } + return this.ttls[index] === 0 || this.starts[index] === 0 + ? Infinity + : this.starts[index] + + this.ttls[index] - + (cachedNow || getNow()) + } + + this.isStale = index => { + return ( + this.ttls[index] !== 0 && + this.starts[index] !== 0 && + (cachedNow || getNow()) - this.starts[index] > + this.ttls[index] + ) + } + } + updateItemAge(_index) {} + setItemTTL(_index, _ttl, _start) {} + isStale(_index) { + return false + } + + initializeSizeTracking() { + this.calculatedSize = 0 + this.sizes = new ZeroArray(this.max) + this.removeItemSize = index => { + this.calculatedSize -= this.sizes[index] + this.sizes[index] = 0 + } + this.requireSize = (k, v, size, sizeCalculation) => { + // provisionally accept background fetches. + // actual value size will be checked when they return. + if (this.isBackgroundFetch(v)) { + return 0 + } + if (!isPosInt(size)) { + if (sizeCalculation) { + if (typeof sizeCalculation !== 'function') { + throw new TypeError('sizeCalculation must be a function') + } + size = sizeCalculation(v, k) + if (!isPosInt(size)) { + throw new TypeError( + 'sizeCalculation return invalid (expect positive integer)' + ) + } + } else { + throw new TypeError( + 'invalid size value (must be positive integer). ' + + 'When maxSize or maxEntrySize is used, sizeCalculation or size ' + + 'must be set.' + ) + } + } + return size + } + this.addItemSize = (index, size) => { + this.sizes[index] = size + if (this.maxSize) { + const maxSize = this.maxSize - this.sizes[index] + while (this.calculatedSize > maxSize) { + this.evict(true) + } + } + this.calculatedSize += this.sizes[index] + } + } + removeItemSize(_index) {} + addItemSize(_index, _size) {} + requireSize(_k, _v, size, sizeCalculation) { + if (size || sizeCalculation) { + throw new TypeError( + 'cannot set size without setting maxSize or maxEntrySize on cache' + ) + } + } + + *indexes({ allowStale = this.allowStale } = {}) { + if (this.size) { + for (let i = this.tail; true; ) { + if (!this.isValidIndex(i)) { + break + } + if (allowStale || !this.isStale(i)) { + yield i + } + if (i === this.head) { + break + } else { + i = this.prev[i] + } + } + } + } + + *rindexes({ allowStale = this.allowStale } = {}) { + if (this.size) { + for (let i = this.head; true; ) { + if (!this.isValidIndex(i)) { + break + } + if (allowStale || !this.isStale(i)) { + yield i + } + if (i === this.tail) { + break + } else { + i = this.next[i] + } + } + } + } + + isValidIndex(index) { + return this.keyMap.get(this.keyList[index]) === index + } + + *entries() { + for (const i of this.indexes()) { + if (!this.isBackgroundFetch(this.valList[i])) { + yield [this.keyList[i], this.valList[i]] + } + } + } + *rentries() { + for (const i of this.rindexes()) { + if (!this.isBackgroundFetch(this.valList[i])) { + yield [this.keyList[i], this.valList[i]] + } + } + } + + *keys() { + for (const i of this.indexes()) { + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.keyList[i] + } + } + } + *rkeys() { + for (const i of this.rindexes()) { + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.keyList[i] + } + } + } + + *values() { + for (const i of this.indexes()) { + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.valList[i] + } + } + } + *rvalues() { + for (const i of this.rindexes()) { + if (!this.isBackgroundFetch(this.valList[i])) { + yield this.valList[i] + } + } + } + + [Symbol.iterator]() { + return this.entries() + } + + find(fn, getOptions = {}) { + for (const i of this.indexes()) { + if (fn(this.valList[i], this.keyList[i], this)) { + return this.get(this.keyList[i], getOptions) + } + } + } + + forEach(fn, thisp = this) { + for (const i of this.indexes()) { + fn.call(thisp, this.valList[i], this.keyList[i], this) + } + } + + rforEach(fn, thisp = this) { + for (const i of this.rindexes()) { + fn.call(thisp, this.valList[i], this.keyList[i], this) + } + } + + get prune() { + deprecatedMethod('prune', 'purgeStale') + return this.purgeStale + } + + purgeStale() { + let deleted = false + for (const i of this.rindexes({ allowStale: true })) { + if (this.isStale(i)) { + this.delete(this.keyList[i]) + deleted = true + } + } + return deleted + } + + dump() { + const arr = [] + for (const i of this.indexes({ allowStale: true })) { + const key = this.keyList[i] + const v = this.valList[i] + const value = this.isBackgroundFetch(v) + ? v.__staleWhileFetching + : v + if (value === undefined) continue + const entry = { value } + if (this.ttls) { + entry.ttl = this.ttls[i] + // always dump the start relative to a portable timestamp + // it's ok for this to be a bit slow, it's a rare operation. + const age = perf.now() - this.starts[i] + entry.start = Math.floor(Date.now() - age) + } + if (this.sizes) { + entry.size = this.sizes[i] + } + arr.unshift([key, entry]) + } + return arr + } + + load(arr) { + this.clear() + for (const [key, entry] of arr) { + if (entry.start) { + // entry.start is a portable timestamp, but we may be using + // node's performance.now(), so calculate the offset. + // it's ok for this to be a bit slow, it's a rare operation. + const age = Date.now() - entry.start + entry.start = perf.now() - age + } + this.set(key, entry.value, entry) + } + } + + dispose(_v, _k, _reason) {} + + set( + k, + v, + { + ttl = this.ttl, + start, + noDisposeOnSet = this.noDisposeOnSet, + size = 0, + sizeCalculation = this.sizeCalculation, + noUpdateTTL = this.noUpdateTTL, + } = {} + ) { + size = this.requireSize(k, v, size, sizeCalculation) + // if the item doesn't fit, don't do anything + // NB: maxEntrySize set to maxSize by default + if (this.maxEntrySize && size > this.maxEntrySize) { + // have to delete, in case a background fetch is there already. + // in non-async cases, this is a no-op + this.delete(k) + return this + } + let index = this.size === 0 ? undefined : this.keyMap.get(k) + if (index === undefined) { + // addition + index = this.newIndex() + this.keyList[index] = k + this.valList[index] = v + this.keyMap.set(k, index) + this.next[this.tail] = index + this.prev[index] = this.tail + this.tail = index + this.size++ + this.addItemSize(index, size) + noUpdateTTL = false + } else { + // update + this.moveToTail(index) + const oldVal = this.valList[index] + if (v !== oldVal) { + if (this.isBackgroundFetch(oldVal)) { + oldVal.__abortController.abort(new Error('replaced')) + } else { + if (!noDisposeOnSet) { + this.dispose(oldVal, k, 'set') + if (this.disposeAfter) { + this.disposed.push([oldVal, k, 'set']) + } + } + } + this.removeItemSize(index) + this.valList[index] = v + this.addItemSize(index, size) + } + } + if (ttl !== 0 && this.ttl === 0 && !this.ttls) { + this.initializeTTLTracking() + } + if (!noUpdateTTL) { + this.setItemTTL(index, ttl, start) + } + if (this.disposeAfter) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } + return this + } + + newIndex() { + if (this.size === 0) { + return this.tail + } + if (this.size === this.max && this.max !== 0) { + return this.evict(false) + } + if (this.free.length !== 0) { + return this.free.pop() + } + // initial fill, just keep writing down the list + return this.initialFill++ + } + + pop() { + if (this.size) { + const val = this.valList[this.head] + this.evict(true) + return val + } + } + + evict(free) { + const head = this.head + const k = this.keyList[head] + const v = this.valList[head] + if (this.isBackgroundFetch(v)) { + v.__abortController.abort(new Error('evicted')) + } else { + this.dispose(v, k, 'evict') + if (this.disposeAfter) { + this.disposed.push([v, k, 'evict']) + } + } + this.removeItemSize(head) + // if we aren't about to use the index, then null these out + if (free) { + this.keyList[head] = null + this.valList[head] = null + this.free.push(head) + } + this.head = this.next[head] + this.keyMap.delete(k) + this.size-- + return head + } + + has(k, { updateAgeOnHas = this.updateAgeOnHas } = {}) { + const index = this.keyMap.get(k) + if (index !== undefined) { + if (!this.isStale(index)) { + if (updateAgeOnHas) { + this.updateItemAge(index) + } + return true + } + } + return false + } + + // like get(), but without any LRU updating or TTL expiration + peek(k, { allowStale = this.allowStale } = {}) { + const index = this.keyMap.get(k) + if (index !== undefined && (allowStale || !this.isStale(index))) { + const v = this.valList[index] + // either stale and allowed, or forcing a refresh of non-stale value + return this.isBackgroundFetch(v) ? v.__staleWhileFetching : v + } + } + + backgroundFetch(k, index, options, context) { + const v = index === undefined ? undefined : this.valList[index] + if (this.isBackgroundFetch(v)) { + return v + } + const ac = new AC() + const fetchOpts = { + signal: ac.signal, + options, + context, + } + const cb = v => { + if (!ac.signal.aborted) { + this.set(k, v, fetchOpts.options) + return v + } else { + return eb(ac.signal.reason) + } + } + const eb = er => { + if (this.valList[index] === p) { + // if we allow stale on fetch rejections, then we need to ensure that + // the stale value is not removed from the cache when the fetch fails. + const noDelete = + options.noDeleteOnFetchRejection || + options.allowStaleOnFetchRejection + const del = !noDelete || p.__staleWhileFetching === undefined + if (del) { + this.delete(k) + } else { + // still replace the *promise* with the stale value, + // since we are done with the promise at this point. + this.valList[index] = p.__staleWhileFetching + } + } + if (options.allowStaleOnFetchRejection) { + return p.__staleWhileFetching + } else if (p.__returned === p) { + throw er + } + } + const pcall = (res, rej) => { + ac.signal.addEventListener('abort', () => res()) + this.fetchMethod(k, v, fetchOpts).then(res, rej) + } + const p = new Promise(pcall).then(cb, eb) + p.__abortController = ac + p.__staleWhileFetching = v + p.__returned = null + if (index === undefined) { + this.set(k, p, fetchOpts.options) + index = this.keyMap.get(k) + } else { + this.valList[index] = p + } + return p + } + + isBackgroundFetch(p) { + return ( + p && + typeof p === 'object' && + typeof p.then === 'function' && + Object.prototype.hasOwnProperty.call( + p, + '__staleWhileFetching' + ) && + Object.prototype.hasOwnProperty.call(p, '__returned') && + (p.__returned === p || p.__returned === null) + ) + } + + // this takes the union of get() and set() opts, because it does both + async fetch( + k, + { + // get options + allowStale = this.allowStale, + updateAgeOnGet = this.updateAgeOnGet, + noDeleteOnStaleGet = this.noDeleteOnStaleGet, + // set options + ttl = this.ttl, + noDisposeOnSet = this.noDisposeOnSet, + size = 0, + sizeCalculation = this.sizeCalculation, + noUpdateTTL = this.noUpdateTTL, + // fetch exclusive options + noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, + allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, + fetchContext = this.fetchContext, + forceRefresh = false, + signal, + } = {} + ) { + if (!this.fetchMethod) { + return this.get(k, { + allowStale, + updateAgeOnGet, + noDeleteOnStaleGet, + }) + } + + const options = { + allowStale, + updateAgeOnGet, + noDeleteOnStaleGet, + ttl, + noDisposeOnSet, + size, + sizeCalculation, + noUpdateTTL, + noDeleteOnFetchRejection, + allowStaleOnFetchRejection, + signal, + } + + let index = this.keyMap.get(k) + if (index === undefined) { + const p = this.backgroundFetch(k, index, options, fetchContext) + return (p.__returned = p) + } else { + // in cache, maybe already fetching + const v = this.valList[index] + if (this.isBackgroundFetch(v)) { + return allowStale && v.__staleWhileFetching !== undefined + ? v.__staleWhileFetching + : (v.__returned = v) + } + + // if we force a refresh, that means do NOT serve the cached value, + // unless we are already in the process of refreshing the cache. + if (!forceRefresh && !this.isStale(index)) { + this.moveToTail(index) + if (updateAgeOnGet) { + this.updateItemAge(index) + } + return v + } + + // ok, it is stale or a forced refresh, and not already fetching. + // refresh the cache. + const p = this.backgroundFetch(k, index, options, fetchContext) + return allowStale && p.__staleWhileFetching !== undefined + ? p.__staleWhileFetching + : (p.__returned = p) + } + } + + get( + k, + { + allowStale = this.allowStale, + updateAgeOnGet = this.updateAgeOnGet, + noDeleteOnStaleGet = this.noDeleteOnStaleGet, + } = {} + ) { + const index = this.keyMap.get(k) + if (index !== undefined) { + const value = this.valList[index] + const fetching = this.isBackgroundFetch(value) + if (this.isStale(index)) { + // delete only if not an in-flight background fetch + if (!fetching) { + if (!noDeleteOnStaleGet) { + this.delete(k) + } + return allowStale ? value : undefined + } else { + return allowStale ? value.__staleWhileFetching : undefined + } + } else { + // if we're currently fetching it, we don't actually have it yet + // it's not stale, which means this isn't a staleWhileRefetching, + // so we just return undefined + if (fetching) { + return undefined + } + this.moveToTail(index) + if (updateAgeOnGet) { + this.updateItemAge(index) + } + return value + } + } + } + + connect(p, n) { + this.prev[n] = p + this.next[p] = n + } + + moveToTail(index) { + // if tail already, nothing to do + // if head, move head to next[index] + // else + // move next[prev[index]] to next[index] (head has no prev) + // move prev[next[index]] to prev[index] + // prev[index] = tail + // next[tail] = index + // tail = index + if (index !== this.tail) { + if (index === this.head) { + this.head = this.next[index] + } else { + this.connect(this.prev[index], this.next[index]) + } + this.connect(this.tail, index) + this.tail = index + } + } + + get del() { + deprecatedMethod('del', 'delete') + return this.delete + } + + delete(k) { + let deleted = false + if (this.size !== 0) { + const index = this.keyMap.get(k) + if (index !== undefined) { + deleted = true + if (this.size === 1) { + this.clear() + } else { + this.removeItemSize(index) + const v = this.valList[index] + if (this.isBackgroundFetch(v)) { + v.__abortController.abort(new Error('deleted')) + } else { + this.dispose(v, k, 'delete') + if (this.disposeAfter) { + this.disposed.push([v, k, 'delete']) + } + } + this.keyMap.delete(k) + this.keyList[index] = null + this.valList[index] = null + if (index === this.tail) { + this.tail = this.prev[index] + } else if (index === this.head) { + this.head = this.next[index] + } else { + this.next[this.prev[index]] = this.next[index] + this.prev[this.next[index]] = this.prev[index] + } + this.size-- + this.free.push(index) + } + } + } + if (this.disposed) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } + return deleted + } + + clear() { + for (const index of this.rindexes({ allowStale: true })) { + const v = this.valList[index] + if (this.isBackgroundFetch(v)) { + v.__abortController.abort(new Error('deleted')) + } else { + const k = this.keyList[index] + this.dispose(v, k, 'delete') + if (this.disposeAfter) { + this.disposed.push([v, k, 'delete']) + } + } + } + + this.keyMap.clear() + this.valList.fill(null) + this.keyList.fill(null) + if (this.ttls) { + this.ttls.fill(0) + this.starts.fill(0) + } + if (this.sizes) { + this.sizes.fill(0) + } + this.head = 0 + this.tail = 0 + this.initialFill = 1 + this.free.length = 0 + this.calculatedSize = 0 + this.size = 0 + if (this.disposed) { + while (this.disposed.length) { + this.disposeAfter(...this.disposed.shift()) + } + } + } + + get reset() { + deprecatedMethod('reset', 'clear') + return this.clear + } + + get length() { + deprecatedProperty('length', 'size') + return this.size + } + + static get AbortController() { + return AC + } + static get AbortSignal() { + return AS + } +} + +export default LRUCache diff --git a/node_modules/lru-cache/package.json b/node_modules/lru-cache/package.json index 366ec03dfbc52..fb90c93901b09 100644 --- a/node_modules/lru-cache/package.json +++ b/node_modules/lru-cache/package.json @@ -1,7 +1,7 @@ { "name": "lru-cache", "description": "A cache object that deletes the least-recently-used items.", - "version": "7.14.1", + "version": "7.16.2", "author": "Isaac Z. Schlueter ", "keywords": [ "mru", @@ -10,16 +10,36 @@ ], "sideEffects": false, "scripts": { - "build": "", + "build": "npm run prepare", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "prepare": "node ./scripts/transpile-to-esm.mjs", "size": "size-limit", "test": "tap", "snap": "tap", "preversion": "npm test", "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", - "format": "prettier --write ." + "format": "prettier --write .", + "typedoc": "typedoc ./index.d.ts" + }, + "type": "commonjs", + "main": "./index.js", + "module": "./index.mjs", + "types": "./index.d.ts", + "exports": { + ".": { + "import": { + "types": "./index.d.ts", + "default": "./index.mjs" + }, + "require": { + "types": "./index.d.ts", + "default": "./index.js" + } + }, + "./package.json": "./package.json" }, - "main": "index.js", "repository": "git://github.com/isaacs/node-lru-cache.git", "devDependencies": { "@size-limit/preset-small-lib": "^7.0.8", @@ -31,14 +51,16 @@ "eslint-config-prettier": "^8.5.0", "prettier": "^2.6.2", "size-limit": "^7.0.8", - "tap": "^16.0.1", + "tap": "^16.3.4", "ts-node": "^10.7.0", "tslib": "^2.4.0", + "typedoc": "^0.23.24", "typescript": "^4.6.4" }, "license": "ISC", "files": [ "index.js", + "index.mjs", "index.d.ts" ], "engines": { diff --git a/package-lock.json b/package-lock.json index 8ce9d061a6eeb..50b565a30cd13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -262,30 +262,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.20.14", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz", - "integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.21.0.tgz", + "integrity": "sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.20.12", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.12.tgz", - "integrity": "sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.0.tgz", + "integrity": "sha512-PuxUbxcW6ZYe656yL3EAhpy7qXKq0DmYsrJLpbB8XrsCP9Nm+XCg9XFMb5vIDliPD7+U/+M+QJlH17XOcB7eXA==", "dev": true, "dependencies": { - "@ampproject/remapping": "^2.1.0", + "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.20.7", + "@babel/generator": "^7.21.0", "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-module-transforms": "^7.20.11", - "@babel/helpers": "^7.20.7", - "@babel/parser": "^7.20.7", + "@babel/helper-module-transforms": "^7.21.0", + "@babel/helpers": "^7.21.0", + "@babel/parser": "^7.21.0", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.12", - "@babel/types": "^7.20.7", + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -310,13 +310,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.20.14", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.14.tgz", - "integrity": "sha512-AEmuXHdcD3A52HHXxaTmYlb8q/xMEhoRP67B3T4Oq7lbmSoqroMZzjnGj3+i1io3pdnF8iBYVu4Ilj+c4hBxYg==", + "version": "7.21.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.1.tgz", + "integrity": "sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA==", "dev": true, "dependencies": { - "@babel/types": "^7.20.7", + "@babel/types": "^7.21.0", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "engines": { @@ -390,13 +391,13 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", - "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", "dev": true, "dependencies": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -427,9 +428,9 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.20.11", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz", - "integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.0.tgz", + "integrity": "sha512-eD/JQ21IG2i1FraJnTMbUarAUkA7G988ofehG5MDCRXaUU91rEBJuCeSoou2Sk1y4RbLYXzqEg1QLwEmRU4qcQ==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", @@ -438,8 +439,8 @@ "@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-validator-identifier": "^7.19.1", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.10", - "@babel/types": "^7.20.7" + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -488,23 +489,23 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", - "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz", + "integrity": "sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.13.tgz", - "integrity": "sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.21.0.tgz", + "integrity": "sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==", "dev": true, "dependencies": { "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.13", - "@babel/types": "^7.20.7" + "@babel/traverse": "^7.21.0", + "@babel/types": "^7.21.0" }, "engines": { "node": ">=6.9.0" @@ -596,9 +597,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.20.15", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.15.tgz", - "integrity": "sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg==", + "version": "7.21.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.1.tgz", + "integrity": "sha512-JzhBFpkuhBNYUY7qs+wTzNmyCWUHEaAFpQQD2YfU1rPL38/L43Wvid0fFkiOCnHvsGncRZgEPyGnltABLcVDTg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -622,19 +623,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.13.tgz", - "integrity": "sha512-kMJXfF0T6DIS9E8cgdLCSAL+cuCK+YEZHWiLK0SXpTo8YRj5lpJu3CDNKiIBCne4m9hhTIqUg6SYTAI39tAiVQ==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.0.tgz", + "integrity": "sha512-Xdt2P1H4LKTO8ApPfnO1KmzYMFpp7D/EinoXzLYN/cHcBNrVCAkAtGUcXnHXrl/VGktureU6fkQrHSBE2URfoA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.20.7", + "@babel/generator": "^7.21.0", "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", + "@babel/helper-function-name": "^7.21.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.20.13", - "@babel/types": "^7.20.7", + "@babel/parser": "^7.21.0", + "@babel/types": "^7.21.0", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -652,9 +653,9 @@ } }, "node_modules/@babel/types": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz", - "integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.0.tgz", + "integrity": "sha512-uR7NWq2VNFnDi7EYqiRz2Jv/VQIu38tu64Zy8TX2nQFQ6etJ9V/Rr2msW8BS132mum2rL645qpDrLtAJtVpuow==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.19.4", @@ -682,16 +683,16 @@ } }, "node_modules/@commitlint/cli": { - "version": "17.4.3", - "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-17.4.3.tgz", - "integrity": "sha512-IPTS7AZuBHgD0gl24El8HwuDM9zJN9JLa5KmZUQoFD1BQeGGdzAYJOnAr85CeJWpTDok0BGHDL0+4odnH0iTyA==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-17.4.4.tgz", + "integrity": "sha512-HwKlD7CPVMVGTAeFZylVNy14Vm5POVY0WxPkZr7EXLC/os0LH/obs6z4HRvJtH/nHCMYBvUBQhGwnufKfTjd5g==", "dev": true, "dependencies": { - "@commitlint/format": "^17.4.0", - "@commitlint/lint": "^17.4.3", - "@commitlint/load": "^17.4.2", - "@commitlint/read": "^17.4.2", - "@commitlint/types": "^17.4.0", + "@commitlint/format": "^17.4.4", + "@commitlint/lint": "^17.4.4", + "@commitlint/load": "^17.4.4", + "@commitlint/read": "^17.4.4", + "@commitlint/types": "^17.4.4", "execa": "^5.0.0", "lodash.isfunction": "^3.0.9", "resolve-from": "5.0.0", @@ -706,9 +707,9 @@ } }, "node_modules/@commitlint/config-conventional": { - "version": "17.4.3", - "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-17.4.3.tgz", - "integrity": "sha512-8EsY2iDw74hCk3hIQSg7/E0R8/KtPjnFPZVwmmHxcjhZjkSykmxysefICPDnbI3xgxfov0zwL1WKDHM8zglJdw==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-17.4.4.tgz", + "integrity": "sha512-u6ztvxqzi6NuhrcEDR7a+z0yrh11elY66nRrQIpqsqW6sZmpxYkDLtpRH8jRML+mmxYQ8s4qqF06Q/IQx5aJeQ==", "dev": true, "dependencies": { "conventional-changelog-conventionalcommits": "^5.0.0" @@ -718,12 +719,12 @@ } }, "node_modules/@commitlint/config-validator": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-17.4.0.tgz", - "integrity": "sha512-Sa/+8KNpDXz4zT4bVbz2fpFjvgkPO6u2V2fP4TKgt6FjmOw2z3eEX859vtfeaTav/ukBw0/0jr+5ZTZp9zCBhA==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/config-validator/-/config-validator-17.4.4.tgz", + "integrity": "sha512-bi0+TstqMiqoBAQDvdEP4AFh0GaKyLFlPPEObgI29utoKEYoPQTvF0EYqIwYYLEoJYhj5GfMIhPHJkTJhagfeg==", "dev": true, "dependencies": { - "@commitlint/types": "^17.4.0", + "@commitlint/types": "^17.4.4", "ajv": "^8.11.0" }, "engines": { @@ -731,12 +732,12 @@ } }, "node_modules/@commitlint/ensure": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-17.4.0.tgz", - "integrity": "sha512-7oAxt25je0jeQ/E0O/M8L3ADb1Cvweu/5lc/kYF8g/kXatI0wxGE5La52onnAUAWeWlsuvBNar15WcrmDmr5Mw==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-17.4.4.tgz", + "integrity": "sha512-AHsFCNh8hbhJiuZ2qHv/m59W/GRE9UeOXbkOqxYMNNg9pJ7qELnFcwj5oYpa6vzTSHtPGKf3C2yUFNy1GGHq6g==", "dev": true, "dependencies": { - "@commitlint/types": "^17.4.0", + "@commitlint/types": "^17.4.4", "lodash.camelcase": "^4.3.0", "lodash.kebabcase": "^4.1.1", "lodash.snakecase": "^4.1.1", @@ -757,12 +758,12 @@ } }, "node_modules/@commitlint/format": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-17.4.0.tgz", - "integrity": "sha512-Z2bWAU5+f1YZh9W76c84J8iLIWIvvm+mzqogTz0Nsc1x6EHW0Z2gI38g5HAjB0r0I3ZjR15IDEJKhsxyblcyhA==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-17.4.4.tgz", + "integrity": "sha512-+IS7vpC4Gd/x+uyQPTAt3hXs5NxnkqAZ3aqrHd5Bx/R9skyCAWusNlNbw3InDbAK6j166D9asQM8fnmYIa+CXQ==", "dev": true, "dependencies": { - "@commitlint/types": "^17.4.0", + "@commitlint/types": "^17.4.4", "chalk": "^4.1.0" }, "engines": { @@ -770,12 +771,12 @@ } }, "node_modules/@commitlint/is-ignored": { - "version": "17.4.2", - "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-17.4.2.tgz", - "integrity": "sha512-1b2Y2qJ6n7bHG9K6h8S4lBGUl6kc7mMhJN9gy1SQfUZqe92ToDjUTtgNWb6LbzR1X8Cq4SEus4VU8Z/riEa94Q==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-17.4.4.tgz", + "integrity": "sha512-Y3eo1SFJ2JQDik4rWkBC4tlRIxlXEFrRWxcyrzb1PUT2k3kZ/XGNuCDfk/u0bU2/yS0tOA/mTjFsV+C4qyACHw==", "dev": true, "dependencies": { - "@commitlint/types": "^17.4.0", + "@commitlint/types": "^17.4.4", "semver": "7.3.8" }, "engines": { @@ -783,30 +784,30 @@ } }, "node_modules/@commitlint/lint": { - "version": "17.4.3", - "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-17.4.3.tgz", - "integrity": "sha512-GnPsqEYmXIB/MaBhRMzkiDJWyjuLrKad4xoxKO4N6Kc19iqjR4DPc/bl2dxeW9kUmtrAtefOzIEzJAevpA5y2w==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-17.4.4.tgz", + "integrity": "sha512-qgkCRRFjyhbMDWsti/5jRYVJkgYZj4r+ZmweZObnbYqPUl5UKLWMf9a/ZZisOI4JfiPmRktYRZ2JmqlSvg+ccw==", "dev": true, "dependencies": { - "@commitlint/is-ignored": "^17.4.2", - "@commitlint/parse": "^17.4.2", - "@commitlint/rules": "^17.4.3", - "@commitlint/types": "^17.4.0" + "@commitlint/is-ignored": "^17.4.4", + "@commitlint/parse": "^17.4.4", + "@commitlint/rules": "^17.4.4", + "@commitlint/types": "^17.4.4" }, "engines": { "node": ">=v14" } }, "node_modules/@commitlint/load": { - "version": "17.4.2", - "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-17.4.2.tgz", - "integrity": "sha512-Si++F85rJ9t4hw6JcOw1i2h0fdpdFQt0YKwjuK4bk9KhFjyFkRxvR3SB2dPaMs+EwWlDrDBGL+ygip1QD6gmPw==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-17.4.4.tgz", + "integrity": "sha512-z6uFIQ7wfKX5FGBe1AkOF4l/ShOQsaa1ml/nLMkbW7R/xF8galGS7Zh0yHvzVp/srtfS0brC+0bUfQfmpMPFVQ==", "dev": true, "dependencies": { - "@commitlint/config-validator": "^17.4.0", + "@commitlint/config-validator": "^17.4.4", "@commitlint/execute-rule": "^17.4.0", - "@commitlint/resolve-extends": "^17.4.0", - "@commitlint/types": "^17.4.0", + "@commitlint/resolve-extends": "^17.4.4", + "@commitlint/types": "^17.4.4", "@types/node": "*", "chalk": "^4.1.0", "cosmiconfig": "^8.0.0", @@ -832,12 +833,12 @@ } }, "node_modules/@commitlint/parse": { - "version": "17.4.2", - "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-17.4.2.tgz", - "integrity": "sha512-DK4EwqhxfXpyCA+UH8TBRIAXAfmmX4q9QRBz/2h9F9sI91yt6mltTrL6TKURMcjUVmgaB80wgS9QybNIyVBIJA==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-17.4.4.tgz", + "integrity": "sha512-EKzz4f49d3/OU0Fplog7nwz/lAfXMaDxtriidyGF9PtR+SRbgv4FhsfF310tKxs6EPj8Y+aWWuX3beN5s+yqGg==", "dev": true, "dependencies": { - "@commitlint/types": "^17.4.0", + "@commitlint/types": "^17.4.4", "conventional-changelog-angular": "^5.0.11", "conventional-commits-parser": "^3.2.2" }, @@ -846,13 +847,13 @@ } }, "node_modules/@commitlint/read": { - "version": "17.4.2", - "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-17.4.2.tgz", - "integrity": "sha512-hasYOdbhEg+W4hi0InmXHxtD/1favB4WdwyFxs1eOy/DvMw6+2IZBmATgGOlqhahsypk4kChhxjAFJAZ2F+JBg==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-17.4.4.tgz", + "integrity": "sha512-B2TvUMJKK+Svzs6eji23WXsRJ8PAD+orI44lVuVNsm5zmI7O8RSGJMvdEZEikiA4Vohfb+HevaPoWZ7PiFZ3zA==", "dev": true, "dependencies": { "@commitlint/top-level": "^17.4.0", - "@commitlint/types": "^17.4.0", + "@commitlint/types": "^17.4.4", "fs-extra": "^11.0.0", "git-raw-commits": "^2.0.0", "minimist": "^1.2.6" @@ -862,13 +863,13 @@ } }, "node_modules/@commitlint/resolve-extends": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-17.4.0.tgz", - "integrity": "sha512-3JsmwkrCzoK8sO22AzLBvNEvC1Pmdn/65RKXzEtQMy6oYMl0Snrq97a5bQQEFETF0VsvbtUuKttLqqgn99OXRQ==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-17.4.4.tgz", + "integrity": "sha512-znXr1S0Rr8adInptHw0JeLgumS11lWbk5xAWFVno+HUFVN45875kUtqjrI6AppmD3JI+4s0uZlqqlkepjJd99A==", "dev": true, "dependencies": { - "@commitlint/config-validator": "^17.4.0", - "@commitlint/types": "^17.4.0", + "@commitlint/config-validator": "^17.4.4", + "@commitlint/types": "^17.4.4", "import-fresh": "^3.0.0", "lodash.mergewith": "^4.6.2", "resolve-from": "^5.0.0", @@ -879,15 +880,15 @@ } }, "node_modules/@commitlint/rules": { - "version": "17.4.3", - "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-17.4.3.tgz", - "integrity": "sha512-xHReDfE3Z+O9p1sXeEhPRSk4FifBsC4EbXzvQ4aa0ykQe+n/iZDd4CrFC/Oiv2K9BU4ZnFHak30IbMLa4ks1Rw==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-17.4.4.tgz", + "integrity": "sha512-0tgvXnHi/mVcyR8Y8mjTFZIa/FEQXA4uEutXS/imH2v1UNkYDSEMsK/68wiXRpfW1euSgEdwRkvE1z23+yhNrQ==", "dev": true, "dependencies": { - "@commitlint/ensure": "^17.4.0", + "@commitlint/ensure": "^17.4.4", "@commitlint/message": "^17.4.2", "@commitlint/to-lines": "^17.4.0", - "@commitlint/types": "^17.4.0", + "@commitlint/types": "^17.4.4", "execa": "^5.0.0" }, "engines": { @@ -916,9 +917,9 @@ } }, "node_modules/@commitlint/types": { - "version": "17.4.0", - "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-17.4.0.tgz", - "integrity": "sha512-2NjAnq5IcxY9kXtUeO2Ac0aPpvkuOmwbH/BxIm36XXK5LtWFObWJWjXOA+kcaABMrthjWu6la+FUpyYFMHRvbA==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-17.4.4.tgz", + "integrity": "sha512-amRN8tRLYOsxRr6mTnGGGvB5EmW/4DDjLMgiwK3CCVEmN6Sr/6xePGEpWaspKkckILuUORCwe6VfDBw6uj4axQ==", "dev": true, "dependencies": { "chalk": "^4.1.0" @@ -2498,9 +2499,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.13.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", - "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==", + "version": "18.14.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.0.tgz", + "integrity": "sha512-5EWrvLmglK+imbCJY0+INViFWUHg1AHel1sq4ZVSfdcNqGy9Edv3UB9IIzzg+xPaUcAgZYcfVs2fBcwDeZzU0A==", "dev": true }, "node_modules/@types/normalize-package-data": { @@ -3189,9 +3190,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001452", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001452.tgz", - "integrity": "sha512-Lkp0vFjMkBB3GTpLR8zk4NwW5EdRdnitwYJHDOOKIU85x4ckYCPQ+9WlVvSVClHxVReefkUMtWZH2l9KGlD51w==", + "version": "1.0.30001457", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001457.tgz", + "integrity": "sha512-SDIV6bgE1aVbK6XyxdURbUE89zY7+k1BBBaOwYwkNCglXlel/E7mELiHC64HQ+W0xSKlqWhV9Wh7iHxUjMs4fA==", "dev": true, "funding": [ { @@ -4192,9 +4193,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.295", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.295.tgz", - "integrity": "sha512-lEO94zqf1bDA3aepxwnWoHUjA8sZ+2owgcSZjYQy0+uOSEclJX0VieZC+r+wLpSxUHRd6gG32znTWmr+5iGzFw==", + "version": "1.4.305", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.305.tgz", + "integrity": "sha512-WETy6tG0CT5gm1O+xCbyapWNsCcmIvrn4NHViIGYo2AT8FV2qUCXdaB+WqYxSv/vS5mFqhBYnfZAAkVArjBmUg==", "dev": true }, "node_modules/emoji-regex": { @@ -4927,9 +4928,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz", + "integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==", "dev": true, "peer": true, "dependencies": { @@ -5789,9 +5790,9 @@ } }, "node_modules/hast-util-from-parse5": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.1.tgz", - "integrity": "sha512-R6PoNcUs89ZxLJmMWsVbwSWuz95/9OriyQZ3e2ybwqGsRXzhA6gv49rgGmQvLbZuSNDv9fCg7vV7gXUsvtUFaA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz", + "integrity": "sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw==", "dev": true, "dependencies": { "@types/hast": "^2.0.0", @@ -7387,9 +7388,9 @@ } }, "node_modules/lru-cache": { - "version": "7.14.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.1.tgz", - "integrity": "sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==", + "version": "7.16.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.16.2.tgz", + "integrity": "sha512-t6D6OM05Y3f+61zNnXh/+0D69kAgJKVEWLuWL1r38CIHRPTWpNjwpR7S+nmiQlG5GmUB1BDiiMjU1Ihs4YBLlg==", "inBundle": true, "engines": { "node": ">=12" @@ -14852,9 +14853,9 @@ } }, "node_modules/yargs": { - "version": "17.6.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", - "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", "dev": true, "dependencies": { "cliui": "^8.0.1",