@vltpkg/graph 1.0.0-rc.18 → 1.0.0-rc.22

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.
Files changed (217) hide show
  1. package/package.json +45 -41
  2. package/dist/actual/load.d.ts +0 -100
  3. package/dist/actual/load.d.ts.map +0 -1
  4. package/dist/actual/load.js +0 -320
  5. package/dist/actual/load.js.map +0 -1
  6. package/dist/browser.d.ts +0 -15
  7. package/dist/browser.d.ts.map +0 -1
  8. package/dist/browser.js +0 -17
  9. package/dist/browser.js.map +0 -1
  10. package/dist/build.d.ts +0 -29
  11. package/dist/build.d.ts.map +0 -1
  12. package/dist/build.js +0 -79
  13. package/dist/build.js.map +0 -1
  14. package/dist/dependencies.d.ts +0 -66
  15. package/dist/dependencies.d.ts.map +0 -1
  16. package/dist/dependencies.js +0 -112
  17. package/dist/dependencies.js.map +0 -1
  18. package/dist/diff.d.ts +0 -120
  19. package/dist/diff.d.ts.map +0 -1
  20. package/dist/diff.js +0 -152
  21. package/dist/diff.js.map +0 -1
  22. package/dist/edge.d.ts +0 -47
  23. package/dist/edge.d.ts.map +0 -1
  24. package/dist/edge.js +0 -78
  25. package/dist/edge.js.map +0 -1
  26. package/dist/fixup-added-names.d.ts +0 -19
  27. package/dist/fixup-added-names.d.ts.map +0 -1
  28. package/dist/fixup-added-names.js +0 -47
  29. package/dist/fixup-added-names.js.map +0 -1
  30. package/dist/graph.d.ts +0 -154
  31. package/dist/graph.d.ts.map +0 -1
  32. package/dist/graph.js +0 -445
  33. package/dist/graph.js.map +0 -1
  34. package/dist/ideal/append-nodes.d.ts +0 -32
  35. package/dist/ideal/append-nodes.d.ts.map +0 -1
  36. package/dist/ideal/append-nodes.js +0 -561
  37. package/dist/ideal/append-nodes.js.map +0 -1
  38. package/dist/ideal/build-ideal-from-starting-graph.d.ts +0 -15
  39. package/dist/ideal/build-ideal-from-starting-graph.d.ts.map +0 -1
  40. package/dist/ideal/build-ideal-from-starting-graph.js +0 -70
  41. package/dist/ideal/build-ideal-from-starting-graph.js.map +0 -1
  42. package/dist/ideal/build.d.ts +0 -41
  43. package/dist/ideal/build.d.ts.map +0 -1
  44. package/dist/ideal/build.js +0 -85
  45. package/dist/ideal/build.js.map +0 -1
  46. package/dist/ideal/get-importer-specs.d.ts +0 -21
  47. package/dist/ideal/get-importer-specs.d.ts.map +0 -1
  48. package/dist/ideal/get-importer-specs.js +0 -181
  49. package/dist/ideal/get-importer-specs.js.map +0 -1
  50. package/dist/ideal/peers.d.ts +0 -161
  51. package/dist/ideal/peers.d.ts.map +0 -1
  52. package/dist/ideal/peers.js +0 -697
  53. package/dist/ideal/peers.js.map +0 -1
  54. package/dist/ideal/refresh-ideal-graph.d.ts +0 -44
  55. package/dist/ideal/refresh-ideal-graph.d.ts.map +0 -1
  56. package/dist/ideal/refresh-ideal-graph.js +0 -63
  57. package/dist/ideal/refresh-ideal-graph.js.map +0 -1
  58. package/dist/ideal/remove-satisfied-specs.d.ts +0 -8
  59. package/dist/ideal/remove-satisfied-specs.d.ts.map +0 -1
  60. package/dist/ideal/remove-satisfied-specs.js +0 -35
  61. package/dist/ideal/remove-satisfied-specs.js.map +0 -1
  62. package/dist/ideal/sorting.d.ts +0 -46
  63. package/dist/ideal/sorting.d.ts.map +0 -1
  64. package/dist/ideal/sorting.js +0 -71
  65. package/dist/ideal/sorting.js.map +0 -1
  66. package/dist/ideal/types.d.ts +0 -108
  67. package/dist/ideal/types.d.ts.map +0 -1
  68. package/dist/ideal/types.js +0 -2
  69. package/dist/ideal/types.js.map +0 -1
  70. package/dist/index.d.ts +0 -39
  71. package/dist/index.d.ts.map +0 -1
  72. package/dist/index.js +0 -33
  73. package/dist/index.js.map +0 -1
  74. package/dist/install.d.ts +0 -20
  75. package/dist/install.d.ts.map +0 -1
  76. package/dist/install.js +0 -209
  77. package/dist/install.js.map +0 -1
  78. package/dist/lockfile/load-edges.d.ts +0 -12
  79. package/dist/lockfile/load-edges.d.ts.map +0 -1
  80. package/dist/lockfile/load-edges.js +0 -106
  81. package/dist/lockfile/load-edges.js.map +0 -1
  82. package/dist/lockfile/load-nodes.d.ts +0 -5
  83. package/dist/lockfile/load-nodes.d.ts.map +0 -1
  84. package/dist/lockfile/load-nodes.js +0 -102
  85. package/dist/lockfile/load-nodes.js.map +0 -1
  86. package/dist/lockfile/load.d.ts +0 -46
  87. package/dist/lockfile/load.d.ts.map +0 -1
  88. package/dist/lockfile/load.js +0 -85
  89. package/dist/lockfile/load.js.map +0 -1
  90. package/dist/lockfile/save.d.ts +0 -31
  91. package/dist/lockfile/save.d.ts.map +0 -1
  92. package/dist/lockfile/save.js +0 -175
  93. package/dist/lockfile/save.js.map +0 -1
  94. package/dist/lockfile/types.d.ts +0 -96
  95. package/dist/lockfile/types.d.ts.map +0 -1
  96. package/dist/lockfile/types.js +0 -50
  97. package/dist/lockfile/types.js.map +0 -1
  98. package/dist/modifiers.d.ts +0 -189
  99. package/dist/modifiers.d.ts.map +0 -1
  100. package/dist/modifiers.js +0 -330
  101. package/dist/modifiers.js.map +0 -1
  102. package/dist/node.d.ts +0 -235
  103. package/dist/node.d.ts.map +0 -1
  104. package/dist/node.js +0 -389
  105. package/dist/node.js.map +0 -1
  106. package/dist/non-empty-list.d.ts +0 -3
  107. package/dist/non-empty-list.d.ts.map +0 -1
  108. package/dist/non-empty-list.js +0 -3
  109. package/dist/non-empty-list.js.map +0 -1
  110. package/dist/reify/add-edge.d.ts +0 -10
  111. package/dist/reify/add-edge.d.ts.map +0 -1
  112. package/dist/reify/add-edge.js +0 -65
  113. package/dist/reify/add-edge.js.map +0 -1
  114. package/dist/reify/add-edges.d.ts +0 -5
  115. package/dist/reify/add-edges.d.ts.map +0 -1
  116. package/dist/reify/add-edges.js +0 -13
  117. package/dist/reify/add-edges.js.map +0 -1
  118. package/dist/reify/add-nodes.d.ts +0 -7
  119. package/dist/reify/add-nodes.d.ts.map +0 -1
  120. package/dist/reify/add-nodes.js +0 -17
  121. package/dist/reify/add-nodes.js.map +0 -1
  122. package/dist/reify/bin-chmod.d.ts +0 -11
  123. package/dist/reify/bin-chmod.d.ts.map +0 -1
  124. package/dist/reify/bin-chmod.js +0 -39
  125. package/dist/reify/bin-chmod.js.map +0 -1
  126. package/dist/reify/build.d.ts +0 -14
  127. package/dist/reify/build.d.ts.map +0 -1
  128. package/dist/reify/build.js +0 -112
  129. package/dist/reify/build.js.map +0 -1
  130. package/dist/reify/calculate-save-value.d.ts +0 -3
  131. package/dist/reify/calculate-save-value.d.ts.map +0 -1
  132. package/dist/reify/calculate-save-value.js +0 -45
  133. package/dist/reify/calculate-save-value.js.map +0 -1
  134. package/dist/reify/check-needed-build.d.ts +0 -35
  135. package/dist/reify/check-needed-build.d.ts.map +0 -1
  136. package/dist/reify/check-needed-build.js +0 -72
  137. package/dist/reify/check-needed-build.js.map +0 -1
  138. package/dist/reify/delete-edge.d.ts +0 -5
  139. package/dist/reify/delete-edge.d.ts.map +0 -1
  140. package/dist/reify/delete-edge.js +0 -28
  141. package/dist/reify/delete-edge.js.map +0 -1
  142. package/dist/reify/delete-edges.d.ts +0 -5
  143. package/dist/reify/delete-edges.d.ts.map +0 -1
  144. package/dist/reify/delete-edges.js +0 -14
  145. package/dist/reify/delete-edges.js.map +0 -1
  146. package/dist/reify/delete-nodes.d.ts +0 -5
  147. package/dist/reify/delete-nodes.d.ts.map +0 -1
  148. package/dist/reify/delete-nodes.js +0 -16
  149. package/dist/reify/delete-nodes.js.map +0 -1
  150. package/dist/reify/extract-node.d.ts +0 -24
  151. package/dist/reify/extract-node.d.ts.map +0 -1
  152. package/dist/reify/extract-node.js +0 -84
  153. package/dist/reify/extract-node.js.map +0 -1
  154. package/dist/reify/index.d.ts +0 -35
  155. package/dist/reify/index.d.ts.map +0 -1
  156. package/dist/reify/index.js +0 -162
  157. package/dist/reify/index.js.map +0 -1
  158. package/dist/reify/internal-hoist.d.ts +0 -9
  159. package/dist/reify/internal-hoist.d.ts.map +0 -1
  160. package/dist/reify/internal-hoist.js +0 -134
  161. package/dist/reify/internal-hoist.js.map +0 -1
  162. package/dist/reify/optional-fail.d.ts +0 -16
  163. package/dist/reify/optional-fail.d.ts.map +0 -1
  164. package/dist/reify/optional-fail.js +0 -16
  165. package/dist/reify/optional-fail.js.map +0 -1
  166. package/dist/reify/rollback.d.ts +0 -5
  167. package/dist/reify/rollback.d.ts.map +0 -1
  168. package/dist/reify/rollback.js +0 -24
  169. package/dist/reify/rollback.js.map +0 -1
  170. package/dist/reify/update-importers-package-json.d.ts +0 -36
  171. package/dist/reify/update-importers-package-json.d.ts.map +0 -1
  172. package/dist/reify/update-importers-package-json.js +0 -123
  173. package/dist/reify/update-importers-package-json.js.map +0 -1
  174. package/dist/remove-optional-subgraph.d.ts +0 -34
  175. package/dist/remove-optional-subgraph.d.ts.map +0 -1
  176. package/dist/remove-optional-subgraph.js +0 -48
  177. package/dist/remove-optional-subgraph.js.map +0 -1
  178. package/dist/resolve-save-type.d.ts +0 -6
  179. package/dist/resolve-save-type.d.ts.map +0 -1
  180. package/dist/resolve-save-type.js +0 -5
  181. package/dist/resolve-save-type.js.map +0 -1
  182. package/dist/stringify-node.d.ts +0 -3
  183. package/dist/stringify-node.d.ts.map +0 -1
  184. package/dist/stringify-node.js +0 -33
  185. package/dist/stringify-node.js.map +0 -1
  186. package/dist/transfer-data/load.d.ts +0 -44
  187. package/dist/transfer-data/load.d.ts.map +0 -1
  188. package/dist/transfer-data/load.js +0 -176
  189. package/dist/transfer-data/load.js.map +0 -1
  190. package/dist/uninstall.d.ts +0 -15
  191. package/dist/uninstall.d.ts.map +0 -1
  192. package/dist/uninstall.js +0 -68
  193. package/dist/uninstall.js.map +0 -1
  194. package/dist/update.d.ts +0 -13
  195. package/dist/update.d.ts.map +0 -1
  196. package/dist/update.js +0 -74
  197. package/dist/update.js.map +0 -1
  198. package/dist/virtual-root.d.ts +0 -16
  199. package/dist/virtual-root.d.ts.map +0 -1
  200. package/dist/virtual-root.js +0 -79
  201. package/dist/virtual-root.js.map +0 -1
  202. package/dist/visualization/human-readable-output.d.ts +0 -27
  203. package/dist/visualization/human-readable-output.d.ts.map +0 -1
  204. package/dist/visualization/human-readable-output.js +0 -164
  205. package/dist/visualization/human-readable-output.js.map +0 -1
  206. package/dist/visualization/json-output.d.ts +0 -42
  207. package/dist/visualization/json-output.d.ts.map +0 -1
  208. package/dist/visualization/json-output.js +0 -51
  209. package/dist/visualization/json-output.js.map +0 -1
  210. package/dist/visualization/mermaid-output.d.ts +0 -18
  211. package/dist/visualization/mermaid-output.d.ts.map +0 -1
  212. package/dist/visualization/mermaid-output.js +0 -176
  213. package/dist/visualization/mermaid-output.js.map +0 -1
  214. package/dist/visualization/object-like-output.d.ts +0 -3
  215. package/dist/visualization/object-like-output.d.ts.map +0 -1
  216. package/dist/visualization/object-like-output.js +0 -48
  217. package/dist/visualization/object-like-output.js.map +0 -1
