feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -1,3 +1,6 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { LRUCache } from 'lru-cache';
|
||||
import { posix, win32 } from 'node:path';
|
||||
import { Minipass } from 'minipass';
|
||||
@@ -190,8 +193,6 @@ export declare abstract class PathBase implements Dirent {
|
||||
/**
|
||||
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
||||
* this property refers to the *parent* path, not the path object itself.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
get path(): string;
|
||||
/**
|
||||
@@ -621,7 +622,7 @@ export declare abstract class PathScurryBase {
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(cwd: (URL | string) | undefined, pathImpl: typeof win32 | typeof posix, sep: string | RegExp, { nocase, childrenCacheSize, fs, }?: PathScurryOpts);
|
||||
constructor(cwd: string | URL | undefined, pathImpl: typeof win32 | typeof posix, sep: string | RegExp, { nocase, childrenCacheSize, fs, }?: PathScurryOpts);
|
||||
/**
|
||||
* Get the depth of a provided path, string, or the cwd
|
||||
*/
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-6
@@ -99,7 +99,7 @@ const entToType = (s) => s.isFile() ? IFREG
|
||||
: s.isFIFO() ? IFIFO
|
||||
: UNKNOWN;
|
||||
// normalize unicode path names
|
||||
const normalizeCache = new lru_cache_1.LRUCache({ max: 2 ** 12 });
|
||||
const normalizeCache = new Map();
|
||||
const normalize = (s) => {
|
||||
const c = normalizeCache.get(s);
|
||||
if (c)
|
||||
@@ -108,7 +108,7 @@ const normalize = (s) => {
|
||||
normalizeCache.set(s, n);
|
||||
return n;
|
||||
};
|
||||
const normalizeNocaseCache = new lru_cache_1.LRUCache({ max: 2 ** 12 });
|
||||
const normalizeNocaseCache = new Map();
|
||||
const normalizeNocase = (s) => {
|
||||
const c = normalizeNocaseCache.get(s);
|
||||
if (c)
|
||||
@@ -299,17 +299,13 @@ class PathBase {
|
||||
get parentPath() {
|
||||
return (this.parent || this).fullpath();
|
||||
}
|
||||
/* c8 ignore start */
|
||||
/**
|
||||
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
||||
* this property refers to the *parent* path, not the path object itself.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
get path() {
|
||||
return this.parentPath;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
/**
|
||||
* Do not create new Path objects directly. They should always be accessed
|
||||
* via the PathScurry class or other methods on the Path class.
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-3
@@ -1,3 +1,6 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import { LRUCache } from 'lru-cache';
|
||||
import { posix, win32 } from 'node:path';
|
||||
import { Minipass } from 'minipass';
|
||||
@@ -190,8 +193,6 @@ export declare abstract class PathBase implements Dirent {
|
||||
/**
|
||||
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
||||
* this property refers to the *parent* path, not the path object itself.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
get path(): string;
|
||||
/**
|
||||
@@ -621,7 +622,7 @@ export declare abstract class PathScurryBase {
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(cwd: (URL | string) | undefined, pathImpl: typeof win32 | typeof posix, sep: string | RegExp, { nocase, childrenCacheSize, fs, }?: PathScurryOpts);
|
||||
constructor(cwd: string | URL | undefined, pathImpl: typeof win32 | typeof posix, sep: string | RegExp, { nocase, childrenCacheSize, fs, }?: PathScurryOpts);
|
||||
/**
|
||||
* Get the depth of a provided path, string, or the cwd
|
||||
*/
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-6
@@ -73,7 +73,7 @@ const entToType = (s) => s.isFile() ? IFREG
|
||||
: s.isFIFO() ? IFIFO
|
||||
: UNKNOWN;
|
||||
// normalize unicode path names
|
||||
const normalizeCache = new LRUCache({ max: 2 ** 12 });
|
||||
const normalizeCache = new Map();
|
||||
const normalize = (s) => {
|
||||
const c = normalizeCache.get(s);
|
||||
if (c)
|
||||
@@ -82,7 +82,7 @@ const normalize = (s) => {
|
||||
normalizeCache.set(s, n);
|
||||
return n;
|
||||
};
|
||||
const normalizeNocaseCache = new LRUCache({ max: 2 ** 12 });
|
||||
const normalizeNocaseCache = new Map();
|
||||
const normalizeNocase = (s) => {
|
||||
const c = normalizeNocaseCache.get(s);
|
||||
if (c)
|
||||
@@ -271,17 +271,13 @@ export class PathBase {
|
||||
get parentPath() {
|
||||
return (this.parent || this).fullpath();
|
||||
}
|
||||
/* c8 ignore start */
|
||||
/**
|
||||
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
||||
* this property refers to the *parent* path, not the path object itself.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
get path() {
|
||||
return this.parentPath;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
/**
|
||||
* Do not create new Path objects directly. They should always be accessed
|
||||
* via the PathScurry class or other methods on the Path class.
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+17
-155
@@ -57,17 +57,10 @@ const options = {
|
||||
|
||||
// for use when you need to clean up something when objects
|
||||
// are evicted from the cache
|
||||
dispose: (value, key, reason) => {
|
||||
dispose: (value, key) => {
|
||||
freeFromMemoryOrWhatever(value)
|
||||
},
|
||||
|
||||
// for use when you need to know that an item is being inserted
|
||||
// note that this does NOT allow you to prevent the insertion,
|
||||
// it just allows you to know about it.
|
||||
onInsert: (value, key, reason) => {
|
||||
logInsertionOrWhatever(key, value)
|
||||
},
|
||||
|
||||
// how long to live in ms
|
||||
ttl: 1000 * 60 * 5,
|
||||
|
||||
@@ -79,7 +72,11 @@ const options = {
|
||||
|
||||
// async method to use for cache.fetch(), for
|
||||
// stale-while-revalidate type of behavior
|
||||
fetchMethod: async (key, staleValue, { options, signal, context }) => {},
|
||||
fetchMethod: async (
|
||||
key,
|
||||
staleValue,
|
||||
{ options, signal, context }
|
||||
) => {},
|
||||
}
|
||||
|
||||
const cache = new LRUCache(options)
|
||||
@@ -157,7 +154,7 @@ const cache = {
|
||||
}
|
||||
cache.timers.set(
|
||||
k,
|
||||
setTimeout(() => cache.delete(k), ttl),
|
||||
setTimeout(() => cache.delete(k), ttl)
|
||||
)
|
||||
cache.data.set(k, v)
|
||||
},
|
||||
@@ -215,95 +212,9 @@ const myGet = (key, value) => {
|
||||
}
|
||||
```
|
||||
|
||||
## Tracing and Observability
|
||||
|
||||
Most methods can accept a `status` option, which is an
|
||||
[`LRUCache.Status`](https://isaacs.github.io/node-lru-cache/interfaces/LRUCache.LRUCache.Status.html)
|
||||
object that will be decorated along the operation with
|
||||
indications about what was done and why.
|
||||
|
||||
Additionally, this library is instrumented using the
|
||||
[`node:diagnostics_channel`](https://nodejs.org/api/diagnostics_channel.html)
|
||||
module on Node and other platforms that support it. In order to
|
||||
get diagnostics metrics, listen on the
|
||||
`channel('lru-cache:metrics')`. To get Tracing Channel traces,
|
||||
subscribe to the `tracingChannel('lru-cache')`. The
|
||||
[`LRUCache.Status`](https://isaacs.github.io/node-lru-cache/interfaces/LRUCache.LRUCache.Status.html)
|
||||
objects will be provided as the message context to those channel
|
||||
listeners.
|
||||
|
||||
For example, you could do the following to get comprehensive
|
||||
information about every LRUCache instance in your application:
|
||||
|
||||
```ts
|
||||
import { tracingChannel, subscribe } from 'node:diagnostics_channel'
|
||||
|
||||
subscribe('lru-cache:metrics', (message, name) => {
|
||||
// name will always be 'lru-cache:metrics'
|
||||
// message will be the LRUCache.Status object for whatever
|
||||
// synchronous operation was performed.
|
||||
console.error('LRUCache Metrics', message)
|
||||
})
|
||||
|
||||
tracingChannel('lru-cache').subscribe({
|
||||
start: status => {
|
||||
// a traced operation is starting
|
||||
},
|
||||
asyncStart: status => {
|
||||
// an async traced operation is starting
|
||||
},
|
||||
asyncEnd: status => {
|
||||
// an async traced operation is ending
|
||||
}
|
||||
error: status => {
|
||||
// a traced operation failed
|
||||
},
|
||||
end: status => {
|
||||
// a traced operation is complete
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
The async `cache.fetch()` and `cache.forceFetch` methods are
|
||||
covered by `tracingChannels`. All the other operations are
|
||||
covered by the `lru-cache:metrics` channel, because they are
|
||||
strictly synchronous, and thus don't have an asynchronous
|
||||
lifecycle to track.
|
||||
|
||||
Note that using `status` objects or using
|
||||
`node:diagnostics_channel` listeners _will_ impose a modest
|
||||
performance penalty. Creating data objects is not ever free; do
|
||||
not believe anyone who tells you otherwise. But it is as small as
|
||||
possible.
|
||||
|
||||
### Platform Compatibility Caveat
|
||||
|
||||
Not all platforms support the `node:diagnostics_channel` module.
|
||||
Currently, this is only available in Node, Bun, and Deno, and
|
||||
some edge computing platforms that provide a Node compatibility
|
||||
layer.
|
||||
|
||||
To work around this, if you are loading in a non-Node
|
||||
environment, the package.json exports will direct your module
|
||||
loader to pull in a version that starts out with a dummy
|
||||
implementation, then does a conditional dynamic `import` of the
|
||||
`node:diagnostics_channel` module, and then swaps out those
|
||||
dummy objects with the real thing if it succeeds. This means that
|
||||
cache metrics and tracing channels started in the first load-time
|
||||
tick of your application will _not_ be covered, except in
|
||||
environments that load using the `require` import
|
||||
condition, or both the `node` and `esm` import conditions
|
||||
together.
|
||||
|
||||
Top-level await _could_ be used to remove this caveat, but that
|
||||
feature is dead on arrival, unfortunately. See
|
||||
[#397](https://github.com/isaacs/node-lru-cache/issues/397) and
|
||||
[#398](https://github.com/isaacs/node-lru-cache/issues/398) for
|
||||
more details.
|
||||
|
||||
## Performance
|
||||
|
||||
As of April 2026, version 11 of this library is one of the most
|
||||
As of January 2022, version 7 of this library is one of the most
|
||||
performant LRU cache implementations in JavaScript.
|
||||
|
||||
Benchmarks can be extremely difficult to get right. In
|
||||
@@ -358,9 +269,9 @@ If performance matters to you:
|
||||
LRUCache](https://yomguithereal.github.io/mnemonist/lru-cache)
|
||||
which uses an Object as its data store.
|
||||
|
||||
2. Failing that, if you can use short non-numeric strings (ie,
|
||||
less than 256 characters) as your keys, and you do not need
|
||||
any of the other features of this library, use [mnemonist's
|
||||
2. Failing that, if at all possible, use short non-numeric
|
||||
strings (ie, less than 256 characters) as your keys, and use
|
||||
[mnemonist's
|
||||
LRUCache](https://yomguithereal.github.io/mnemonist/lru-cache).
|
||||
|
||||
3. If the types of your keys will be anything else, especially
|
||||
@@ -372,63 +283,14 @@ If performance matters to you:
|
||||
(like asynchronous fetching, a variety of TTL staleness
|
||||
options, and so on), then [mnemonist's
|
||||
LRUMap](https://yomguithereal.github.io/mnemonist/lru-map) is
|
||||
also a very good option, and just slightly faster than this
|
||||
module (since it does considerably less).
|
||||
a very good option, and just slightly faster than this module
|
||||
(since it does considerably less).
|
||||
|
||||
4. Do not use a `dispose` function, size tracking, or especially
|
||||
ttl behavior or observability features, unless absolutely
|
||||
needed. These features are convenient, and necessary in some
|
||||
use cases, and every attempt has been made to make the
|
||||
performance impact minimal, but it isn't nothing.
|
||||
|
||||
## Testing
|
||||
|
||||
When writing tests that involve TTL-related functionality, note
|
||||
that this module creates an internal reference to the global
|
||||
`performance` or `Date` objects at import time. If you import it
|
||||
statically at the top level, those references cannot be mocked or
|
||||
overridden in your test environment.
|
||||
|
||||
To avoid this, dynamically import the package within your tests
|
||||
so that the references are captured after your mocks are applied.
|
||||
For example:
|
||||
|
||||
```ts
|
||||
// ❌ Not recommended
|
||||
import { LRUCache } from 'lru-cache'
|
||||
// mocking timers, e.g. jest.useFakeTimers()
|
||||
|
||||
// ✅ Recommended for TTL tests
|
||||
// mocking timers, e.g. jest.useFakeTimers()
|
||||
const { LRUCache } = await import('lru-cache')
|
||||
```
|
||||
|
||||
This ensures that your mocked timers or time sources are
|
||||
respected when testing TTL behavior.
|
||||
|
||||
Additionally, you can pass in a `perf` option when creating your
|
||||
LRUCache instance. This option accepts any object with a `now`
|
||||
method that returns a number.
|
||||
|
||||
For example, this would be a very bare-bones time-mocking system
|
||||
you could use in your tests, without any particular test
|
||||
framework:
|
||||
|
||||
```ts
|
||||
import { LRUCache } from 'lru-cache'
|
||||
|
||||
let myClockTime = 0
|
||||
|
||||
const cache = new LRUCache<string>({
|
||||
max: 10,
|
||||
ttl: 1000,
|
||||
perf: {
|
||||
now: () => myClockTime,
|
||||
},
|
||||
})
|
||||
|
||||
// run tests, updating myClockTime as needed
|
||||
```
|
||||
ttl behavior, unless absolutely needed. These features are
|
||||
convenient, and necessary in some use cases, and every attempt
|
||||
has been made to make the performance impact minimal, but it
|
||||
isn't nothing.
|
||||
|
||||
## Breaking Changes in Version 7
|
||||
|
||||
|
||||
+33
-156
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
* @module LRUCache
|
||||
*/
|
||||
import type { Perf } from './perf.js';
|
||||
export type { Perf } from './perf.js';
|
||||
declare const TYPE: unique symbol;
|
||||
export type PosInt = number & {
|
||||
[TYPE]: 'Positive Integer';
|
||||
@@ -77,20 +75,6 @@ export declare namespace LRUCache {
|
||||
* {@link OptionsBase.disposeAfter} options.
|
||||
*/
|
||||
type Disposer<K, V> = (value: V, key: K, reason: DisposeReason) => void;
|
||||
/**
|
||||
* The reason why an item was added to the cache, passed
|
||||
* to the {@link Inserter} methods.
|
||||
*
|
||||
* - `add`: the item was not found in the cache, and was added
|
||||
* - `update`: the item was in the cache, with the same value provided
|
||||
* - `replace`: the item was in the cache, and replaced
|
||||
*/
|
||||
type InsertReason = 'add' | 'update' | 'replace';
|
||||
/**
|
||||
* A method called upon item insertion, passed as the
|
||||
* {@link OptionsBase.insert}
|
||||
*/
|
||||
type Inserter<K, V> = (value: V, key: K, reason: InsertReason) => void;
|
||||
/**
|
||||
* A function that returns the effective calculated size
|
||||
* of an entry in the cache.
|
||||
@@ -118,16 +102,8 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* The `status` option should be a plain JavaScript object. The following
|
||||
* fields will be set on it appropriately, depending on the situation.
|
||||
*
|
||||
* These objects are also the context objects passed to listeners on the
|
||||
* `lru-cache:metrics` diagnostic channel, and the `lru-cache` tracing
|
||||
* channels, in platforms that support them.
|
||||
*/
|
||||
interface Status<K, V, FC = unknown> {
|
||||
/**
|
||||
* The operation being performed
|
||||
*/
|
||||
op?: 'get' | 'set' | 'memo' | 'fetch' | 'delete' | 'has' | 'peek';
|
||||
interface Status<V> {
|
||||
/**
|
||||
* The status of a set() operation.
|
||||
*
|
||||
@@ -136,37 +112,7 @@ export declare namespace LRUCache {
|
||||
* - replace: the item was in the cache, and replaced
|
||||
* - miss: the item was not added to the cache for some reason
|
||||
*/
|
||||
set?: 'add' | 'update' | 'replace' | 'miss' | 'deleted';
|
||||
/**
|
||||
* The status of a delete() operation.
|
||||
*/
|
||||
delete?: LRUCache.DisposeReason;
|
||||
/**
|
||||
* The result of a peek() operation
|
||||
*
|
||||
* - hit: the item was found and returned
|
||||
* - stale: the item is in the cache, but past its ttl and not returned
|
||||
* - miss: item not in the cache
|
||||
*/
|
||||
peek?: 'hit' | 'miss' | 'stale';
|
||||
/**
|
||||
* The status of a memo() operation.
|
||||
*
|
||||
* - 'hit': the item was found in the cache and returned
|
||||
* - 'miss': the `memoMethod` function was called
|
||||
*/
|
||||
memo?: 'hit' | 'miss';
|
||||
/**
|
||||
* The `context` option provided to a memo or fetch operation
|
||||
*
|
||||
* In practice, of course, this will be the same type as the `FC`
|
||||
* fetch context param used to instantiate the LRUCache, but the
|
||||
* convolutions of threading that through would get quite complicated,
|
||||
* and preclude forcing/forbidding the passing of a `context` param
|
||||
* where it is/isn't expected, which is more valuable for error
|
||||
* prevention.
|
||||
*/
|
||||
context?: unknown;
|
||||
set?: 'add' | 'update' | 'replace' | 'miss';
|
||||
/**
|
||||
* the ttl stored for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
@@ -197,15 +143,8 @@ export declare namespace LRUCache {
|
||||
*/
|
||||
maxEntrySizeExceeded?: true;
|
||||
/**
|
||||
* The key that was set or retrieved
|
||||
*/
|
||||
key?: K;
|
||||
/**
|
||||
* The value that was set
|
||||
*/
|
||||
value?: V;
|
||||
/**
|
||||
* The old value, specified in the case of `set:'replace'`
|
||||
* The old value, specified in the case of `set:'update'` or
|
||||
* `set:'replace'`
|
||||
*/
|
||||
oldValue?: V;
|
||||
/**
|
||||
@@ -231,10 +170,6 @@ export declare namespace LRUCache {
|
||||
* {@link FetchOptions.forceRefresh} was specified.
|
||||
*/
|
||||
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh';
|
||||
/**
|
||||
* `forceRefresh` option was used for either a fetch or memo operation
|
||||
*/
|
||||
forceRefresh?: boolean;
|
||||
/**
|
||||
* The {@link OptionsBase.fetchMethod} was called
|
||||
*/
|
||||
@@ -256,7 +191,7 @@ export declare namespace LRUCache {
|
||||
fetchAborted?: true;
|
||||
/**
|
||||
* The abort signal received was ignored, and the fetch was allowed to
|
||||
* continue in the background.
|
||||
* continue.
|
||||
*/
|
||||
fetchAbortIgnored?: true;
|
||||
/**
|
||||
@@ -272,27 +207,15 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* - fetching: The item is currently being fetched. If a previous value
|
||||
* is present and allowed, that will be returned.
|
||||
* - stale: The item is in the cache, and is stale. If it was returned,
|
||||
* then the `returnedStale` flag will be set.
|
||||
* - stale-fetching: The value is being fetched in the background, but is
|
||||
* currently stale. If the stale value was returned, then the
|
||||
* `returnedStale` flag will be set.
|
||||
* - stale: The item is in the cache, and is stale.
|
||||
* - hit: the item is in the cache
|
||||
* - miss: the item is not in the cache
|
||||
*/
|
||||
get?: 'stale' | 'hit' | 'miss' | 'fetching' | 'stale-fetching';
|
||||
get?: 'stale' | 'hit' | 'miss';
|
||||
/**
|
||||
* A fetch or get operation returned a stale value.
|
||||
*/
|
||||
returnedStale?: true;
|
||||
/**
|
||||
* A tracingChannel trace was started for this operation
|
||||
*/
|
||||
trace?: boolean;
|
||||
/**
|
||||
* A reference to the cache instance associated with this operation
|
||||
*/
|
||||
cache?: LRUCache<K & {}, V & {}, FC>;
|
||||
}
|
||||
/**
|
||||
* options which override the options set in the LRUCache constructor
|
||||
@@ -310,7 +233,7 @@ export declare namespace LRUCache {
|
||||
* the fetchMethod is called.
|
||||
*/
|
||||
interface FetcherFetchOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
size?: Size;
|
||||
}
|
||||
/**
|
||||
@@ -332,7 +255,7 @@ export declare namespace LRUCache {
|
||||
*/
|
||||
context?: FC;
|
||||
signal?: AbortSignal;
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options provided to {@link LRUCache#fetch} when the FC type is something
|
||||
@@ -345,7 +268,7 @@ export declare namespace LRUCache {
|
||||
* Options provided to {@link LRUCache#fetch} when the FC type is
|
||||
* `undefined` or `void`
|
||||
*/
|
||||
interface FetchOptionsNoContext<K, V, FC extends undefined | void = undefined> extends FetchOptions<K, V, FC> {
|
||||
interface FetchOptionsNoContext<K, V> extends FetchOptions<K, V, undefined> {
|
||||
context?: undefined;
|
||||
}
|
||||
interface MemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
|
||||
@@ -363,7 +286,7 @@ export declare namespace LRUCache {
|
||||
* be required.
|
||||
*/
|
||||
context?: FC;
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options provided to {@link LRUCache#memo} when the FC type is something
|
||||
@@ -376,7 +299,7 @@ export declare namespace LRUCache {
|
||||
* Options provided to {@link LRUCache#memo} when the FC type is
|
||||
* `undefined` or `void`
|
||||
*/
|
||||
interface MemoOptionsNoContext<K, V, FC extends undefined | void = undefined> extends MemoOptions<K, V, FC> {
|
||||
interface MemoOptionsNoContext<K, V> extends MemoOptions<K, V, undefined> {
|
||||
context?: undefined;
|
||||
}
|
||||
/**
|
||||
@@ -397,7 +320,7 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* This is the union of {@link GetOptions} and {@link SetOptions}, plus
|
||||
* {@link MemoOptions.forceRefresh}, and
|
||||
* {@link MemoOptions.context}
|
||||
* {@link MemoerOptions.context}
|
||||
*
|
||||
* Any of these may be modified in the {@link OptionsBase.memoMethod}
|
||||
* function, but the {@link GetOptions} fields will of course have no
|
||||
@@ -405,7 +328,7 @@ export declare namespace LRUCache {
|
||||
* the memoMethod is called.
|
||||
*/
|
||||
interface MemoizerMemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
size?: Size;
|
||||
start?: Milliseconds;
|
||||
}
|
||||
@@ -413,19 +336,18 @@ export declare namespace LRUCache {
|
||||
* Options that may be passed to the {@link LRUCache#has} method.
|
||||
*/
|
||||
interface HasOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'updateAgeOnHas'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options that may be passed to the {@link LRUCache#get} method.
|
||||
*/
|
||||
interface GetOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options that may be passed to the {@link LRUCache#peek} method.
|
||||
*/
|
||||
interface PeekOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale'> {
|
||||
status?: Status<K, V, FC>;
|
||||
}
|
||||
/**
|
||||
* Options that may be passed to the {@link LRUCache#set} method.
|
||||
@@ -446,7 +368,7 @@ export declare namespace LRUCache {
|
||||
* method is in use.
|
||||
*/
|
||||
start?: Milliseconds;
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* The type signature for the {@link OptionsBase.fetchMethod} option.
|
||||
@@ -633,17 +555,6 @@ export declare namespace LRUCache {
|
||||
* `cache.clear()`, or `cache.set(key, undefined)`.
|
||||
*/
|
||||
dispose?: Disposer<K, V>;
|
||||
/**
|
||||
* Function that is called when new items are inserted into the cache,
|
||||
* as `onInsert(value, key, reason)`.
|
||||
*
|
||||
* This can be useful if you need to perform actions when an item is
|
||||
* added, such as logging or tracking insertions.
|
||||
*
|
||||
* Unlike some other options, this may _not_ be overridden by passing
|
||||
* an option to `set()`, for performance and consistency reasons.
|
||||
*/
|
||||
onInsert?: Inserter<K, V>;
|
||||
/**
|
||||
* The same as {@link OptionsBase.dispose}, but called *after* the entry
|
||||
* is completely removed and the cache is once again in a clean state.
|
||||
@@ -699,20 +610,6 @@ export declare namespace LRUCache {
|
||||
* though for most cases, only minimally.
|
||||
*/
|
||||
maxSize?: Size;
|
||||
/**
|
||||
* The effective size for background fetch promises.
|
||||
*
|
||||
* This has no effect unless `maxSize` and `sizeCalculation` are used,
|
||||
* and a {@link LRUCache.OptionsBase.fetchMethod} is provided to
|
||||
* support {@link LRUCache#fetch}.
|
||||
*
|
||||
* If a stale value is present in the cache, then the effective size of
|
||||
* the background fetch is the size of the stale item it will eventually
|
||||
* replace. If not, then this value is used as its effective size.
|
||||
*
|
||||
* @default 1
|
||||
*/
|
||||
backgroundFetchSize?: number;
|
||||
/**
|
||||
* The maximum allowed size for any single item in the cache.
|
||||
*
|
||||
@@ -899,15 +796,6 @@ export declare namespace LRUCache {
|
||||
* call to {@link LRUCache#fetch}.
|
||||
*/
|
||||
ignoreFetchAbort?: boolean;
|
||||
/**
|
||||
* In some cases, you may want to swap out the performance/Date object
|
||||
* used for TTL tracking. This should almost certainly NOT be done in
|
||||
* production environments!
|
||||
*
|
||||
* This value defaults to `global.performance` if it has a `now()` method,
|
||||
* or the `global.Date` object otherwise.
|
||||
*/
|
||||
perf?: Perf;
|
||||
}
|
||||
interface OptionsMaxLimit<K, V, FC> extends OptionsBase<K, V, FC> {
|
||||
max: Count;
|
||||
@@ -949,12 +837,8 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* Changing any of these will alter the defaults for subsequent method calls.
|
||||
*/
|
||||
export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
export declare class LRUCache<K extends {}, V extends {}, FC = unknown> implements Map<K, V> {
|
||||
#private;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.perf}
|
||||
*/
|
||||
get perf(): Perf;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.ttl}
|
||||
*/
|
||||
@@ -1015,8 +899,6 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* {@link LRUCache.OptionsBase.ignoreFetchAbort}
|
||||
*/
|
||||
ignoreFetchAbort: boolean;
|
||||
/** {@link LRUCache.OptionsBase.backgroundFetchSize} */
|
||||
backgroundFetchSize: number;
|
||||
/**
|
||||
* Do not call this method unless you need to inspect the
|
||||
* inner workings of the cache. If anything returned by this
|
||||
@@ -1029,7 +911,6 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
static unsafeExposeInternals<K extends {}, V extends {}, FC extends unknown = unknown>(c: LRUCache<K, V, FC>): {
|
||||
starts: ZeroArray | undefined;
|
||||
ttls: ZeroArray | undefined;
|
||||
autopurgeTimers: (NodeJS.Timeout | undefined)[] | undefined;
|
||||
sizes: ZeroArray | undefined;
|
||||
keyMap: Map<K, number>;
|
||||
keyList: (K | undefined)[];
|
||||
@@ -1039,8 +920,8 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
readonly head: Index;
|
||||
readonly tail: Index;
|
||||
free: StackLike;
|
||||
isBackgroundFetch: (p: unknown) => p is BackgroundFetch<V>;
|
||||
backgroundFetch: (k: K, index: number | undefined, options: LRUCache.FetchOptions<K, V, FC>, context: unknown) => BackgroundFetch<V>;
|
||||
isBackgroundFetch: (p: any) => boolean;
|
||||
backgroundFetch: (k: K, index: number | undefined, options: LRUCache.FetchOptions<K, V, FC>, context: any) => BackgroundFetch<V>;
|
||||
moveToTail: (index: number) => void;
|
||||
indexes: (options?: {
|
||||
allowStale: boolean;
|
||||
@@ -1075,10 +956,6 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
||||
*/
|
||||
get dispose(): LRUCache.Disposer<K, V> | undefined;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.onInsert} (read-only)
|
||||
*/
|
||||
get onInsert(): LRUCache.Inserter<K, V> | undefined;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
||||
*/
|
||||
@@ -1100,7 +977,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* Return a generator yielding `[key, value]` pairs,
|
||||
* in order from least recently used to most recently used.
|
||||
*/
|
||||
rentries(): Generator<(K | V)[], void, unknown>;
|
||||
rentries(): Generator<(K | V | BackgroundFetch<V> | undefined)[], void, unknown>;
|
||||
/**
|
||||
* Return a generator yielding the keys in the cache,
|
||||
* in order from most recently used to least recently used.
|
||||
@@ -1124,7 +1001,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* Return a generator yielding the values in the cache,
|
||||
* in order from least recently used to most recently used.
|
||||
*/
|
||||
rvalues(): Generator<V | undefined, void, unknown>;
|
||||
rvalues(): Generator<V | BackgroundFetch<V> | undefined, void, unknown>;
|
||||
/**
|
||||
* Iterating over the cache itself yields the same results as
|
||||
* {@link LRUCache.entries}
|
||||
@@ -1152,12 +1029,12 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
*
|
||||
* Does not update age or recenty of use, or iterate over stale values.
|
||||
*/
|
||||
forEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => unknown, thisp?: unknown): void;
|
||||
forEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
|
||||
/**
|
||||
* The same as {@link LRUCache.forEach} but items are iterated over in
|
||||
* reverse order. (ie, less recently used items are iterated over first.)
|
||||
*/
|
||||
rforEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => unknown, thisp?: unknown): void;
|
||||
rforEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
|
||||
/**
|
||||
* Delete any stale entries. Returns true if anything was removed,
|
||||
* false otherwise.
|
||||
@@ -1178,7 +1055,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
info(key: K): LRUCache.Entry<V> | undefined;
|
||||
/**
|
||||
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
||||
* passed to {@link LRUCache#load}.
|
||||
* passed to {@link LRLUCache#load}.
|
||||
*
|
||||
* The `start` fields are calculated relative to a portable `Date.now()`
|
||||
* timestamp, even if `performance.now()` is available.
|
||||
@@ -1230,7 +1107,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* If the value is `undefined`, then this is an alias for
|
||||
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
||||
*/
|
||||
set(k: K, v: V | undefined, setOptions?: LRUCache.SetOptions<K, V, FC>): this;
|
||||
set(k: K, v: V | BackgroundFetch<V> | undefined, setOptions?: LRUCache.SetOptions<K, V, FC>): this;
|
||||
/**
|
||||
* Evict the least recently used item, returning its value or
|
||||
* `undefined` if cache is empty.
|
||||
@@ -1346,23 +1223,23 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* the same time, because they're both waiting on the same
|
||||
* underlying fetchMethod response.
|
||||
*/
|
||||
fetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<undefined | V>;
|
||||
fetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : never): Promise<undefined | V>;
|
||||
fetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<undefined | V>;
|
||||
fetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<undefined | V>;
|
||||
/**
|
||||
* In some cases, `cache.fetch()` may resolve to `undefined`, either because
|
||||
* a {@link LRUCache.OptionsBase#fetchMethod} was not provided (turning
|
||||
* `cache.fetch(k)` into just an async wrapper around `cache.get(k)`) or
|
||||
* because `ignoreFetchAbort` was specified (either to the constructor or
|
||||
* in the {@link LRUCache.FetchOptions}). Also, the
|
||||
* {@link LRUCache.OptionsBase.fetchMethod} may return `undefined` or `void`, making
|
||||
* {@link OptionsBase.fetchMethod} may return `undefined` or `void`, making
|
||||
* the test even more complicated.
|
||||
*
|
||||
* Because inferring the cases where `undefined` might be returned are so
|
||||
* cumbersome, but testing for `undefined` can also be annoying, this method
|
||||
* can be used, which will reject if `this.fetch()` resolves to undefined.
|
||||
*/
|
||||
forceFetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<V>;
|
||||
forceFetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : never): Promise<V>;
|
||||
forceFetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<V>;
|
||||
forceFetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<V>;
|
||||
/**
|
||||
* If the key is found in the cache, then this is equivalent to
|
||||
* {@link LRUCache#get}. If not, in the cache, then calculate the value using
|
||||
@@ -1377,8 +1254,8 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* relevant in the course of fetching the data. It is only relevant for the
|
||||
* course of a single `memo()` operation, and discarded afterwards.
|
||||
*/
|
||||
memo(k: K, memoOptions: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V, FC> : LRUCache.MemoOptionsWithContext<K, V, FC>): V;
|
||||
memo(k: unknown extends FC ? K : FC extends undefined | void ? K : never, memoOptions?: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V, FC> : never): V;
|
||||
memo(k: K, memoOptions: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : LRUCache.MemoOptionsWithContext<K, V, FC>): V;
|
||||
memo(k: unknown extends FC ? K : FC extends undefined | void ? K : never, memoOptions?: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : never): V;
|
||||
/**
|
||||
* Return a value from the cache. Will update the recency of the cache
|
||||
* entry found.
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+244
-424
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
File diff suppressed because one or more lines are too long
+33
-156
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
* @module LRUCache
|
||||
*/
|
||||
import type { Perf } from './perf.js';
|
||||
export type { Perf } from './perf.js';
|
||||
declare const TYPE: unique symbol;
|
||||
export type PosInt = number & {
|
||||
[TYPE]: 'Positive Integer';
|
||||
@@ -77,20 +75,6 @@ export declare namespace LRUCache {
|
||||
* {@link OptionsBase.disposeAfter} options.
|
||||
*/
|
||||
type Disposer<K, V> = (value: V, key: K, reason: DisposeReason) => void;
|
||||
/**
|
||||
* The reason why an item was added to the cache, passed
|
||||
* to the {@link Inserter} methods.
|
||||
*
|
||||
* - `add`: the item was not found in the cache, and was added
|
||||
* - `update`: the item was in the cache, with the same value provided
|
||||
* - `replace`: the item was in the cache, and replaced
|
||||
*/
|
||||
type InsertReason = 'add' | 'update' | 'replace';
|
||||
/**
|
||||
* A method called upon item insertion, passed as the
|
||||
* {@link OptionsBase.insert}
|
||||
*/
|
||||
type Inserter<K, V> = (value: V, key: K, reason: InsertReason) => void;
|
||||
/**
|
||||
* A function that returns the effective calculated size
|
||||
* of an entry in the cache.
|
||||
@@ -118,16 +102,8 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* The `status` option should be a plain JavaScript object. The following
|
||||
* fields will be set on it appropriately, depending on the situation.
|
||||
*
|
||||
* These objects are also the context objects passed to listeners on the
|
||||
* `lru-cache:metrics` diagnostic channel, and the `lru-cache` tracing
|
||||
* channels, in platforms that support them.
|
||||
*/
|
||||
interface Status<K, V, FC = unknown> {
|
||||
/**
|
||||
* The operation being performed
|
||||
*/
|
||||
op?: 'get' | 'set' | 'memo' | 'fetch' | 'delete' | 'has' | 'peek';
|
||||
interface Status<V> {
|
||||
/**
|
||||
* The status of a set() operation.
|
||||
*
|
||||
@@ -136,37 +112,7 @@ export declare namespace LRUCache {
|
||||
* - replace: the item was in the cache, and replaced
|
||||
* - miss: the item was not added to the cache for some reason
|
||||
*/
|
||||
set?: 'add' | 'update' | 'replace' | 'miss' | 'deleted';
|
||||
/**
|
||||
* The status of a delete() operation.
|
||||
*/
|
||||
delete?: LRUCache.DisposeReason;
|
||||
/**
|
||||
* The result of a peek() operation
|
||||
*
|
||||
* - hit: the item was found and returned
|
||||
* - stale: the item is in the cache, but past its ttl and not returned
|
||||
* - miss: item not in the cache
|
||||
*/
|
||||
peek?: 'hit' | 'miss' | 'stale';
|
||||
/**
|
||||
* The status of a memo() operation.
|
||||
*
|
||||
* - 'hit': the item was found in the cache and returned
|
||||
* - 'miss': the `memoMethod` function was called
|
||||
*/
|
||||
memo?: 'hit' | 'miss';
|
||||
/**
|
||||
* The `context` option provided to a memo or fetch operation
|
||||
*
|
||||
* In practice, of course, this will be the same type as the `FC`
|
||||
* fetch context param used to instantiate the LRUCache, but the
|
||||
* convolutions of threading that through would get quite complicated,
|
||||
* and preclude forcing/forbidding the passing of a `context` param
|
||||
* where it is/isn't expected, which is more valuable for error
|
||||
* prevention.
|
||||
*/
|
||||
context?: unknown;
|
||||
set?: 'add' | 'update' | 'replace' | 'miss';
|
||||
/**
|
||||
* the ttl stored for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
@@ -197,15 +143,8 @@ export declare namespace LRUCache {
|
||||
*/
|
||||
maxEntrySizeExceeded?: true;
|
||||
/**
|
||||
* The key that was set or retrieved
|
||||
*/
|
||||
key?: K;
|
||||
/**
|
||||
* The value that was set
|
||||
*/
|
||||
value?: V;
|
||||
/**
|
||||
* The old value, specified in the case of `set:'replace'`
|
||||
* The old value, specified in the case of `set:'update'` or
|
||||
* `set:'replace'`
|
||||
*/
|
||||
oldValue?: V;
|
||||
/**
|
||||
@@ -231,10 +170,6 @@ export declare namespace LRUCache {
|
||||
* {@link FetchOptions.forceRefresh} was specified.
|
||||
*/
|
||||
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh';
|
||||
/**
|
||||
* `forceRefresh` option was used for either a fetch or memo operation
|
||||
*/
|
||||
forceRefresh?: boolean;
|
||||
/**
|
||||
* The {@link OptionsBase.fetchMethod} was called
|
||||
*/
|
||||
@@ -256,7 +191,7 @@ export declare namespace LRUCache {
|
||||
fetchAborted?: true;
|
||||
/**
|
||||
* The abort signal received was ignored, and the fetch was allowed to
|
||||
* continue in the background.
|
||||
* continue.
|
||||
*/
|
||||
fetchAbortIgnored?: true;
|
||||
/**
|
||||
@@ -272,27 +207,15 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* - fetching: The item is currently being fetched. If a previous value
|
||||
* is present and allowed, that will be returned.
|
||||
* - stale: The item is in the cache, and is stale. If it was returned,
|
||||
* then the `returnedStale` flag will be set.
|
||||
* - stale-fetching: The value is being fetched in the background, but is
|
||||
* currently stale. If the stale value was returned, then the
|
||||
* `returnedStale` flag will be set.
|
||||
* - stale: The item is in the cache, and is stale.
|
||||
* - hit: the item is in the cache
|
||||
* - miss: the item is not in the cache
|
||||
*/
|
||||
get?: 'stale' | 'hit' | 'miss' | 'fetching' | 'stale-fetching';
|
||||
get?: 'stale' | 'hit' | 'miss';
|
||||
/**
|
||||
* A fetch or get operation returned a stale value.
|
||||
*/
|
||||
returnedStale?: true;
|
||||
/**
|
||||
* A tracingChannel trace was started for this operation
|
||||
*/
|
||||
trace?: boolean;
|
||||
/**
|
||||
* A reference to the cache instance associated with this operation
|
||||
*/
|
||||
cache?: LRUCache<K & {}, V & {}, FC>;
|
||||
}
|
||||
/**
|
||||
* options which override the options set in the LRUCache constructor
|
||||
@@ -310,7 +233,7 @@ export declare namespace LRUCache {
|
||||
* the fetchMethod is called.
|
||||
*/
|
||||
interface FetcherFetchOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
size?: Size;
|
||||
}
|
||||
/**
|
||||
@@ -332,7 +255,7 @@ export declare namespace LRUCache {
|
||||
*/
|
||||
context?: FC;
|
||||
signal?: AbortSignal;
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options provided to {@link LRUCache#fetch} when the FC type is something
|
||||
@@ -345,7 +268,7 @@ export declare namespace LRUCache {
|
||||
* Options provided to {@link LRUCache#fetch} when the FC type is
|
||||
* `undefined` or `void`
|
||||
*/
|
||||
interface FetchOptionsNoContext<K, V, FC extends undefined | void = undefined> extends FetchOptions<K, V, FC> {
|
||||
interface FetchOptionsNoContext<K, V> extends FetchOptions<K, V, undefined> {
|
||||
context?: undefined;
|
||||
}
|
||||
interface MemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL' | 'noDeleteOnFetchRejection' | 'allowStaleOnFetchRejection' | 'ignoreFetchAbort' | 'allowStaleOnFetchAbort'> {
|
||||
@@ -363,7 +286,7 @@ export declare namespace LRUCache {
|
||||
* be required.
|
||||
*/
|
||||
context?: FC;
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options provided to {@link LRUCache#memo} when the FC type is something
|
||||
@@ -376,7 +299,7 @@ export declare namespace LRUCache {
|
||||
* Options provided to {@link LRUCache#memo} when the FC type is
|
||||
* `undefined` or `void`
|
||||
*/
|
||||
interface MemoOptionsNoContext<K, V, FC extends undefined | void = undefined> extends MemoOptions<K, V, FC> {
|
||||
interface MemoOptionsNoContext<K, V> extends MemoOptions<K, V, undefined> {
|
||||
context?: undefined;
|
||||
}
|
||||
/**
|
||||
@@ -397,7 +320,7 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* This is the union of {@link GetOptions} and {@link SetOptions}, plus
|
||||
* {@link MemoOptions.forceRefresh}, and
|
||||
* {@link MemoOptions.context}
|
||||
* {@link MemoerOptions.context}
|
||||
*
|
||||
* Any of these may be modified in the {@link OptionsBase.memoMethod}
|
||||
* function, but the {@link GetOptions} fields will of course have no
|
||||
@@ -405,7 +328,7 @@ export declare namespace LRUCache {
|
||||
* the memoMethod is called.
|
||||
*/
|
||||
interface MemoizerMemoOptions<K, V, FC = unknown> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet' | 'sizeCalculation' | 'ttl' | 'noDisposeOnSet' | 'noUpdateTTL'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
size?: Size;
|
||||
start?: Milliseconds;
|
||||
}
|
||||
@@ -413,19 +336,18 @@ export declare namespace LRUCache {
|
||||
* Options that may be passed to the {@link LRUCache#has} method.
|
||||
*/
|
||||
interface HasOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'updateAgeOnHas'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options that may be passed to the {@link LRUCache#get} method.
|
||||
*/
|
||||
interface GetOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale' | 'updateAgeOnGet' | 'noDeleteOnStaleGet'> {
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* Options that may be passed to the {@link LRUCache#peek} method.
|
||||
*/
|
||||
interface PeekOptions<K, V, FC> extends Pick<OptionsBase<K, V, FC>, 'allowStale'> {
|
||||
status?: Status<K, V, FC>;
|
||||
}
|
||||
/**
|
||||
* Options that may be passed to the {@link LRUCache#set} method.
|
||||
@@ -446,7 +368,7 @@ export declare namespace LRUCache {
|
||||
* method is in use.
|
||||
*/
|
||||
start?: Milliseconds;
|
||||
status?: Status<K, V, FC>;
|
||||
status?: Status<V>;
|
||||
}
|
||||
/**
|
||||
* The type signature for the {@link OptionsBase.fetchMethod} option.
|
||||
@@ -633,17 +555,6 @@ export declare namespace LRUCache {
|
||||
* `cache.clear()`, or `cache.set(key, undefined)`.
|
||||
*/
|
||||
dispose?: Disposer<K, V>;
|
||||
/**
|
||||
* Function that is called when new items are inserted into the cache,
|
||||
* as `onInsert(value, key, reason)`.
|
||||
*
|
||||
* This can be useful if you need to perform actions when an item is
|
||||
* added, such as logging or tracking insertions.
|
||||
*
|
||||
* Unlike some other options, this may _not_ be overridden by passing
|
||||
* an option to `set()`, for performance and consistency reasons.
|
||||
*/
|
||||
onInsert?: Inserter<K, V>;
|
||||
/**
|
||||
* The same as {@link OptionsBase.dispose}, but called *after* the entry
|
||||
* is completely removed and the cache is once again in a clean state.
|
||||
@@ -699,20 +610,6 @@ export declare namespace LRUCache {
|
||||
* though for most cases, only minimally.
|
||||
*/
|
||||
maxSize?: Size;
|
||||
/**
|
||||
* The effective size for background fetch promises.
|
||||
*
|
||||
* This has no effect unless `maxSize` and `sizeCalculation` are used,
|
||||
* and a {@link LRUCache.OptionsBase.fetchMethod} is provided to
|
||||
* support {@link LRUCache#fetch}.
|
||||
*
|
||||
* If a stale value is present in the cache, then the effective size of
|
||||
* the background fetch is the size of the stale item it will eventually
|
||||
* replace. If not, then this value is used as its effective size.
|
||||
*
|
||||
* @default 1
|
||||
*/
|
||||
backgroundFetchSize?: number;
|
||||
/**
|
||||
* The maximum allowed size for any single item in the cache.
|
||||
*
|
||||
@@ -899,15 +796,6 @@ export declare namespace LRUCache {
|
||||
* call to {@link LRUCache#fetch}.
|
||||
*/
|
||||
ignoreFetchAbort?: boolean;
|
||||
/**
|
||||
* In some cases, you may want to swap out the performance/Date object
|
||||
* used for TTL tracking. This should almost certainly NOT be done in
|
||||
* production environments!
|
||||
*
|
||||
* This value defaults to `global.performance` if it has a `now()` method,
|
||||
* or the `global.Date` object otherwise.
|
||||
*/
|
||||
perf?: Perf;
|
||||
}
|
||||
interface OptionsMaxLimit<K, V, FC> extends OptionsBase<K, V, FC> {
|
||||
max: Count;
|
||||
@@ -949,12 +837,8 @@ export declare namespace LRUCache {
|
||||
*
|
||||
* Changing any of these will alter the defaults for subsequent method calls.
|
||||
*/
|
||||
export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
export declare class LRUCache<K extends {}, V extends {}, FC = unknown> implements Map<K, V> {
|
||||
#private;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.perf}
|
||||
*/
|
||||
get perf(): Perf;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.ttl}
|
||||
*/
|
||||
@@ -1015,8 +899,6 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* {@link LRUCache.OptionsBase.ignoreFetchAbort}
|
||||
*/
|
||||
ignoreFetchAbort: boolean;
|
||||
/** {@link LRUCache.OptionsBase.backgroundFetchSize} */
|
||||
backgroundFetchSize: number;
|
||||
/**
|
||||
* Do not call this method unless you need to inspect the
|
||||
* inner workings of the cache. If anything returned by this
|
||||
@@ -1029,7 +911,6 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
static unsafeExposeInternals<K extends {}, V extends {}, FC extends unknown = unknown>(c: LRUCache<K, V, FC>): {
|
||||
starts: ZeroArray | undefined;
|
||||
ttls: ZeroArray | undefined;
|
||||
autopurgeTimers: (NodeJS.Timeout | undefined)[] | undefined;
|
||||
sizes: ZeroArray | undefined;
|
||||
keyMap: Map<K, number>;
|
||||
keyList: (K | undefined)[];
|
||||
@@ -1039,8 +920,8 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
readonly head: Index;
|
||||
readonly tail: Index;
|
||||
free: StackLike;
|
||||
isBackgroundFetch: (p: unknown) => p is BackgroundFetch<V>;
|
||||
backgroundFetch: (k: K, index: number | undefined, options: LRUCache.FetchOptions<K, V, FC>, context: unknown) => BackgroundFetch<V>;
|
||||
isBackgroundFetch: (p: any) => boolean;
|
||||
backgroundFetch: (k: K, index: number | undefined, options: LRUCache.FetchOptions<K, V, FC>, context: any) => BackgroundFetch<V>;
|
||||
moveToTail: (index: number) => void;
|
||||
indexes: (options?: {
|
||||
allowStale: boolean;
|
||||
@@ -1075,10 +956,6 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
||||
*/
|
||||
get dispose(): LRUCache.Disposer<K, V> | undefined;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.onInsert} (read-only)
|
||||
*/
|
||||
get onInsert(): LRUCache.Inserter<K, V> | undefined;
|
||||
/**
|
||||
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
||||
*/
|
||||
@@ -1100,7 +977,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* Return a generator yielding `[key, value]` pairs,
|
||||
* in order from least recently used to most recently used.
|
||||
*/
|
||||
rentries(): Generator<(K | V)[], void, unknown>;
|
||||
rentries(): Generator<(K | V | BackgroundFetch<V> | undefined)[], void, unknown>;
|
||||
/**
|
||||
* Return a generator yielding the keys in the cache,
|
||||
* in order from most recently used to least recently used.
|
||||
@@ -1124,7 +1001,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* Return a generator yielding the values in the cache,
|
||||
* in order from least recently used to most recently used.
|
||||
*/
|
||||
rvalues(): Generator<V | undefined, void, unknown>;
|
||||
rvalues(): Generator<V | BackgroundFetch<V> | undefined, void, unknown>;
|
||||
/**
|
||||
* Iterating over the cache itself yields the same results as
|
||||
* {@link LRUCache.entries}
|
||||
@@ -1152,12 +1029,12 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
*
|
||||
* Does not update age or recenty of use, or iterate over stale values.
|
||||
*/
|
||||
forEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => unknown, thisp?: unknown): void;
|
||||
forEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
|
||||
/**
|
||||
* The same as {@link LRUCache.forEach} but items are iterated over in
|
||||
* reverse order. (ie, less recently used items are iterated over first.)
|
||||
*/
|
||||
rforEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => unknown, thisp?: unknown): void;
|
||||
rforEach(fn: (v: V, k: K, self: LRUCache<K, V, FC>) => any, thisp?: any): void;
|
||||
/**
|
||||
* Delete any stale entries. Returns true if anything was removed,
|
||||
* false otherwise.
|
||||
@@ -1178,7 +1055,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
info(key: K): LRUCache.Entry<V> | undefined;
|
||||
/**
|
||||
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
||||
* passed to {@link LRUCache#load}.
|
||||
* passed to {@link LRLUCache#load}.
|
||||
*
|
||||
* The `start` fields are calculated relative to a portable `Date.now()`
|
||||
* timestamp, even if `performance.now()` is available.
|
||||
@@ -1230,7 +1107,7 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* If the value is `undefined`, then this is an alias for
|
||||
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
||||
*/
|
||||
set(k: K, v: V | undefined, setOptions?: LRUCache.SetOptions<K, V, FC>): this;
|
||||
set(k: K, v: V | BackgroundFetch<V> | undefined, setOptions?: LRUCache.SetOptions<K, V, FC>): this;
|
||||
/**
|
||||
* Evict the least recently used item, returning its value or
|
||||
* `undefined` if cache is empty.
|
||||
@@ -1346,23 +1223,23 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* the same time, because they're both waiting on the same
|
||||
* underlying fetchMethod response.
|
||||
*/
|
||||
fetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<undefined | V>;
|
||||
fetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : never): Promise<undefined | V>;
|
||||
fetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<undefined | V>;
|
||||
fetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<undefined | V>;
|
||||
/**
|
||||
* In some cases, `cache.fetch()` may resolve to `undefined`, either because
|
||||
* a {@link LRUCache.OptionsBase#fetchMethod} was not provided (turning
|
||||
* `cache.fetch(k)` into just an async wrapper around `cache.get(k)`) or
|
||||
* because `ignoreFetchAbort` was specified (either to the constructor or
|
||||
* in the {@link LRUCache.FetchOptions}). Also, the
|
||||
* {@link LRUCache.OptionsBase.fetchMethod} may return `undefined` or `void`, making
|
||||
* {@link OptionsBase.fetchMethod} may return `undefined` or `void`, making
|
||||
* the test even more complicated.
|
||||
*
|
||||
* Because inferring the cases where `undefined` might be returned are so
|
||||
* cumbersome, but testing for `undefined` can also be annoying, this method
|
||||
* can be used, which will reject if `this.fetch()` resolves to undefined.
|
||||
*/
|
||||
forceFetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<V>;
|
||||
forceFetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V, FC> : never): Promise<V>;
|
||||
forceFetch(k: K, fetchOptions: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : LRUCache.FetchOptionsWithContext<K, V, FC>): Promise<V>;
|
||||
forceFetch(k: unknown extends FC ? K : FC extends undefined | void ? K : never, fetchOptions?: unknown extends FC ? LRUCache.FetchOptions<K, V, FC> : FC extends undefined | void ? LRUCache.FetchOptionsNoContext<K, V> : never): Promise<V>;
|
||||
/**
|
||||
* If the key is found in the cache, then this is equivalent to
|
||||
* {@link LRUCache#get}. If not, in the cache, then calculate the value using
|
||||
@@ -1377,8 +1254,8 @@ export declare class LRUCache<K extends {}, V extends {}, FC = unknown> {
|
||||
* relevant in the course of fetching the data. It is only relevant for the
|
||||
* course of a single `memo()` operation, and discarded afterwards.
|
||||
*/
|
||||
memo(k: K, memoOptions: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V, FC> : LRUCache.MemoOptionsWithContext<K, V, FC>): V;
|
||||
memo(k: unknown extends FC ? K : FC extends undefined | void ? K : never, memoOptions?: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V, FC> : never): V;
|
||||
memo(k: K, memoOptions: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : LRUCache.MemoOptionsWithContext<K, V, FC>): V;
|
||||
memo(k: unknown extends FC ? K : FC extends undefined | void ? K : never, memoOptions?: unknown extends FC ? LRUCache.MemoOptions<K, V, FC> : FC extends undefined | void ? LRUCache.MemoOptionsNoContext<K, V> : never): V;
|
||||
/**
|
||||
* Return a value from the cache. Will update the recency of the cache
|
||||
* entry found.
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+244
-424
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
File diff suppressed because one or more lines are too long
+44
-82
@@ -1,7 +1,10 @@
|
||||
{
|
||||
"name": "lru-cache",
|
||||
"publishConfig": {
|
||||
"tag": "legacy-v10"
|
||||
},
|
||||
"description": "A cache object that deletes the least-recently-used items.",
|
||||
"version": "11.5.0",
|
||||
"version": "10.4.3",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me>",
|
||||
"keywords": [
|
||||
"mru",
|
||||
@@ -11,7 +14,7 @@
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"build": "npm run prepare",
|
||||
"prepare": "tshy && bash scripts/build.sh",
|
||||
"prepare": "tshy && bash fixup.sh",
|
||||
"pretest": "npm run prepare",
|
||||
"presnap": "npm run prepare",
|
||||
"test": "tap",
|
||||
@@ -25,130 +28,89 @@
|
||||
"prebenchmark": "npm run prepare",
|
||||
"benchmark": "make -C benchmark",
|
||||
"preprofile": "npm run prepare",
|
||||
"profile": "make -C benchmark profile",
|
||||
"lint": "oxlint --fix src test",
|
||||
"postsnap": "npm run lint",
|
||||
"postlint": "npm run format"
|
||||
"profile": "make -C benchmark profile"
|
||||
},
|
||||
"main": "./dist/commonjs/index.min.js",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"tshy": {
|
||||
"esmDialects": [
|
||||
"browser",
|
||||
"node"
|
||||
],
|
||||
"commonjsDialects": [
|
||||
"browser",
|
||||
"node"
|
||||
],
|
||||
"exports": {
|
||||
"./raw": "./src/index.ts",
|
||||
".": {
|
||||
".": "./src/index.ts",
|
||||
"./min": {
|
||||
"import": {
|
||||
"browser": {
|
||||
"types": "./dist/esm/browser/index.d.ts",
|
||||
"default": "./dist/esm/browser/index.min.js"
|
||||
},
|
||||
"node": {
|
||||
"types": "./dist/esm/node/index.d.ts",
|
||||
"default": "./dist/esm/node/index.min.js"
|
||||
},
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.min.js"
|
||||
},
|
||||
"require": {
|
||||
"browser": {
|
||||
"types": "./dist/commonjs/browser/index.d.ts",
|
||||
"default": "./dist/commonjs/browser/index.min.js"
|
||||
},
|
||||
"node": {
|
||||
"types": "./dist/commonjs/node/index.d.ts",
|
||||
"default": "./dist/commonjs/node/index.min.js"
|
||||
},
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.min.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"selfLink": false
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/isaacs/node-lru-cache.git"
|
||||
"url": "git://github.com/isaacs/node-lru-cache.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.2.5",
|
||||
"@types/tap": "^15.0.6",
|
||||
"benchmark": "^2.1.4",
|
||||
"esbuild": "^0.28.0",
|
||||
"esbuild": "^0.17.11",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"marked": "^4.2.12",
|
||||
"mkdirp": "^3.0.1",
|
||||
"oxlint": "^1.65.0",
|
||||
"oxlint-tsgolint": "^0.22.1",
|
||||
"prettier": "^3.8.3",
|
||||
"tap": "^21.7.4",
|
||||
"tshy": "^4.1.2",
|
||||
"typedoc": "^0.28.19"
|
||||
"mkdirp": "^2.1.5",
|
||||
"prettier": "^2.6.2",
|
||||
"tap": "^20.0.3",
|
||||
"tshy": "^2.0.0",
|
||||
"tslib": "^2.4.0",
|
||||
"typedoc": "^0.25.3",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"license": "BlueOak-1.0.0",
|
||||
"license": "ISC",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": "20 || >=22"
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 70,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
},
|
||||
"tap": {
|
||||
"node-arg": [
|
||||
"--expose-gc"
|
||||
],
|
||||
"plugin": [
|
||||
"@tapjs/clock"
|
||||
]
|
||||
},
|
||||
"exports": {
|
||||
"./raw": {
|
||||
".": {
|
||||
"import": {
|
||||
"browser": {
|
||||
"types": "./dist/esm/browser/index.d.ts",
|
||||
"default": "./dist/esm/browser/index.js"
|
||||
},
|
||||
"node": {
|
||||
"types": "./dist/esm/node/index.d.ts",
|
||||
"default": "./dist/esm/node/index.js"
|
||||
},
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"browser": {
|
||||
"types": "./dist/commonjs/browser/index.d.ts",
|
||||
"default": "./dist/commonjs/browser/index.js"
|
||||
},
|
||||
"node": {
|
||||
"types": "./dist/commonjs/node/index.d.ts",
|
||||
"default": "./dist/commonjs/node/index.js"
|
||||
},
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
},
|
||||
".": {
|
||||
"./min": {
|
||||
"import": {
|
||||
"browser": {
|
||||
"types": "./dist/esm/browser/index.d.ts",
|
||||
"default": "./dist/esm/browser/index.min.js"
|
||||
},
|
||||
"node": {
|
||||
"types": "./dist/esm/node/index.d.ts",
|
||||
"default": "./dist/esm/node/index.min.js"
|
||||
},
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.min.js"
|
||||
},
|
||||
"require": {
|
||||
"browser": {
|
||||
"types": "./dist/commonjs/browser/index.d.ts",
|
||||
"default": "./dist/commonjs/browser/index.min.js"
|
||||
},
|
||||
"node": {
|
||||
"types": "./dist/commonjs/node/index.d.ts",
|
||||
"default": "./dist/commonjs/node/index.min.js"
|
||||
},
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.min.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./dist/esm/index.min.js"
|
||||
"module": "./dist/esm/index.js"
|
||||
}
|
||||
|
||||
+31
-14
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "path-scurry",
|
||||
"version": "2.0.2",
|
||||
"version": "1.11.1",
|
||||
"description": "walk paths fast and efficiently",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
@@ -31,23 +31,41 @@
|
||||
"presnap": "npm run prepare",
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"format": "prettier --write . --log-level warn",
|
||||
"format": "prettier --write . --loglevel warn",
|
||||
"typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts",
|
||||
"bench": "bash ./scripts/bench.sh"
|
||||
},
|
||||
"prettier": {
|
||||
"experimentalTernaries": true,
|
||||
"semi": false,
|
||||
"printWidth": 75,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nodelib/fs.walk": "^3.0.1",
|
||||
"@types/node": "^25.3.0",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
"@types/node": "^20.12.11",
|
||||
"c8": "^7.12.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"mkdirp": "^3.0.0",
|
||||
"prettier": "^3.3.2",
|
||||
"rimraf": "^6.1.3",
|
||||
"tap": "^21.6.1",
|
||||
"prettier": "^3.2.5",
|
||||
"rimraf": "^5.0.1",
|
||||
"tap": "^18.7.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"tshy": "^3.3.2",
|
||||
"typedoc": "^0.28.17"
|
||||
"tshy": "^1.14.0",
|
||||
"typedoc": "^0.25.12",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"tap": {
|
||||
"typecheck": true
|
||||
},
|
||||
"engines": {
|
||||
"node": "18 || 20 || >=22"
|
||||
"node": ">=16 || 14 >=14.18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
@@ -57,8 +75,8 @@
|
||||
"url": "git+https://github.com/isaacs/path-scurry"
|
||||
},
|
||||
"dependencies": {
|
||||
"lru-cache": "^11.0.0",
|
||||
"minipass": "^7.1.2"
|
||||
"lru-cache": "^10.2.0",
|
||||
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
|
||||
},
|
||||
"tshy": {
|
||||
"selfLink": false,
|
||||
@@ -67,6 +85,5 @@
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"module": "./dist/esm/index.js"
|
||||
"types": "./dist/commonjs/index.d.ts"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user