index
Classes
Diff
Defined in: graph/src/diff.ts:25
A Diff object is a representation of a set of changes from one graph to another, typically from the actual graph as it is reified on disk, to an intended ideal graph.
The naming convention can get a bit confusing here, because it's a set of directed changes from one set of directed objects to another.
Within the context the Diff object, from is the Graph we're coming from,
and to is the Graph we're trying to create.
Constructors
new Diff()
new Diff(from, to): DiffDefined in: graph/src/diff.ts:66
Parameters
Returns
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
edges | object | undefined | Collection of nodes to add and delete |
edges.add | Set<Edge> | undefined | Edges in the to graph that are not found in the from graph |
edges.delete | Set<Edge> | undefined | Edges in the from graph that are not found in the to graph |
from | Graph | undefined | - |
hadOptionalFailures | boolean | false | If changes need to be made later for failures of optional nodes, set this flag so that we know to call graph.gc() at the appropriate time. |
nodes | object | undefined | Collection of nodes to add and delete |
nodes.add | Set<Node> | undefined | Nodes in the to graph that are not in the from graph |
nodes.delete | Set<Node> | undefined | Nodes in the from graph that are not in the to graph |
optionalOnly | boolean | true | True if every added node/edge is confined to an optional subtree |
projectRoot | string | undefined | - |
to | Graph | undefined | - |
Accessors
[toStringTag]
Get Signature
get toStringTag: stringDefined in: graph/src/diff.ts:62
Returns
string
Methods
[kCustomInspect]()
kCustomInspect: stringDefined in: graph/src/diff.ts:117
Parameters
| Parameter | Type |
|---|---|
_ | number |
options? | InspectOptions |
Returns
string
hasChanges()
hasChanges(): booleanDefined in: graph/src/diff.ts:157
Returns
boolean
toJSON()
toJSON(): objectDefined in: graph/src/diff.ts:166
Returns
object
| Name | Type |
|---|---|
edges | object |
edges.add | object[] |
edges.delete | object[] |
nodes | object |
nodes.add | object[] |
nodes.delete | object[] |
Edge
Defined in: graph/src/edge.ts:10
Implements
Constructors
new Edge()
new Edge(
type,
spec,
from,
to?): EdgeDefined in: graph/src/edge.ts:48
Parameters
| Parameter | Type |
|---|---|
type | DependencyTypeShort |
spec | Spec |
from | Node |
to? | Node |
Returns
Properties
| Property | Type | Description |
|---|---|---|
from | Node | The Node this Edge is connecting from, this is usually the dependent. |
spec | Spec | The defined spec value for to as parsed from the dependent metadata. |
to? | Node | The node this Edge is connecting to, this is usually a direct dependency. |
type | DependencyTypeShort | What type of dependency relationship from and to nodes have. |
Accessors
[toStringTag]
Get Signature
get toStringTag: stringDefined in: graph/src/edge.ts:11
Returns
string
dev
Get Signature
get dev(): booleanDefined in: graph/src/edge.ts:70
This edge was defined as part of a devDependencies in package.json
Returns
boolean
name
Get Signature
get name(): stringDefined in: graph/src/edge.ts:63
The name of the dependency to as defined in the dependent metadata.
Returns
string
Implementation of
EdgeLike.nameoptional
Get Signature
get optional(): booleanDefined in: graph/src/edge.ts:74
Returns
boolean
Implementation of
EdgeLike.optionalpeer
Get Signature
get peer(): booleanDefined in: graph/src/edge.ts:78
Returns
boolean
Implementation of
EdgeLike.peerpeerOptional
Get Signature
get peerOptional(): booleanDefined in: graph/src/edge.ts:82
Returns
boolean
Methods
[kCustomInspect]()
kCustomInspect: stringDefined in: graph/src/edge.ts:15
Parameters
| Parameter | Type |
|---|---|
_ | number |
options | InspectOptions |
Returns
string
toJSON()
toJSON(): objectDefined in: graph/src/edge.ts:97
Returns
object
| Name | Type |
|---|---|
from | DepID |
spec | string |
to | undefined | DepID |
type | DependencyTypeShort |
toString()
toString(): stringDefined in: graph/src/edge.ts:106
Returns a string representation of an object.
Returns
string
valid()
valid(): booleanDefined in: graph/src/edge.ts:86
Returns
boolean
Graph
Defined in: graph/src/graph.ts:89
Implements
Constructors
new Graph()
new Graph(options): GraphDefined in: graph/src/graph.ts:207
Parameters
| Parameter | Type |
|---|---|
options | GraphOptions |
Returns
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
currentPeerContextIndex | number | 0 | Tracks the current peer context index. |
edges | Set<Edge> | undefined | A set of all edges in this graph. |
extraneousDependencies | Set<Edge> | undefined | A set of extraneous dependencies found when building the graph. |
importers | Set<Node> | undefined | A set of importer nodes in this graph. |
lockedResolutions? | Map<string, DepID> | undefined | Lockfile edge targets captured immediately before resetEdges(). Used by the ideal builder to reuse locked resolutions across a rebuild. |
lockfileStale | boolean | false | Whether the lockfile on disk no longer matches this graph even though no node changed, e.g. an importer edge spec was rewritten to the value saved to package.json, or the config options the graph was built with differ from the ones stored in the lockfile. Reify saves the lockfiles from its no-diff early return when set. |
mainImporter | Node | undefined | The Node that represents the project root package.json. |
manifests | ManifestInventory | undefined | An inventory with all manifests related to an install. |
monorepo? | Monorepo | undefined | A Monorepo instance, used for managing workspaces. |
mutations | number | 0 | Count of structural writes: nodes placed or removed, edges reset, created or re-pointed. Never reset; callers snapshot it and compare, so the ideal builder can tell whether a rebuild touched anything the peer identities depend on. |
nodes | Map<DepID, Node> | undefined | Map registered dep ids to the node that represent them in the graph. |
nodesByName | Map<string, Set<Node>> | undefined | Map of nodes by their name |
optionsChanged | boolean | false | Whether the options used to create this graph differ from the options stored in the lockfile it was loaded from. When true, the ideal builder must reset edges and rebuild the graph. |
optionsChanges | OptionsChange[] | [] | The individual differences behind optionsChanged, in the order they are reported to the user. Empty when nothing changed. |
peerContextForkCache | Map<string, PeerContext> | undefined | Cache of forked peer contexts so identical fork operations can reuse previously created contexts instead of duplicating them. Key format is internal and constructed in ideal/peers.ts. |
peerContexts | PeerContext[] | undefined | The peer context sets used to resolve peer dependencies within this graph. |
projectRoot | string | undefined | The root of the project this graph represents |
resolutions | Map<string, Node> | undefined | Cached resolutions for spec lookups |
resolutionsReverse | Map<Node, Set<string>> | undefined | Reverse map of resolutions |
Accessors
[toStringTag]
Get Signature
get toStringTag: stringDefined in: graph/src/graph.ts:90
Returns
string
Methods
[kCustomInspect]()
kCustomInspect: stringDefined in: graph/src/graph.ts:742
Parameters
| Parameter | Type |
|---|---|
_ | number |
options | InspectOptions |
Returns
string
addEdge()
addEdge(
type,
spec,
from,
to?): EdgeDefined in: graph/src/graph.ts:379
Create a new edge between two nodes of the graph in case both exist, in case the destination node does not exists, then a dangling edge, pointing to nothing will be created to represent that missing dependency.
Parameters
| Parameter | Type |
|---|---|
type | DependencySaveType |
spec | Spec |
from | NodeLike |
to? | NodeLike |
Returns
Implementation of
GraphLike.addEdgeaddNode()
addNode(
id?,
manifest?,
spec?,
name?,
version?): NodeDefined in: graph/src/graph.ts:475
Create a new node in the graph.
Parameters
| Parameter | Type |
|---|---|
id? | DepID |
manifest? | Override<Manifest, NormalizedFields> |
spec? | Spec |
name? | string |
version? | string |
Returns
Implementation of
GraphLike.addNodefindResolution()
findResolution(
spec,
fromNode,
extra): undefined | NodeDefined in: graph/src/graph.ts:436
Find an existing node to satisfy a dependency
Parameters
Returns
undefined | Node
gc()
gc(): Map<DepID, Node>Defined in: graph/src/graph.ts:304
Delete all nodes and edges that are unreachable from the importers. The collection of deleted nodes is returned.
Marking is O(N+E) and always runs, but when nothing is unreachable
and every reachable node is registered under its own id, nodes is
left alone — no rebuild, no sort, and an empty map is returned.
Only call when it is known that some unreachable nodes may have been
created, for example when deleting the unneeded subgraph when an
optional node fails to resolve/install.
Returns
nextPeerContextIndex()
nextPeerContextIndex(): numberDefined in: graph/src/graph.ts:289
Get the next peer context index.
Returns
number
placePackage()
placePackage(
fromNode,
depType,
spec,
manifest?,
id?,
extra?): undefined | NodeDefined in: graph/src/graph.ts:515
Place a new package into the graph representation, creating the new edges and possibly new nodes that are to be expected when traversing the graph in a top-down direction, e.g: from importers to leafs.
For different uses that are not a direct top-down traversal of the graph
consider using addNode() and addEdge() instead.
Parameters
| Parameter | Type |
|---|---|
fromNode | Node |
depType | DependencySaveType |
spec | Spec |
manifest? | Override<Manifest, NormalizedFields> |
id? | DepID |
extra? | string |
Returns
undefined | Node
removeEdgeResolution()
removeEdgeResolution(edge, extra): voidDefined in: graph/src/graph.ts:690
Removes the resolved node of a given edge.
Parameters
| Parameter | Type | Default value |
|---|---|---|
edge | Edge | undefined |
extra | string | '' |
Returns
void
removeNode()
removeNode(
node,
replacement?,
keepEdges?): voidDefined in: graph/src/graph.ts:651
Removes a node and its relevant edges from the graph.
Use the keepEdges option to keep the edges that were pointing to
this node and only removes their to property value.
If a replacement is provided, then any edges that were previously pointing to the removed node will be directed to the replacement, if it is valid to do so.
Parameters
Returns
void
Implementation of
GraphLike.removeNoderesetEdges()
resetEdges(): voidDefined in: graph/src/graph.ts:714
Remove all edges from the graph while preserving nodes and resolution caches. This allows the graph to be reconstructed efficiently using the existing nodes.
Returns
void
sortNodes()
sortNodes(): voidDefined in: graph/src/graph.ts:346
Rebuild nodes so importers come first, then remaining nodes in
DepID order. Matches lockfile save so a built graph and a
save→load round-trip iterate the same way.
A graph coming from the lockfile loader is already in that order, so the pass below detects it and keeps the map as-is.
Returns
void
toJSON()
toJSON(): LockfileDataDefined in: graph/src/graph.ts:734
Returns
GraphModifier
Defined in: graph/src/modifiers.ts:151
Class representing loaded modifiers configuration for a project.
Instances of this class can be used as a helper to modify the graph during the graph build ideal traversal time.
const modifier = new GraphModifier(options)
modifier.load(options)The tryImporter method can be used to register the initial importer
node along with any modifier that includes an importer selector, e.g:
modifier.tryImporter(graph.mainImporter)
When traversing the graph, use the tryNewDependency method to check
if a given dependency spec to the current traversed node has matching
registered modifiers, e.g:
const entries = modifier.tryNewDependency(fromNode, depSpec)
Use updateActiveEntry to update a given active modifier entry state
with the current node of the graph being traversed. e.g:
for (const entry of entries)
modifier.updateActiveEntry(fromNode, entry)Constructors
new GraphModifier()
new GraphModifier(options): GraphModifierDefined in: graph/src/modifiers.ts:185
Parameters
| Parameter | Type |
|---|---|
options | SpecOptions |
Returns
Properties
| Property | Type | Description |
|---|---|---|
activeModifiers | Set<ModifierActiveEntry> | A set of currently active modifiers, which are being parsed. |
modifierNames | Set<string> | A set of all modifier string values loaded from vlt.json |
Accessors
config
Get Signature
get config(): GraphModifierConfigObjectDefined in: graph/src/modifiers.ts:193
Load the modifiers definitions from vlt.json, converting the result into a GraphModifierConfigObject
Returns
Methods
deregisterModifier()
deregisterModifier(modifier): voidDefined in: graph/src/modifiers.ts:453
Removes a previously registered modifier from the active entries.
Parameters
| Parameter | Type |
|---|---|
modifier | ModifierEntry |
Returns
void
load()
load(options): voidDefined in: graph/src/modifiers.ts:227
Loads the modifiers defined in vlt.json into memory.
Parameters
| Parameter | Type |
|---|---|
options | SpecOptions |
Returns
void
newModifier()
newModifier(from, modifier): ModifierActiveEntryDefined in: graph/src/modifiers.ts:439
Creates a new active modifier.
Parameters
| Parameter | Type |
|---|---|
from | Node |
modifier | ModifierEntry |
Returns
rollbackActiveEntries()
rollbackActiveEntries(): voidDefined in: graph/src/modifiers.ts:480
Operates in previously registered nodes and edges in order to put back in place any of the original edges that were referenced to in active (ongoing) breadcrumb parsing entries that were never completed.
This method can be used to easily rollback any pending operations once the graph traversal is done.
Returns
void
targetsImporterEdge()
targetsImporterEdge(importer, spec): booleanDefined in: graph/src/modifiers.ts:208
Whether a modifier governs the direct importer -> spec.name edge,
i.e. whether its value comes from config rather than from the
manifest that declares it. Only a breadcrumb whose whole scope is
that edge counts, and only if its qualifier accepts the spec:
:root > #a > #b names b but governs an edge under a, and
#b:semver(^1) leaves a ^2 edge alone, so in both cases the
root's own b edge is still the manifest's to validate and heal.
Parameters
Returns
boolean
tryDependencies()
tryDependencies(from, dependencies): Map<string, ModifierActiveEntry>Defined in: graph/src/modifiers.ts:388
Returns the set of ModifierActiveEntry instances that matches the provided Dependency specs for a given node.
This method is mostly a helper to GraphModifier.tryNewDependency that handles the registered modifiers traversal lookup.
Parameters
| Parameter | Type |
|---|---|
from | Node |
dependencies | | Edge[] | Dependency[] |
Returns
Map<string, ModifierActiveEntry>
tryImporter()
tryImporter(importer): voidDefined in: graph/src/modifiers.ts:282
Try matching the provided node against the top-level selectors. In case a match is found it will also register the active entry modifier and update the active entry to the current importer node.
Parameters
| Parameter | Type |
|---|---|
importer | Node |
Returns
void
tryNewDependency()
tryNewDependency(from, spec):
| undefined
| ModifierActiveEntryDefined in: graph/src/modifiers.ts:315
Try matching the provided node and spec to the current active parsing modifier entries along with possible starting-level modifiers.
Any entries in which the breachcrumb have already reached its last
element will be prioritized, along with checking for specificity,
the complete entry with the highest specificity will be returned or just
the entry with the highest specificity if no complete entry is found.
Returns undefined if no matching entry is found.
This method works with the assumption that it's going to be called during a graph traversal, such that any ascendent has been checked and the active modifier entry state has been updated in the previous iteration.
Parameters
Returns
| undefined
| ModifierActiveEntry
updateActiveEntry()
updateActiveEntry(from, active): voidDefined in: graph/src/modifiers.ts:407
Updates an active entry state keeping track of items in the multi-level active entries map. If the current breadcrumb state shows there's no more items left, then we deregister the modifier.
Parameters
| Parameter | Type |
|---|---|
from | Node |
active | ModifierActiveEntry |
Returns
void
load()
static load(options): GraphModifierDefined in: graph/src/modifiers.ts:509
Convenience method to instantiate and load in one call. Throws if called on a directory that does not have a vlt.json file.
Parameters
| Parameter | Type |
|---|---|
options | SpecOptions |
Returns
maybeLoad()
static maybeLoad(options): undefined | GraphModifierDefined in: graph/src/modifiers.ts:499
Convenience method to instantiate and load in one call. Returns undefined if the project does not have a vlt.json file, otherwise returns the loaded Modifiers instance.
Parameters
| Parameter | Type |
|---|---|
options | SpecOptions |
Returns
undefined | GraphModifier
Node
Defined in: graph/src/node.ts:30
Implements
Constructors
new Node()
new Node(
options,
id?,
manifest?,
spec?,
name?,
version?): NodeDefined in: graph/src/node.ts:293
Parameters
| Parameter | Type |
|---|---|
options | NodeOptions |
id? | DepID |
manifest? | Override<Manifest, NormalizedFields> |
spec? | Spec |
name? | string |
version? | string |
Returns
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
bindingGyp? | boolean | undefined | True if the package has a root binding.gyp, when known without a disk check (placed from the global store). Not persisted. |
bins? | Record<string, string> | undefined | Record of binary names to their paths in the package, if any. |
buildState | "none" | "needed" | "built" | "failed" | 'none' | Build state of this node - tracks whether it needs building, has been built, or failed. - 'none': No build state (default) - 'needed': Node needs to be built - 'built': Node has been successfully built - 'failed': Node build has failed |
built | boolean | false | True if this node has been built as part of the reify step. |
confused | boolean | false | True if there's a manifest-confused package name. |
detached | boolean | false | True if this node is detached from the graph. This is used to indicate that the node is not part of the graph although the node is still available as part of the resolution process. Allows for skipping fetching manifests for detached nodes. |
edgesIn | Set<Edge> | undefined | List of edges coming into this node. |
edgesOut | Map<string, Edge> | undefined | List of edges from this node into other nodes. This usually represents that the connected node is a direct dependency of this node. |
extracted | boolean | false | True if this node has been extracted to the file system. |
graph | Graph | undefined | A reference to the graph this node is a part of. |
id | DepID | undefined | A reference to the DepID this node represents in the graph. |
importer | boolean | false | True if this node is an importer node. |
integrity? | `sha512-${string}` | undefined | The manifest integrity value. |
mainImporter | boolean | false | True if this node is the project root node. |
manifest? | Override<Manifest, NormalizedFields> | undefined | The manifest this node represents in the graph. |
modifier | undefined | string | undefined | If this node has been modified as part of applying a GraphModifier then this field will contain the modifier query that was applied. Otherwise, it will be undefined. |
peerSetHash? | string | undefined | Deterministic unique string used to identify (and ultimately duplicate) nodes that are affected by a peer context set modified resolution. These are appended to the node DepID as the extra suffix. |
platform? | object | undefined | Platform requirements (engines, os, cpu) extracted from manifest. Stored separately for optional dependencies to enable platform checks when manifest is not loaded. |
platform.cpu? | string | string[] | undefined | - |
platform.engines? | Record<string, string> | undefined | - |
platform.libc? | string | string[] | undefined | - |
platform.os? | string | string[] | undefined | - |
projectRoot | string | undefined | Project where this node resides |
registry? | string | undefined | For registry nodes, this is the registry we fetched them from. Needed because their un-prefixed dependencies need to come from the same registry, if it's not the default. |
resolved? | string | undefined | An address PackageInfoClient may use to extract this package. |
resolvedFromLockfile | boolean | false | True when integrity and resolved came from a lockfile, i.e. they were verified by the install that wrote them. |
version? | string | undefined | The version of the package represented by this node, this is usually equivalent to manifest.version but in a few ways it may differ such as nodes loaded from a lockfile that lacks a loaded manifest. This field should be used to retrieve package versions instead. |
workspaces | undefined | Map<string, Edge> | undefined | A mainImporter node may have workspace connected to it, equivalent to its edgesOut linked deps. |
Accessors
[toStringTag]
Get Signature
get toStringTag: stringDefined in: graph/src/node.ts:31
Returns
string
dev
Get Signature
get dev(): booleanDefined in: graph/src/node.ts:72
True if a node is only reachable via dev edges from any importer.
Setting this to false, if previously set to true, will also unset the flag on any dev-flagged non-dev dependencies.
Returns
boolean
Set Signature
set dev(dev): voidDefined in: graph/src/node.ts:75
Parameters
| Parameter | Type |
|---|---|
dev | boolean |
Returns
void
Implementation of
NodeLike.devlocation
Get Signature
get location(): stringDefined in: graph/src/node.ts:253
The file system location for this node.
Returns
string
Set Signature
set location(location): voidDefined in: graph/src/node.ts:263
Parameters
| Parameter | Type |
|---|---|
location | string |
Returns
void
Implementation of
NodeLike.locationname
Get Signature
get name(): stringDefined in: graph/src/node.ts:179
Returns
string
Implementation of
NodeLike.nameoptional
Get Signature
get optional(): booleanDefined in: graph/src/node.ts:47
True if a node is only reachable via optional or peerOptional edges from any importer.
Setting this to false, if previously set to true, will also unset the flag on any optional-flagged non-optional dependencies.
Returns
boolean
Set Signature
set optional(optional): voidDefined in: graph/src/node.ts:50
Parameters
| Parameter | Type |
|---|---|
optional | boolean |
Returns
void
Implementation of
NodeLike.optionaloptions
Get Signature
get options(): SpecOptionsDefined in: graph/src/node.ts:346
Returns
Set Signature
set options(_opts): voidDefined in: graph/src/node.ts:351
Parameters
| Parameter | Type |
|---|---|
_opts | SpecOptions |
Returns
void
Implementation of
NodeLike.optionsrawManifest
Get Signature
get rawManifest():
| undefined
| Override<Manifest, NormalizedFields>Defined in: graph/src/node.ts:450
The raw manifest before any modifications. If not set, falls back to the current manifest.
Returns
| undefined
| Override<Manifest, NormalizedFields>
Implementation of
NodeLike.rawManifestMethods
addEdgesTo()
addEdgesTo(
type,
spec,
node?): EdgeDefined in: graph/src/node.ts:439
Add an edge from this node connecting it to a direct dependency.
Parameters
| Parameter | Type |
|---|---|
type | DependencyTypeShort |
spec | Spec |
node? | Node |
Returns
equals()
equals(other): booleanDefined in: graph/src/node.ts:353
Parameters
| Parameter | Type |
|---|---|
other | Node |
Returns
boolean
inVltStore()
inVltStore(): booleanDefined in: graph/src/node.ts:328
return true if this node is located in the vlt store memoized the first time it's called, since the store location doesn't change within the context of a single operation.
Returns
boolean
isDev()
isDev(): this is Node & { dev: true }Defined in: graph/src/node.ts:86
Returns
this is Node & { dev: true }
isOptional()
isOptional(): this is Node & { optional: true }Defined in: graph/src/node.ts:61
Returns
this is Node & { optional: true }
maybeSetConfusedManifest()
maybeSetConfusedManifest(spec, confused?): voidDefined in: graph/src/node.ts:470
Sets this node as having a manifest-confused manifest.
Parameters
| Parameter | Type |
|---|---|
spec | Spec |
confused? | Override<Manifest, NormalizedFields> |
Returns
void
Implementation of
NodeLike.maybeSetConfusedManifestnodeModules()
nodeModules(scurry): stringDefined in: graph/src/node.ts:286
The location of the node_modules folder where this node's edgesOut should be linked into. For nodes in the store, this is the parent directory, since they're extracted into a node_modules folder side by side with links to their deps. For nodes outside of the store (ie, importers and arbitrary link deps) this is the node_modules folder directly inside the node's directory.
Parameters
| Parameter | Type |
|---|---|
scurry | PathScurry |
Returns
string
resolvedLocation()
resolvedLocation(scurry): stringDefined in: graph/src/node.ts:274
The resolved location of the node in the file system.
Parameters
| Parameter | Type |
|---|---|
scurry | PathScurry |
Returns
string
setConfusedManifest()
setConfusedManifest(fixed, confused?): voidDefined in: graph/src/node.ts:457
Sets this node as having a manifest-confused manifest.
Parameters
| Parameter | Type |
|---|---|
fixed | Override |
confused? | Override<Manifest, NormalizedFields> |
Returns
void
Implementation of
NodeLike.setConfusedManifestsetDefaultLocation()
setDefaultLocation(): voidDefined in: graph/src/node.ts:422
Returns
void
setImporterLocation()
setImporterLocation(location): voidDefined in: graph/src/node.ts:360
Sets the node as an importer along with its location.
Parameters
| Parameter | Type |
|---|---|
location | string |
Returns
void
setPeerIdentity()
setPeerIdentity(id, peerSetHash): voidDefined in: graph/src/node.ts:395
Update this node's DepID and peer suffix after canonicalization. Resets name/location memos that were derived from the previous id.
Parameters
| Parameter | Type |
|---|---|
id | DepID |
peerSetHash | string |
Returns
void
setResolved()
setResolved(): voidDefined in: graph/src/node.ts:370
Sets the appropriate resolve / integrity value for this node. Note that other places might also set these values, like for example the lockfile that might have already have this info.
Returns
void
Implementation of
NodeLike.setResolvedtoJSON()
toJSON(): objectDefined in: graph/src/node.ts:485
Returns
object
| Name | Type |
|---|---|
buildState | "none" | "needed" | "built" | "failed" |
confused | boolean |
dev | boolean |
id | DepID |
importer | boolean |
integrity | undefined | `sha512-${string}` |
location | string |
manifest | | undefined | Override<Manifest, NormalizedFields> |
modifier | undefined | string |
name | string |
optional | boolean |
peerSetHash? | string |
platform | | undefined | { cpu: string | string[]; engines: Record<string, string>; libc: string | string[]; os: string | string[]; } |
projectRoot | string |
rawManifest? | Override<Manifest, NormalizedFields> |
resolved | undefined | string |
version | undefined | string |
Implementation of
NodeLike.toJSONtoString()
toString(): stringDefined in: graph/src/node.ts:513
Returns
string
Implementation of
NodeLike.toStringInterfaces
BuildOptions
Defined in: graph/src/build.ts:17
Options for the build process
Extends
Properties
| Property | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|
catalog? | Record<string, string> | - | - | LoadOptions.catalog |
catalogs? | Record<string, Record<string, string>> | - | - | LoadOptions.catalogs |
default-registry-alias? | string | The name of the registry alias (a key in registries) that bare specs (e.g. foo@latest) and transitive deps without an explicit registry protocol resolve through, when no registry or scoped-registries entry applies. Defaults to 'npm'. The npm alias itself has no built-in URL -- it must be configured (e.g. via vlt setup), otherwise bare specs resolve with spec.registry === undefined. | - | LoadOptions.default-registry-alias |
expectLockfile? | boolean | If set to true, fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity. | - | LoadOptions.expectLockfile |
frozenLockfile? | boolean | If set to true, fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications and is stricter than expectLockfile. | - | LoadOptions.frozenLockfile |
git-host-archives? | Record<string, string> | tarball hosting services for hosts listed in git-hosts | - | LoadOptions.git-host-archives |
git-hosts? | Record<string, string> | shorthand prefix names for known git hosts | - | LoadOptions.git-hosts |
jsr-registries? | Record<string, string> | registries that work like https://npm.jsr.io | - | LoadOptions.jsr-registries |
loadManifests? | boolean | If set to false, actual.load will not load any package.json files while traversing the file system. The resulting Graph from loading with loadManifests=false has no information on dependency types or the specs defined and no information on missing and extraneous dependencies. | - | LoadOptions.loadManifests |
lockfileData? | LockfileData | Already-parsed main lockfile data. When set, ideal build skips re-reading vlt-lock.json. | - | LoadOptions.lockfileData |
lockfileOnly? | boolean | If set to true, only update the lockfile without performing any node_modules operations. Skips package extraction, filesystem operations, and hidden lockfile saves. | - | LoadOptions.lockfileOnly |
mainManifest? | Override<Manifest, NormalizedFields> | The project root manifest. | - | LoadOptions.mainManifest |
modifiers? | GraphModifier | The graph modifiers helper object. | - | LoadOptions.modifiers |
monorepo? | Monorepo | Optional monorepo configuration. If not provided, will attempt to load from project. | LoadOptions.monorepo | - |
packageJson | PackageJson | A PackageJson object, for sharing manifest caches | - | LoadOptions.packageJson |
projectRoot | string | The project root dirname. | - | LoadOptions.projectRoot |
registries? | Record<string, string> | shorthand prefix names for known registries | - | LoadOptions.registries |
registry? | string | The registry where a spec should be resolved against. There is no default. If no registry is configured, registry-type specs parsed without one will have spec.registry === undefined, and anything that needs to build a registry URL will fail. Named registry aliases (gh:, jsr:) and scoped-registries are unaffected. For bare specs, this takes precedence over the default-registry-alias lookup but not over a matching scoped-registries entry. | - | LoadOptions.registry |
scoped-registries? | Record<`@${string}`, string> | registries mapped to a @scope | - | LoadOptions.scoped-registries |
scurry | PathScurry | A PathScurry object, for use in globs | - | LoadOptions.scurry |
skipHiddenLockfile? | boolean | If set to true, then do not shortcut the process by reading the hidden lockfile at node_modules/.vlt-lock.json | - | LoadOptions.skipHiddenLockfile |
skipLoadingNodesOnModifiersChange? | boolean | Load only importers into the graph if the modifiers have changed. | - | LoadOptions.skipLoadingNodesOnModifiersChange |
specCache? | SpecCache | Shared intern cache for parsed lockfile specs. | - | LoadOptions.specCache |
target | string | DSS query string to filter which nodes to build. | - | - |
Type Aliases
ActualLoadOptions
type ActualLoadOptions = SpecOptions & object;Defined in: graph/src/actual/load.ts:35
Type declaration
| Name | Type | Description |
|---|---|---|
expectLockfile? | boolean | If set to true, fail if lockfile is missing or out of date. Used by ci command to enforce lockfile integrity. |
frozenLockfile? | boolean | If set to true, fail if lockfile is missing or out of sync with package.json. Prevents any lockfile modifications and is stricter than expectLockfile. |
loadManifests? | boolean | If set to false, actual.load will not load any package.json files while traversing the file system. The resulting Graph from loading with loadManifests=false has no information on dependency types or the specs defined and no information on missing and extraneous dependencies. |
lockfileData? | LockfileData | Already-parsed main lockfile data. When set, ideal build skips re-reading vlt-lock.json. |
lockfileOnly? | boolean | If set to true, only update the lockfile without performing any node_modules operations. Skips package extraction, filesystem operations, and hidden lockfile saves. |
mainManifest? | NormalizedManifest | The project root manifest. |
modifiers? | GraphModifier | The graph modifiers helper object. |
monorepo? | Monorepo | A Monorepo object, for managing workspaces |
packageJson | PackageJson | A PackageJson object, for sharing manifest caches |
projectRoot | string | The project root dirname. |
scurry | PathScurry | A PathScurry object, for use in globs |
skipHiddenLockfile? | boolean | If set to true, then do not shortcut the process by reading the hidden lockfile at node_modules/.vlt-lock.json |
skipLoadingNodesOnModifiersChange? | boolean | Load only importers into the graph if the modifiers have changed. |
specCache? | SpecCache | Shared intern cache for parsed lockfile specs. |
AddImportersDependenciesMap
type AddImportersDependenciesMap = Map<DepID, Map<string, Dependency>> & object;Defined in: graph/src/dependencies.ts:75
A Map in which keys are DepID linking to another Map in which
keys are the dependency names and values are Dependency. This
structure represents dependencies that need to be added to the importer
represented by DepID.
The modifiedDependencies property can be used to indicate that there
are added dependencies to any of the importer nodes.
Type declaration
| Name | Type |
|---|---|
modifiedDependencies | boolean |
BaseModifierEntry
type BaseModifierEntry = object;Defined in: graph/src/modifiers.ts:40
Info needed to define a graph modifier.
Type declaration
| Name | Type |
|---|---|
breadcrumb | ModifierBreadcrumb |
query | string |
refs | Set<{ from: Node; name: string; }> |
type | "edge" | "node" |
value | | string | NormalizedManifest |
BuildIdealOptions
type BuildIdealOptions = ActualLoadOptions & object;Defined in: graph/src/ideal/build.ts:22
Type declaration
| Name | Type | Description |
|---|---|---|
actual? | Graph | An actual graph |
add? | AddImportersDependenciesMap | A Map in which keys are DepID linking to another Map in which keys are the dependency names and values are Dependency. This structure represents dependencies that need to be added to the importer represented by DepID. |
packageInfo | PackageInfoClient | A PackageInfoClient instance to read manifest info from. |
remove? | RemoveImportersDependenciesMap | A Map object representing nodes to be removed from the ideal graph. Each DepID key represents an importer node and the Set of dependency names to be removed from its dependency list. |
remover | RollbackRemove | A RollbackRemove instance to handle extraction rollbacks |
BuildResult
type BuildResult = object;Defined in: graph/src/reify/build.ts:21
Returns an object mapping registries to the names of the packages built.
Type declaration
Dependency
type Dependency = object;Defined in: graph/src/dependencies.ts:54
Parsed dependency entries info.
Type declaration
| Name | Type | Description |
|---|---|---|
spec | Spec | The parsed Spec object describing the dependency requirements. |
type | DependencySaveType | The DependencySaveType, describing the way this dependency should be saved back to the manifest. |
EdgeMap
type EdgeMap = Map<NodeLike | undefined, TreeItem>;Defined in: graph/src/visualization/human-readable-output.ts:40
EdgeModifierEntry
type EdgeModifierEntry = BaseModifierEntry & object;Defined in: graph/src/modifiers.ts:54
Extra info to define specifically a graph edge modifier.
Type declaration
| Name | Type |
|---|---|
spec | Spec |
type | "edge" |
value | string |
GraphModifierConfigObject
type GraphModifierConfigObject = Record<string, string>;Defined in: graph/src/modifiers.ts:35
Type definition for the modifiers configuration object
GraphModifierLoadedConfig
type GraphModifierLoadedConfig = object;Defined in: graph/src/modifiers.ts:27
Loaded modifiers configuration as described in the vlt.json file.
Type declaration
| Name | Type |
|---|---|
modifiers | GraphModifierConfigObject |
GraphOptions
type GraphOptions = SpecOptions & object;Defined in: graph/src/graph.ts:70
Type declaration
| Name | Type | Description |
|---|---|---|
mainManifest | NormalizedManifest | The main importer manifest info. |
manifests? | ManifestInventory | An inventory of seen manifests. |
monorepo? | Monorepo | A Monorepo object, for managing workspaces |
projectRoot | string | Root of the project this graph represents |
HumanReadableOutputGraph
type HumanReadableOutputGraph = object;Defined in: graph/src/visualization/human-readable-output.ts:33
Type declaration
InstallOptions
type InstallOptions = ActualLoadOptions & object;Defined in: graph/src/install.ts:29
Type declaration
| Name | Type |
|---|---|
allowScripts | string |
cleanInstall? | boolean |
packageInfo | PackageInfoClient |
saveExact? | boolean |
savePrefix? | string |
JSONOutputGraph
type JSONOutputGraph = object;Defined in: graph/src/visualization/json-output.ts:35
Type declaration
JSONOutputItem
type JSONOutputItem = object;Defined in: graph/src/visualization/json-output.ts:8
A JSON output item describes a package that is present in the install graph. It represents an edge plus it's linking Node.
Type declaration
| Name | Type | Description |
|---|---|---|
fromID? | DepID | A reference to the id of the Node that this package is linked from. |
name | string | The name of the package. |
overridden | boolean | Whether this edge was overridden by a graph modifier. |
spec? | string | The dependency spec definition for this package. |
to? | NodeLike | A representation of the package object that fulfills this dependency. |
type? | EdgeLike["type"] | The package type. |
LockfileBuildState
type LockfileBuildState = undefined | 1 | 2 | 3;Defined in: graph/src/lockfile/types.ts:103
Build state for a node - tracks whether it needs building, has been built, or failed
LockfileData
type LockfileData = object;Defined in: graph/src/lockfile/types.ts:27
This is the main type definition for the contents of the
vlt-lock.json file.
The nodes and edges information from the lockfile are used to reconstruct a Graph representing a previous install.
Type declaration
| Name | Type |
|---|---|
edges | LockfileEdges |
lockfileVersion | number |
nodes | Record<DepID, LockfileNode> |
options | SpecOptions & object |
LockfileEdgeKey
type LockfileEdgeKey = `${DepID} ${string}`;Defined in: graph/src/lockfile/types.ts:165
${from} ${dep name}
LockfileEdges
type LockfileEdges = object;Defined in: graph/src/lockfile/types.ts:160
Lockfile edges are stored as a record object where the key
is ${from.id} ${spec.name} and the value is
${type} ${spec.bareSpec} ${to.id | 'MISSING'}
Storing them in a record like this means that we are guaranteed to
never end up with duplicates, and a standard JSON.stringify()
will nicely print them out one line per edge.
Index Signature
[key:
| `~${string}~${string}~${string} ${string}`
| `git~${string}~${string}~${string} ${string}`
| `~${string}~${string} ${string}`
| `git~${string}~${string} ${string}`
| `file~${string}~${string} ${string}`
| `remote~${string}~${string} ${string}`
| `workspace~${string}~${string} ${string}`
| `file~${string} ${string}`
| `remote~${string} ${string}`
| `workspace~${string} ${string}`]:
| `dev ${string} ~${string}~${string}~${string}`
| `dev ${string} git~${string}~${string}~${string}`
| `dev ${string} ~${string}~${string}`
| `dev ${string} git~${string}~${string}`
| `dev ${string} file~${string}~${string}`
| `dev ${string} remote~${string}~${string}`
| `dev ${string} workspace~${string}~${string}`
| `dev ${string} file~${string}`
| `dev ${string} remote~${string}`
| `dev ${string} workspace~${string}`
| `dev ${string} MISSING`
| `optional ${string} ~${string}~${string}~${string}`
| `optional ${string} git~${string}~${string}~${string}`
| `optional ${string} ~${string}~${string}`
| `optional ${string} git~${string}~${string}`
| `optional ${string} file~${string}~${string}`
| `optional ${string} remote~${string}~${string}`
| `optional ${string} workspace~${string}~${string}`
| `optional ${string} file~${string}`
| `optional ${string} remote~${string}`
| `optional ${string} workspace~${string}`
| `optional ${string} MISSING`
| `peer ${string} ~${string}~${string}~${string}`
| `peer ${string} git~${string}~${string}~${string}`
| `peer ${string} ~${string}~${string}`
| `peer ${string} git~${string}~${string}`
| `peer ${string} file~${string}~${string}`
| `peer ${string} remote~${string}~${string}`
| `peer ${string} workspace~${string}~${string}`
| `peer ${string} file~${string}`
| `peer ${string} remote~${string}`
| `peer ${string} workspace~${string}`
| `peer ${string} MISSING`
| `peerOptional ${string} ~${string}~${string}~${string}`
| `peerOptional ${string} git~${string}~${string}~${string}`
| `peerOptional ${string} ~${string}~${string}`
| `peerOptional ${string} git~${string}~${string}`
| `peerOptional ${string} file~${string}~${string}`
| `peerOptional ${string} remote~${string}~${string}`
| `peerOptional ${string} workspace~${string}~${string}`
| `peerOptional ${string} file~${string}`
| `peerOptional ${string} remote~${string}`
| `peerOptional ${string} workspace~${string}`
| `peerOptional ${string} MISSING`
| `prod ${string} ~${string}~${string}~${string}`
| `prod ${string} git~${string}~${string}~${string}`
| `prod ${string} ~${string}~${string}`
| `prod ${string} git~${string}~${string}`
| `prod ${string} file~${string}~${string}`
| `prod ${string} remote~${string}~${string}`
| `prod ${string} workspace~${string}~${string}`
| `prod ${string} file~${string}`
| `prod ${string} remote~${string}`
| `prod ${string} workspace~${string}`
| `prod ${string} MISSING`LockfileEdgeValue
type LockfileEdgeValue = `${DependencyTypeShort} ${Spec["bareSpec"]} ${DepID | "MISSING"}`;Defined in: graph/src/lockfile/types.ts:168
${type} ${spec} ${to}
LockfileLoadOptions
type LockfileLoadOptions = SpecOptions & object;Defined in: graph/src/lockfile/load.ts:29
Type declaration
| Name | Type | Description |
|---|---|---|
actual? | Graph | An optional Graph object to hydrate extra data from. |
lockfileData? | LockfileData | Already-parsed lockfile data. When set, skips the filesystem read. |
mainManifest | NormalizedManifest | The project root manifest. |
modifiers? | GraphModifier | The graph modifiers helper object. |
monorepo? | Monorepo | A Monorepo object, for managing workspaces |
packageJson? | PackageJson | A PackageJson object, for sharing manifest caches |
projectRoot | string | The project root dirname. |
scurry? | PathScurry | A PathScurry object, for use in globs |
specCache? | SpecCache | Shared intern cache for parsed lockfile specs. |
throwOnMissingManifest? | boolean | Whether to throw an error if a manifest is missing when loading nodes. |
LockfileNode
type LockfileNode = [LockfileNodeFlags, string | null, Integrity | null, string | null, string | null, NormalizedManifest | null, NormalizedManifest | null, LockfilePlatform | null, Record<string, string> | null, LockfileBuildState | null];Defined in: graph/src/lockfile/types.ts:138
Lockfile representation of a node from the install graph.
LockfileNodeFlags
type LockfileNodeFlags = 0 | 1 | 2 | 3;Defined in: graph/src/lockfile/types.ts:90
Bit flags indicating whether a node is optional and/or dev.
LockfilePlatform
type LockfilePlatform = object;Defined in: graph/src/lockfile/types.ts:13
Platform requirements for a lockfile node
Type declaration
| Name | Type |
|---|---|
cpu? | string[] | string |
engines? | Record<string, string> |
libc? | string[] | string |
os? | string[] | string |
ManifestInventory
type ManifestInventory = Map<DepID, NormalizedManifest>;Defined in: graph/src/graph.ts:37
MermaidOutputGraph
type MermaidOutputGraph = object;Defined in: graph/src/visualization/mermaid-output.ts:6
Type declaration
ModifierActiveEntry
type ModifierActiveEntry = object;Defined in: graph/src/modifiers.ts:79
An object to track modifiers that have matched an initial part of the breadcrumb. It holds pointers to both nodes and edges matched in the current traversed graph on top of the modifier info and the breadcrumb state that is used to track the current state of the parsing.
Type declaration
| Name | Type | Description |
|---|---|---|
interactiveBreadcrumb | ModifierInteractiveBreadcrumb | The breadcrumb that is used to track the current state of the parsing. |
modifiedEdge? | Edge | The modified edge that is being used to replace the original edge. |
modifier | ModifierEntry | The modifier this active entry is working with. |
originalEdge? | Edge | The original edge that is being replaced with this entry. |
originalFrom | Node | The first node to be affected by this modifier. |
ModifierEntry
type ModifierEntry =
| EdgeModifierEntry
| NodeModifierEntry;Defined in: graph/src/modifiers.ts:71
A graph modifier entry, which can be either an edge or a node modifier.
NodeModifierEntry
type NodeModifierEntry = BaseModifierEntry & object;Defined in: graph/src/modifiers.ts:63
Extra info to define the graph node modifier.
Type declaration
| Name | Type |
|---|---|
manifest | NormalizedManifest |
type | "node" |
NodeOptions
type NodeOptions = SpecOptions & object;Defined in: graph/src/node.ts:25
Type declaration
| Name | Type |
|---|---|
graph | GraphLike |
projectRoot | string |
OptionsChange
type OptionsChange = object;Defined in: graph/src/lockfile/types.ts:40
A single difference between the config a graph was built with and the
options block stored in the lockfile it was loaded from.
Type declaration
| Name | Type | Description |
|---|---|---|
from? | string | the value stored in the lockfile, absent when the entry is new |
key? | string | the entry inside that section, e.g. the catalog name. Absent for scalar sections; <catalog> <dep> for catalogs. |
section | string | the options key the difference was found in, e.g. catalog |
to? | string | the current value, absent when the entry is gone |
RawDependency
type RawDependency = object;Defined in: graph/src/dependencies.ts:44
Dependency entries info as defined in a package.json file.
Type declaration
| Name | Type |
|---|---|
bareSpec | string |
name | string |
registry? | string |
type | DependencyTypeLong |
ReifyOptions
type ReifyOptions = ActualLoadOptions & object;Defined in: graph/src/reify/index.ts:89
Type declaration
| Name | Type |
|---|---|
actual? | Graph |
add? | AddImportersDependenciesMap |
allowScripts | string |
graph | Graph |
modifiers? | GraphModifier |
packageInfo | PackageInfoClient |
remove? | RemoveImportersDependenciesMap |
remover | RollbackRemove |
saveExact? | boolean |
savePrefix? | string |
update? | boolean |
RemoveImportersDependenciesMap
type RemoveImportersDependenciesMap = Map<DepID, Set<string>> & object;Defined in: graph/src/dependencies.ts:88
A Map object representing nodes to be removed from the ideal graph.
Each DepID key represents an importer node and the Set of
dependency names to be removed from its dependency list.
The modifiedDependencies property can be used to indicate that there
are added dependencies to any of the importer nodes.
Type declaration
| Name | Type |
|---|---|
modifiedDependencies | boolean |
SaveOptions
type SaveOptions = SpecOptions & object;Defined in: graph/src/lockfile/save.ts:35
Type declaration
| Name | Type | Description |
|---|---|---|
graph | Graph | The graph to be stored in the lockfile. |
modifiers? | GraphModifier | The graph modifiers helper object. |
saveBuildData? | boolean | Should it save build state data in the lockfile? |
saveManifests? | boolean | Should it save manifest data in the lockfile? |
throwOnMissingManifest? | boolean | Should it throw an error if a manifest is missing? |
SpecCache
type SpecCache = Map<string, Spec>;Defined in: graph/src/lockfile/types.ts:59
Per-install intern cache for parsed lockfile specs. Shared across hidden + main lockfile loads so identical (name, bareSpec) pairs reuse one Spec instance.
TreeItem
type TreeItem = object;Defined in: graph/src/visualization/human-readable-output.ts:21
Type declaration
TreeMap
type TreeMap = Map<EdgeLike | undefined, EdgeMap>;Defined in: graph/src/visualization/human-readable-output.ts:42
UninstallOptions
type UninstallOptions = ActualLoadOptions & object;Defined in: graph/src/uninstall.ts:14
Type declaration
| Name | Type |
|---|---|
allowScripts | string |
packageInfo | PackageInfoClient |
UpdateOptions
type UpdateOptions = ActualLoadOptions & object;Defined in: graph/src/update.ts:16
Type declaration
| Name | Type |
|---|---|
allowScripts | string |
packageInfo | PackageInfoClient |
Variables
actual
const actual: object;Defined in: graph/src/index.ts:21
Type declaration
| Name | Type | Default value |
|---|---|---|
load | (options) => Graph | actualLoad |
BuildStateBuilt
const BuildStateBuilt: 2 = 2;Defined in: graph/src/lockfile/types.ts:97
BuildStateFailed
const BuildStateFailed: 3 = 3;Defined in: graph/src/lockfile/types.ts:98
BuildStateNeeded
const BuildStateNeeded: 1 = 1;Defined in: graph/src/lockfile/types.ts:96
BuildStateNone
const BuildStateNone: undefined = undefined;Defined in: graph/src/lockfile/types.ts:95
Build state constants for lockfile nodes
ideal
const ideal: object;Defined in: graph/src/index.ts:45
Type declaration
| Name | Type |
|---|---|
build | (options) => Promise<Graph> |
lockfile
const lockfile: object;Defined in: graph/src/index.ts:31
Type declaration
| Name | Type | Default value |
|---|---|---|
load | (options) => Graph | lockfileLoad |
loadData | (projectRoot, lockfilePath) => LockfileData | lockfileLoadData |
loadEdges | (graph, edges, options, cache?) => void | - |
loadNodes | (graph, nodes, options, actual?, throwOnMissingManifest?) => void | - |
save | (options) => void | - |
LOCKFILE_VERSION
const LOCKFILE_VERSION: 1 = 1;Defined in: graph/src/lockfile/types.ts:66
Current lockfile format version. Only lockfiles with matching version are considered valid. Bump when making breaking format changes.
LockfileNodeFlagDev
const LockfileNodeFlagDev: 2 = 2;Defined in: graph/src/lockfile/types.ts:84
LockfileNodeFlagDevOptional
const LockfileNodeFlagDevOptional: 3 = 3;Defined in: graph/src/lockfile/types.ts:85
LockfileNodeFlagNone
const LockfileNodeFlagNone: 0 = 0;Defined in: graph/src/lockfile/types.ts:82
LockfileNodeFlagOptional
const LockfileNodeFlagOptional: 1 = 1;Defined in: graph/src/lockfile/types.ts:83
VIRTUAL_ROOT_ID
const VIRTUAL_ROOT_ID: DepID;Defined in: graph/src/virtual-root.ts:9
An unique DepID to identify the virtual root node.
Functions
addKey()
function addKey(spec): stringDefined in: graph/src/dependencies.ts:117
The key an added dependency is filed under. A nameless spec
(github:u/r, file:../x, a tarball url) has no name to key by, so
the CLI uses its stringified form; every reader of an add map has to
derive the key the same way.
Parameters
| Parameter | Type |
|---|---|
spec | Spec |
Returns
string
asDependency()
function asDependency(obj): DependencyDefined in: graph/src/dependencies.ts:104
Parameters
| Parameter | Type |
|---|---|
obj | unknown |
Returns
asDependencyTypeShort()
function asDependencyTypeShort(obj): DependencyTypeShortDefined in: graph/src/dependencies.ts:29
Parameters
| Parameter | Type |
|---|---|
obj | unknown |
Returns
asNode()
function asNode(value): NodeDefined in: graph/src/node.ts:542
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
build()
function build(options): Promise<BuildResult>Defined in: graph/src/build.ts:73
Build the project based on actual graph state and build state from lockfile
This function:
- Loads the actual graph from node_modules
- Loads build data from lockfile and transfers it to the actual graph
- Constructs a Diff object representing what needs to be built
- Filters nodes based on buildState === 'needed'
- Calls the reify build process with the constructed diff
- Persists build results to the hidden lockfile, when the vlt store exists
Parameters
| Parameter | Type |
|---|---|
options | BuildOptions |
Returns
Promise<BuildResult>
copyPackageMetadata()
function copyPackageMetadata(to, from): voidDefined in: graph/src/node.ts:524
Copy the tarball metadata to is missing from another node for the
same package version. Lockfile provenance only carries over once both
integrity and resolved are set, since that pair is what makes it
usable without refetching.
Parameters
Returns
void
createVirtualRoot()
function createVirtualRoot(
name,
options,
mainImporters): undefined | NodeLikeDefined in: graph/src/virtual-root.ts:22
A virtual root used to aggregate multiple importers into a single graph.
This is meant to be used with visual tools that want a single root node starting point to represent the graph.
Returns undefined if a virtual root is not needed.
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | 'virtual-root' |
options | SpecOptions | undefined |
mainImporters | NodeLike[] | undefined |
Returns
undefined | NodeLike
fixupAddedNames()
function fixupAddedNames(
add,
manifest,
options,
spec): SpecDefined in: graph/src/fixup-added-names.ts:21
When adding new dependencies, it's very common to not have a dependency
name directly available to reference, e.g: file:local/folder or
remote:tarball-url.tgz. In these cases, a placeholder (unknown) name
is used in the Spec object and the add Map structure that holds
references to added dependencies will use the stringified spec as a key.
This helper function fixes unknown names in the add map by replacing
placeholder specs with the correct names from the provided manifest.
It also fixes empty bareSpec values (from CLI args like vlt install foo)
by calculating the proper semver range from the resolved manifest version.
Parameters
| Parameter | Type |
|---|---|
add | | undefined | Map<string, Dependency> |
manifest | | undefined | Pick<Manifest, "name" | "version"> |
options | SpecOptions |
spec | Spec |
Returns
generateShortId()
function generateShortId(index): stringDefined in: graph/src/visualization/mermaid-output.ts:33
Generates a short identifier for a given index following the pattern: 0 -> a, 1 -> b, ..., 25 -> z, 26 -> A, ..., 51 -> Z, 52 -> aa, 53 -> ab, etc. This implements a bijective base-52 numbering system where a-z = 0-25, A-Z = 26-51
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
string
getBooleanFlagsFromNum()
function getBooleanFlagsFromNum(flags): objectDefined in: graph/src/lockfile/types.ts:77
Parameters
| Parameter | Type |
|---|---|
flags | LockfileNodeFlags |
Returns
object
| Name | Type |
|---|---|
dev | boolean |
optional | boolean |
getBuildStateFromNode()
function getBuildStateFromNode(node): LockfileBuildStateDefined in: graph/src/lockfile/types.ts:105
Parameters
| Parameter | Type |
|---|---|
node | { buildState: "none" | "needed" | "built" | "failed"; } |
node.buildState? | "none" | "needed" | "built" | "failed" |
Returns
getBuildStateFromNum()
function getBuildStateFromNum(state): "none" | "needed" | "built" | "failed"Defined in: graph/src/lockfile/types.ts:120
Parameters
| Parameter | Type |
|---|---|
state | LockfileBuildState |
Returns
"none" | "needed" | "built" | "failed"
getDependencies()
function getDependencies(node, options): Map<string, Dependency>Defined in: graph/src/dependencies.ts:225
Retrieves a map of all dependencies, of all types, that can be inferred from a given node manifest, including missing dependencies.
Parameters
| Parameter | Type |
|---|---|
node | NodeLike |
options | SpecOptions |
Returns
Map<string, Dependency>
getFlagNumFromNode()
function getFlagNumFromNode(node): 0 | 1 | 2 | 3Defined in: graph/src/lockfile/types.ts:68
Parameters
| Parameter | Type |
|---|---|
node | { dev: boolean; optional: boolean; } |
node.dev? | boolean |
node.optional? | boolean |
Returns
0 | 1 | 2 | 3
getRawDependencies()
function getRawDependencies(node): Map<string, RawDependency>Defined in: graph/src/dependencies.ts:170
Parameters
| Parameter | Type |
|---|---|
node | NodeLike |
Returns
Map<string, RawDependency>
humanReadableOutput()
function humanReadableOutput(options, __namedParameters): stringDefined in: graph/src/visualization/human-readable-output.ts:113
Returns a human-readable output of the graph.
Parameters
| Parameter | Type |
|---|---|
options | HumanReadableOutputGraph |
__namedParameters | { colors: boolean; } |
__namedParameters.colors? | boolean |
Returns
string
install()
function install(options, add?): Promise<
| {
buildQueue: undefined;
diff: undefined;
graph: Graph;
}
| {
buildQueue: undefined | DepID[];
diff: Diff;
graph: Graph;
}>Defined in: graph/src/install.ts:37
Parameters
| Parameter | Type |
|---|---|
options | InstallOptions |
add? | AddImportersDependenciesMap |
Returns
Promise<
| {
buildQueue: undefined;
diff: undefined;
graph: Graph;
}
| {
buildQueue: undefined | DepID[];
diff: Diff;
graph: Graph;
}>
isDependency()
function isDependency(o): o is DependencyDefined in: graph/src/dependencies.ts:97
Parameters
| Parameter | Type |
|---|---|
o | unknown |
Returns
o is Dependency
isDependencySaveType()
function isDependencySaveType(obj): obj is DependencyTypeShortDefined in: graph/src/dependencies.ts:23
Parameters
| Parameter | Type |
|---|---|
obj | unknown |
Returns
obj is DependencyTypeShort
isDependencyTypeShort()
function isDependencyTypeShort(obj): obj is DependencyTypeShortDefined in: graph/src/dependencies.ts:18
Parameters
| Parameter | Type |
|---|---|
obj | unknown |
Returns
obj is DependencyTypeShort
isNode()
function isNode(value): value is NodeDefined in: graph/src/node.ts:532
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
value is Node
jsonOutput()
function jsonOutput(__namedParameters): JSONOutputItem[]Defined in: graph/src/visualization/json-output.ts:44
Returns a JSON string representation of the graph.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | JSONOutputGraph |
Returns
mermaidOutput()
function mermaidOutput(options): stringDefined in: graph/src/visualization/mermaid-output.ts:204
Returns a mermaid string representation of the graph.
Parameters
| Parameter | Type |
|---|---|
options | MermaidOutputGraph |
Returns
string
reify()
function reify(options): Promise<ReifyResult>Defined in: graph/src/reify/index.ts:118
Make the current project match the supplied graph.
Parameters
| Parameter | Type |
|---|---|
options | ReifyOptions |
Returns
Promise<ReifyResult>
shorten()
function shorten(
typeLong,
name?,
manifest?): DependencyTypeShortDefined in: graph/src/dependencies.ts:123
Get the DependencyTypeShort from a DependencyTypeLong.
Parameters
| Parameter | Type |
|---|---|
typeLong | DependencyTypeLong |
name? | string |
manifest? | | null | Pick<Manifest, "peerDependenciesMeta"> |
Returns
shouldInstallDepType()
function shouldInstallDepType(node, depType): booleanDefined in: graph/src/dependencies.ts:158
Only install devDeps for git dependencies and importers Everything else always gets installed
Deliberately stricter than getRawDependencies, which also keeps
devDeps of file: nodes: this is the rule the ideal build places with, so
peer checks use it to match what actually lands in the graph.
Parameters
| Parameter | Type |
|---|---|
node | NodeLike |
depType | DependencyTypeLong |
Returns
boolean
stringifyNode()
function stringifyNode(node?): stringDefined in: graph/src/stringify-node.ts:5
Parameters
| Parameter | Type |
|---|---|
node? | NodeLike |
Returns
string
uninstall()
function uninstall(options, remove?): Promise<
| {
diff: undefined;
graph: Graph;
}
| {
diff: ReifyResult;
graph: Graph;
}>Defined in: graph/src/uninstall.ts:19
Parameters
| Parameter | Type |
|---|---|
options | UninstallOptions |
remove? | RemoveImportersDependenciesMap |
Returns
Promise<
| {
diff: undefined;
graph: Graph;
}
| {
diff: ReifyResult;
graph: Graph;
}>
update()
function update(options): Promise<{
buildQueue: undefined | DepID[];
diff: Diff;
graph: Graph;
}>Defined in: graph/src/update.ts:21
Parameters
| Parameter | Type |
|---|---|
options | UpdateOptions |
Returns
Promise<{
buildQueue: undefined | DepID[];
diff: Diff;
graph: Graph;
}>