@vltpkg/graph 0.0.0-9 → 1.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -1
- package/dist/esm/actual/load.d.ts +49 -3
- package/dist/esm/actual/load.d.ts.map +1 -1
- package/dist/esm/actual/load.js +146 -74
- package/dist/esm/actual/load.js.map +1 -1
- package/dist/esm/browser.d.ts +8 -4
- package/dist/esm/browser.d.ts.map +1 -1
- package/dist/esm/browser.js +6 -2
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/build.d.ts +29 -0
- package/dist/esm/build.d.ts.map +1 -0
- package/dist/esm/build.js +79 -0
- package/dist/esm/build.js.map +1 -0
- package/dist/esm/dependencies.d.ts +10 -3
- package/dist/esm/dependencies.d.ts.map +1 -1
- package/dist/esm/dependencies.js +63 -0
- package/dist/esm/dependencies.js.map +1 -1
- package/dist/esm/diff.d.ts +69 -0
- package/dist/esm/diff.d.ts.map +1 -1
- package/dist/esm/diff.js +25 -0
- package/dist/esm/diff.js.map +1 -1
- package/dist/esm/edge.d.ts +8 -2
- package/dist/esm/edge.d.ts.map +1 -1
- package/dist/esm/edge.js +12 -0
- package/dist/esm/edge.js.map +1 -1
- package/dist/esm/fixup-added-names.d.ts +16 -0
- package/dist/esm/fixup-added-names.d.ts.map +1 -0
- package/dist/esm/fixup-added-names.js +31 -0
- package/dist/esm/fixup-added-names.js.map +1 -0
- package/dist/esm/graph.d.ts +34 -10
- package/dist/esm/graph.d.ts.map +1 -1
- package/dist/esm/graph.js +150 -24
- package/dist/esm/graph.js.map +1 -1
- package/dist/esm/ideal/append-nodes.d.ts +12 -1
- package/dist/esm/ideal/append-nodes.d.ts.map +1 -1
- package/dist/esm/ideal/append-nodes.js +303 -53
- package/dist/esm/ideal/append-nodes.js.map +1 -1
- package/dist/esm/ideal/build-ideal-from-starting-graph.d.ts +4 -4
- package/dist/esm/ideal/build-ideal-from-starting-graph.d.ts.map +1 -1
- package/dist/esm/ideal/build-ideal-from-starting-graph.js +35 -16
- package/dist/esm/ideal/build-ideal-from-starting-graph.js.map +1 -1
- package/dist/esm/ideal/build.d.ts +9 -0
- package/dist/esm/ideal/build.d.ts.map +1 -1
- package/dist/esm/ideal/build.js +31 -1
- package/dist/esm/ideal/build.js.map +1 -1
- package/dist/esm/ideal/get-importer-specs.d.ts +11 -3
- package/dist/esm/ideal/get-importer-specs.d.ts.map +1 -1
- package/dist/esm/ideal/get-importer-specs.js +86 -9
- package/dist/esm/ideal/get-importer-specs.js.map +1 -1
- package/dist/esm/ideal/get-ordered-dependencies.d.ts +10 -0
- package/dist/esm/ideal/get-ordered-dependencies.d.ts.map +1 -0
- package/dist/esm/ideal/get-ordered-dependencies.js +42 -0
- package/dist/esm/ideal/get-ordered-dependencies.js.map +1 -0
- package/dist/esm/ideal/peers.d.ts +71 -0
- package/dist/esm/ideal/peers.d.ts.map +1 -0
- package/dist/esm/ideal/peers.js +318 -0
- package/dist/esm/ideal/peers.js.map +1 -0
- package/dist/esm/ideal/refresh-ideal-graph.d.ts +48 -0
- package/dist/esm/ideal/refresh-ideal-graph.d.ts.map +1 -0
- package/dist/esm/ideal/refresh-ideal-graph.js +79 -0
- package/dist/esm/ideal/refresh-ideal-graph.js.map +1 -0
- package/dist/esm/ideal/types.d.ts +78 -1
- package/dist/esm/ideal/types.d.ts.map +1 -1
- package/dist/esm/ideal/types.js.map +1 -1
- package/dist/esm/index.d.ts +9 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install.d.ts +10 -4
- package/dist/esm/install.d.ts.map +1 -1
- package/dist/esm/install.js +191 -20
- package/dist/esm/install.js.map +1 -1
- package/dist/esm/lockfile/load-edges.d.ts +8 -1
- package/dist/esm/lockfile/load-edges.d.ts.map +1 -1
- package/dist/esm/lockfile/load-edges.js +80 -15
- package/dist/esm/lockfile/load-edges.js.map +1 -1
- package/dist/esm/lockfile/load-nodes.d.ts +3 -2
- package/dist/esm/lockfile/load-nodes.d.ts.map +1 -1
- package/dist/esm/lockfile/load-nodes.js +85 -13
- package/dist/esm/lockfile/load-nodes.js.map +1 -1
- package/dist/esm/lockfile/load.d.ts +18 -5
- package/dist/esm/lockfile/load.d.ts.map +1 -1
- package/dist/esm/lockfile/load.js +28 -20
- package/dist/esm/lockfile/load.js.map +1 -1
- package/dist/esm/lockfile/save.d.ts +16 -3
- package/dist/esm/lockfile/save.d.ts.map +1 -1
- package/dist/esm/lockfile/save.js +64 -17
- package/dist/esm/lockfile/save.js.map +1 -1
- package/dist/esm/lockfile/types.d.ts +34 -4
- package/dist/esm/lockfile/types.d.ts.map +1 -1
- package/dist/esm/lockfile/types.js +31 -0
- package/dist/esm/lockfile/types.js.map +1 -1
- package/dist/esm/modifiers.d.ts +189 -0
- package/dist/esm/modifiers.d.ts.map +1 -0
- package/dist/esm/modifiers.js +330 -0
- package/dist/esm/modifiers.js.map +1 -0
- package/dist/esm/node.d.ts +91 -6
- package/dist/esm/node.d.ts.map +1 -1
- package/dist/esm/node.js +119 -5
- package/dist/esm/node.js.map +1 -1
- package/dist/esm/reify/add-edge.d.ts +1 -2
- package/dist/esm/reify/add-edge.d.ts.map +1 -1
- package/dist/esm/reify/add-edge.js +29 -18
- package/dist/esm/reify/add-edge.js.map +1 -1
- package/dist/esm/reify/add-edges.d.ts +1 -2
- package/dist/esm/reify/add-edges.d.ts.map +1 -1
- package/dist/esm/reify/add-edges.js +3 -3
- package/dist/esm/reify/add-edges.js.map +1 -1
- package/dist/esm/reify/add-nodes.d.ts.map +1 -1
- package/dist/esm/reify/add-nodes.js +4 -27
- package/dist/esm/reify/add-nodes.js.map +1 -1
- package/dist/esm/reify/bin-chmod.d.ts +11 -0
- package/dist/esm/reify/bin-chmod.d.ts.map +1 -0
- package/dist/esm/reify/bin-chmod.js +39 -0
- package/dist/esm/reify/bin-chmod.js.map +1 -0
- package/dist/esm/reify/build.d.ts +10 -1
- package/dist/esm/reify/build.d.ts.map +1 -1
- package/dist/esm/reify/build.js +36 -23
- package/dist/esm/reify/build.js.map +1 -1
- package/dist/esm/reify/calculate-save-value.d.ts +3 -0
- package/dist/esm/reify/calculate-save-value.d.ts.map +1 -0
- package/dist/esm/reify/calculate-save-value.js +45 -0
- package/dist/esm/reify/calculate-save-value.js.map +1 -0
- package/dist/esm/reify/check-needed-build.d.ts +25 -0
- package/dist/esm/reify/check-needed-build.d.ts.map +1 -0
- package/dist/esm/reify/check-needed-build.js +50 -0
- package/dist/esm/reify/check-needed-build.js.map +1 -0
- package/dist/esm/reify/delete-edge.d.ts.map +1 -1
- package/dist/esm/reify/delete-edge.js +3 -4
- package/dist/esm/reify/delete-edge.js.map +1 -1
- package/dist/esm/reify/extract-node.d.ts +24 -0
- package/dist/esm/reify/extract-node.d.ts.map +1 -0
- package/dist/esm/reify/extract-node.js +84 -0
- package/dist/esm/reify/extract-node.js.map +1 -0
- package/dist/esm/reify/index.d.ts +18 -1
- package/dist/esm/reify/index.d.ts.map +1 -1
- package/dist/esm/reify/index.js +85 -15
- package/dist/esm/reify/index.js.map +1 -1
- package/dist/esm/reify/internal-hoist.d.ts +9 -0
- package/dist/esm/reify/internal-hoist.d.ts.map +1 -0
- package/dist/esm/reify/internal-hoist.js +134 -0
- package/dist/esm/reify/internal-hoist.js.map +1 -0
- package/dist/esm/reify/update-importers-package-json.d.ts +1 -1
- package/dist/esm/reify/update-importers-package-json.d.ts.map +1 -1
- package/dist/esm/reify/update-importers-package-json.js +33 -24
- package/dist/esm/reify/update-importers-package-json.js.map +1 -1
- package/dist/esm/remove-optional-subgraph.js +1 -1
- package/dist/esm/remove-optional-subgraph.js.map +1 -1
- package/dist/esm/resolve-save-type.d.ts +1 -2
- package/dist/esm/resolve-save-type.d.ts.map +1 -1
- package/dist/esm/resolve-save-type.js.map +1 -1
- package/dist/esm/stringify-node.d.ts +1 -1
- package/dist/esm/stringify-node.d.ts.map +1 -1
- package/dist/esm/stringify-node.js +10 -1
- package/dist/esm/stringify-node.js.map +1 -1
- package/dist/esm/transfer-data/load.d.ts +44 -0
- package/dist/esm/transfer-data/load.d.ts.map +1 -0
- package/dist/esm/transfer-data/load.js +176 -0
- package/dist/esm/transfer-data/load.js.map +1 -0
- package/dist/esm/uninstall.d.ts +5 -4
- package/dist/esm/uninstall.d.ts.map +1 -1
- package/dist/esm/uninstall.js +61 -19
- package/dist/esm/uninstall.js.map +1 -1
- package/dist/esm/update.d.ts +13 -0
- package/dist/esm/update.d.ts.map +1 -0
- package/dist/esm/update.js +73 -0
- package/dist/esm/update.js.map +1 -0
- package/dist/esm/virtual-root.d.ts +16 -0
- package/dist/esm/virtual-root.d.ts.map +1 -0
- package/dist/esm/virtual-root.js +79 -0
- package/dist/esm/virtual-root.js.map +1 -0
- package/dist/esm/visualization/human-readable-output.d.ts +4 -5
- package/dist/esm/visualization/human-readable-output.d.ts.map +1 -1
- package/dist/esm/visualization/human-readable-output.js +47 -19
- package/dist/esm/visualization/human-readable-output.js.map +1 -1
- package/dist/esm/visualization/json-output.d.ts +7 -2
- package/dist/esm/visualization/json-output.d.ts.map +1 -1
- package/dist/esm/visualization/json-output.js +35 -12
- package/dist/esm/visualization/json-output.js.map +1 -1
- package/dist/esm/visualization/mermaid-output.d.ts +7 -1
- package/dist/esm/visualization/mermaid-output.d.ts.map +1 -1
- package/dist/esm/visualization/mermaid-output.js +110 -14
- package/dist/esm/visualization/mermaid-output.js.map +1 -1
- package/dist/esm/visualization/object-like-output.d.ts +1 -1
- package/dist/esm/visualization/object-like-output.d.ts.map +1 -1
- package/dist/esm/visualization/object-like-output.js.map +1 -1
- package/package.json +35 -29
- package/dist/esm/ideal/add-nodes.d.ts +0 -19
- package/dist/esm/ideal/add-nodes.d.ts.map +0 -1
- package/dist/esm/ideal/add-nodes.js +0 -32
- package/dist/esm/ideal/add-nodes.js.map +0 -1
- package/dist/esm/ideal/remove-nodes.d.ts +0 -7
- package/dist/esm/ideal/remove-nodes.d.ts.map +0 -1
- package/dist/esm/ideal/remove-nodes.js +0 -19
- package/dist/esm/ideal/remove-nodes.js.map +0 -1
- package/dist/esm/reify/bin-paths.d.ts +0 -4
- package/dist/esm/reify/bin-paths.d.ts.map +0 -1
- package/dist/esm/reify/bin-paths.js +0 -23
- package/dist/esm/reify/bin-paths.js.map +0 -1
- package/dist/esm/types.d.ts +0 -42
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { parseBreadcrumb, specificitySort, } from '@vltpkg/dss-breadcrumb';
|
|
2
|
+
import { error } from '@vltpkg/error-cause';
|
|
3
|
+
import { Spec } from '@vltpkg/spec';
|
|
4
|
+
import { asNormalizedManifest, assertRecordStringString, normalizeManifest, } from '@vltpkg/types';
|
|
5
|
+
import { load } from '@vltpkg/vlt-json';
|
|
6
|
+
/**
|
|
7
|
+
* Class representing loaded modifiers configuration for a project.
|
|
8
|
+
*
|
|
9
|
+
* Instances of this class can be used as a helper to modify the graph
|
|
10
|
+
* during the graph build ideal traversal time.
|
|
11
|
+
*
|
|
12
|
+
* ```
|
|
13
|
+
* const modifier = new GraphModifier(options)
|
|
14
|
+
* modifier.load(options)
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* The `tryImporter` method can be used to register the initial importer
|
|
18
|
+
* node along with any modifier that includes an importer selector, e.g:
|
|
19
|
+
* `modifier.tryImporter(graph.mainImporter)`
|
|
20
|
+
*
|
|
21
|
+
* When traversing the graph, use the `tryNewDependency` method to check
|
|
22
|
+
* if a given dependency spec to the current traversed node has matching
|
|
23
|
+
* registered modifiers, e.g:
|
|
24
|
+
* `const entries = modifier.tryNewDependency(fromNode, depSpec)`
|
|
25
|
+
*
|
|
26
|
+
* Use `updateActiveEntry` to update a given active modifier entry state
|
|
27
|
+
* with the current node of the graph being traversed. e.g:
|
|
28
|
+
* ```
|
|
29
|
+
* for (const entry of entries)
|
|
30
|
+
* modifier.updateActiveEntry(fromNode, entry)
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export class GraphModifier {
|
|
34
|
+
/** The loaded modifiers configuration */
|
|
35
|
+
#config;
|
|
36
|
+
/** A set of all modifiers loaded from vlt.json */
|
|
37
|
+
#modifiers = new Set();
|
|
38
|
+
/** A set of all edge modifiers loaded from vlt.json */
|
|
39
|
+
#edgeModifiers = new Set();
|
|
40
|
+
/** A set of all node modifiers loaded from vlt.json */
|
|
41
|
+
#nodeModifiers = new Set();
|
|
42
|
+
/**
|
|
43
|
+
* A map of initial entries, keyed by the name of the first breadcrumb
|
|
44
|
+
* item to its modifier entry. Useful for checking for non-importer
|
|
45
|
+
* starting breadcrumbs, e.g: `#a > #b`
|
|
46
|
+
*/
|
|
47
|
+
#initialEntries = new Map();
|
|
48
|
+
/**
|
|
49
|
+
* A multi-level map of active entries, keyed by:
|
|
50
|
+
* - modifiers
|
|
51
|
+
* - edge name
|
|
52
|
+
* - from node
|
|
53
|
+
* that allows for retrieving seen {@link ModifierActiveEntry} instances
|
|
54
|
+
* in constant time.
|
|
55
|
+
*/
|
|
56
|
+
#activeEntries = new Map();
|
|
57
|
+
/**
|
|
58
|
+
* A set of currently active modifiers, which are being parsed.
|
|
59
|
+
*/
|
|
60
|
+
activeModifiers = new Set();
|
|
61
|
+
/** A set of all modifier string values loaded from vlt.json */
|
|
62
|
+
modifierNames = new Set();
|
|
63
|
+
constructor(options) {
|
|
64
|
+
this.load(options);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Load the modifiers definitions from vlt.json,
|
|
68
|
+
* converting the result into a GraphModifierConfigObject
|
|
69
|
+
*/
|
|
70
|
+
get config() {
|
|
71
|
+
if (this.#config)
|
|
72
|
+
return this.#config;
|
|
73
|
+
return (this.#config =
|
|
74
|
+
load('modifiers', assertRecordStringString) ?? {});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Loads the modifiers defined in `vlt.json` into memory.
|
|
78
|
+
*/
|
|
79
|
+
load(options) {
|
|
80
|
+
for (const [key, value] of Object.entries(this.config)) {
|
|
81
|
+
this.modifierNames.add(key);
|
|
82
|
+
const breadcrumb = parseBreadcrumb(key);
|
|
83
|
+
/* c8 ignore start - should not be possible */
|
|
84
|
+
if (!breadcrumb.last.name) {
|
|
85
|
+
throw error('Could not find name in breadcrumb', {
|
|
86
|
+
found: key,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/* c8 ignore stop */
|
|
90
|
+
let mod;
|
|
91
|
+
if (typeof value === 'string') {
|
|
92
|
+
mod = {
|
|
93
|
+
breadcrumb,
|
|
94
|
+
query: key,
|
|
95
|
+
refs: new Set(),
|
|
96
|
+
spec: Spec.parse(breadcrumb.last.name, value, options),
|
|
97
|
+
type: 'edge',
|
|
98
|
+
value,
|
|
99
|
+
};
|
|
100
|
+
this.#edgeModifiers.add(mod);
|
|
101
|
+
/* c8 ignore start - TODO */
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const manifest = asNormalizedManifest(normalizeManifest(value));
|
|
105
|
+
mod = {
|
|
106
|
+
breadcrumb,
|
|
107
|
+
query: key,
|
|
108
|
+
manifest,
|
|
109
|
+
refs: new Set(),
|
|
110
|
+
type: 'node',
|
|
111
|
+
value: manifest,
|
|
112
|
+
};
|
|
113
|
+
this.#nodeModifiers.add(mod);
|
|
114
|
+
}
|
|
115
|
+
/* c8 ignore end */
|
|
116
|
+
this.#modifiers.add(mod);
|
|
117
|
+
// if the breadcrumb starts with an id, then add it to the
|
|
118
|
+
// map of initial entries, so that we can use it to match
|
|
119
|
+
if (breadcrumb.first.name) {
|
|
120
|
+
const initialSet = this.#initialEntries.get(breadcrumb.first.name) ?? new Set();
|
|
121
|
+
initialSet.add(mod);
|
|
122
|
+
this.#initialEntries.set(breadcrumb.first.name, initialSet);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Try matching the provided node against the top-level selectors. In case
|
|
128
|
+
* a match is found it will also register the active entry modifier and
|
|
129
|
+
* update the active entry to the current importer node.
|
|
130
|
+
*/
|
|
131
|
+
tryImporter(importer) {
|
|
132
|
+
for (const modifier of this.#modifiers) {
|
|
133
|
+
// if the first item in the breadcrumb is an importer and it matches
|
|
134
|
+
// any of the valid top-level selectors, then register the modifier
|
|
135
|
+
const { first } = modifier.breadcrumb;
|
|
136
|
+
const matchRoot = first.value === ':root' && importer.mainImporter;
|
|
137
|
+
const matchWorkspace = first.value === ':workspace' && importer.importer;
|
|
138
|
+
const matchAny = first.value === ':project' || matchRoot || matchWorkspace;
|
|
139
|
+
if (first.importer && matchAny) {
|
|
140
|
+
const active = this.newModifier(importer, modifier);
|
|
141
|
+
const single = active.modifier.breadcrumb.single;
|
|
142
|
+
// only the importers will update the active entry right after
|
|
143
|
+
// registering it since tryImporter doesn't try to match from
|
|
144
|
+
// active dependencies
|
|
145
|
+
if (!single) {
|
|
146
|
+
this.updateActiveEntry(importer, active);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Try matching the provided node and spec to the current
|
|
153
|
+
* active parsing modifier entries along with possible starting-level
|
|
154
|
+
* modifiers.
|
|
155
|
+
*
|
|
156
|
+
* Any entries in which the breachcrumb have already reached its last
|
|
157
|
+
* element will be prioritized, along with checking for specificity,
|
|
158
|
+
* the complete entry with the highest specificity will be returned or just
|
|
159
|
+
* the entry with the highest specificity if no complete entry is found.
|
|
160
|
+
* Returns `undefined` if no matching entry is found.
|
|
161
|
+
*
|
|
162
|
+
* This method works with the assumption that it's going to be called
|
|
163
|
+
* during a graph traversal, such that any ascendent has been checked
|
|
164
|
+
* and the active modifier entry state has been updated in the previous
|
|
165
|
+
* iteration.
|
|
166
|
+
*/
|
|
167
|
+
tryNewDependency(from, spec) {
|
|
168
|
+
const { name, semver } = spec;
|
|
169
|
+
// here we use a map instead of a set so that we can associate each
|
|
170
|
+
// modifier active entry with its breadcrumb so that it's easier to
|
|
171
|
+
// pick the correct entry when we sort breadcrbumbs by specificity
|
|
172
|
+
const all = new Map();
|
|
173
|
+
for (const modifier of this.#modifiers) {
|
|
174
|
+
// if an active entry is found then returns that
|
|
175
|
+
const entry = this.#activeEntries
|
|
176
|
+
.get(modifier)
|
|
177
|
+
?.get(name)
|
|
178
|
+
?.get(from);
|
|
179
|
+
if (entry) {
|
|
180
|
+
all.set(entry.modifier.breadcrumb, entry);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// matches the name against the initial entries, this will make it so
|
|
184
|
+
// that modifier queries that start with a name (e.g: #a > #b) can
|
|
185
|
+
// match at any point of the graph traversal
|
|
186
|
+
const initialSet = this.#initialEntries.get(name) ?? new Set();
|
|
187
|
+
for (const initial of initialSet) {
|
|
188
|
+
const initialEntry =
|
|
189
|
+
/* c8 ignore next - difficult to test branch */
|
|
190
|
+
this.#activeEntries.get(initial)?.get(name)?.get(from) ??
|
|
191
|
+
this.newModifier(from, initial);
|
|
192
|
+
all.set(initialEntry.modifier.breadcrumb, initialEntry);
|
|
193
|
+
}
|
|
194
|
+
// selects the active entry that should apply to this dependency,
|
|
195
|
+
// any active entry that is done parsing has the priority, if we
|
|
196
|
+
// find multiple entries then we use css specificity to pick a winner
|
|
197
|
+
// if we have multiple matches but no active entry is complete, then
|
|
198
|
+
// we pick the one with the highest specificity breadcrumb
|
|
199
|
+
const arr = [...all.values()];
|
|
200
|
+
const completeEntries = arr.filter(active => active.interactiveBreadcrumb.current ===
|
|
201
|
+
active.modifier.breadcrumb.last);
|
|
202
|
+
// deregister completed entries
|
|
203
|
+
for (const entry of completeEntries) {
|
|
204
|
+
this.deregisterModifier(entry.modifier);
|
|
205
|
+
}
|
|
206
|
+
// returns the highest specificity entry from either the complete entries
|
|
207
|
+
// if any were found or from any of the entries if available, otherwise
|
|
208
|
+
// it will return undefined as no entry is found in the `all` map
|
|
209
|
+
const entries = completeEntries.length ? completeEntries : arr;
|
|
210
|
+
return all.get(specificitySort(entries
|
|
211
|
+
// here we filter out any entries that do not match the
|
|
212
|
+
// pseudo selector comparators used in the breadcrumb item
|
|
213
|
+
.filter(i => i.interactiveBreadcrumb.current?.comparator({
|
|
214
|
+
semver,
|
|
215
|
+
}))
|
|
216
|
+
.map(i => i.modifier.breadcrumb))[0]);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Returns the set of {@link ModifierActiveEntry} instances that matches
|
|
220
|
+
* the provided {@link Dependency} specs for a given node.
|
|
221
|
+
*
|
|
222
|
+
* This method is mostly a helper to {@link GraphModifier.tryNewDependency}
|
|
223
|
+
* that handles the registered modifiers traversal lookup.
|
|
224
|
+
*/
|
|
225
|
+
tryDependencies(from, dependencies) {
|
|
226
|
+
const modifierRefs = new Map();
|
|
227
|
+
for (const { spec } of dependencies) {
|
|
228
|
+
const active = this.tryNewDependency(from, spec);
|
|
229
|
+
if (active) {
|
|
230
|
+
modifierRefs.set(spec.name, active);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return modifierRefs;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Updates an active entry state keeping track of items in the multi-level
|
|
237
|
+
* active entries map. If the current breadcrumb state shows there's no more
|
|
238
|
+
* items left, then we deregister the modifier.
|
|
239
|
+
*/
|
|
240
|
+
updateActiveEntry(from, active) {
|
|
241
|
+
const { modifier } = active;
|
|
242
|
+
const interactiveBreadcrumb = active.interactiveBreadcrumb.next();
|
|
243
|
+
const name = interactiveBreadcrumb.current?.name;
|
|
244
|
+
// if there's no name, or we're done parsing then we
|
|
245
|
+
// deregister the modifier instead of updating the entry
|
|
246
|
+
if (interactiveBreadcrumb.done || !name) {
|
|
247
|
+
this.deregisterModifier(modifier);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// register the active modifier
|
|
251
|
+
this.activeModifiers.add(active);
|
|
252
|
+
active.modifier.refs.add({ from, name });
|
|
253
|
+
// optionally read or create the nested maps
|
|
254
|
+
const nameMap = this.#activeEntries.get(modifier) ??
|
|
255
|
+
new Map();
|
|
256
|
+
this.#activeEntries.set(modifier, nameMap);
|
|
257
|
+
const nodeMap = nameMap.get(name) ?? new Map();
|
|
258
|
+
nameMap.set(name, nodeMap);
|
|
259
|
+
// sets the active entry in the map
|
|
260
|
+
nodeMap.set(from, active);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Creates a new active modifier.
|
|
264
|
+
*/
|
|
265
|
+
newModifier(from, modifier) {
|
|
266
|
+
return {
|
|
267
|
+
modifier,
|
|
268
|
+
interactiveBreadcrumb: modifier.breadcrumb.interactive(),
|
|
269
|
+
originalFrom: from,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Removes a previously registered modifier from the active entries.
|
|
274
|
+
*/
|
|
275
|
+
deregisterModifier(modifier) {
|
|
276
|
+
for (const { from, name } of modifier.refs) {
|
|
277
|
+
const nodeMap = this.#activeEntries.get(modifier)?.get(name);
|
|
278
|
+
if (nodeMap) {
|
|
279
|
+
// if an entry is found, we remove it from the active set
|
|
280
|
+
const entry = nodeMap.get(from);
|
|
281
|
+
if (entry) {
|
|
282
|
+
this.activeModifiers.delete(entry);
|
|
283
|
+
}
|
|
284
|
+
// then we remove the entry from the map
|
|
285
|
+
nodeMap.delete(from);
|
|
286
|
+
// if the map is empty, we remove it from the active entries map
|
|
287
|
+
if (!nodeMap.size) {
|
|
288
|
+
this.#activeEntries.get(modifier)?.delete(name);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Operates in previously registered nodes and edges in order to put
|
|
295
|
+
* back in place any of the original edges that were referenced to in
|
|
296
|
+
* active (ongoing) breadcrumb parsing entries that were never completed.
|
|
297
|
+
*
|
|
298
|
+
* This method can be used to easily rollback any pending operations
|
|
299
|
+
* once the graph traversal is done.
|
|
300
|
+
*/
|
|
301
|
+
rollbackActiveEntries() {
|
|
302
|
+
for (const modifier of this.activeModifiers) {
|
|
303
|
+
// if the modifier has an original edge, we can put it back in place
|
|
304
|
+
if (modifier.originalEdge) {
|
|
305
|
+
modifier.originalFrom.edgesOut.set(modifier.originalEdge.spec.name, modifier.originalEdge);
|
|
306
|
+
}
|
|
307
|
+
// then we deregister the modifier
|
|
308
|
+
this.deregisterModifier(modifier.modifier);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Convenience method to instantiate and load in one call.
|
|
313
|
+
* Returns undefined if the project does not have a vlt.json file,
|
|
314
|
+
* otherwise returns the loaded Modifiers instance.
|
|
315
|
+
*/
|
|
316
|
+
static maybeLoad(options) {
|
|
317
|
+
const config = load('modifiers', assertRecordStringString);
|
|
318
|
+
if (!config)
|
|
319
|
+
return;
|
|
320
|
+
return new GraphModifier(options);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Convenience method to instantiate and load in one call.
|
|
324
|
+
* Throws if called on a directory that does not have a vlt.json file.
|
|
325
|
+
*/
|
|
326
|
+
static load(options) {
|
|
327
|
+
return new GraphModifier(options);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=modifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modifiers.js","sourceRoot":"","sources":["../../src/modifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAyFvC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,aA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E,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;oBAClB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;gBACjD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,qBAAqB;QACnB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC5C,oEAAoE;YACpE,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;gBAC1B,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAChC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAC/B,QAAQ,CAAC,YAAY,CACtB,CAAA;YACH,CAAC;YACD,kCAAkC;YAClC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAC5C,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,OAAoB;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAA;QAC1D,IAAI,CAAC,MAAM;YAAE,OAAM;QACnB,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,IAAI,CAAC,OAAoB;QAC9B,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;CACF","sourcesContent":["import {\n parseBreadcrumb,\n specificitySort,\n} from '@vltpkg/dss-breadcrumb'\nimport { error } from '@vltpkg/error-cause'\nimport { Spec } from '@vltpkg/spec'\nimport {\n asNormalizedManifest,\n assertRecordStringString,\n normalizeManifest,\n} from '@vltpkg/types'\nimport { load } from '@vltpkg/vlt-json'\nimport type {\n ModifierBreadcrumb,\n ModifierInteractiveBreadcrumb,\n} from '@vltpkg/dss-breadcrumb'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { Edge } from './edge.ts'\nimport type { Node } from './node.ts'\nimport type { Dependency } from './dependencies.ts'\n\n/**\n * Loaded modifiers configuration as described in the `vlt.json` file.\n */\nexport type GraphModifierLoadedConfig = {\n modifiers: GraphModifierConfigObject\n}\n\n/**\n * Type definition for the modifiers configuration object\n */\n// TODO: subtype string into a more specific type for Queries\nexport type GraphModifierConfigObject = Record<string, string>\n\n/**\n * Info needed to define a graph modifier.\n */\nexport type BaseModifierEntry = {\n type: 'edge' | 'node'\n query: string\n breadcrumb: ModifierBreadcrumb\n value: string | NormalizedManifest\n refs: Set<{\n name: string\n from: Node\n }>\n}\n\n/**\n * Extra info to define specifically a graph edge modifier.\n */\nexport type EdgeModifierEntry = BaseModifierEntry & {\n type: 'edge'\n spec: Spec\n value: string\n}\n\n/**\n * Extra info to define the graph node modifier.\n */\nexport type NodeModifierEntry = BaseModifierEntry & {\n type: 'node'\n manifest: NormalizedManifest\n}\n\n/**\n * A graph modifier entry, which can be either an edge or a node modifier.\n */\nexport type ModifierEntry = EdgeModifierEntry | NodeModifierEntry\n\n/**\n * An object to track modifiers that have matched an initial part of the\n * breadcrumb. It holds pointers to both nodes and edges matched in the\n * current traversed graph on top of the modifier info and the breadcrumb\n * state that is used to track the current state of the parsing.\n */\nexport type ModifierActiveEntry = {\n /**\n * The modifier this active entry is working with.\n */\n modifier: ModifierEntry\n /**\n * The breadcrumb that is used to track the current state of the parsing.\n */\n interactiveBreadcrumb: ModifierInteractiveBreadcrumb\n /**\n * The first node to be affected by this modifier.\n */\n originalFrom: Node\n /**\n * The original edge that is being replaced with this entry.\n */\n originalEdge?: Edge\n /**\n * The modified edge that is being used to replace the original edge.\n */\n modifiedEdge?: Edge\n}\n\n/**\n * Class representing loaded modifiers configuration for a project.\n *\n * Instances of this class can be used as a helper to modify the graph\n * during the graph build ideal traversal time.\n *\n * ```\n * const modifier = new GraphModifier(options)\n * modifier.load(options)\n * ```\n *\n * The `tryImporter` method can be used to register the initial importer\n * node along with any modifier that includes an importer selector, e.g:\n * `modifier.tryImporter(graph.mainImporter)`\n *\n * When traversing the graph, use the `tryNewDependency` method to check\n * if a given dependency spec to the current traversed node has matching\n * registered modifiers, e.g:\n * `const entries = modifier.tryNewDependency(fromNode, depSpec)`\n *\n * Use `updateActiveEntry` to update a given active modifier entry state\n * with the current node of the graph being traversed. e.g:\n * ```\n * for (const entry of entries)\n * modifier.updateActiveEntry(fromNode, entry)\n * ```\n */\nexport class GraphModifier {\n /** The loaded modifiers configuration */\n #config?: GraphModifierConfigObject\n /** A set of all modifiers loaded from vlt.json */\n #modifiers = new Set<ModifierEntry>()\n /** A set of all edge modifiers loaded from vlt.json */\n #edgeModifiers = new Set<EdgeModifierEntry>()\n /** A set of all node modifiers loaded from vlt.json */\n #nodeModifiers = new Set<NodeModifierEntry>()\n /**\n * A map of initial entries, keyed by the name of the first breadcrumb\n * item to its modifier entry. Useful for checking for non-importer\n * starting breadcrumbs, e.g: `#a > #b`\n */\n #initialEntries = new Map<string, Set<ModifierEntry>>()\n /**\n * A multi-level map of active entries, keyed by:\n * - modifiers\n * - edge name\n * - from node\n * that allows for retrieving seen {@link ModifierActiveEntry} instances\n * in constant time.\n */\n #activeEntries = new Map<\n ModifierEntry,\n Map<string, Map<Node, ModifierActiveEntry>>\n >()\n /**\n * A set of currently active modifiers, which are being parsed.\n */\n activeModifiers = new Set<ModifierActiveEntry>()\n /** A set of all modifier string values loaded from vlt.json */\n modifierNames = new Set<string>()\n\n constructor(options: SpecOptions) {\n this.load(options)\n }\n\n /**\n * Load the modifiers definitions from vlt.json,\n * converting the result into a GraphModifierConfigObject\n */\n get config(): GraphModifierConfigObject {\n if (this.#config) return this.#config\n return (this.#config =\n load('modifiers', assertRecordStringString) ?? {})\n }\n\n /**\n * Loads the modifiers defined in `vlt.json` into memory.\n */\n load(options: SpecOptions) {\n for (const [key, value] of Object.entries(this.config)) {\n this.modifierNames.add(key)\n const breadcrumb = parseBreadcrumb(key)\n /* c8 ignore start - should not be possible */\n if (!breadcrumb.last.name) {\n throw error('Could not find name in breadcrumb', {\n found: key,\n })\n }\n /* c8 ignore stop */\n let mod: ModifierEntry\n if (typeof value === 'string') {\n mod = {\n breadcrumb,\n query: key,\n refs: new Set(),\n spec: Spec.parse(breadcrumb.last.name, value, options),\n type: 'edge',\n value,\n } satisfies EdgeModifierEntry\n this.#edgeModifiers.add(mod)\n /* c8 ignore start - TODO */\n } else {\n const manifest = asNormalizedManifest(\n normalizeManifest(value),\n )\n mod = {\n breadcrumb,\n query: key,\n manifest,\n refs: new Set(),\n type: 'node',\n value: manifest,\n } satisfies NodeModifierEntry\n this.#nodeModifiers.add(mod)\n }\n /* c8 ignore end */\n this.#modifiers.add(mod)\n // if the breadcrumb starts with an id, then add it to the\n // map of initial entries, so that we can use it to match\n if (breadcrumb.first.name) {\n const initialSet =\n this.#initialEntries.get(breadcrumb.first.name) ?? new Set()\n initialSet.add(mod)\n this.#initialEntries.set(breadcrumb.first.name, initialSet)\n }\n }\n }\n\n /**\n * Try matching the provided node against the top-level selectors. In case\n * a match is found it will also register the active entry modifier and\n * update the active entry to the current importer node.\n */\n tryImporter(importer: Node) {\n for (const modifier of this.#modifiers) {\n // if the first item in the breadcrumb is an importer and it matches\n // any of the valid top-level selectors, then register the modifier\n const { first } = modifier.breadcrumb\n const matchRoot =\n first.value === ':root' && importer.mainImporter\n const matchWorkspace =\n first.value === ':workspace' && importer.importer\n const matchAny =\n first.value === ':project' || matchRoot || matchWorkspace\n if (first.importer && matchAny) {\n const active = this.newModifier(importer, modifier)\n const single = active.modifier.breadcrumb.single\n // only the importers will update the active entry right after\n // registering it since tryImporter doesn't try to match from\n // active dependencies\n if (!single) {\n this.updateActiveEntry(importer, active)\n }\n }\n }\n }\n\n /**\n * Try matching the provided node and spec to the current\n * active parsing modifier entries along with possible starting-level\n * modifiers.\n *\n * Any entries in which the breachcrumb have already reached its last\n * element will be prioritized, along with checking for specificity,\n * the complete entry with the highest specificity will be returned or just\n * the entry with the highest specificity if no complete entry is found.\n * Returns `undefined` if no matching entry is found.\n *\n * This method works with the assumption that it's going to be called\n * during a graph traversal, such that any ascendent has been checked\n * and the active modifier entry state has been updated in the previous\n * iteration.\n */\n tryNewDependency(\n from: Node,\n spec: Spec,\n ): ModifierActiveEntry | undefined {\n const { name, semver } = spec\n // here we use a map instead of a set so that we can associate each\n // modifier active entry with its breadcrumb so that it's easier to\n // pick the correct entry when we sort breadcrbumbs by specificity\n const all = new Map<\n ModifierBreadcrumb | undefined,\n ModifierActiveEntry\n >()\n for (const modifier of this.#modifiers) {\n // if an active entry is found then returns that\n const entry = this.#activeEntries\n .get(modifier)\n ?.get(name)\n ?.get(from)\n if (entry) {\n all.set(entry.modifier.breadcrumb, entry)\n }\n }\n // matches the name against the initial entries, this will make it so\n // that modifier queries that start with a name (e.g: #a > #b) can\n // match at any point of the graph traversal\n const initialSet =\n this.#initialEntries.get(name) ?? new Set<ModifierEntry>()\n for (const initial of initialSet) {\n const initialEntry =\n /* c8 ignore next - difficult to test branch */\n this.#activeEntries.get(initial)?.get(name)?.get(from) ??\n this.newModifier(from, initial)\n all.set(initialEntry.modifier.breadcrumb, initialEntry)\n }\n // selects the active entry that should apply to this dependency,\n // any active entry that is done parsing has the priority, if we\n // find multiple entries then we use css specificity to pick a winner\n // if we have multiple matches but no active entry is complete, then\n // we pick the one with the highest specificity breadcrumb\n const arr = [...all.values()]\n const completeEntries = arr.filter(\n active =>\n active.interactiveBreadcrumb.current ===\n active.modifier.breadcrumb.last,\n )\n // deregister completed entries\n for (const entry of completeEntries) {\n this.deregisterModifier(entry.modifier)\n }\n // returns the highest specificity entry from either the complete entries\n // if any were found or from any of the entries if available, otherwise\n // it will return undefined as no entry is found in the `all` map\n const entries = completeEntries.length ? completeEntries : arr\n return all.get(\n specificitySort(\n entries\n // here we filter out any entries that do not match the\n // pseudo selector comparators used in the breadcrumb item\n .filter(i =>\n i.interactiveBreadcrumb.current?.comparator({\n semver,\n }),\n )\n .map(i => i.modifier.breadcrumb),\n )[0],\n )\n }\n\n /**\n * Returns the set of {@link ModifierActiveEntry} instances that matches\n * the provided {@link Dependency} specs for a given node.\n *\n * This method is mostly a helper to {@link GraphModifier.tryNewDependency}\n * that handles the registered modifiers traversal lookup.\n */\n tryDependencies(\n from: Node,\n dependencies: Dependency[] | Edge[],\n ): Map<string, ModifierActiveEntry> {\n const modifierRefs = new Map<string, ModifierActiveEntry>()\n for (const { spec } of dependencies) {\n const active = this.tryNewDependency(from, spec)\n if (active) {\n modifierRefs.set(spec.name, active)\n }\n }\n return modifierRefs\n }\n\n /**\n * Updates an active entry state keeping track of items in the multi-level\n * active entries map. If the current breadcrumb state shows there's no more\n * items left, then we deregister the modifier.\n */\n updateActiveEntry(from: Node, active: ModifierActiveEntry): void {\n const { modifier } = active\n const interactiveBreadcrumb = active.interactiveBreadcrumb.next()\n const name = interactiveBreadcrumb.current?.name\n\n // if there's no name, or we're done parsing then we\n // deregister the modifier instead of updating the entry\n if (interactiveBreadcrumb.done || !name) {\n this.deregisterModifier(modifier)\n return\n }\n\n // register the active modifier\n this.activeModifiers.add(active)\n active.modifier.refs.add({ from, name })\n\n // optionally read or create the nested maps\n const nameMap =\n this.#activeEntries.get(modifier) ??\n new Map<string, Map<Node, ModifierActiveEntry>>()\n this.#activeEntries.set(modifier, nameMap)\n const nodeMap =\n nameMap.get(name) ?? new Map<Node, ModifierActiveEntry>()\n nameMap.set(name, nodeMap)\n\n // sets the active entry in the map\n nodeMap.set(from, active)\n }\n\n /**\n * Creates a new active modifier.\n */\n newModifier(\n from: Node,\n modifier: ModifierEntry,\n ): ModifierActiveEntry {\n return {\n modifier,\n interactiveBreadcrumb: modifier.breadcrumb.interactive(),\n originalFrom: from,\n }\n }\n\n /**\n * Removes a previously registered modifier from the active entries.\n */\n deregisterModifier(modifier: ModifierEntry): void {\n for (const { from, name } of modifier.refs) {\n const nodeMap = this.#activeEntries.get(modifier)?.get(name)\n if (nodeMap) {\n // if an entry is found, we remove it from the active set\n const entry = nodeMap.get(from)\n if (entry) {\n this.activeModifiers.delete(entry)\n }\n // then we remove the entry from the map\n nodeMap.delete(from)\n // if the map is empty, we remove it from the active entries map\n if (!nodeMap.size) {\n this.#activeEntries.get(modifier)?.delete(name)\n }\n }\n }\n }\n\n /**\n * Operates in previously registered nodes and edges in order to put\n * back in place any of the original edges that were referenced to in\n * active (ongoing) breadcrumb parsing entries that were never completed.\n *\n * This method can be used to easily rollback any pending operations\n * once the graph traversal is done.\n */\n rollbackActiveEntries(): void {\n for (const modifier of this.activeModifiers) {\n // if the modifier has an original edge, we can put it back in place\n if (modifier.originalEdge) {\n modifier.originalFrom.edgesOut.set(\n modifier.originalEdge.spec.name,\n modifier.originalEdge,\n )\n }\n // then we deregister the modifier\n this.deregisterModifier(modifier.modifier)\n }\n }\n\n /**\n * Convenience method to instantiate and load in one call.\n * Returns undefined if the project does not have a vlt.json file,\n * otherwise returns the loaded Modifiers instance.\n */\n static maybeLoad(options: SpecOptions) {\n const config = load('modifiers', assertRecordStringString)\n if (!config) return\n return new GraphModifier(options)\n }\n\n /**\n * Convenience method to instantiate and load in one call.\n * Throws if called on a directory that does not have a vlt.json file.\n */\n static load(options: SpecOptions) {\n return new GraphModifier(options)\n }\n}\n"]}
|
package/dist/esm/node.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PathScurry } from 'path-scurry';
|
|
2
2
|
import type { DepID } from '@vltpkg/dep-id';
|
|
3
3
|
import type { Spec, SpecOptions } from '@vltpkg/spec';
|
|
4
|
-
import type { Integrity,
|
|
4
|
+
import type { Integrity, NormalizedManifest, DependencyTypeShort, GraphLike, NodeLike } from '@vltpkg/types';
|
|
5
5
|
import { Edge } from './edge.ts';
|
|
6
|
-
import type {
|
|
6
|
+
import type { Graph } from './graph.ts';
|
|
7
7
|
export type NodeOptions = SpecOptions & {
|
|
8
8
|
projectRoot: string;
|
|
9
9
|
graph: GraphLike;
|
|
@@ -34,6 +34,14 @@ export declare class Node implements NodeLike {
|
|
|
34
34
|
isDev(): this is Node & {
|
|
35
35
|
dev: true;
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* True if there's a manifest-confused package name.
|
|
39
|
+
*/
|
|
40
|
+
confused: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* True if this node has been extracted to the file system.
|
|
43
|
+
*/
|
|
44
|
+
extracted: boolean;
|
|
37
45
|
/**
|
|
38
46
|
* List of edges coming into this node.
|
|
39
47
|
*/
|
|
@@ -43,6 +51,11 @@ export declare class Node implements NodeLike {
|
|
|
43
51
|
* that the connected node is a direct dependency of this node.
|
|
44
52
|
*/
|
|
45
53
|
edgesOut: Map<string, Edge>;
|
|
54
|
+
/**
|
|
55
|
+
* A `mainImporter` node may have workspace connected to it,
|
|
56
|
+
* equivalent to its `edgesOut` linked deps.
|
|
57
|
+
*/
|
|
58
|
+
workspaces: Map<string, Edge> | undefined;
|
|
46
59
|
/**
|
|
47
60
|
* A reference to the {@link DepID} this node represents in the graph.
|
|
48
61
|
*/
|
|
@@ -58,7 +71,7 @@ export declare class Node implements NodeLike {
|
|
|
58
71
|
/**
|
|
59
72
|
* A reference to the graph this node is a part of.
|
|
60
73
|
*/
|
|
61
|
-
graph:
|
|
74
|
+
graph: Graph;
|
|
62
75
|
/**
|
|
63
76
|
* The manifest integrity value.
|
|
64
77
|
*/
|
|
@@ -66,7 +79,7 @@ export declare class Node implements NodeLike {
|
|
|
66
79
|
/**
|
|
67
80
|
* The manifest this node represents in the graph.
|
|
68
81
|
*/
|
|
69
|
-
manifest?:
|
|
82
|
+
manifest?: NormalizedManifest;
|
|
70
83
|
/**
|
|
71
84
|
* Project where this node resides
|
|
72
85
|
*/
|
|
@@ -77,6 +90,12 @@ export declare class Node implements NodeLike {
|
|
|
77
90
|
* the same registry, if it's not the default.
|
|
78
91
|
*/
|
|
79
92
|
registry?: string;
|
|
93
|
+
/**
|
|
94
|
+
* If this node has been modified as part of applying a {@link GraphModifier}
|
|
95
|
+
* then this field will contain the modifier query that was applied.
|
|
96
|
+
* Otherwise, it will be `undefined`.
|
|
97
|
+
*/
|
|
98
|
+
modifier: string | undefined;
|
|
80
99
|
get name(): string;
|
|
81
100
|
/**
|
|
82
101
|
* The version of the package represented by this node, this is usually
|
|
@@ -89,6 +108,45 @@ export declare class Node implements NodeLike {
|
|
|
89
108
|
* An address {@link PackageInfoClient} may use to extract this package.
|
|
90
109
|
*/
|
|
91
110
|
resolved?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Platform requirements (engines, os, cpu) extracted from manifest.
|
|
113
|
+
* Stored separately for optional dependencies to enable platform checks
|
|
114
|
+
* when manifest is not loaded.
|
|
115
|
+
*/
|
|
116
|
+
platform?: {
|
|
117
|
+
engines?: Record<string, string>;
|
|
118
|
+
os?: string[] | string;
|
|
119
|
+
cpu?: string[] | string;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Record of binary names to their paths in the package, if any.
|
|
123
|
+
*/
|
|
124
|
+
bins?: Record<string, string>;
|
|
125
|
+
/**
|
|
126
|
+
* True if this node has been built as part of the reify step.
|
|
127
|
+
*/
|
|
128
|
+
built: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Build state of this node - tracks whether it needs building, has been built, or failed.
|
|
131
|
+
* - 'none': No build state (default)
|
|
132
|
+
* - 'needed': Node needs to be built
|
|
133
|
+
* - 'built': Node has been successfully built
|
|
134
|
+
* - 'failed': Node build has failed
|
|
135
|
+
*/
|
|
136
|
+
buildState: 'none' | 'needed' | 'built' | 'failed';
|
|
137
|
+
/**
|
|
138
|
+
* Deterministic unique string used to identify (and ultimately duplicate)
|
|
139
|
+
* nodes that are affected by a peer context set modified resolution.
|
|
140
|
+
* These are appended to the node {@link DepID} as the `extra` suffix.
|
|
141
|
+
*/
|
|
142
|
+
peerSetHash?: string;
|
|
143
|
+
/**
|
|
144
|
+
* True if this node is detached from the graph.
|
|
145
|
+
* This is used to indicate that the node is not part of the graph
|
|
146
|
+
* although the node is still available as part of the resolution process.
|
|
147
|
+
* Allows for skipping fetching manifests for detached nodes.
|
|
148
|
+
*/
|
|
149
|
+
detached: boolean;
|
|
92
150
|
/**
|
|
93
151
|
* The file system location for this node.
|
|
94
152
|
*/
|
|
@@ -107,13 +165,15 @@ export declare class Node implements NodeLike {
|
|
|
107
165
|
* directly inside the node's directory.
|
|
108
166
|
*/
|
|
109
167
|
nodeModules(scurry: PathScurry): string;
|
|
110
|
-
constructor(options: NodeOptions, id?: DepID, manifest?:
|
|
168
|
+
constructor(options: NodeOptions, id?: DepID, manifest?: NormalizedManifest, spec?: Spec, name?: string, version?: string);
|
|
111
169
|
/**
|
|
112
170
|
* return true if this node is located in the vlt store
|
|
113
171
|
* memoized the first time it's called, since the store location
|
|
114
172
|
* doesn't change within the context of a single operation.
|
|
115
173
|
*/
|
|
116
174
|
inVltStore(): boolean;
|
|
175
|
+
get options(): SpecOptions;
|
|
176
|
+
set options(_opts: SpecOptions);
|
|
117
177
|
equals(other: Node): boolean;
|
|
118
178
|
/**
|
|
119
179
|
* Sets the node as an importer along with its location.
|
|
@@ -130,19 +190,44 @@ export declare class Node implements NodeLike {
|
|
|
130
190
|
* Add an edge from this node connecting it to a direct dependency.
|
|
131
191
|
*/
|
|
132
192
|
addEdgesTo(type: DependencyTypeShort, spec: Spec, node?: Node): Edge;
|
|
193
|
+
/**
|
|
194
|
+
* The raw manifest before any modifications.
|
|
195
|
+
* If not set, falls back to the current manifest.
|
|
196
|
+
*/
|
|
197
|
+
get rawManifest(): NormalizedManifest | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* Sets this node as having a manifest-confused manifest.
|
|
200
|
+
*/
|
|
201
|
+
setConfusedManifest(fixed: NormalizedManifest, confused?: NormalizedManifest): void;
|
|
202
|
+
/**
|
|
203
|
+
* Sets this node as having a manifest-confused manifest.
|
|
204
|
+
*/
|
|
205
|
+
maybeSetConfusedManifest(spec: Spec, confused?: NormalizedManifest): void;
|
|
133
206
|
toJSON(): {
|
|
207
|
+
rawManifest?: import("@vltpkg/types").Override<import("@vltpkg/types").Manifest, import("@vltpkg/types").NormalizedFields> | undefined;
|
|
208
|
+
peerSetHash?: string | undefined;
|
|
134
209
|
id: DepID;
|
|
135
210
|
name: string;
|
|
136
211
|
version: string | undefined;
|
|
137
212
|
location: string;
|
|
138
213
|
importer: boolean;
|
|
139
|
-
manifest: Manifest | undefined;
|
|
214
|
+
manifest: import("@vltpkg/types").Override<import("@vltpkg/types").Manifest, import("@vltpkg/types").NormalizedFields> | undefined;
|
|
140
215
|
projectRoot: string;
|
|
141
216
|
integrity: `sha512-${string}` | undefined;
|
|
142
217
|
resolved: string | undefined;
|
|
143
218
|
dev: boolean;
|
|
144
219
|
optional: boolean;
|
|
220
|
+
confused: boolean;
|
|
221
|
+
modifier: string | undefined;
|
|
222
|
+
platform: {
|
|
223
|
+
engines?: Record<string, string>;
|
|
224
|
+
os?: string[] | string;
|
|
225
|
+
cpu?: string[] | string;
|
|
226
|
+
} | undefined;
|
|
227
|
+
buildState: "none" | "needed" | "built" | "failed";
|
|
145
228
|
};
|
|
146
229
|
toString(): string;
|
|
147
230
|
}
|
|
231
|
+
export declare const isNode: (value: unknown) => value is Node;
|
|
232
|
+
export declare const asNode: (value: unknown) => Node;
|
|
148
233
|
//# sourceMappingURL=node.d.ts.map
|
package/dist/esm/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAO7C,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,gBAAgB,CAAA;AAEvD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cA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