package/package.json CHANGED
@@ -1,83 +1,87 @@
1
1
  {
2
2
  "name": "@vltpkg/graph",
3
3
  "description": "A library that helps understanding & expressing what happens on an install",
4
- "version": "1.0.0-rc.18",
4
+ "version": "1.0.0-rc.22",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
8
8
  "directory": "src/graph"
9
9
  },
10
- "author": "vlt technology inc. <support@vlt.sh> (http://vlt.sh)",
10
+ "author": {
11
+ "name": "vlt technology inc.",
12
+ "email": "support@vlt.sh"
13
+ },
11
14
  "dependencies": {
15
+ "@vltpkg/cmd-shim": "1.0.0-rc.22",
16
+ "@vltpkg/dep-id": "1.0.0-rc.22",
17
+ "@vltpkg/dss-breadcrumb": "1.0.0-rc.22",
18
+ "@vltpkg/error-cause": "1.0.0-rc.22",
19
+ "@vltpkg/fast-split": "1.0.0-rc.22",
20
+ "@vltpkg/graph-run": "1.0.0-rc.22",
21
+ "@vltpkg/init": "1.0.0-rc.22",
22
+ "@vltpkg/output": "1.0.0-rc.22",
23
+ "@vltpkg/package-info": "1.0.0-rc.22",
24
+ "@vltpkg/package-json": "1.0.0-rc.22",
25
+ "@vltpkg/pick-manifest": "1.0.0-rc.22",
26
+ "@vltpkg/query": "1.0.0-rc.22",
27
+ "@vltpkg/rollback-remove": "1.0.0-rc.22",
28
+ "@vltpkg/run": "1.0.0-rc.22",
29
+ "@vltpkg/satisfies": "1.0.0-rc.22",
30
+ "@vltpkg/security-archive": "1.0.0-rc.22",
31
+ "@vltpkg/spec": "1.0.0-rc.22",
32
+ "@vltpkg/types": "1.0.0-rc.22",
33
+ "@vltpkg/vlt-json": "1.0.0-rc.22",
34
+ "@vltpkg/workspaces": "1.0.0-rc.22",
12
35
  "path-scurry": "^2.0.1",
13
- "promise-call-limit": "^3.0.2",
14
- "@vltpkg/dep-id": "1.0.0-rc.18",
15
- "@vltpkg/dss-breadcrumb": "1.0.0-rc.18",
16
- "@vltpkg/cmd-shim": "1.0.0-rc.18",
17
- "@vltpkg/fast-split": "1.0.0-rc.18",
18
- "@vltpkg/error-cause": "1.0.0-rc.18",
19
- "@vltpkg/graph-run": "1.0.0-rc.18",
20
- "@vltpkg/init": "1.0.0-rc.18",
21
- "@vltpkg/output": "1.0.0-rc.18",
22
- "@vltpkg/package-info": "1.0.0-rc.18",
23
- "@vltpkg/package-json": "1.0.0-rc.18",
24
- "@vltpkg/pick-manifest": "1.0.0-rc.18",
25
- "@vltpkg/query": "1.0.0-rc.18",
26
- "@vltpkg/rollback-remove": "1.0.0-rc.18",
27
- "@vltpkg/run": "1.0.0-rc.18",
28
- "@vltpkg/satisfies": "1.0.0-rc.18",
29
- "@vltpkg/security-archive": "1.0.0-rc.18",
30
- "@vltpkg/spec": "1.0.0-rc.18",
31
- "@vltpkg/types": "1.0.0-rc.18",
32
- "@vltpkg/vlt-json": "1.0.0-rc.18",
33
- "@vltpkg/workspaces": "1.0.0-rc.18"
36
+ "promise-call-limit": "^3.0.2"
34
37
  },
