On this page

Source Code: lib/util/WeakTupleMap.js#L43

Stores values by tuple keys while using WeakMap for object elements so the cache can release entries when those objects are collected.

new WeakTupleMap(): WeakTupleMap<K, V>
Returns:WeakTupleMap<K, V>
weakTupleMap.cachedProvide(compute, thisArg, args): V
Source Code: lib/util/WeakTupleMap.js#L144
Attributes
compute:(thisArg: any, args: K) => V
thisArg:any
args:any[]
Returns:V

Memoizes compute(thisArg, ...args) under the tuple key [compute, ...args], computing it on a miss. Equivalent to provide(compute, ...args, () => compute(thisArg, ...args)) but without allocating that closure (or an extra rest array) on every call — ModuleGraph#cached runs this on hot paths where most calls hit the cache and the closure would be pure waste.

weakTupleMap.clear(): void
Source Code: lib/util/WeakTupleMap.js#L175

Clears the stored value and all strong and weak child maps from this node.

weakTupleMap.delete(...args?): void
Source Code: lib/util/WeakTupleMap.js#L161
Attributes
...args:any[]

Removes the value stored for the tuple key without pruning the trie.

weakTupleMap.get(...args?): V | undefined
Source Code: lib/util/WeakTupleMap.js#L104
Attributes
...args:any[]
Returns:V | undefined

Returns the value stored for the exact tuple key, if any.

weakTupleMap.has(...args?): boolean
Source Code: lib/util/WeakTupleMap.js#L89
Attributes
...args:any[]
Returns:boolean

Checks whether the exact tuple key has a stored value.

weakTupleMap.provide(...args?): V
Source Code: lib/util/WeakTupleMap.js#L120
Attributes
...args:[K, ...((args: K) => V)[]]
Returns:V

Returns an existing value for the tuple or computes, stores, and returns a new one when the tuple is missing.

weakTupleMap.set(...args?): void
Source Code: lib/util/WeakTupleMap.js#L75
Attributes
...args:[K, ...V[]]

Stores a value at the node identified by the provided tuple key.