@vltpkg/graph 0.0.0-2 → 0.0.0-20
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 +148 -12
- package/dist/esm/actual/load.d.ts +44 -3
- package/dist/esm/actual/load.d.ts.map +1 -1
- package/dist/esm/actual/load.js +114 -70
- package/dist/esm/actual/load.js.map +1 -1
- package/dist/esm/browser.d.ts +1 -1
- package/dist/esm/dependencies.d.ts +15 -5
- package/dist/esm/dependencies.d.ts.map +1 -1
- package/dist/esm/dependencies.js +67 -2
- package/dist/esm/dependencies.js.map +1 -1
- package/dist/esm/diff.d.ts +1 -0
- package/dist/esm/diff.d.ts.map +1 -1
- package/dist/esm/diff.js +6 -0
- package/dist/esm/diff.js.map +1 -1
- package/dist/esm/edge.d.ts +1 -1
- package/dist/esm/edge.d.ts.map +1 -1
- package/dist/esm/edge.js +1 -1
- package/dist/esm/edge.js.map +1 -1
- package/dist/esm/graph.d.ts +17 -10
- package/dist/esm/graph.d.ts.map +1 -1
- package/dist/esm/graph.js +52 -12
- package/dist/esm/graph.js.map +1 -1
- package/dist/esm/ideal/add-nodes.d.ts +6 -1
- package/dist/esm/ideal/add-nodes.d.ts.map +1 -1
- package/dist/esm/ideal/add-nodes.js +9 -4
- package/dist/esm/ideal/add-nodes.js.map +1 -1
- package/dist/esm/ideal/append-nodes.d.ts +2 -1
- package/dist/esm/ideal/append-nodes.d.ts.map +1 -1
- package/dist/esm/ideal/append-nodes.js +22 -5
- package/dist/esm/ideal/append-nodes.js.map +1 -1
- package/dist/esm/ideal/build.d.ts +4 -0
- package/dist/esm/ideal/build.d.ts.map +1 -1
- package/dist/esm/ideal/build.js +2 -0
- package/dist/esm/ideal/build.js.map +1 -1
- package/dist/esm/ideal/get-importer-specs.d.ts +3 -2
- package/dist/esm/ideal/get-importer-specs.d.ts.map +1 -1
- package/dist/esm/ideal/get-importer-specs.js +7 -5
- package/dist/esm/ideal/get-importer-specs.js.map +1 -1
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install.d.ts +4 -5
- package/dist/esm/install.d.ts.map +1 -1
- package/dist/esm/install.js +143 -23
- package/dist/esm/install.js.map +1 -1
- package/dist/esm/lockfile/load-nodes.d.ts +1 -1
- package/dist/esm/lockfile/load-nodes.d.ts.map +1 -1
- package/dist/esm/lockfile/load-nodes.js +33 -10
- 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 +23 -6
- package/dist/esm/lockfile/load.js.map +1 -1
- package/dist/esm/lockfile/save.d.ts +8 -3
- package/dist/esm/lockfile/save.d.ts.map +1 -1
- package/dist/esm/lockfile/save.js +26 -12
- package/dist/esm/lockfile/save.js.map +1 -1
- package/dist/esm/lockfile/types.d.ts +7 -3
- package/dist/esm/lockfile/types.d.ts.map +1 -1
- 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 +32 -4
- package/dist/esm/node.d.ts.map +1 -1
- package/dist/esm/node.js +60 -2
- package/dist/esm/node.js.map +1 -1
- package/dist/esm/reify/add-edge.d.ts +1 -1
- package/dist/esm/reify/add-edge.d.ts.map +1 -1
- package/dist/esm/reify/add-edge.js +36 -14
- package/dist/esm/reify/add-edge.js.map +1 -1
- package/dist/esm/reify/bin-paths.d.ts +1 -1
- package/dist/esm/reify/bin-paths.d.ts.map +1 -1
- package/dist/esm/reify/bin-paths.js.map +1 -1
- package/dist/esm/reify/build.js +6 -3
- 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/delete-edge.js +1 -1
- package/dist/esm/reify/delete-edge.js.map +1 -1
- package/dist/esm/reify/delete-nodes.d.ts.map +1 -1
- package/dist/esm/reify/delete-nodes.js +4 -0
- package/dist/esm/reify/delete-nodes.js.map +1 -1
- package/dist/esm/reify/index.d.ts +2 -0
- package/dist/esm/reify/index.d.ts.map +1 -1
- package/dist/esm/reify/index.js +13 -1
- 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 +121 -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 +35 -12
- 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 +7 -0
- package/dist/esm/resolve-save-type.d.ts.map +1 -0
- package/dist/esm/resolve-save-type.js +5 -0
- package/dist/esm/resolve-save-type.js.map +1 -0
- package/dist/esm/types.d.ts +15 -3
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/uninstall.d.ts +3 -5
- package/dist/esm/uninstall.d.ts.map +1 -1
- package/dist/esm/uninstall.js +0 -3
- package/dist/esm/uninstall.js.map +1 -1
- package/dist/esm/update.d.ts +11 -0
- package/dist/esm/update.d.ts.map +1 -0
- package/dist/esm/update.js +49 -0
- package/dist/esm/update.js.map +1 -0
- package/dist/esm/visualization/human-readable-output.d.ts +3 -4
- package/dist/esm/visualization/human-readable-output.d.ts.map +1 -1
- package/dist/esm/visualization/human-readable-output.js +33 -19
- package/dist/esm/visualization/human-readable-output.js.map +1 -1
- package/dist/esm/visualization/json-output.d.ts +4 -0
- package/dist/esm/visualization/json-output.d.ts.map +1 -1
- package/dist/esm/visualization/json-output.js +2 -0
- package/dist/esm/visualization/json-output.js.map +1 -1
- package/dist/esm/visualization/mermaid-output.d.ts +6 -0
- package/dist/esm/visualization/mermaid-output.d.ts.map +1 -1
- package/dist/esm/visualization/mermaid-output.js +64 -9
- package/dist/esm/visualization/mermaid-output.js.map +1 -1
- package/package.json +27 -25
package/dist/esm/browser.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { stringifyNode } from './stringify-node.ts';
|
|
|
5
5
|
export * from './types.ts';
|
|
6
6
|
declare const lockfile: {
|
|
7
7
|
loadEdges: (graph: import("./types.ts").GraphLike, edges: import("./lockfile/types.ts").LockfileData["edges"], options: import("@vltpkg/spec").SpecOptions) => void;
|
|
8
|
-
loadNodes: (graph: import("./types.ts").GraphLike, nodes: import("./lockfile/types.ts").LockfileData["nodes"]) => void;
|
|
8
|
+
loadNodes: (graph: import("./types.ts").GraphLike, nodes: import("./lockfile/types.ts").LockfileData["nodes"], actual?: import("./types.ts").GraphLike) => void;
|
|
9
9
|
};
|
|
10
10
|
export { asDependencyTypeShort, getBooleanFlagsFromNum, lockfile, longDependencyTypes, shorten, stringifyNode, };
|
|
11
11
|
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { DepID } from '@vltpkg/dep-id';
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
2
|
+
import { Spec } from '@vltpkg/spec/browser';
|
|
3
|
+
import type { SpecOptions } from '@vltpkg/spec';
|
|
4
|
+
import type { DependencySaveType, DependencyTypeLong, DependencyTypeShort, Manifest } from '@vltpkg/types';
|
|
5
|
+
import type { NodeLike } from './types.ts';
|
|
4
6
|
export declare const isDependencyTypeShort: (obj: unknown) => obj is DependencyTypeShort;
|
|
7
|
+
export declare const isDependencySaveType: (obj: unknown) => obj is DependencyTypeShort;
|
|
5
8
|
export declare const asDependencyTypeShort: (obj: unknown) => DependencyTypeShort;
|
|
6
9
|
/**
|
|
7
10
|
* Dependency entries info as defined in a package.json file.
|
|
@@ -21,9 +24,10 @@ export type Dependency = {
|
|
|
21
24
|
*/
|
|
22
25
|
spec: Spec;
|
|
23
26
|
/**
|
|
24
|
-
* The {@link
|
|
27
|
+
* The {@link DependencySaveType}, describing the way this dependency should
|
|
28
|
+
* be saved back to the manifest.
|
|
25
29
|
*/
|
|
26
|
-
type:
|
|
30
|
+
type: DependencySaveType;
|
|
27
31
|
};
|
|
28
32
|
/**
|
|
29
33
|
* A `Map` in which keys are {@link DepID} linking to another `Map` in which
|
|
@@ -53,5 +57,11 @@ export declare const asDependency: (obj: unknown) => Dependency;
|
|
|
53
57
|
/**
|
|
54
58
|
* Get the {@link DependencyTypeShort} from a {@link DependencyTypeLong}.
|
|
55
59
|
*/
|
|
56
|
-
export declare const shorten: (typeLong: DependencyTypeLong, name?: string, manifest?: Manifest) => DependencyTypeShort;
|
|
60
|
+
export declare const shorten: (typeLong: DependencyTypeLong, name?: string, manifest?: Pick<Manifest, "peerDependenciesMeta"> | null) => DependencyTypeShort;
|
|
61
|
+
export declare const getRawDependencies: (node: NodeLike) => Map<string, RawDependency>;
|
|
62
|
+
/**
|
|
63
|
+
* Retrieves a map of all dependencies, of all types, that can be inferred
|
|
64
|
+
* from a given node manifest, including missing dependencies.
|
|
65
|
+
*/
|
|
66
|
+
export declare const getDependencies: (node: NodeLike, options: SpecOptions) => Map<string, Dependency>;
|
|
57
67
|
//# sourceMappingURL=dependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../src/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sour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Y,MAAO,OAAO,KAAG,CAAC,IAAI,UAKjB,CAAA;AAE9B,eAAO,MAAM,YAAY,QAAS,OAAO,KAAG,UAK3C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,aACR,kBAAkB,SACrB,MAAM,aACF,IAAI,CAAC,QAAQ,EAAE,sBAAsB,CAAC,GAAG,IAAI,KACvD,mBAkBF,CAAA;AASD,eAAO,MAAM,kBAAkB,SAAU,QAAQ,+BAyChD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,SACpB,QAAQ,WACL,WAAW,KACnB,GAAG,CAAC,MAAM,EAAE,UAAU,CAexB,CAAA"}
|
package/dist/esm/dependencies.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { error } from '@vltpkg/error-cause';
|
|
2
|
-
import {
|
|
2
|
+
import { Spec } from '@vltpkg/spec/browser';
|
|
3
|
+
import { dependencyTypes, longDependencyTypes, shortDependencyTypes, } from '@vltpkg/types';
|
|
3
4
|
export const isDependencyTypeShort = (obj) => shortDependencyTypes.has(obj);
|
|
5
|
+
export const isDependencySaveType = (obj) => shortDependencyTypes.has(obj) ||
|
|
6
|
+
obj === 'implicit';
|
|
4
7
|
export const asDependencyTypeShort = (obj) => {
|
|
5
8
|
if (!isDependencyTypeShort(obj)) {
|
|
6
9
|
throw error('Invalid dependency type', {
|
|
@@ -17,7 +20,7 @@ export const isDependency = (o) =>
|
|
|
17
20
|
isObj(o) &&
|
|
18
21
|
isObj(o.spec) &&
|
|
19
22
|
!!o.spec.type &&
|
|
20
|
-
|
|
23
|
+
isDependencySaveType(o.type);
|
|
21
24
|
export const asDependency = (obj) => {
|
|
22
25
|
if (!isDependency(obj)) {
|
|
23
26
|
throw error('Invalid dependency', { found: obj });
|
|
@@ -44,4 +47,66 @@ export const shorten = (typeLong, name, manifest) => {
|
|
|
44
47
|
}
|
|
45
48
|
return 'peer';
|
|
46
49
|
};
|
|
50
|
+
const isStringArray = (a) => Array.isArray(a) && !a.some(b => typeof b !== 'string');
|
|
51
|
+
/*
|
|
52
|
+
* Retrieves a map of all dependencies, of all types, that can be iterated
|
|
53
|
+
* on and consulted when parsing the directory contents of a given node.
|
|
54
|
+
*/
|
|
55
|
+
export const getRawDependencies = (node) => {
|
|
56
|
+
const dependencies = new Map();
|
|
57
|
+
const bundleDeps = node.manifest?.bundleDependencies ?? [];
|
|
58
|
+
// if it's an importer, bundleDeps are just normal. if it's a dep,
|
|
59
|
+
// then they're ignored entirely.
|
|
60
|
+
const bundled = (!node.importer &&
|
|
61
|
+
!node.id.startsWith('git') &&
|
|
62
|
+
isStringArray(bundleDeps)) ?
|
|
63
|
+
new Set(bundleDeps)
|
|
64
|
+
: new Set();
|
|
65
|
+
for (const depType of longDependencyTypes) {
|
|
66
|
+
const obj = node.manifest?.[depType];
|
|
67
|
+
// only care about devDeps for importers and git or symlink deps
|
|
68
|
+
// technically this will also include devDeps for tarball file: specs,
|
|
69
|
+
// but that is likely rare enough to not worry about too much.
|
|
70
|
+
if (depType === 'devDependencies' &&
|
|
71
|
+
!node.importer &&
|
|
72
|
+
!node.id.startsWith('git') &&
|
|
73
|
+
!node.id.startsWith('file')) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (obj) {
|
|
77
|
+
for (const [name, bareSpec] of Object.entries(obj)) {
|
|
78
|
+
// if it's a bundled dependency, we just ignore it entirely.
|
|
79
|
+
if (bundled.has(name))
|
|
80
|
+
continue;
|
|
81
|
+
dependencies.set(name, {
|
|
82
|
+
name,
|
|
83
|
+
type: depType,
|
|
84
|
+
bareSpec,
|
|
85
|
+
registry: node.registry,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return dependencies;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves a map of all dependencies, of all types, that can be inferred
|
|
94
|
+
* from a given node manifest, including missing dependencies.
|
|
95
|
+
*/
|
|
96
|
+
export const getDependencies = (node, options) => {
|
|
97
|
+
const res = new Map();
|
|
98
|
+
const dependencies = getRawDependencies(node);
|
|
99
|
+
for (const { name, type, bareSpec } of dependencies.values()) {
|
|
100
|
+
const depType = shorten(type, name, node.manifest);
|
|
101
|
+
const spec = Spec.parse(name, bareSpec, {
|
|
102
|
+
...options,
|
|
103
|
+
registry: node.registry,
|
|
104
|
+
});
|
|
105
|
+
res.set(name, {
|
|
106
|
+
spec,
|
|
107
|
+
type: depType,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return res;
|
|
111
|
+
};
|
|
47
112
|
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../src/dependencies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAQ3C,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,eAAe,CAAA;AAGtB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,GAAY,EACgB,EAAE,CAC9B,oBAAoB,CAAC,GAAG,CAAC,GAA0B,CAAC,CAAA;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,GAAY,EACgB,EAAE,CAC9B,oBAAoB,CAAC,GAAG,CAAC,GAA0B,CAAC;IACpD,GAAG,KAAK,UAAU,CAAA;AAEpB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,GAAY,EACS,EAAE;IACvB,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,KAAK,CAAC,yBAAyB,EAAE;YACrC,KAAK,EAAE,GAAG;YACV,YAA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AC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnD,4DAA4D;gBAC5D,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;oBAAE,SAAQ;gBAC/B,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE;oBACrB,IAAI;oBACJ,IAAI,EAAE,OAAO;oBACb,QAAQ;oBACR,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,IAAc,EACd,OAAoB,EACK,EAAE;IAC3B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAsB,CAAA;IACzC,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAC7C,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;QAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE;YACtC,GAAG,OAAO;YACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAA;QACF,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE;YACZ,IAAI;YACJ,IAAI,EAAE,OAAO;SACd,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import type { DepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport { Spec } from '@vltpkg/spec/browser'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type {\n DependencySaveType,\n DependencyTypeLong,\n DependencyTypeShort,\n Manifest,\n} from '@vltpkg/types'\nimport {\n dependencyTypes,\n longDependencyTypes,\n shortDependencyTypes,\n} from '@vltpkg/types'\nimport type { NodeLike } from './types.ts'\n\nexport const isDependencyTypeShort = (\n obj: unknown,\n): obj is DependencyTypeShort =>\n shortDependencyTypes.has(obj as DependencyTypeShort)\n\nexport const isDependencySaveType = (\n obj: unknown,\n): obj is DependencyTypeShort =>\n shortDependencyTypes.has(obj as DependencyTypeShort) ||\n obj === 'implicit'\n\nexport const asDependencyTypeShort = (\n obj: unknown,\n): DependencyTypeShort => {\n if (!isDependencyTypeShort(obj)) {\n throw error('Invalid dependency type', {\n found: obj,\n validOptions: [...shortDependencyTypes],\n })\n }\n return obj\n}\n\n/**\n * Dependency entries info as defined in a package.json file.\n */\nexport type RawDependency = {\n name: string\n bareSpec: string\n type: DependencyTypeLong\n registry?: string\n}\n\n/**\n * Parsed dependency entries info.\n */\nexport type Dependency = {\n /**\n * The parsed {@link Spec} object describing the dependency requirements.\n */\n spec: Spec\n /**\n * The {@link DependencySaveType}, describing the way this dependency should\n * be saved back to the manifest.\n */\n type: DependencySaveType\n}\n\n/**\n * A `Map` in which keys are {@link DepID} linking to another `Map` in which\n * keys are the dependency names and values are {@link Dependency}. This\n * structure represents dependencies that need to be added to the importer\n * represented by {@link DepID}.\n *\n * The `modifiedDependencies` property can be used to indicate that there\n * are added dependencies to any of the importer nodes.\n */\nexport type AddImportersDependenciesMap = Map<\n DepID,\n Map<string, Dependency>\n> & { modifiedDependencies: boolean }\n\n/**\n * A `Map` object representing nodes to be removed from the ideal graph.\n * Each {@link DepID} key represents an importer node and the `Set` of\n * dependency names to be removed from its dependency list.\n *\n * The `modifiedDependencies` property can be used to indicate that there\n * are added dependencies to any of the importer nodes.\n */\nexport type RemoveImportersDependenciesMap = Map<\n DepID,\n Set<string>\n> & { modifiedDependencies: boolean }\n\nconst isObj = (o: unknown): o is Record<string, unknown> =>\n !!o && typeof o === 'object'\n\n// TODO: it would be nice to have a @vltpkg/spec.isSpec method\nexport const isDependency = (o: unknown): o is Dependency =>\n // TODO: it would be nice to have a @vltpkg/spec.isSpec method\n isObj(o) &&\n isObj(o.spec) &&\n !!o.spec.type &&\n isDependencySaveType(o.type)\n\nexport const asDependency = (obj: unknown): Dependency => {\n if (!isDependency(obj)) {\n throw error('Invalid dependency', { found: obj })\n }\n return obj\n}\n\n/**\n * Get the {@link DependencyTypeShort} from a {@link DependencyTypeLong}.\n */\nexport const shorten = (\n typeLong: DependencyTypeLong,\n name?: string,\n manifest?: Pick<Manifest, 'peerDependenciesMeta'> | null,\n): DependencyTypeShort => {\n const shortName = dependencyTypes.get(typeLong)\n if (!shortName) {\n throw error('Invalid dependency type name', {\n found: typeLong,\n validOptions: [...longDependencyTypes],\n })\n }\n if (shortName !== 'peer') {\n return shortName\n }\n if (\n name &&\n manifest?.peerDependenciesMeta?.[name]?.optional === true\n ) {\n return 'peerOptional'\n }\n return 'peer'\n}\n\nconst isStringArray = (a: unknown): a is string[] =>\n Array.isArray(a) && !a.some(b => typeof b !== 'string')\n\n/*\n * Retrieves a map of all dependencies, of all types, that can be iterated\n * on and consulted when parsing the directory contents of a given node.\n */\nexport const getRawDependencies = (node: NodeLike) => {\n const dependencies = new Map<string, RawDependency>()\n const bundleDeps: unknown = node.manifest?.bundleDependencies ?? []\n // if it's an importer, bundleDeps are just normal. if it's a dep,\n // then they're ignored entirely.\n const bundled =\n (\n !node.importer &&\n !node.id.startsWith('git') &&\n isStringArray(bundleDeps)\n ) ?\n new Set(bundleDeps)\n : new Set<string>()\n for (const depType of longDependencyTypes) {\n const obj: Record<string, string> | undefined =\n node.manifest?.[depType]\n // only care about devDeps for importers and git or symlink deps\n // technically this will also include devDeps for tarball file: specs,\n // but that is likely rare enough to not worry about too much.\n if (\n depType === 'devDependencies' &&\n !node.importer &&\n !node.id.startsWith('git') &&\n !node.id.startsWith('file')\n ) {\n continue\n }\n if (obj) {\n for (const [name, bareSpec] of Object.entries(obj)) {\n // if it's a bundled dependency, we just ignore it entirely.\n if (bundled.has(name)) continue\n dependencies.set(name, {\n name,\n type: depType,\n bareSpec,\n registry: node.registry,\n })\n }\n }\n }\n return dependencies\n}\n\n/**\n * Retrieves a map of all dependencies, of all types, that can be inferred\n * from a given node manifest, including missing dependencies.\n */\nexport const getDependencies = (\n node: NodeLike,\n options: SpecOptions,\n): Map<string, Dependency> => {\n const res = new Map<string, Dependency>()\n const dependencies = getRawDependencies(node)\n for (const { name, type, bareSpec } of dependencies.values()) {\n const depType = shorten(type, name, node.manifest)\n const spec = Spec.parse(name, bareSpec, {\n ...options,\n registry: node.registry,\n })\n res.set(name, {\n spec,\n type: depType,\n })\n }\n return res\n}\n"]}
|
package/dist/esm/diff.d.ts
CHANGED
package/dist/esm/diff.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/diff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAOrC,QAAA,MAAM,cAAc,eAA2C,CAAA;AAE/D;;;;;;;;;;GAUG;AACH,qBAAa,IAAI;IACf,IAAI,EAAE,KAAK,CAAA;IACX,EAAE,EAAE,KAAK,CAAA;IAET,WAAW,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,mBAAmB,UAAQ;IAE3B;;OAEG;IACH,KAAK;QACH,+DAA+D;;QAE/D,+DAA+D;;MAEhE;IAED;;OAEG;IACH,KAAK;QACH,qEAAqE;;QAErE,qEAAqE;;MAEtE;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;gBAEW,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK;IAyClC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/diff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAOrC,QAAA,MAAM,cAAc,eAA2C,CAAA;AAE/D;;;;;;;;;;GAUG;AACH,qBAAa,IAAI;IACf,IAAI,EAAE,KAAK,CAAA;IACX,EAAE,EAAE,KAAK,CAAA;IAET,WAAW,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,mBAAmB,UAAQ;IAE3B;;OAEG;IACH,KAAK;QACH,+DAA+D;;QAE/D,+DAA+D;;MAEhE;IAED;;OAEG;IACH,KAAK;QACH,qEAAqE;;QAErE,qEAAqE;;MAEtE;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;gBAEW,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK;IAyClC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM;IAwC7D,UAAU,IAAI,OAAO;CAQtB"}
|
package/dist/esm/diff.js
CHANGED
package/dist/esm/diff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAM3C,uDAAuD;AACvD,6EAA6E;AAC7E,4BAA4B;AAC5B,wBAAwB;AAExB,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;AAE/D;;;;;;;;;;G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ge } from './edge.ts'\nimport type { Graph } from './graph.ts'\nimport type { Node } from './node.ts'\n\n// XXX should file deps *always* be considered changed?\n// unless the thing containing it wasn't possibly changed because it's inside\n// a dep that didn't change?\n// Same with remote deps\n\nconst kCustomInspect = Symbol.for('nodejs.util.inspect.custom')\n\n/**\n * A Diff object is a representation of a set of changes from one\n * graph to another, typically from the actual graph as it is reified\n * on disk, to an intended ideal graph.\n *\n * The naming convention can get a bit confusing here, because it's a\n * set of directed changes from one set of directed objects to another.\n *\n * Within the context the Diff object, `from` is the Graph we're coming from,\n * and `to` is the Graph we're trying to create.\n */\nexport class Diff {\n from: Graph\n to: Graph\n\n projectRoot: string\n\n /**\n * If changes need to be made later for failures of optional nodes,\n * set this flag so that we know to call graph.gc() at the appropriate time.\n */\n hadOptionalFailures = false\n\n /**\n * Collection of nodes to add and delete\n */\n nodes = {\n /** Nodes in the `to` graph that are not in the `from` graph */\n add: new Set<Node>(),\n /** Nodes in the `from` graph that are not in the `to` graph */\n delete: new Set<Node>(),\n }\n\n /**\n * Collection of nodes to add and delete\n */\n edges = {\n /** Edges in the `to` graph that are not found in the `from` graph */\n add: new Set<Edge>(),\n /** Edges in the `from` graph that are not found in the `to` graph */\n delete: new Set<Edge>(),\n }\n\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Diff'\n }\n\n constructor(from: Graph, to: Graph) {\n this.from = from\n this.to = to\n this.projectRoot = from.projectRoot\n if (to.projectRoot !== from.projectRoot) {\n throw error('projectRoot mismatch in Graph diff', {\n wanted: from.projectRoot,\n found: to.projectRoot,\n })\n }\n\n for (const [id, node] of this.from.nodes) {\n if (!this.to.nodes.get(id)?.equals(node)) {\n this.nodes.delete.add(node)\n }\n }\n\n for (const [id, node] of this.to.nodes) {\n if (!this.from.nodes.get(id)?.equals(node)) {\n this.nodes.add.add(node)\n }\n }\n\n for (const edge of this.to.edges) {\n // the node with this dep, in the from graph\n const fromNode = this.from.nodes.get(edge.from.id)\n const fromEdge = fromNode?.edgesOut.get(edge.spec.name)\n if (fromEdge?.to?.id === edge.to?.id) continue\n if (fromEdge?.to) this.edges.delete.add(fromEdge)\n if (edge.to) this.edges.add.add(edge)\n }\n for (const edge of this.from.edges) {\n // the node with this dep, in the to graph\n const toNode = this.to.nodes.get(edge.from.id)\n const toEdge = toNode?.edgesOut.get(edge.spec.name)\n if (toEdge?.to?.id === edge.to?.id) continue\n if (edge.to) this.edges.delete.add(edge)\n if (toEdge?.to) this.edges.add.add(toEdge)\n }\n }\n\n [kCustomInspect](_: number, options?: InspectOptions): string {\n const red: [string, string] =\n options?.colors ? ['\\x1b[31m', '\\x1b[m'] : ['', '']\n const green: [string, string] =\n options?.colors ? ['\\x1b[32m', '\\x1b[m'] : ['', '']\n const lines: string[] = []\n for (const node of this.nodes.add) {\n lines.push(`+ ${node.id}`)\n }\n for (const node of this.nodes.delete) {\n lines.push(`- ${node.id}`)\n }\n for (const edge of this.edges.add) {\n /* c8 ignore next */\n const to = edge.to?.id ?? ''\n lines.push(\n `+ ${edge.from.id} ${edge.type} ${edge.spec} ${to}`.trim(),\n )\n }\n for (const edge of this.edges.delete) {\n /* c8 ignore next */\n const to = edge.to?.id ?? ''\n lines.push(\n `- ${edge.from.id} ${edge.type} ${edge.spec} ${to}`.trim(),\n )\n }\n const wrap = (s: string, c: [string, string]) => c.join(s)\n const color =\n options?.colors ?\n (s: string) => wrap(s, s.startsWith('+') ? green : red)\n : (s: string) => s\n\n return `${this[Symbol.toStringTag]} {\n${lines\n .sort((a, b) => a.substring(1).localeCompare(b.substring(1), 'en'))\n .map(s => ' ' + color(s))\n .join('\\n')}\n}`\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAM3C,uDAAuD;AACvD,6EAA6E;AAC7E,4BAA4B;AAC5B,wBAAwB;AAExB,MAAM,cAAc,GAAG,MAAM,CAAC,GA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,CACL,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC;YAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAC3B,CAAA;IACH,CAAC;CACF","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport type { InspectOptions } from 'node:util'\nimport type { Edge } from './edge.ts'\nimport type { Graph } from './graph.ts'\nimport type { Node } from './node.ts'\n\n// XXX should file deps *always* be considered changed?\n// unless the thing containing it wasn't possibly changed because it's inside\n// a dep that didn't change?\n// Same with remote deps\n\nconst kCustomInspect = Symbol.for('nodejs.util.inspect.custom')\n\n/**\n * A Diff object is a representation of a set of changes from one\n * graph to another, typically from the actual graph as it is reified\n * on disk, to an intended ideal graph.\n *\n * The naming convention can get a bit confusing here, because it's a\n * set of directed changes from one set of directed objects to another.\n *\n * Within the context the Diff object, `from` is the Graph we're coming from,\n * and `to` is the Graph we're trying to create.\n */\nexport class Diff {\n from: Graph\n to: Graph\n\n projectRoot: string\n\n /**\n * If changes need to be made later for failures of optional nodes,\n * set this flag so that we know to call graph.gc() at the appropriate time.\n */\n hadOptionalFailures = false\n\n /**\n * Collection of nodes to add and delete\n */\n nodes = {\n /** Nodes in the `to` graph that are not in the `from` graph */\n add: new Set<Node>(),\n /** Nodes in the `from` graph that are not in the `to` graph */\n delete: new Set<Node>(),\n }\n\n /**\n * Collection of nodes to add and delete\n */\n edges = {\n /** Edges in the `to` graph that are not found in the `from` graph */\n add: new Set<Edge>(),\n /** Edges in the `from` graph that are not found in the `to` graph */\n delete: new Set<Edge>(),\n }\n\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Diff'\n }\n\n constructor(from: Graph, to: Graph) {\n this.from = from\n this.to = to\n this.projectRoot = from.projectRoot\n if (to.projectRoot !== from.projectRoot) {\n throw error('projectRoot mismatch in Graph diff', {\n wanted: from.projectRoot,\n found: to.projectRoot,\n })\n }\n\n for (const [id, node] of this.from.nodes) {\n if (!this.to.nodes.get(id)?.equals(node)) {\n this.nodes.delete.add(node)\n }\n }\n\n for (const [id, node] of this.to.nodes) {\n if (!this.from.nodes.get(id)?.equals(node)) {\n this.nodes.add.add(node)\n }\n }\n\n for (const edge of this.to.edges) {\n // the node with this dep, in the from graph\n const fromNode = this.from.nodes.get(edge.from.id)\n const fromEdge = fromNode?.edgesOut.get(edge.spec.name)\n if (fromEdge?.to?.id === edge.to?.id) continue\n if (fromEdge?.to) this.edges.delete.add(fromEdge)\n if (edge.to) this.edges.add.add(edge)\n }\n for (const edge of this.from.edges) {\n // the node with this dep, in the to graph\n const toNode = this.to.nodes.get(edge.from.id)\n const toEdge = toNode?.edgesOut.get(edge.spec.name)\n if (toEdge?.to?.id === edge.to?.id) continue\n if (edge.to) this.edges.delete.add(edge)\n if (toEdge?.to) this.edges.add.add(toEdge)\n }\n }\n\n [kCustomInspect](_: number, options?: InspectOptions): string {\n const red: [string, string] =\n options?.colors ? ['\\x1b[31m', '\\x1b[m'] : ['', '']\n const green: [string, string] =\n options?.colors ? ['\\x1b[32m', '\\x1b[m'] : ['', '']\n const lines: string[] = []\n for (const node of this.nodes.add) {\n lines.push(`+ ${node.id}`)\n }\n for (const node of this.nodes.delete) {\n lines.push(`- ${node.id}`)\n }\n for (const edge of this.edges.add) {\n /* c8 ignore next */\n const to = edge.to?.id ?? ''\n lines.push(\n `+ ${edge.from.id} ${edge.type} ${edge.spec} ${to}`.trim(),\n )\n }\n for (const edge of this.edges.delete) {\n /* c8 ignore next */\n const to = edge.to?.id ?? ''\n lines.push(\n `- ${edge.from.id} ${edge.type} ${edge.spec} ${to}`.trim(),\n )\n }\n const wrap = (s: string, c: [string, string]) => c.join(s)\n const color =\n options?.colors ?\n (s: string) => wrap(s, s.startsWith('+') ? green : red)\n : (s: string) => s\n\n return `${this[Symbol.toStringTag]} {\n${lines\n .sort((a, b) => a.substring(1).localeCompare(b.substring(1), 'en'))\n .map(s => ' ' + color(s))\n .join('\\n')}\n}`\n }\n\n hasChanges(): boolean {\n return (\n this.nodes.add.size > 0 ||\n this.nodes.delete.size > 0 ||\n this.edges.add.size > 0 ||\n this.edges.delete.size > 0\n )\n }\n}\n"]}
|
package/dist/esm/edge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Spec } from '@vltpkg/spec';
|
|
2
|
-
import type { InspectOptions } from 'util';
|
|
2
|
+
import type { InspectOptions } from 'node:util';
|
|
3
3
|
import type { DependencyTypeShort } from '@vltpkg/types';
|
|
4
4
|
import type { Node } from './node.ts';
|
|
5
5
|
import type { EdgeLike } from './types.ts';
|
package/dist/esm/edge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/edge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/edge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,QAAA,MAAM,cAAc,eAA2C,CAAA;AAE/D,qBAAa,IAAK,YAAW,QAAQ;IACnC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAED,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;IAanD;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;IAEV;;OAEG;IACH,EAAE,CAAC,EAAE,IAAI,CAAA;IAET;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAA;IAEzB;;OAEG;IACH,IAAI,EAAE,IAAI,CAAA;gBAGR,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,EAAE,CAAC,EAAE,IAAI;IAQX;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,GAAG,IAAI,OAAO,CAEjB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,KAAK,IAAI,OAAO;CAUjB"}
|
package/dist/esm/edge.js
CHANGED
package/dist/esm/edge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../src/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../src/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;AAE/D,MAAM,OAAO,IAAI;IACf,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,oBAAoB,CAAA;IAC7B,CAAC;IAED,CAAC,cAAc,CAAC,CAAC,CAAS,EAAE,OAAuB;QACjD,MAAM,GAAG,GAAG,OAAO,CACjB;YACE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YACl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CAAC,IAAI,EACT,IAAI,CAAC,IAAI,CAAC,QAAQ,EAClB,IAAI,CAAC,IAAI,CAAC,WAAW,CACtB,CAAA;IACP,CAAC;CACF","sourcesContent":["import { satisfies } from '@vltpkg/satisfies'\nimport type { Spec } from '@vltpkg/spec'\nimport { inspect } from 'node:util'\nimport type { InspectOptions } from 'node:util'\nimport type { DependencyTypeShort } from '@vltpkg/types'\nimport type { Node } from './node.ts'\nimport type { EdgeLike } from './types.ts'\n\nconst kCustomInspect = Symbol.for('nodejs.util.inspect.custom')\n\nexport class Edge implements EdgeLike {\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Edge'\n }\n\n [kCustomInspect](_: number, options: InspectOptions) {\n const str = inspect(\n {\n from: this.from.id,\n type: this.type,\n spec: String(this.spec),\n to: this.to?.id,\n },\n options,\n )\n return `${this[Symbol.toStringTag]} ${str}`\n }\n\n /**\n * The Node this Edge is connecting from, this is usually the dependent.\n */\n from: Node\n\n /**\n * The node this Edge is connecting to, this is usually a direct dependency.\n */\n to?: Node\n\n /**\n * What type of dependency relationship `from` and `to` nodes have.\n */\n type: DependencyTypeShort\n\n /**\n * The defined spec value for `to` as parsed from the dependent metadata.\n */\n spec: Spec\n\n constructor(\n type: DependencyTypeShort,\n spec: Spec,\n from: Node,\n to?: Node,\n ) {\n this.from = from\n this.to = to\n this.type = type\n this.spec = spec\n }\n\n /**\n * The name of the dependency `to` as defined in the dependent metadata.\n */\n get name() {\n return this.spec.name\n }\n\n /**\n * This edge was defined as part of a `devDependencies` in `package.json`\n */\n get dev(): boolean {\n return this.type === 'dev'\n }\n\n get optional(): boolean {\n return this.type === 'peerOptional' || this.type === 'optional'\n }\n\n get peer(): boolean {\n return this.type === 'peer' || this.type === 'peerOptional'\n }\n\n get peerOptional(): boolean {\n return this.type === 'peerOptional'\n }\n\n valid(): boolean {\n return !this.to ?\n this.optional\n : satisfies(\n this.to.id,\n this.spec,\n this.from.location,\n this.from.projectRoot,\n )\n }\n}\n"]}
|
package/dist/esm/graph.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { DepID } from '@vltpkg/dep-id';
|
|
2
2
|
import { Spec } from '@vltpkg/spec';
|
|
3
3
|
import type { SpecOptions } from '@vltpkg/spec';
|
|
4
|
-
import type {
|
|
4
|
+
import type { NormalizedManifest, DependencySaveType } from '@vltpkg/types';
|
|
5
5
|
import type { Monorepo } from '@vltpkg/workspaces';
|
|
6
|
-
import type { InspectOptions } from 'util';
|
|
6
|
+
import type { InspectOptions } from 'node:util';
|
|
7
7
|
import type { Edge } from './edge.ts';
|
|
8
8
|
import { Node } from './node.ts';
|
|
9
9
|
import type { GraphLike, NodeLike } from './types.ts';
|
|
10
10
|
declare const kCustomInspect: unique symbol;
|
|
11
|
-
export type ManifestInventory = Map<DepID,
|
|
11
|
+
export type ManifestInventory = Map<DepID, NormalizedManifest>;
|
|
12
12
|
export type GraphOptions = SpecOptions & {
|
|
13
13
|
/**
|
|
14
14
|
* The main importer manifest info.
|
|
15
15
|
*/
|
|
16
|
-
mainManifest:
|
|
16
|
+
mainManifest: NormalizedManifest;
|
|
17
17
|
/**
|
|
18
18
|
* An inventory of seen manifests.
|
|
19
19
|
*/
|
|
@@ -76,7 +76,7 @@ export declare class Graph implements GraphLike {
|
|
|
76
76
|
projectRoot: string;
|
|
77
77
|
constructor(options: GraphOptions);
|
|
78
78
|
/**
|
|
79
|
-
* Delete all nodes that are unreachable from the importers.
|
|
79
|
+
* Delete all nodes and edges that are unreachable from the importers.
|
|
80
80
|
* The collection of deleted nodes is returned.
|
|
81
81
|
*
|
|
82
82
|
* NOTE: This can be extremely slow for large graphs, and is almost always
|
|
@@ -90,15 +90,15 @@ export declare class Graph implements GraphLike {
|
|
|
90
90
|
* in case the destination node does not exists, then a dangling edge,
|
|
91
91
|
* pointing to nothing will be created to represent that missing dependency.
|
|
92
92
|
*/
|
|
93
|
-
addEdge(type:
|
|
93
|
+
addEdge(type: DependencySaveType, spec: Spec, from: NodeLike, to?: NodeLike): Edge;
|
|
94
94
|
/**
|
|
95
95
|
* Find an existing node to satisfy a dependency
|
|
96
96
|
*/
|
|
97
|
-
findResolution(spec: Spec, fromNode: Node): Node | undefined;
|
|
97
|
+
findResolution(spec: Spec, fromNode: Node, queryModifier?: string): Node | undefined;
|
|
98
98
|
/**
|
|
99
99
|
* Create a new node in the graph.
|
|
100
100
|
*/
|
|
101
|
-
addNode(id?: DepID, manifest?:
|
|
101
|
+
addNode(id?: DepID, manifest?: NormalizedManifest, spec?: Spec, name?: string, version?: string): Node;
|
|
102
102
|
/**
|
|
103
103
|
* Place a new package into the graph representation, creating the new
|
|
104
104
|
* edges and possibly new nodes that are to be expected when traversing
|
|
@@ -107,15 +107,22 @@ export declare class Graph implements GraphLike {
|
|
|
107
107
|
* For different uses that are not a direct top-down traversal of the graph
|
|
108
108
|
* consider using `addNode()` and `addEdge()` instead.
|
|
109
109
|
*/
|
|
110
|
-
placePackage(fromNode: Node, depType:
|
|
110
|
+
placePackage(fromNode: Node, depType: DependencySaveType, spec: Spec, manifest?: NormalizedManifest, id?: DepID, extra?: string): Node | undefined;
|
|
111
111
|
/**
|
|
112
112
|
* Removes a node and its relevant edges from the graph.
|
|
113
113
|
*
|
|
114
|
+
* Use the `keepEdges` option to keep the edges that were pointing to
|
|
115
|
+
* this node and only removes their `to` property value.
|
|
116
|
+
*
|
|
114
117
|
* If a replacement is provided, then any edges that were previously
|
|
115
118
|
* pointing to the removed node will be directed to the replacement,
|
|
116
119
|
* if it is valid to do so.
|
|
117
120
|
*/
|
|
118
|
-
removeNode(node: Node, replacement?: Node): void;
|
|
121
|
+
removeNode(node: Node, replacement?: Node, keepEdges?: boolean): void;
|
|
122
|
+
/**
|
|
123
|
+
* Removes the resolved node of a given edge.
|
|
124
|
+
*/
|
|
125
|
+
removeEdgeResolution(edge: Edge, queryModifier?: string): void;
|
|
119
126
|
toJSON(): import("./index.ts").LockfileData;
|
|
120
127
|
[kCustomInspect](_: number, options: InspectOptions): string;
|
|
121
128
|
}
|
package/dist/esm/graph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/graph.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG3C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/graph.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG3C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrD,QAAA,MAAM,cAAc,eAA2C,CAAA;AAM/D,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAA;AAoB9D,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC;;OAEG;IACH,YAAY,EAAE,kBAAkB,CAAA;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB;;OAEG;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CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO;IAmC9D;;OAEG;IACH,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,SAAK;IAmBnD,MAAM;IAQN,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc;CAIpD"}
|
package/dist/esm/graph.js
CHANGED
|
@@ -2,14 +2,25 @@ import { getId, joinDepIDTuple } from '@vltpkg/dep-id';
|
|
|
2
2
|
import { error } from '@vltpkg/error-cause';
|
|
3
3
|
import { satisfies } from '@vltpkg/satisfies';
|
|
4
4
|
import { Spec } from '@vltpkg/spec';
|
|
5
|
-
import { inspect } from 'util';
|
|
5
|
+
import { inspect } from 'node:util';
|
|
6
6
|
import { lockfileData } from "./lockfile/save.js";
|
|
7
7
|
import { Node } from "./node.js";
|
|
8
|
+
import { resolveSaveType } from "./resolve-save-type.js";
|
|
8
9
|
const kCustomInspect = Symbol.for('nodejs.util.inspect.custom');
|
|
9
10
|
// this is always the same, but we don't hard code it as a string,
|
|
10
11
|
// in case the DepID module needs to change its delimiter again ever.
|
|
11
12
|
const mainDepID = joinDepIDTuple(['file', '.']);
|
|
12
13
|
const getMap = (m) => m ?? new Map();
|
|
14
|
+
/**
|
|
15
|
+
* Get a cache key for a resolution based on the
|
|
16
|
+
* spec, location and query modifier.
|
|
17
|
+
*/
|
|
18
|
+
const getResolutionCacheKey = (spec, location, queryModifier) => {
|
|
19
|
+
const f = spec.final;
|
|
20
|
+
// if it's a file: dep, then the fromNode location matters
|
|
21
|
+
const fromPref = f.type === 'file' ? location + ' : ' : '';
|
|
22
|
+
return fromPref + String(f) + queryModifier;
|
|
23
|
+
};
|
|
13
24
|
export class Graph {
|
|
14
25
|
get [Symbol.toStringTag]() {
|
|
15
26
|
return '@vltpkg/graph.Graph';
|
|
@@ -93,7 +104,7 @@ export class Graph {
|
|
|
93
104
|
}
|
|
94
105
|
}
|
|
95
106
|
/**
|
|
96
|
-
* Delete all nodes that are unreachable from the importers.
|
|
107
|
+
* Delete all nodes and edges that are unreachable from the importers.
|
|
97
108
|
* The collection of deleted nodes is returned.
|
|
98
109
|
*
|
|
99
110
|
* NOTE: This can be extremely slow for large graphs, and is almost always
|
|
@@ -103,13 +114,16 @@ export class Graph {
|
|
|
103
114
|
*/
|
|
104
115
|
gc() {
|
|
105
116
|
const { nodes } = this;
|
|
117
|
+
this.edges.clear();
|
|
106
118
|
this.nodes = new Map();
|
|
107
119
|
const marked = new Set(this.importers);
|
|
108
120
|
for (const imp of marked) {
|
|
109
121
|
// don't delete the importer!
|
|
110
122
|
nodes.delete(imp.id);
|
|
111
123
|
this.nodes.set(imp.id, imp);
|
|
112
|
-
for (const
|
|
124
|
+
for (const edge of imp.edgesOut.values()) {
|
|
125
|
+
this.edges.add(edge);
|
|
126
|
+
const { to } = edge;
|
|
113
127
|
if (!to || marked.has(to))
|
|
114
128
|
continue;
|
|
115
129
|
marked.add(to);
|
|
@@ -144,6 +158,9 @@ export class Graph {
|
|
|
144
158
|
if (edge.type === type &&
|
|
145
159
|
edge.spec.bareSpec === spec.bareSpec) {
|
|
146
160
|
if (to && to !== edge.to) {
|
|
161
|
+
// removes this edge from its destination edgesIn ref
|
|
162
|
+
edge.to?.edgesIn.delete(edge);
|
|
163
|
+
// now swap the destination to the new one
|
|
147
164
|
edge.to = to;
|
|
148
165
|
edge.to.edgesIn.add(edge);
|
|
149
166
|
}
|
|
@@ -152,18 +169,16 @@ export class Graph {
|
|
|
152
169
|
this.edges.delete(edge);
|
|
153
170
|
}
|
|
154
171
|
const f = from;
|
|
155
|
-
const edgeOut = f.addEdgesTo(type, spec, to);
|
|
172
|
+
const edgeOut = f.addEdgesTo(resolveSaveType(from, spec.name, type), spec, to);
|
|
156
173
|
this.edges.add(edgeOut);
|
|
157
174
|
return edgeOut;
|
|
158
175
|
}
|
|
159
176
|
/**
|
|
160
177
|
* Find an existing node to satisfy a dependency
|
|
161
178
|
*/
|
|
162
|
-
findResolution(spec, fromNode) {
|
|
179
|
+
findResolution(spec, fromNode, queryModifier = '') {
|
|
163
180
|
const f = spec.final;
|
|
164
|
-
|
|
165
|
-
const fromPref = f.type === 'file' ? fromNode.location + ' : ' : '';
|
|
166
|
-
const sf = fromPref + String(f);
|
|
181
|
+
const sf = getResolutionCacheKey(f, fromNode.location, queryModifier);
|
|
167
182
|
const cached = this.resolutions.get(sf);
|
|
168
183
|
if (cached)
|
|
169
184
|
return cached;
|
|
@@ -212,7 +227,7 @@ export class Graph {
|
|
|
212
227
|
* For different uses that are not a direct top-down traversal of the graph
|
|
213
228
|
* consider using `addNode()` and `addEdge()` instead.
|
|
214
229
|
*/
|
|
215
|
-
placePackage(fromNode, depType, spec, manifest, id) {
|
|
230
|
+
placePackage(fromNode, depType, spec, manifest, id, extra) {
|
|
216
231
|
// if no manifest is available, then create an edge that has no
|
|
217
232
|
// reference to any other node, representing a missing dependency
|
|
218
233
|
if (!manifest && !id) {
|
|
@@ -226,7 +241,7 @@ export class Graph {
|
|
|
226
241
|
depType === 'optional' ||
|
|
227
242
|
depType === 'peerOptional',
|
|
228
243
|
};
|
|
229
|
-
const depId = id || (manifest && getId(spec, manifest));
|
|
244
|
+
const depId = id || (manifest && getId(spec, manifest, extra));
|
|
230
245
|
/* c8 ignore start - should not be possible */
|
|
231
246
|
if (!depId) {
|
|
232
247
|
throw error('Could not find dep id when placing package', {
|
|
@@ -247,21 +262,26 @@ export class Graph {
|
|
|
247
262
|
return toFoundNode;
|
|
248
263
|
}
|
|
249
264
|
// creates a new node and edges to its parent
|
|
250
|
-
const toNode = this.addNode(depId, manifest);
|
|
265
|
+
const toNode = this.addNode(depId, manifest, spec);
|
|
251
266
|
toNode.registry = spec.registry;
|
|
252
267
|
toNode.dev = flags.dev;
|
|
253
268
|
toNode.optional = flags.optional;
|
|
269
|
+
toNode.modifier = extra;
|
|
270
|
+
toNode.maybeSetConfusedManifest(spec, manifest);
|
|
254
271
|
this.addEdge(depType, spec, fromNode, toNode);
|
|
255
272
|
return toNode;
|
|
256
273
|
}
|
|
257
274
|
/**
|
|
258
275
|
* Removes a node and its relevant edges from the graph.
|
|
259
276
|
*
|
|
277
|
+
* Use the `keepEdges` option to keep the edges that were pointing to
|
|
278
|
+
* this node and only removes their `to` property value.
|
|
279
|
+
*
|
|
260
280
|
* If a replacement is provided, then any edges that were previously
|
|
261
281
|
* pointing to the removed node will be directed to the replacement,
|
|
262
282
|
* if it is valid to do so.
|
|
263
283
|
*/
|
|
264
|
-
removeNode(node, replacement) {
|
|
284
|
+
removeNode(node, replacement, keepEdges) {
|
|
265
285
|
this.nodes.delete(node.id);
|
|
266
286
|
const nbn = this.nodesByName.get(node.name);
|
|
267
287
|
// if it's the last one, just remove the set
|
|
@@ -282,12 +302,32 @@ export class Graph {
|
|
|
282
302
|
satisfies(replacement.id, edge.spec, edge.from.location, this.projectRoot, this.monorepo)) {
|
|
283
303
|
edge.to = replacement;
|
|
284
304
|
}
|
|
305
|
+
else if (keepEdges) {
|
|
306
|
+
edge.to = undefined;
|
|
307
|
+
}
|
|
285
308
|
else {
|
|
286
309
|
edge.from.edgesOut.delete(edge.spec.name);
|
|
287
310
|
this.edges.delete(edge);
|
|
288
311
|
}
|
|
289
312
|
}
|
|
290
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Removes the resolved node of a given edge.
|
|
316
|
+
*/
|
|
317
|
+
removeEdgeResolution(edge, queryModifier = '') {
|
|
318
|
+
const node = edge.to;
|
|
319
|
+
const resolutionKey = getResolutionCacheKey(edge.spec, edge.from.location, queryModifier);
|
|
320
|
+
if (node) {
|
|
321
|
+
edge.to = undefined;
|
|
322
|
+
this.resolutions.delete(resolutionKey);
|
|
323
|
+
this.resolutionsReverse.get(node)?.delete(resolutionKey);
|
|
324
|
+
this.nodesByName.delete(node.name);
|
|
325
|
+
node.edgesIn.delete(edge);
|
|
326
|
+
if (node.edgesIn.size === 0) {
|
|
327
|
+
this.nodes.delete(node.id);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
291
331
|
toJSON() {
|
|
292
332
|
return lockfileData({
|
|
293
333
|
...this.#options,
|