35
38
  "devDependencies": {
36
39
  "@eslint/js": "^9.39.1",
37
40
  "@types/node": "^22.19.2",
41
+ "@vltpkg/vlt-json": "1.0.0-rc.22",
38
42
  "eslint": "^9.39.1",
39
43
  "prettier": "^3.7.4",
40
44
  "tap": "^21.5.0",
41
45
  "tar": "^7.5.2",
42
46
  "typedoc": "~0.27.9",
43
47
  "typescript": "5.7.3",
44
- "typescript-eslint": "^8.49.0",
45
- "@vltpkg/vlt-json": "1.0.0-rc.18"
48
+ "typescript-eslint": "^8.49.0"
46
49
  },
47
50
  "license": "BSD-2-Clause-Patent",
48
51
  "engines": {
49
- "node": ">=22.9.0"
52
+ "node": ">=22.22.0"
53
+ },
54
+ "scripts": {
55
+ "format": "prettier --write . --log-level warn --ignore-path ../../.prettierignore --cache",
56
+ "format:check": "prettier --check . --ignore-path ../../.prettierignore --cache",
57
+ "lint": "eslint . --fix",
58
+ "lint:check": "eslint .",
59
+ "prepack": "tsc -p tsconfig.publish.json && ../../scripts/update-dist-exports.ts",
60
+ "snap": "tap",
61
+ "test": "tap",
62
+ "posttest": "tsc --noEmit",
63
+ "typecheck": "tsc --noEmit"
50
64
  },
51
65
  "tap": {
52
66
  "extends": "../../tap-config.yaml"
53
67
  },
54
68
  "prettier": "../../.prettierrc.js",
55
- "module": "./dist/index.js",
69
+ "module": "./src/index.ts",
56
70
  "type": "module",
57
71
  "exports": {
58
72
  "./package.json": "./package.json",
59
73
  ".": {
60
74
  "import": {
61
- "default": "./dist/index.js"
75
+ "default": "./src/index.ts"
62
76
  }
63
77
  },
64
78
  "./browser": {
65
79
  "import": {
66
- "default": "./dist/browser.js"
80
+ "default": "./src/browser.ts"
67
81
  }
68
82
  }
69
83
  },
