@vltpkg/graph
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): Diff
Defined in: graph/src/diff.ts:61
Parameters
from
to
Returns
Properties
edges
edges: object
Defined in: graph/src/diff.ts:50
Collection of nodes to add and delete
add
add: Set<Edge>
Edges in the to
graph that are not found in the from
graph
delete
delete: Set<Edge>;
Edges in the from
graph that are not found in the to
graph
from
from: Graph
Defined in: graph/src/diff.ts:26
hadOptionalFailures
hadOptionalFailures: boolean = false
Defined in: graph/src/diff.ts:35
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
nodes: object
Defined in: graph/src/diff.ts:40
Collection of nodes to add and delete
add
add: Set<Node>
Nodes in the to
graph that are not in the from
graph
delete
delete: Set<Node>;
Nodes in the from
graph that are not in the to
graph
projectRoot
projectRoot: string
Defined in: graph/src/diff.ts:29
to
to: Graph
Defined in: graph/src/diff.ts:27
Accessors
[toStringTag]
Get Signature
get toStringTag: string
Defined in: graph/src/diff.ts:57
Returns
string
Methods
[kCustomInspect]()
kCustomInspect: string
Defined in: graph/src/diff.ts:102
Parameters
_
number
options?
InspectOptions
Returns
string
Edge
Defined in: graph/src/edge.ts:11
Implements
Constructors
new Edge()
new Edge( type, spec, from, to?): Edge
Defined in: graph/src/edge.ts:49
Parameters
type
spec
from
to?
Returns
Properties
from
from: Node
Defined in: graph/src/edge.ts:32
The Node this Edge is connecting from, this is usually the dependent.
Implementation of
EdgeLike.from
spec
spec: Spec
Defined in: graph/src/edge.ts:47
The defined spec value for to
as parsed from the dependent metadata.
Implementation of
EdgeLike.spec
to?
optional to: Node;
Defined in: graph/src/edge.ts:37
The node this Edge is connecting to, this is usually a direct dependency.
Implementation of
EdgeLike.to
type
type: DependencyTypeShort
Defined in: graph/src/edge.ts:42
What type of dependency relationship from
and to
nodes have.
Implementation of
EdgeLike.type
Accessors
[toStringTag]
Get Signature
get toStringTag: string
Defined in: graph/src/edge.ts:12
Returns
string
dev
Get Signature
get dev(): boolean
Defined in: graph/src/edge.ts:71
This edge was defined as part of a devDependencies
in package.json
Returns
boolean
name
Get Signature
get name(): string
Defined in: graph/src/edge.ts:64
The name of the dependency to
as defined in the dependent metadata.
Returns
string
Implementation of
EdgeLike.name
optional
Get Signature
get optional(): boolean
Defined in: graph/src/edge.ts:75
Returns
boolean
peer
Get Signature
get peer(): boolean
Defined in: graph/src/edge.ts:79
Returns
boolean
peerOptional
Get Signature
get peerOptional(): boolean
Defined in: graph/src/edge.ts:83
Returns
boolean
Methods
[kCustomInspect]()
kCustomInspect: string
Defined in: graph/src/edge.ts:16
Parameters
_
number
options
InspectOptions
Returns
string
valid()
valid(): boolean
Defined in: graph/src/edge.ts:87
Returns
boolean
Graph
Defined in: graph/src/graph.ts:47
Implements
Constructors
new Graph()
new Graph(options): Graph
Defined in: graph/src/graph.ts:111
Parameters
options
Returns
Properties
edges
edges: Set<Edge>
Defined in: graph/src/graph.ts:69
A set of all edges in this graph.
Implementation of
GraphLike.edges
extraneousDependencies
extraneousDependencies: Set<Edge>
Defined in: graph/src/graph.ts:104
A set of extraneous dependencies found when building the graph.
importers
importers: Set<Node>
Defined in: graph/src/graph.ts:94
A set of importer nodes in this graph.
Implementation of
GraphLike.importers
mainImporter
mainImporter: Node
Defined in: graph/src/graph.ts:99
The Node that represents the project root package.json
.
Implementation of
GraphLike.mainImporter
manifests
manifests: ManifestInventory
Defined in: graph/src/graph.ts:64
An inventory with all manifests related to an install.
monorepo?
optional monorepo: Monorepo;
Defined in: graph/src/graph.ts:59
A Monorepo instance, used for managing workspaces.
nodes
nodes: Map<DepID, Node>
Defined in: graph/src/graph.ts:74
Map registered dep ids to the node that represent them in the graph.
Implementation of
GraphLike.nodes
nodesByName
nodesByName: Map<string, Set<Node>>
Defined in: graph/src/graph.ts:79
Map of nodes by their name
projectRoot
projectRoot: string
Defined in: graph/src/graph.ts:109
The root of the project this graph represents
Implementation of
GraphLike.projectRoot
resolutions
resolutions: Map<string, Node>
Defined in: graph/src/graph.ts:84
Cached resolutions for spec lookups
resolutionsReverse
resolutionsReverse: Map<Node, Set<string>>
Defined in: graph/src/graph.ts:89
Reverse map of resolutions
Accessors
[toStringTag]
Get Signature
get toStringTag: string
Defined in: graph/src/graph.ts:48
Returns
string
Methods
[kCustomInspect]()
kCustomInspect: string
Defined in: graph/src/graph.ts:413
Parameters
_
number
options
InspectOptions
Returns
string
addEdge()
addEdge( type, spec, from, to?): Edge
Defined in: graph/src/graph.ts:193
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
type
spec
from
to?
Returns
Implementation of
GraphLike.addEdge
addNode()
addNode( id?, manifest?, spec?, name?, version?): Node
Defined in: graph/src/graph.ts:266
Create a new node in the graph.
Parameters
id?
manifest?
spec?
name?
string
version?
string
Returns
Implementation of
GraphLike.addNode
findResolution()
findResolution(spec, fromNode): undefined | Node
Defined in: graph/src/graph.ts:235
Find an existing node to satisfy a dependency
Parameters
spec
fromNode
Returns
undefined
| Node
gc()
gc(): Map<DepID, Node>
Defined in: graph/src/graph.ts:167
Delete all nodes that are unreachable from the importers. The collection of deleted nodes is returned.
NOTE: This can be extremely slow for large graphs, and is almost always unnecessary! 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
placePackage()
placePackage( fromNode, depType, spec, manifest?, id?): undefined | Node
Defined in: graph/src/graph.ts:310
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
fromNode
depType
spec
manifest?
id?
Returns
undefined
| Node
removeNode()
removeNode(node, replacement?): void
Defined in: graph/src/graph.ts:372
Removes a node and its relevant edges from the graph.
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
node
replacement?
Returns
void
toJSON()
toJSON(): LockfileData
Defined in: graph/src/graph.ts:405
Returns
Node
Defined in: graph/src/node.ts:21
Implements
Constructors
new Node()
new Node( options, id?, manifest?, spec?, name?, version?): Node
Defined in: graph/src/node.ts:202
Parameters
options
id?
manifest?
spec?
name?
string
version?
string
Returns
Properties
edgesIn
edgesIn: Set<Edge>
Defined in: graph/src/node.ts:83
List of edges coming into this node.
Implementation of
NodeLike.edgesIn
edgesOut
edgesOut: Map<string, Edge>
Defined in: graph/src/node.ts:89
List of edges from this node into other nodes. This usually represents that the connected node is a direct dependency of this node.
Implementation of
NodeLike.edgesOut
graph
graph: GraphLike
Defined in: graph/src/node.ts:109
A reference to the graph this node is a part of.
Implementation of
NodeLike.graph
id
id: DepID
Defined in: graph/src/node.ts:94
A reference to the DepID this node represents in the graph.
Implementation of
NodeLike.id
importer
importer: boolean = false
Defined in: graph/src/node.ts:99
True if this node is an importer node.
Implementation of
NodeLike.importer
integrity?
optional integrity: `sha512-${string}`;
Defined in: graph/src/node.ts:114
The manifest integrity value.
Implementation of
NodeLike.integrity
mainImporter
mainImporter: boolean = false
Defined in: graph/src/node.ts:104
True if this node is the project root node.
Implementation of
NodeLike.mainImporter
manifest?
optional manifest: Manifest;
Defined in: graph/src/node.ts:119
The manifest this node represents in the graph.
Implementation of
NodeLike.manifest
projectRoot
projectRoot: string
Defined in: graph/src/node.ts:124
Project where this node resides
Implementation of
NodeLike.projectRoot
registry?
optional registry: string;
Defined in: graph/src/node.ts:131
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?
optional resolved: string;
Defined in: graph/src/node.ts:157
An address PackageInfoClient may use to extract this package.
Implementation of
NodeLike.resolved
version?
optional version: string;
Defined in: graph/src/node.ts:152
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.
Implementation of
NodeLike.version
Accessors
[toStringTag]
Get Signature
get toStringTag: string
Defined in: graph/src/node.ts:22
Returns
string
dev
Get Signature
get dev(): boolean
Defined in: graph/src/node.ts:62
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): void
Defined in: graph/src/node.ts:65
Parameters
dev
boolean
Returns
void
Implementation of
NodeLike.dev
location
Get Signature
get location(): string
Defined in: graph/src/node.ts:162
The file system location for this node.
Returns
string
Set Signature
set location(location): void
Defined in: graph/src/node.ts:172
Parameters
location
string
Returns
void
Implementation of
NodeLike.location
name
Get Signature
get name(): string
Defined in: graph/src/node.ts:140
Returns
string
Implementation of
NodeLike.name
optional
Get Signature
get optional(): boolean
Defined in: graph/src/node.ts:37
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): void
Defined in: graph/src/node.ts:40
Parameters
optional
boolean
Returns
void
Implementation of
NodeLike.optional
Methods
addEdgesTo()
addEdgesTo( type, spec, node?): Edge
Defined in: graph/src/node.ts:308
Add an edge from this node connecting it to a direct dependency.
Parameters
type
spec
node?
Returns
equals()
equals(other): boolean
Defined in: graph/src/node.ts:258
Parameters
other
Returns
boolean
inVltStore()
inVltStore(): boolean
Defined in: graph/src/node.ts:240
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:76
Returns
this is Node & { dev: true }
isOptional()
isOptional(): this is Node & { optional: true }
Defined in: graph/src/node.ts:51
Returns
this is Node & { optional: true }
nodeModules()
nodeModules(scurry): string
Defined in: graph/src/node.ts:195
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
scurry
Returns
string
resolvedLocation()
resolvedLocation(scurry): string
Defined in: graph/src/node.ts:183
The resolved location of the node in the file system.
Parameters
scurry
Returns
string
setDefaultLocation()
setDefaultLocation(): void
Defined in: graph/src/node.ts:291
Returns
void
setImporterLocation()
setImporterLocation(location): void
Defined in: graph/src/node.ts:265
Sets the node as an importer along with its location.
Parameters
location
string
Returns
void
setResolved()
setResolved(): void
Defined in: graph/src/node.ts:275
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.setResolved
toJSON()
toJSON(): object
Defined in: graph/src/node.ts:315
Returns
object
dev
dev: boolean
id
id: DepID
importer
importer: boolean
integrity
integrity: undefined | `sha512-${string}`
location
location: string
manifest
manifest: undefined | Manifest
name
name: string
optional
optional: boolean
projectRoot
projectRoot: string
resolved
resolved: undefined | string
version
version: undefined | string
toString()
toString(): string
Defined in: graph/src/node.ts:331
Returns
string
Implementation of
NodeLike.toString
Type Aliases
ActualLoadOptions
type ActualLoadOptions = SpecOptions & object
Defined in: graph/src/actual/load.ts:17
Type declaration
loadManifests?
optional 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.
mainManifest?
optional mainManifest: Manifest;
The project root manifest.
monorepo?
optional monorepo: Monorepo;
A Monorepo object, for managing workspaces
packageJson
packageJson: PackageJson
A PackageJson object, for sharing manifest caches
projectRoot
projectRoot: string
The project root dirname.
scurry
scurry: PathScurry
A PathScurry object, for use in globs
skipHiddenLockfile?
optional skipHiddenLockfile: boolean;
If set to true
, then do not shortcut the process by reading the
hidden lockfile at node_modules/.vlt-lock.json
AddImportersDependenciesMap
type AddImportersDependenciesMap = Map< DepID, Map<string, Dependency>> & object
Defined in: graph/src/dependencies.ts:65
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
modifiedDependencies
modifiedDependencies: boolean
BuildIdealOptions
type BuildIdealOptions = ActualLoadOptions & object
Defined in: graph/src/ideal/build.ts:18
Type declaration
add?
optional 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
packageInfo: PackageInfoClient
A PackageInfoClient instance to read manifest info from.
remove?
optional 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.
Dependency
type Dependency = object
Defined in: graph/src/dependencies.ts:45
Parsed dependency entries info.
Type declaration
spec
spec: Spec
The parsed Spec object describing the dependency requirements.
type
type: DependencyTypeShort
The DependencyTypeShort, describing the type of dependency.
EdgeLike
type EdgeLike = object
Defined in: graph/src/types.ts:5
Type declaration
from
from: NodeLike
name
name: string
spec
spec: SpecLikeBase
to?
optional to: NodeLike;
type
type: DependencyTypeShort
EdgeMap
type EdgeMap = Map<NodeLike | undefined, TreeItem>
Defined in: graph/src/visualization/human-readable-output.ts:34
GraphLike
type GraphLike = object
Defined in: graph/src/types.ts:13
Type declaration
addEdge()
addEdge: (type, spec, from, to?) => EdgeLike
Parameters
type
spec
from
to?
Returns
addNode()
addNode: (id?, manifest?, spec?, name?, version?) => NodeLike
Parameters
id?
manifest?
spec?
name?
string
version?
string
Returns
edges
edges: Set<EdgeLike>
importers
importers: Set<NodeLike>
mainImporter
mainImporter: NodeLike
nodes
nodes: Map<DepID, NodeLike>
projectRoot
projectRoot: string
GraphOptions
type GraphOptions = SpecOptions & object
Defined in: graph/src/graph.ts:28
Type declaration
mainManifest
mainManifest: Manifest
The main importer manifest info.
manifests?
optional manifests: ManifestInventory;
An inventory of seen manifests.
monorepo?
optional monorepo: Monorepo;
A Monorepo object, for managing workspaces
projectRoot
projectRoot: string
Root of the project this graph represents
HumanReadableOutputGraph
type HumanReadableOutputGraph = object
Defined in: graph/src/visualization/human-readable-output.ts:27
Type declaration
edges
edges: EdgeLike[];
highlightSelection?
optional highlightSelection: boolean;
importers
importers: Set<NodeLike>
nodes
nodes: NodeLike[];
InstallOptions
type InstallOptions = ActualLoadOptions & object
Defined in: graph/src/install.ts:9
Type declaration
packageInfo
packageInfo: PackageInfoClient
packageJson
packageJson: PackageJson
projectRoot
projectRoot: string
JSONOutputGraph
type JSONOutputGraph = object
Defined in: graph/src/visualization/json-output.ts:31
Type declaration
edges
edges: EdgeLike[];
nodes
nodes: NodeLike[];
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
fromID?
optional fromID: DepID;
A reference to the id of the Node that this package is linked from.
name
name: string
The name of the package.
spec?
optional spec: string;
The dependency spec definition for this package.
to?
optional to: NodeLike;
A representation of the package object that fulfills this dependency.
type?
optional type: EdgeLike["type"];
The package type.
LockfileData
type LockfileData = object
Defined in: graph/src/lockfile/types.ts:17
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
edges
edges: LockfileEdges
nodes
nodes: Record<DepID, LockfileNode>
options
options: SpecOptions
LockfileEdgeKey
type LockfileEdgeKey = `${DepID} ${string}`
Defined in: graph/src/lockfile/types.ts:73
${from} ${dep name}
LockfileEdges
type LockfileEdges = object
Defined in: graph/src/lockfile/types.ts:68
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:76
${type} ${spec} ${to}
LockfileLoadOptions
type LockfileLoadOptions = SpecOptions & object
Defined in: graph/src/lockfile/load.ts:13
Type declaration
mainManifest
mainManifest: Manifest
The project root manifest.
monorepo?
optional monorepo: Monorepo;
A Monorepo object, for managing workspaces
packageJson?
optional packageJson: PackageJson;
A PackageJson object, for sharing manifest caches
projectRoot
projectRoot: string
The project root dirname.
scurry?
optional scurry: PathScurry;
A PathScurry object, for use in globs
LockfileNode
type LockfileNode = [ LockfileNodeFlags, string | null, Integrity | null, string | null, string | null, Manifest | null,]
Defined in: graph/src/lockfile/types.ts:50
Lockfile representation of a node from the install graph.
LockfileNodeFlags
type LockfileNodeFlags = 0 | 1 | 2 | 3
Defined in: graph/src/lockfile/types.ts:45
Bit flags indicating whether a node is optional and/or dev.
ManifestInventory
type ManifestInventory = Map<DepID, Manifest>
Defined in: graph/src/graph.ts:23
MermaidOutputGraph
type MermaidOutputGraph = object
Defined in: graph/src/visualization/mermaid-output.ts:6
Type declaration
edges
edges: EdgeLike[];
importers
importers: Set<NodeLike>
nodes
nodes: NodeLike[];
NodeLike
type NodeLike = object
Defined in: graph/src/types.ts:34
Type declaration
dev
dev: boolean
edgesIn
edgesIn: Set<EdgeLike>
edgesOut
edgesOut: Map<string, EdgeLike>
graph
graph: GraphLike
id
id: DepID
importer
importer: boolean
integrity?
optional integrity: string | null;
location?
optional location: string;
mainImporter
mainImporter: boolean
manifest?
optional manifest: Manifest | null;
name?
optional name: string | null;
optional
optional: boolean
projectRoot
projectRoot: string
resolved?
optional resolved: string | null;
version?
optional version: string | null;
setResolved()
Returns
void
toString()
Returns
string
NodeOptions
type NodeOptions = SpecOptions & object
Defined in: graph/src/node.ts:16
Type declaration
graph
graph: GraphLike
projectRoot
projectRoot: string
RawDependency
type RawDependency = object
Defined in: graph/src/dependencies.ts:35
Dependency entries info as defined in a package.json file.
Type declaration
bareSpec
bareSpec: string
name
name: string
registry?
optional registry: string;
type
type: DependencyTypeLong
ReifyOptions
type ReifyOptions = ActualLoadOptions & object
Defined in: graph/src/reify/index.ts:33
Type declaration
actual?
optional actual: Graph;
add?
optional add: AddImportersDependenciesMap;
graph
graph: Graph
packageInfo
packageInfo: PackageInfoClient
remove?
optional remove: RemoveImportersDependenciesMap;
RemoveImportersDependenciesMap
type RemoveImportersDependenciesMap = Map<DepID, Set<string>> & object
Defined in: graph/src/dependencies.ts:78
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
modifiedDependencies
modifiedDependencies: boolean
SaveOptions
type SaveOptions = SpecOptions & object
Defined in: graph/src/lockfile/save.ts:24
Type declaration
graph
graph: Graph
The graph to be stored in the lockfile.
saveManifests?
optional saveManifests: boolean;
Should it save manifest data in the lockfile?
TreeItem
type TreeItem = object
Defined in: graph/src/visualization/human-readable-output.ts:15
Type declaration
deduped
deduped: boolean
edge
edge: EdgeLike | undefined
hasSibling
hasSibling: boolean
include
include: boolean
name?
optional name: string | null;
node
node: NodeLike | undefined
padding
padding: string
parent
parent: TreeItem | undefined
prefix
prefix: string
TreeMap
type TreeMap = Map<EdgeLike | undefined, EdgeMap>
Defined in: graph/src/visualization/human-readable-output.ts:36
UninstallOptions
type UninstallOptions = ActualLoadOptions & object
Defined in: graph/src/uninstall.ts:9
Type declaration
packageInfo
packageInfo: PackageInfoClient
packageJson
packageJson: PackageJson
projectRoot
projectRoot: string
Variables
actual
const actual: object
Defined in: graph/src/index.ts:17
Type declaration
load()
load: options => (Graph = actualLoad)
Read the file system looking for node_modules
folders and returns a
new Graph that represents the relationship between the
dependencies found.
Parameters
options
Returns
ideal
const ideal: object
Defined in: graph/src/index.ts:37
Type declaration
build()
build: options => Promise<Graph>
Builds an ideal Graph representing the dependencies that
should be present in order to fulfill the requirements defined by the
package.json
and vlt-lock.json
files using either the virtual or
actual graph as a starting point. Also add / remove any dependencies
listed in the add
and remove
properties.
Parameters
options
Returns
Promise
<Graph
>
lockfile
const lockfile: object
Defined in: graph/src/index.ts:24
Type declaration
load()
load: options => (Graph = lockfileLoad)
Parameters
options
Returns
loadEdges()
loadEdges: (graph, edges, options) => void;
Parameters
graph
edges
options
Returns
void
loadNodes()
loadNodes: (graph, nodes) => void;
Parameters
graph
nodes
Record
<DepID
,
LockfileNode
>
Returns
void
save()
save: (options) => void;
Parameters
options
Returns
void
LockfileNodeFlagDev
const LockfileNodeFlagDev: 2 = 2
Defined in: graph/src/lockfile/types.ts:39
LockfileNodeFlagDevOptional
const LockfileNodeFlagDevOptional: 3 = 3
Defined in: graph/src/lockfile/types.ts:40
LockfileNodeFlagNone
const LockfileNodeFlagNone: 0 = 0
Defined in: graph/src/lockfile/types.ts:37
LockfileNodeFlagOptional
const LockfileNodeFlagOptional: 1 = 1
Defined in: graph/src/lockfile/types.ts:38
Functions
asDependency()
function asDependency(obj): Dependency
Defined in: graph/src/dependencies.ts:94
Parameters
obj
unknown
Returns
asDependencyTypeShort()
function asDependencyTypeShort(obj): DependencyTypeShort
Defined in: graph/src/dependencies.ts:20
Parameters
obj
unknown
Returns
getBooleanFlagsFromNum()
function getBooleanFlagsFromNum(flags): object
Defined in: graph/src/lockfile/types.ts:32
Parameters
flags
Returns
object
dev
dev: boolean
optional
optional: boolean
getFlagNumFromNode()
function getFlagNumFromNode(node): 0 | 1 | 2 | 3
Defined in: graph/src/lockfile/types.ts:23
Parameters
node
dev
boolean
optional
boolean
Returns
0
| 1
| 2
| 3
humanReadableOutput()
function humanReadableOutput( options, __namedParameters,): undefined | null | string
Defined in: graph/src/visualization/human-readable-output.ts:98
Returns a human-readable output of the graph.
Parameters
options
__namedParameters
colors
ChalkInstance
Returns
undefined
| null
| string
install()
function install( options, add?,): Promise<{ diff: Diff graph: Graph}>
Defined in: graph/src/install.ts:15
Parameters
options
add?
Returns
Promise
<{ diff
: Diff
; graph
: Graph
; }>
isDependency()
function isDependency(o): o is Dependency
Defined in: graph/src/dependencies.ts:87
Parameters
o
unknown
Returns
o is Dependency
isDependencyTypeShort()
function isDependencyTypeShort(obj): obj is DependencyTypeShort
Defined in: graph/src/dependencies.ts:15
Parameters
obj
unknown
Returns
obj is DependencyTypeShort
jsonOutput()
function jsonOutput(__namedParameters): JSONOutputItem[]
Defined in: graph/src/visualization/json-output.ts:39
Returns a JSON string representation of the graph.
Parameters
__namedParameters
Returns
mermaidOutput()
function mermaidOutput(__namedParameters): string
Defined in: graph/src/visualization/mermaid-output.ts:67
Returns a mermaid string representation of the graph.
Parameters
__namedParameters
Returns
string
reify()
function reify(options): Promise<Diff>
Defined in: graph/src/reify/index.ts:44
Make the current project match the supplied graph.
Parameters
options
Returns
Promise
<Diff
>
shorten()
function shorten(typeLong, name?, manifest?): DependencyTypeShort
Defined in: graph/src/dependencies.ts:104
Get the DependencyTypeShort from a DependencyTypeLong.
Parameters
typeLong
name?
string
manifest?
Returns
stringifyNode()
function stringifyNode(node?): string
Defined in: graph/src/stringify-node.ts:4
Parameters
node?
Returns
string
uninstall()
function uninstall( options, remove?,): Promise<{ diff: Diff graph: Graph}>
Defined in: graph/src/uninstall.ts:15
Parameters
options
remove?
RemoveImportersDependenciesMap