70
84
  "files": [
71
85
  "dist"
72
- ],
73
- "scripts": {
74
- "format": "prettier --write . --log-level warn --ignore-path ../../.prettierignore --cache",
75
- "format:check": "prettier --check . --ignore-path ../../.prettierignore --cache",
76
- "lint": "eslint . --fix",
77
- "lint:check": "eslint .",
78
- "snap": "tap",
79
- "test": "tap",
80
- "posttest": "tsc --noEmit",
81
- "typecheck": "tsc --noEmit"
82
- }
83
- }
86
+ ]
87
+ }
@@ -1,100 +0,0 @@
1
- import { Spec } from '@vltpkg/spec';
2
- import { Graph } from '../graph.ts';
3
- import type { DepID } from '@vltpkg/dep-id';
4
- import type { PackageJson } from '@vltpkg/package-json';
5
- import type { SpecOptions } from '@vltpkg/spec';
6
- import type { NormalizedManifest } from '@vltpkg/types';
7
- import type { Monorepo } from '@vltpkg/workspaces';
8
- import type { Path, PathScurry } from 'path-scurry';
9
- import type { GraphModifier } from '../modifiers.ts';
10
- export type LoadOptions = SpecOptions & {
11
- /**
12
- * The project root dirname.
13
- */
14
- projectRoot: string;
15
- /**
16
- * The project root manifest.
17
- */
18
- mainManifest?: NormalizedManifest;
19
- /**
20
- * The graph modifiers helper object.
21
- */
22
- modifiers?: GraphModifier;
23
- /**
24
- * A {@link Monorepo} object, for managing workspaces
25
- */
26
- monorepo?: Monorepo;
27
- /**
28
- * A {@link PackageJson} object, for sharing manifest caches
29
- */
30
- packageJson: PackageJson;
31
- /**
32
- * A {@link PathScurry} object, for use in globs
33
- */
34
- scurry: PathScurry;
35
- /**
36
- * If set to `false`, `actual.load` will not load any `package.json`
37
- * files while traversing the file system.
38
- *
39
- * The resulting {@link Graph} from loading with `loadManifests=false`
40
- * has no information on dependency types or the specs defined and
41
- * no information on missing and extraneous dependencies.
42
- */
43
- loadManifests?: boolean;
44
- /**
45
- * If set to `true`, then do not shortcut the process by reading the
46
- * hidden lockfile at `node_modules/.vlt-lock.json`
47
- */
48
- skipHiddenLockfile?: boolean;
49
- /**
50
- * Load only importers into the graph if the modifiers have changed.
51
- */
52
- skipLoadingNodesOnModifiersChange?: boolean;
53
- /**
54
- * If set to `true`, fail if lockfile is missing or out of date.
55
- * Used by ci command to enforce lockfile integrity.
56
- */
57
- expectLockfile?: boolean;
58
- /**
59
- * If set to `true`, fail if lockfile is missing or out of sync with package.json.
60
- * Prevents any lockfile modifications and is stricter than expectLockfile.
61
- */
62
- frozenLockfile?: boolean;
63
- /**
64
- * If set to `true`, only update the lockfile without performing any node_modules
65
- * operations. Skips package extraction, filesystem operations, and hidden lockfile saves.
66
- */
67
- lockfileOnly?: boolean;
68
- };
69
- export type ReadEntry = {
70
- alias: string;
71
- name: string;
72
- realpath: Path;
73
- };
74
- /**
75
- * The configuration object type as it is saved in the `.vlt/vlt.json`
76
- */
77
- export type StoreConfigObject = {
78
- modifiers: Record<string, string> | undefined;
79
- };
80
- /**
81
- * Checks if a given object is a {@link StoreConfigObject}.
82
- */
83
- export declare const isStoreConfigObject: (obj: unknown) => obj is StoreConfigObject;
84
- /**
85
- * Returns a {@link StoreConfigObject} from a given object.
86
- * Throws a TypeError if the object can't be converted.
87
- */
88
- export declare const asStoreConfigObject: (obj: unknown) => StoreConfigObject;
89
- /**
90
- * Returns a {@link DepID} for a given spec and path, if the spec is
91
- * path-based or a registry spec, otherwise returns `undefined`.
92
- */
93
- export declare const getPathBasedId: (spec: Spec, path: Path) => DepID | undefined;
94
- /**
95
- * Read the file system looking for `node_modules` folders and
96
- * returns a new {@link Graph} that represents the relationship
97
- * between the dependencies found.
98
- */
99
- export declare const load: (options: LoadOptions) => Graph;
100
- //# sourceMappingURL=load.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/actual/load.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAQnC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAGnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAA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G;AACH,eAAO,MAAM,IAAI,YAAa,WAAW,KAAG,KAuG3C,CAAA"}
@@ -1,320 +0,0 @@
1
- import { asDepID, hydrate, joinDepIDTuple, joinExtra, splitDepID, splitExtra, } from '@vltpkg/dep-id';
2
- import { Spec } from '@vltpkg/spec';
3
- import { graphStep } from '@vltpkg/output';
4
- import { isObject } from '@vltpkg/types';
5
- import { shorten, getRawDependencies, getDependencies, } from "../dependencies.js";
6
- import { Graph } from "../graph.js";
7
- import { loadHidden } from "../lockfile/load.js";
8
- import { saveHidden } from "../lockfile/save.js";
9
- import { readFileSync } from 'node:fs';
10
- /**
11
- * Checks if a given object is a {@link StoreConfigObject}.
12
- */
13
- export const isStoreConfigObject = (obj) => isObject(obj) &&
14
- Object.prototype.hasOwnProperty.call(obj, 'modifiers') &&
15
- isObject(obj.modifiers);
16
- /**
17
- * Returns a {@link StoreConfigObject} from a given object.
18
- * Throws a TypeError if the object can't be converted.
19
- */
20
- export const asStoreConfigObject = (obj) => {
21
- if (!isStoreConfigObject(obj)) {
22
- throw new TypeError(`Expected a store config object, got ${obj}`);
23
- }
24
- return obj;
25
- };
26
- // path-based refer to the types of dependencies that are directly linked to
27
- // their real location in the file system and thus will not have an entry
28
- // in the `node_modules/.vlt` store
29
- const pathBasedType = new Set(['file', 'workspace']);
30
- const isPathBasedType = (type) => pathBasedType.has(type);
31
- /**
32
- * Returns a {@link DepID} for a given spec and path, if the spec is
33
- * path-based or a registry spec, otherwise returns `undefined`.
34
- */
35
- export const getPathBasedId = (spec, path) => isPathBasedType(spec.type) ?
36
- joinDepIDTuple([spec.type, path.relativePosix()])
37
- : findDepID(path);
38
- /**
39
- * Retrieve the {@link DepID} for a given package from its location.
40
- */
41
- const findDepID = ({ parent, name }) => parent?.name === '.vlt' ? asDepID(name)
42
- : parent?.isCWD === false ? findDepID(parent)
43
- : undefined;
44
- /**
45
- * Retrieves the closest `node_modules` parent {@link Path} found.
46
- */
47
- const findNodeModules = ({ parent, name, isCWD, }) => parent?.name === 'node_modules' ? parent
48
- : parent && name !== '.vlt' && !isCWD ? findNodeModules(parent)
49
- : undefined;
50
- /**
51
- * Retrieves the scoped-normalized package name from its {@link Path}.
52
- */
53
- const findName = ({ parent, name }) => parent?.name.startsWith('@') ? `${parent.name}/${name}` : name;
54
- /**
55
- * Helper function that gets a modified {@link Spec} when finding a modifier
56
- * that applies to a given dependency. Otherwise returns the original spec
57
- * value and no queryModifier.
58
- */
59
- const maybeApplyModifierToSpec = (spec, depName, modifierRefs) => {
60
- const activeModifier = modifierRefs?.get(depName);
61
- const queryModifier = activeModifier?.modifier.query;
62
- const completeModifier = activeModifier &&
63
- activeModifier.interactiveBreadcrumb.current ===
64
- activeModifier.modifier.breadcrumb.last;
65
- if (queryModifier &&
66
- completeModifier &&
67
- 'spec' in activeModifier.modifier) {
68
- const modifiedSpec = activeModifier.modifier.spec;
69
- modifiedSpec.overridden = true;
70
- return { spec: modifiedSpec, queryModifier };
71
- }
72
- return { spec, queryModifier };
73
- };
74
- /**
75
- * Reads the current directory defined at `currDir` and looks for folder
76
- * names and their realpath resolution, normalizing scoped package names
77
- * and removing any invalid symlinks from the list of items that should
78
- * be parsed through in order to build the graph.
79
- */
80
- const readDir = (scurry, currDir, fromNodeName) => {
81
- const res = new Set();
82
- for (const entry of scurry.readdirSync(currDir)) {
83
- // ignore any hidden files / folders
84
- if (entry.name.startsWith('.'))
85
- continue;
86
- // scope folder found, it will need to be read and iterated over
87
- // in order to find any scoped packages inside
88
- if (entry.name.startsWith('@')) {
89
- const scopedItems = readDir(scurry, entry, fromNodeName);
90
- for (const scopedItem of scopedItems) {
91
- res.add(scopedItem);
92
- }
93
- continue;
94
- }
95
- // skip anything that isn't a symlink, it's not an edge
96
- if (!entry.isSymbolicLink())
97
- continue;
98
- // we'll need to learn what is the real path for this entry in order
99
- // to retrieve the `location` and `id` properties for the node, if a
100
- // realpath is not found just move on to the next element
101
- const realpath = entry.realpathSync();
102
- if (!realpath) {
103
- continue;
104
- }
105
- // infer both the alias and proper package names, including scopes
106
- const alias = findName(entry);
107
- const name = findName(realpath);
108
- res.add({
109
- alias,
110
- name,
111
- realpath,
112
- });
113
- }
114
- return res;
115
- };
116
- /**
117
- * Parses the files located at `currDir` and place packages found inside
118
- * as dependencies of `fromNode`, building the instantiated `graph`.
119
- */
120
- const parseDir = (options, scurry, packageJson, depsFound, graph, fromNode, currDir) => {
121
- const { loadManifests, modifiers } = options;
122
- const dependencies = getRawDependencies(fromNode);
123
- const seenDeps = new Set();
124
- const readItems = readDir(scurry, currDir, fromNode.name);
125
- // Get modifier references for this node's dependencies
126
- const modifierRefs = modifiers?.tryDependencies(fromNode, [
127
- ...getDependencies(fromNode, options).values(),
128
- ]);
129
- for (const { alias, name, realpath } of readItems) {
130
- let node;
131
- // tracks what dependencies have been seen
132
- // so that we can mark missing dependencies
133
- seenDeps.add(alias);
134
- // places the package in the graph reading
135
- // its manifest only if necessary
136
- if (!loadManifests) {
137
- const depId = findDepID(realpath);
138
- if (depId) {
139
- let h = hydrate(depId, alias, options);
140
- // if the parsed registry value is using the default value, then
141
- // the node should inherit the registry value from its parent node
142
- if (h.type === 'registry' &&
143
- h.registry === h.options.registry &&
144
- fromNode.registry) {
145
- h.registry = fromNode.registry;
146
- }
147
- // Check for active modifiers and replace spec even when not loading manifests
148
- const { spec: modifiedSpec, queryModifier } = maybeApplyModifierToSpec(h, alias, modifierRefs);
149
- h = modifiedSpec;
150
- // graphs build with no manifest have no notion of
151
- // dependency types and or spec definitions since those
152
- // would have to be parsed from a manifest
153
- node = graph.placePackage(fromNode, 'prod', // defaults to prod deps
154
- h, // uses spec from hydrated id
155
- {
156
- name,
157
- }, depId, joinExtra({ modifier: queryModifier }));
158
- // Update active entry after placing package
159
- const activeModifier = modifierRefs?.get(alias);
160
- if (activeModifier && node) {
161
- modifiers?.updateActiveEntry(node, activeModifier);
162
- }
163
- }
164
- }
165
- // retrieve references to the current folder name found in `fromNode`
166
- // manifest listed dependencies, removing it from the map will leave
167
- // a list of missing dependencies at the end of the iteration
168
- const deps = dependencies.get(alias);
169
- // in case this graph is skipping manifests, this next block might
170
- // still need to execute, thus actually loading a manifest file, for
171
- // edge-cases such as loading a linked node that is not going to have
172
- // DepID info available in its realpath or extraneous nodes
173
- if (!node) {
174
- const mani = packageJson.read(realpath.fullpath());
175
- // declares fallback default values for both depType and bareSpec
176
- // in order to support loadManifests=false fallback for link nodes
177
- const type = deps?.type || 'dependencies';
178
- const bareSpec = deps?.bareSpec || '*';
179
- const depType = shorten(type, alias, fromNode.manifest);
180
- let spec = Spec.parse(alias, bareSpec, {
181
- ...options,
182
- registry: fromNode.registry,
183
- });
184
- // Check for active modifiers and replace spec if a modifier is complete
185
- const { spec: modifiedSpec, queryModifier } = maybeApplyModifierToSpec(spec, alias, modifierRefs);
186
- spec = modifiedSpec;
187
- const maybeId = getPathBasedId(spec, realpath);
188
- let peerSetHash;
189
- if (maybeId) {
190
- // parses extra info from depID to retrieve peerSetHash
191
- try {
192
- const tuple = splitDepID(maybeId);
193
- const type = tuple[0];
194
- const extra = type === 'registry' || type === 'git' ?
195
- tuple[3]
196
- : tuple[2];
197
- peerSetHash =
198
- extra ? splitExtra(extra).peerSetHash : undefined;
199
- /* c8 ignore next - impossible: getPathBasedId asserts valid dep id */
200
- }
201
- catch { }
202
- }
203
- node = graph.placePackage(fromNode, depType, spec, mani, maybeId, joinExtra({ modifier: queryModifier, peerSetHash }));
204
- // Update active entry after placing package
205
- const activeModifier = modifierRefs?.get(alias);
206
- if (activeModifier && node) {
207
- modifiers?.updateActiveEntry(node, activeModifier);
208
- }
209
- }
210
- if (node) {
211
- // If a found dependency is not declared in any of the original
212
- // node dependencies, then add an edge to the graph pointing to it
213
- // and mark it as extraneous.
214
- //
215
- // This only makes sense if full manifests are being loaded
216
- // so that we have reference to dependencies info.
217
- if (loadManifests && !deps) {
218
- const [edge] = node.edgesIn;
219
- if (edge) {
220
- graph.extraneousDependencies.add(edge);
221
- }
222
- }
223
- // for a succesfully created node, add its location
224
- // property and queue up to read its dependencies
225
- node.location = `./${realpath.relativePosix()}`;
226
- const node_modules = findNodeModules(realpath);
227
- // queue items up to continue parsing dirs in case a node was succesfully
228
- // placed in the graph and its node_modules folder was correctly found
229
- if (node_modules) {
230
- depsFound.set(node, node_modules);
231
- }
232
- }
233
- }
234
- // any remaining dependencies that have not been found
235
- // when reading the directory should be marked as missing
236
- for (const { name, type, bareSpec } of dependencies.values()) {
237
- if (!seenDeps.has(name)) {
238
- const depType = shorten(type, name, fromNode.manifest);
239
- let spec = Spec.parse(name, bareSpec, {
240
- ...options,
241
- registry: fromNode.registry,
242
- });
243
- // Check for active modifiers and replace spec for missing dependencies
244
- const { spec: modifiedSpec, queryModifier } = maybeApplyModifierToSpec(spec, name, modifierRefs);
245
- spec = modifiedSpec;
246
- graph.placePackage(fromNode, depType, spec, undefined, undefined, joinExtra({ modifier: queryModifier }));
247
- }
248
- }
249
- };
250
- /**
251
- * Read the file system looking for `node_modules` folders and
252
- * returns a new {@link Graph} that represents the relationship
253
- * between the dependencies found.
254
- */
255
- export const load = (options) => {
256
- const done = graphStep('actual');
257
- const { modifiers, monorepo, projectRoot, packageJson, scurry, skipHiddenLockfile = false, skipLoadingNodesOnModifiersChange = false, } = options;
258
- const mainManifest = options.mainManifest ?? packageJson.read(projectRoot);
259
- if (!skipHiddenLockfile) {
260
- try {
261
- // if we reach here, the hidden lockfile is valid
262
- const graph = loadHidden({
263
- ...options,
264
- projectRoot,
265
- mainManifest,
266
- packageJson,
267
- monorepo,
268
- scurry,
269
- });
270
- done();
271
- return graph;
272
- }
273
- catch {
274
- // Hidden lockfile is cache-only, safe to regenerate on any error
275
- // as it will fall back to filesystem traversal
276
- // TODO: Warn version mismatch to @vltpkg/output for debugging
277
- }
278
- }
279
- const graph = new Graph({ ...options, mainManifest });
280
- // retrieve the configuration object from the store
281
- let storeConfig = { modifiers: undefined };
282
- try {
283
- storeConfig = asStoreConfigObject(JSON.parse(readFileSync(scurry.resolve('node_modules/.vlt/vlt.json'), 'utf8')));
284
- }
285
- catch { }
286
- const storeModifiers = JSON.stringify(storeConfig.modifiers ?? {});
287
- const optionsModifiers = JSON.stringify(modifiers?.config);
288
- const modifiersChanged = storeModifiers !== optionsModifiers;
289
- const shouldLoadDependencies = !(skipLoadingNodesOnModifiersChange && modifiersChanged);
290
- // will only skip loading dependencies if the
291
- // skipLoadingNodesOnModifiersChange option is set to true
292
- // and the current modifiers have not changed when compared
293
- // to the modifiers stored in the `node_modules/.vlt/vlt.json` store config
294
- if (shouldLoadDependencies) {
295
- const depsFound = new Map();
296
- // starts the list of initial folders to parse using the importer nodes
297
- for (const importer of graph.importers) {
298
- modifiers?.tryImporter(importer);
299
- depsFound.set(importer, scurry.cwd.resolve(`${importer.location}/node_modules`));
300
- }
301
- // breadth-first traversal of the file system tree reading deps found
302
- // starting from the node_modules folder of every importer in order to
303
- // find the actual installed dependencies at each location
304
- for (const [node, path] of depsFound.entries()) {
305
- parseDir(options, scurry, packageJson, depsFound, graph, node, path);
306
- }
307
- // Clean up any pending modifier entries that were never completed
308
- modifiers?.rollbackActiveEntries();
309
- // caches the load result to the hidden lockfile when enabled
310
- if (scurry.cwd.resolve('node_modules').lstatSync()?.isDirectory()) {
311
- saveHidden({
312
- ...options,
313
- graph,
314
- });
315
- }
316
- }
317
- done();
318
- return graph;
319
- };
320
- //# sourceMappingURL=load.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/actual/load.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,OAAO,EACP,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,GACX,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,eAAe,GACh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O,CAAC,cAAc,CAAC,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,EAC7D,CAAC;YACD,UAAU,CAAC;gBACT,GAAG,OAAO;gBACV,KAAK;aACN,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,IAAI,EAAE,CAAA;IAEN,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import {\n asDepID,\n hydrate,\n joinDepIDTuple,\n joinExtra,\n splitDepID,\n splitExtra,\n} from '@vltpkg/dep-id'\nimport { Spec } from '@vltpkg/spec'\nimport { graphStep } from '@vltpkg/output'\nimport { isObject } from '@vltpkg/types'\nimport {\n shorten,\n getRawDependencies,\n getDependencies,\n} from '../dependencies.ts'\nimport { Graph } from '../graph.ts'\nimport { loadHidden } from '../lockfile/load.ts'\nimport { saveHidden } from '../lockfile/save.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { Monorepo } from '@vltpkg/workspaces'\nimport type { Path, PathScurry } from 'path-scurry'\nimport type { Node } from '../node.ts'\nimport type {\n GraphModifier,\n ModifierActiveEntry,\n} from '../modifiers.ts'\nimport { readFileSync } from 'node:fs'\n\nexport type LoadOptions = SpecOptions & {\n /**\n * The project root dirname.\n */\n projectRoot: string\n /**\n * The project root manifest.\n */\n mainManifest?: NormalizedManifest\n /**\n * The graph modifiers helper object.\n */\n modifiers?: GraphModifier\n /**\n * A {@link Monorepo} object, for managing workspaces\n */\n monorepo?: Monorepo\n /**\n * A {@link PackageJson} object, for sharing manifest caches\n */\n packageJson: PackageJson\n /**\n * A {@link PathScurry} object, for use in globs\n */\n scurry: PathScurry\n /**\n * If set to `false`, `actual.load` will not load any `package.json`\n * files while traversing the file system.\n *\n * The resulting {@link Graph} from loading with `loadManifests=false`\n * has no information on dependency types or the specs defined and\n * no information on missing and extraneous dependencies.\n */\n loadManifests?: boolean\n /**\n * If set to `true`, then do not shortcut the process by reading the\n * hidden lockfile at `node_modules/.vlt-lock.json`\n */\n skipHiddenLockfile?: boolean\n /**\n * Load only importers into the graph if the modifiers have changed.\n */\n skipLoadingNodesOnModifiersChange?: boolean\n // TODO: move the lockfile-related options to a separate type file\n /**\n * If set to `true`, fail if lockfile is missing or out of date.\n * Used by ci command to enforce lockfile integrity.\n */\n expectLockfile?: boolean\n /**\n * If set to `true`, fail if lockfile is missing or out of sync with package.json.\n * Prevents any lockfile modifications and is stricter than expectLockfile.\n */\n frozenLockfile?: boolean\n /**\n * If set to `true`, only update the lockfile without performing any node_modules\n * operations. Skips package extraction, filesystem operations, and hidden lockfile saves.\n */\n lockfileOnly?: boolean\n}\n\nexport type ReadEntry = {\n alias: string\n name: string\n realpath: Path\n}\n\n/**\n * The configuration object type as it is saved in the `.vlt/vlt.json`\n */\nexport type StoreConfigObject = {\n modifiers: Record<string, string> | undefined\n}\n\n/**\n * Checks if a given object is a {@link StoreConfigObject}.\n */\nexport const isStoreConfigObject = (\n obj: unknown,\n): obj is StoreConfigObject =>\n isObject(obj) &&\n Object.prototype.hasOwnProperty.call(obj, 'modifiers') &&\n isObject(obj.modifiers)\n\n/**\n * Returns a {@link StoreConfigObject} from a given object.\n * Throws a TypeError if the object can't be converted.\n */\nexport const asStoreConfigObject = (\n obj: unknown,\n): StoreConfigObject => {\n if (!isStoreConfigObject(obj)) {\n throw new TypeError(`Expected a store config object, got ${obj}`)\n }\n return obj\n}\n\n// path-based refer to the types of dependencies that are directly linked to\n// their real location in the file system and thus will not have an entry\n// in the `node_modules/.vlt` store\nconst pathBasedType = new Set(['file', 'workspace'])\nconst isPathBasedType = (\n type: string,\n): type is 'file' | 'workspace' => pathBasedType.has(type)\n\n/**\n * Returns a {@link DepID} for a given spec and path, if the spec is\n * path-based or a registry spec, otherwise returns `undefined`.\n */\nexport const getPathBasedId = (\n spec: Spec,\n path: Path,\n): DepID | undefined =>\n isPathBasedType(spec.type) ?\n joinDepIDTuple([spec.type, path.relativePosix()])\n : findDepID(path)\n\n/**\n * Retrieve the {@link DepID} for a given package from its location.\n */\nconst findDepID = ({ parent, name }: Path): DepID | undefined =>\n parent?.name === '.vlt' ? asDepID(name)\n : parent?.isCWD === false ? findDepID(parent)\n : undefined\n\n/**\n * Retrieves the closest `node_modules` parent {@link Path} found.\n */\nconst findNodeModules = ({\n parent,\n name,\n isCWD,\n}: Path): Path | undefined =>\n parent?.name === 'node_modules' ? parent\n : parent && name !== '.vlt' && !isCWD ? findNodeModules(parent)\n : undefined\n\n/**\n * Retrieves the scoped-normalized package name from its {@link Path}.\n */\nconst findName = ({ parent, name }: Path): string =>\n parent?.name.startsWith('@') ? `${parent.name}/${name}` : name\n\n/**\n * Helper function that gets a modified {@link Spec} when finding a modifier\n * that applies to a given dependency. Otherwise returns the original spec\n * value and no queryModifier.\n */\nconst maybeApplyModifierToSpec = (\n spec: Spec,\n depName: string,\n modifierRefs?: Map<string, ModifierActiveEntry>,\n): { spec: Spec; queryModifier?: string } => {\n const activeModifier = modifierRefs?.get(depName)\n const queryModifier = activeModifier?.modifier.query\n const completeModifier =\n activeModifier &&\n activeModifier.interactiveBreadcrumb.current ===\n activeModifier.modifier.breadcrumb.last\n\n if (\n queryModifier &&\n completeModifier &&\n 'spec' in activeModifier.modifier\n ) {\n const modifiedSpec = activeModifier.modifier.spec\n modifiedSpec.overridden = true\n return { spec: modifiedSpec, queryModifier }\n }\n\n return { spec, queryModifier }\n}\n\n/**\n * Reads the current directory defined at `currDir` and looks for folder\n * names and their realpath resolution, normalizing scoped package names\n * and removing any invalid symlinks from the list of items that should\n * be parsed through in order to build the graph.\n */\nconst readDir = (\n scurry: PathScurry,\n currDir: Path,\n fromNodeName?: string,\n) => {\n const res = new Set<ReadEntry>()\n for (const entry of scurry.readdirSync(currDir)) {\n // ignore any hidden files / folders\n if (entry.name.startsWith('.')) continue\n\n // scope folder found, it will need to be read and iterated over\n // in order to find any scoped packages inside\n if (entry.name.startsWith('@')) {\n const scopedItems = readDir(scurry, entry, fromNodeName)\n for (const scopedItem of scopedItems) {\n res.add(scopedItem)\n }\n continue\n }\n\n // skip anything that isn't a symlink, it's not an edge\n if (!entry.isSymbolicLink()) continue\n\n // we'll need to learn what is the real path for this entry in order\n // to retrieve the `location` and `id` properties for the node, if a\n // realpath is not found just move on to the next element\n const realpath = entry.realpathSync()\n if (!realpath) {\n continue\n }\n\n // infer both the alias and proper package names, including scopes\n const alias = findName(entry)\n const name = findName(realpath)\n res.add({\n alias,\n name,\n realpath,\n })\n }\n return res\n}\n\n/**\n * Parses the files located at `currDir` and place packages found inside\n * as dependencies of `fromNode`, building the instantiated `graph`.\n */\nconst parseDir = (\n options: LoadOptions,\n scurry: PathScurry,\n packageJson: PackageJson,\n depsFound: Map<Node, Path>,\n graph: Graph,\n fromNode: Node,\n currDir: Path,\n) => {\n const { loadManifests, modifiers } = options\n const dependencies = getRawDependencies(fromNode)\n const seenDeps = new Set<string>()\n const readItems: Set<ReadEntry> = readDir(\n scurry,\n currDir,\n fromNode.name,\n )\n\n // Get modifier references for this node's dependencies\n const modifierRefs = modifiers?.tryDependencies(fromNode, [\n ...getDependencies(fromNode, options).values(),\n ])\n\n for (const { alias, name, realpath } of readItems) {\n let node\n\n // tracks what dependencies have been seen\n // so that we can mark missing dependencies\n seenDeps.add(alias)\n\n // places the package in the graph reading\n // its manifest only if necessary\n if (!loadManifests) {\n const depId = findDepID(realpath)\n\n if (depId) {\n let h = hydrate(depId, alias, options)\n // if the parsed registry value is using the default value, then\n // the node should inherit the registry value from its parent node\n if (\n h.type === 'registry' &&\n h.registry === h.options.registry &&\n fromNode.registry\n ) {\n h.registry = fromNode.registry\n }\n\n // Check for active modifiers and replace spec even when not loading manifests\n const { spec: modifiedSpec, queryModifier } =\n maybeApplyModifierToSpec(h, alias, modifierRefs)\n h = modifiedSpec\n\n // graphs build with no manifest have no notion of\n // dependency types and or spec definitions since those\n // would have to be parsed from a manifest\n node = graph.placePackage(\n fromNode,\n 'prod', // defaults to prod deps\n h, // uses spec from hydrated id\n {\n name,\n },\n depId,\n joinExtra({ modifier: queryModifier }),\n )\n\n // Update active entry after placing package\n const activeModifier = modifierRefs?.get(alias)\n if (activeModifier && node) {\n modifiers?.updateActiveEntry(node, activeModifier)\n }\n }\n }\n\n // retrieve references to the current folder name found in `fromNode`\n // manifest listed dependencies, removing it from the map will leave\n // a list of missing dependencies at the end of the iteration\n const deps = dependencies.get(alias)\n\n // in case this graph is skipping manifests, this next block might\n // still need to execute, thus actually loading a manifest file, for\n // edge-cases such as loading a linked node that is not going to have\n // DepID info available in its realpath or extraneous nodes\n if (!node) {\n const mani = packageJson.read(realpath.fullpath())\n // declares fallback default values for both depType and bareSpec\n // in order to support loadManifests=false fallback for link nodes\n const type = deps?.type || 'dependencies'\n const bareSpec = deps?.bareSpec || '*'\n\n const depType = shorten(type, alias, fromNode.manifest)\n let spec = Spec.parse(alias, bareSpec, {\n ...options,\n registry: fromNode.registry,\n })\n\n // Check for active modifiers and replace spec if a modifier is complete\n const { spec: modifiedSpec, queryModifier } =\n maybeApplyModifierToSpec(spec, alias, modifierRefs)\n spec = modifiedSpec\n\n const maybeId = getPathBasedId(spec, realpath)\n let peerSetHash: string | undefined\n if (maybeId) {\n // parses extra info from depID to retrieve peerSetHash\n try {\n const tuple = splitDepID(maybeId)\n const type = tuple[0]\n const extra =\n type === 'registry' || type === 'git' ?\n tuple[3]\n : tuple[2]\n\n peerSetHash =\n extra ? splitExtra(extra).peerSetHash : undefined\n /* c8 ignore next - impossible: getPathBasedId asserts valid dep id */\n } catch {}\n }\n node = graph.placePackage(\n fromNode,\n depType,\n spec,\n mani,\n maybeId,\n joinExtra({ modifier: queryModifier, peerSetHash }),\n )\n\n // Update active entry after placing package\n const activeModifier = modifierRefs?.get(alias)\n if (activeModifier && node) {\n modifiers?.updateActiveEntry(node, activeModifier)\n }\n }\n\n if (node) {\n // If a found dependency is not declared in any of the original\n // node dependencies, then add an edge to the graph pointing to it\n // and mark it as extraneous.\n //\n // This only makes sense if full manifests are being loaded\n // so that we have reference to dependencies info.\n if (loadManifests && !deps) {\n const [edge] = node.edgesIn\n if (edge) {\n graph.extraneousDependencies.add(edge)\n }\n }\n\n // for a succesfully created node, add its location\n // property and queue up to read its dependencies\n node.location = `./${realpath.relativePosix()}`\n const node_modules = findNodeModules(realpath)\n\n // queue items up to continue parsing dirs in case a node was succesfully\n // placed in the graph and its node_modules folder was correctly found\n if (node_modules) {\n depsFound.set(node, node_modules)\n }\n }\n }\n\n // any remaining dependencies that have not been found\n // when reading the directory should be marked as missing\n for (const { name, type, bareSpec } of dependencies.values()) {\n if (!seenDeps.has(name)) {\n const depType = shorten(type, name, fromNode.manifest)\n let spec = Spec.parse(name, bareSpec, {\n ...options,\n registry: fromNode.registry,\n })\n\n // Check for active modifiers and replace spec for missing dependencies\n const { spec: modifiedSpec, queryModifier } =\n maybeApplyModifierToSpec(spec, name, modifierRefs)\n spec = modifiedSpec\n\n graph.placePackage(\n fromNode,\n depType,\n spec,\n undefined,\n undefined,\n joinExtra({ modifier: queryModifier }),\n )\n }\n }\n}\n\n/**\n * Read the file system looking for `node_modules` folders and\n * returns a new {@link Graph} that represents the relationship\n * between the dependencies found.\n */\nexport const load = (options: LoadOptions): Graph => {\n const done = graphStep('actual')\n const {\n modifiers,\n monorepo,\n projectRoot,\n packageJson,\n scurry,\n skipHiddenLockfile = false,\n skipLoadingNodesOnModifiersChange = false,\n } = options\n const mainManifest =\n options.mainManifest ?? packageJson.read(projectRoot)\n\n if (!skipHiddenLockfile) {\n try {\n // if we reach here, the hidden lockfile is valid\n const graph = loadHidden({\n ...options,\n projectRoot,\n mainManifest,\n packageJson,\n monorepo,\n scurry,\n })\n done()\n return graph\n } catch {\n // Hidden lockfile is cache-only, safe to regenerate on any error\n // as it will fall back to filesystem traversal\n // TODO: Warn version mismatch to @vltpkg/output for debugging\n }\n }\n\n const graph = new Graph({ ...options, mainManifest })\n\n // retrieve the configuration object from the store\n let storeConfig: StoreConfigObject = { modifiers: undefined }\n try {\n storeConfig = asStoreConfigObject(\n JSON.parse(\n readFileSync(\n scurry.resolve('node_modules/.vlt/vlt.json'),\n 'utf8',\n ),\n ),\n )\n } catch {}\n const storeModifiers = JSON.stringify(storeConfig.modifiers ?? {})\n const optionsModifiers = JSON.stringify(modifiers?.config)\n const modifiersChanged = storeModifiers !== optionsModifiers\n const shouldLoadDependencies = !(\n skipLoadingNodesOnModifiersChange && modifiersChanged\n )\n\n // will only skip loading dependencies if the\n // skipLoadingNodesOnModifiersChange option is set to true\n // and the current modifiers have not changed when compared\n // to the modifiers stored in the `node_modules/.vlt/vlt.json` store config\n if (shouldLoadDependencies) {\n const depsFound = new Map<Node, Path>()\n\n // starts the list of initial folders to parse using the importer nodes\n for (const importer of graph.importers) {\n modifiers?.tryImporter(importer)\n depsFound.set(\n importer,\n scurry.cwd.resolve(`${importer.location}/node_modules`),\n )\n }\n\n // breadth-first traversal of the file system tree reading deps found\n // starting from the node_modules folder of every importer in order to\n // find the actual installed dependencies at each location\n for (const [node, path] of depsFound.entries()) {\n parseDir(\n options,\n scurry,\n packageJson,\n depsFound,\n graph,\n node,\n path,\n )\n }\n\n // Clean up any pending modifier entries that were never completed\n modifiers?.rollbackActiveEntries()\n\n // caches the load result to the hidden lockfile when enabled\n if (\n scurry.cwd.resolve('node_modules').lstatSync()?.isDirectory()\n ) {\n saveHidden({\n ...options,\n graph,\n })\n }\n }\n\n done()\n\n return graph\n}\n"]}
package/dist/browser.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { longDependencyTypes } from '@vltpkg/types';
2
- import { asDependencyTypeShort, shorten } from './dependencies.ts';
3
- import { getBooleanFlagsFromNum } from './lockfile/types.ts';
4
- import { stringifyNode } from './stringify-node.ts';
5
- export type { LoadResult, TransferData, } from './transfer-data/load.ts';
6
- export * from './virtual-root.ts';
7
- declare const lockfile: {
8
- loadEdges: (graph: import("@vltpkg/types").GraphLike, edges: import("./lockfile/types.ts").LockfileData["edges"], options: import("@vltpkg/spec").SpecOptions) => void;
9
- loadNodes: (graph: import("@vltpkg/types").GraphLike, nodes: import("./lockfile/types.ts").LockfileData["nodes"], options: import("@vltpkg/spec").SpecOptions, actual?: import("@vltpkg/types").GraphLike, throwOnMissingManifest?: boolean) => void;
10
- };
11
- declare const transfer: {
12
- load: (transfered: import("./transfer-data/load.ts").TransferData) => import("./transfer-data/load.ts").LoadResult;
13
- };
14
- export { asDependencyTypeShort, getBooleanFlagsFromNum, lockfile, longDependencyTypes, shorten, stringifyNode, transfer, };
15
- //# sourceMappingURL=browser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAInD,YAAY,EACV,UAAU,EACV,YAAY,GACb,MAAM,yBAAyB,CAAA;AAEhC,cAAc,mBAAmB,CAAA;AAEjC,QAAA,MAAM,QAAQ;;;CAGb,CAAA;AAED,QAAA,MAAM,QAAQ;;CAEb,CAAA;AAED,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,QAAQ,EACR,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,QAAQ,GACT,CAAA"}
package/dist/browser.js DELETED
@@ -1,17 +0,0 @@
1
- import { longDependencyTypes } from '@vltpkg/types';
2
- import { asDependencyTypeShort, shorten } from "./dependencies.js";
3
- import { getBooleanFlagsFromNum } from "./lockfile/types.js";
4
- import { stringifyNode } from "./stringify-node.js";
5
- import { loadEdges } from "./lockfile/load-edges.js";
6
- import { loadNodes } from "./lockfile/load-nodes.js";
7
- import { load } from "./transfer-data/load.js";
8
- export * from "./virtual-root.js";
9
- const lockfile = {
10
- loadEdges,
11
- loadNodes,
12
- };
13
- const transfer = {
14
- load,
15
- };
16
- export { asDependencyTypeShort, getBooleanFlagsFromNum, lockfile, longDependencyTypes, shorten, stringifyNode, transfer, };
17
- //# sourceMappingURL=browser.js.map