@vltpkg/graph 0.0.0-19 → 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 CHANGED
@@ -5,7 +5,44 @@
5
5
  This is the graph library responsible for representing the packages
6
6
  that are involved in a given install.
7
7
 
8
- **[API](#api)** · **[Usage](#usage)**
8
+ **[Overview](#overview)** · **[Concepts](#concepts)** ·
9
+ **[Architecture](#architecture)** · **[API](#api)** ·
10
+ **[Usage](#usage)** · **[Related Workspaces](#related-workspaces)** ·
11
+ **[References](#references)**
12
+
13
+ ## Overview
14
+
15
+ The `@vltpkg/graph` workspace models a project's dependency
16
+ relationships and drives npm-compatible installs by computing how
17
+ `node_modules` should be structured. It exposes a public API through
18
+ `src/index.ts` that re-exports core types and workflows.
19
+
20
+ At a glance:
21
+
22
+ - `Graph` encapsulates the full dependency graph for a project
23
+ (including monorepo workspaces), and is the source of truth for how
24
+ to lay out `node_modules`.
25
+ - `Node` represents a unique package instance (uniqueness provided by
26
+ `@vltpkg/dep-id`).
27
+ - `Edge` represents a dependency relationship from a dependent to a
28
+ dependency (eg. `dependencies`, `devDependencies`,
29
+ `peerDependencies`, etc.).
30
+ - `Diff` describes the minimal set of changes required to transform an
31
+ Actual graph (disk) into an Ideal graph (desired outcome), which is
32
+ then applied by the `reify` subsystem.
33
+
34
+ ## Concepts
35
+
36
+ - Importers: Root-level nodes used as starting points of the graph.
37
+ The `mainImporter` is the project root (its `package.json`), and the
38
+ remaining importers are workspaces discovered by
39
+ `@vltpkg/workspaces`.
40
+ - Hidden Lockfile: A performance optimization stored at
41
+ `node_modules/.vlt-lock.json` mirroring the current on-disk state to
42
+ accelerate subsequent loads of the Actual graph.
43
+ - Modifiers: Configuration for selectively altering dependency
44
+ resolution; Ideal/Actual builders support skipping node loads when
45
+ modifiers change.
9
46
 
10
47
  ## API
11
48
 
@@ -26,6 +63,13 @@ local file system.
26
63
 
27
64
  Loads the lockfile file found at `projectRoot` and returns the graph.
28
65
 
66
+ ### `reify(options): Promise<Diff>`
67
+
68
+ Computes a `Diff` between the Actual and Ideal graphs and applies the
69
+ minimal filesystem changes (creating/deleting links, writing
70
+ lockfiles, hoisting, lifecycle scripts) to make the on-disk install
71
+ match the Ideal graph.
72
+
29
73
  ## Usage
30
74
 
31
75
  Here's a quick example of how to use the `@vltpkg/graph.ideal.build`
@@ -37,3 +81,94 @@ import { ideal } from '@vltpkg/graph'
37
81
 
38
82
  const graph = await ideal.build({ projectRoot: process.cwd() })
39
83
  ```
84
+
85
+ ### Load Actual Graph and Reify
86
+
87
+ ```ts
88
+ import { actual, ideal, reify } from '@vltpkg/graph'
89
+
90
+ // Load current on-disk state
91
+ const from = actual.load({
92
+ projectRoot: process.cwd(),
93
+ packageJson,
94
+ scurry,
95
+ })
96
+
97
+ // Build intended end state (may start from lockfile or actual)
98
+ const to = await ideal.build({
99
+ projectRoot: process.cwd(),
100
+ packageInfo,
101
+ packageJson,
102
+ scurry,
103
+ })
104
+
105
+ // Apply minimal changes to match Ideal
106
+ await reify({
107
+ graph: to,
108
+ actual: from,
109
+ packageInfo,
110
+ packageJson,
111
+ scurry,
112
+ })
113
+ ```
114
+
115
+ ### Working With Lockfiles
116
+
117
+ ```ts
118
+ import { lockfile } from '@vltpkg/graph'
119
+
120
+ // Load virtual graph from vlt-lock.json
121
+ const g = lockfile.load({
122
+ projectRoot,
123
+ mainManifest,
124
+ packageJson,
125
+ scurry,
126
+ })
127
+
128
+ // Save both lockfile formats
129
+ lockfile.save({ graph: g, projectRoot, packageJson, scurry })
130
+ ```
131
+
132
+ ## Architecture
133
+
134
+ Graph construction modes supported by the library:
135
+
136
+ - Virtual Graphs (lockfile-based)
137
+ - Load and save via `src/lockfile/load.ts` and
138
+ `src/lockfile/save.ts`
139
+ - Hidden lockfile: `node_modules/.vlt-lock.json` for faster loads
140
+
141
+ - Actual Graphs (filesystem-based)
142
+ - Loaded by traversing `node_modules` via `src/actual/load.ts`
143
+ - May shortcut to Hidden Lockfile if present and valid
144
+ - File layout changes are performed by `src/reify/`
145
+
146
+ - Ideal Graphs (desired end state)
147
+ - Entry: `src/ideal/build.ts`
148
+ - Starts from Virtual (preferred) or falls back to Actual
149
+ - Merges `add`/`remove` input with importer manifests using
150
+ `src/ideal/get-importer-specs.ts`
151
+ - Fetches and expands manifests using `@vltpkg/package-info`, reuses
152
+ existing nodes that satisfy specs
153
+
154
+ Finally, `src/diff.ts` computes changes and `src/reify/` applies them
155
+ to the filesystem.
156
+
157
+ ## Related Workspaces
158
+
159
+ - `@vltpkg/dep-id`: Unique IDs for packages, ensuring `Node` identity
160
+ - `@vltpkg/spec`: Parse/normalize dependency specifiers and registry
161
+ semantics
162
+ - `@vltpkg/semver`: Semantic version parsing/comparison
163
+ - `@vltpkg/package-info`: Fetch remote manifests and artifacts
164
+ (registry, git, tarball)
165
+ - `@vltpkg/package-json`: Read and cache local `package.json` files
166
+ - `@vltpkg/workspaces`: Monorepo workspace discovery and grouping
167
+
168
+ ## References
169
+
170
+ - package.json format and behavior:
171
+ [https://docs.npmjs.com/cli/v11/configuring-npm/package-json](https://docs.npmjs.com/cli/v11/configuring-npm/package-json)
172
+ - Semantic Versioning:
173
+ [https://semver.org/spec/v2.0.0.html](https://semver.org/spec/v2.0.0.html)
174
+ - Monorepos: [https://monorepo.tools](https://monorepo.tools)
@@ -10,6 +10,7 @@ export * from './stringify-node.ts';
10
10
  export * from './types.ts';
11
11
  export * from './install.ts';
12
12
  export * from './uninstall.ts';
13
+ export * from './update.ts';
13
14
  export * from './diff.ts';
14
15
  export * from './modifiers.ts';
15
16
  import type { LoadOptions as ActualLoadOptions } from './actual/load.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CA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AAA;AACzB,cAAc,gBAAgB,CAAA;AAG9B,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,eAAO,MAAM,MAAM;;CAAuB,CAAA;AAG1C,OAAO,KAAK,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAI5E,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAA;AAED,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,iBAAiB,EAAE,CAAA;AACjC,eAAO,MAAM,KAAK;;CAAY,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/esm/index.js CHANGED
@@ -10,6 +10,7 @@ export * from "./stringify-node.js";
10
10
  export * from "./types.js";
11
11
  export * from "./install.js";
12
12
  export * from "./uninstall.js";
13
+ export * from "./update.js";
13
14
  export * from "./diff.js";
14
15
  export * from "./modifiers.js";
15
16
  import { load as actualLoad } from "./actual/load.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AACxD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAE9B,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;AAE1C,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,YAAY;IAClB,SAAS;IACT,SAAS;IACT,IAAI;CACL,CAAA;AAKD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAGxC,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["export * from './edge.ts'\nexport * from './graph.ts'\nexport * from './node.ts'\nexport * from './dependencies.ts'\nexport * from './lockfile/types.ts'\nexport * from './visualization/json-output.ts'\nexport * from './visualization/human-readable-output.ts'\nexport * from './visualization/mermaid-output.ts'\nexport * from './stringify-node.ts'\nexport * from './types.ts'\nexport * from './install.ts'\nexport * from './uninstall.ts'\nexport * from './diff.ts'\nexport * from './modifiers.ts'\n\nimport { load as actualLoad } from './actual/load.ts'\nimport type { LoadOptions as ActualLoadOptions } from './actual/load.ts'\nexport const actual = { load: actualLoad }\n\nimport { load as lockfileLoad } from './lockfile/load.ts'\nimport type { LoadOptions as LockfileLoadOptions } from './lockfile/load.ts'\nimport { loadEdges } from './lockfile/load-edges.ts'\nimport { loadNodes } from './lockfile/load-nodes.ts'\nimport { save } from './lockfile/save.ts'\nexport const lockfile = {\n load: lockfileLoad,\n loadEdges,\n loadNodes,\n save,\n}\n\nexport type { ActualLoadOptions, LockfileLoadOptions }\nexport type { SaveOptions } from './lockfile/save.ts'\n\nimport { build } from './ideal/build.ts'\nimport type { BuildIdealOptions } from './ideal/build.ts'\nexport type { BuildIdealOptions }\nexport const ideal = { build }\nexport { reify } from './reify/index.ts'\nexport type { ReifyOptions } from './reify/index.ts'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AACxD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAE9B,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;AAE1C,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,YAAY;IAClB,SAAS;IACT,SAAS;IACT,IAAI;CACL,CAAA;AAKD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAGxC,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["export * from './edge.ts'\nexport * from './graph.ts'\nexport * from './node.ts'\nexport * from './dependencies.ts'\nexport * from './lockfile/types.ts'\nexport * from './visualization/json-output.ts'\nexport * from './visualization/human-readable-output.ts'\nexport * from './visualization/mermaid-output.ts'\nexport * from './stringify-node.ts'\nexport * from './types.ts'\nexport * from './install.ts'\nexport * from './uninstall.ts'\nexport * from './update.ts'\nexport * from './diff.ts'\nexport * from './modifiers.ts'\n\nimport { load as actualLoad } from './actual/load.ts'\nimport type { LoadOptions as ActualLoadOptions } from './actual/load.ts'\nexport const actual = { load: actualLoad }\n\nimport { load as lockfileLoad } from './lockfile/load.ts'\nimport type { LoadOptions as LockfileLoadOptions } from './lockfile/load.ts'\nimport { loadEdges } from './lockfile/load-edges.ts'\nimport { loadNodes } from './lockfile/load-nodes.ts'\nimport { save } from './lockfile/save.ts'\nexport const lockfile = {\n load: lockfileLoad,\n loadEdges,\n loadNodes,\n save,\n}\n\nexport type { ActualLoadOptions, LockfileLoadOptions }\nexport type { SaveOptions } from './lockfile/save.ts'\n\nimport { build } from './ideal/build.ts'\nimport type { BuildIdealOptions } from './ideal/build.ts'\nexport type { BuildIdealOptions }\nexport const ideal = { build }\nexport { reify } from './reify/index.ts'\nexport type { ReifyOptions } from './reify/index.ts'\n"]}
@@ -0,0 +1,11 @@
1
+ import type { PackageInfoClient } from '@vltpkg/package-info';
2
+ import type { LoadOptions } from './actual/load.ts';
3
+ import { Graph } from './graph.ts';
4
+ export type UpdateOptions = LoadOptions & {
5
+ packageInfo: PackageInfoClient;
6
+ };
7
+ export declare const update: (options: UpdateOptions) => Promise<{
8
+ graph: Graph;
9
+ diff: import("./diff.ts").Diff;
10
+ }>;
11
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,MAAM,YAAmB,aAAa;;;EA0ClD,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { load as actualLoad } from "./actual/load.js";
2
+ import { buildIdealFromStartingGraph } from "./ideal/build-ideal-from-starting-graph.js";
3
+ import { reify } from "./reify/index.js";
4
+ import { GraphModifier } from "./modifiers.js";
5
+ import { init } from '@vltpkg/init';
6
+ import { asError } from '@vltpkg/types';
7
+ import { Graph } from "./graph.js";
8
+ import { graphStep } from '@vltpkg/output';
9
+ export const update = async (options) => {
10
+ let mainManifest = undefined;
11
+ try {
12
+ mainManifest = options.packageJson.read(options.projectRoot);
13
+ }
14
+ catch (err) {
15
+ if (asError(err).message === 'Could not read package.json file') {
16
+ await init({ cwd: options.projectRoot });
17
+ mainManifest = options.packageJson.read(options.projectRoot, {
18
+ reload: true,
19
+ });
20
+ }
21
+ else {
22
+ throw err;
23
+ }
24
+ }
25
+ const modifiers = GraphModifier.maybeLoad(options);
26
+ const done = graphStep('build');
27
+ const graph = await buildIdealFromStartingGraph({
28
+ ...options,
29
+ add: Object.assign(new Map(), { modifiedDependencies: false }),
30
+ remove: Object.assign(new Map(), { modifiedDependencies: false }),
31
+ graph: new Graph({ ...options, mainManifest }),
32
+ modifiers,
33
+ });
34
+ done();
35
+ const act = actualLoad({
36
+ ...options,
37
+ mainManifest,
38
+ loadManifests: true,
39
+ });
40
+ const diff = await reify({
41
+ ...options,
42
+ actual: act,
43
+ graph,
44
+ loadManifests: true,
45
+ modifiers,
46
+ });
47
+ return { graph, diff };
48
+ };
49
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sour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V,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;QAC9D,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;QACjE,KAAK,EAAE,IAAI,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC;QAC9C,SAAS;KACV,CAAC,CAAA;IACF,IAAI,EAAE,CAAA;IAEN,MAAM,GAAG,GAAG,UAAU,CAAC;QACrB,GAAG,OAAO;QACV,YAAY;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC;QACvB,GAAG,OAAO;QACV,MAAM,EAAE,GAAG;QACX,KAAK;QACL,aAAa,EAAE,IAAI;QACnB,SAAS;KACV,CAAC,CAAA;IAEF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import { load as actualLoad } from './actual/load.ts'\nimport { buildIdealFromStartingGraph } from './ideal/build-ideal-from-starting-graph.ts'\nimport { reify } from './reify/index.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { init } from '@vltpkg/init'\nimport { asError } from '@vltpkg/types'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { Graph } from './graph.ts'\nimport { graphStep } from '@vltpkg/output'\n\nexport type UpdateOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n}\n\nexport const update = async (options: UpdateOptions) => {\n let mainManifest: NormalizedManifest | undefined = undefined\n try {\n mainManifest = options.packageJson.read(options.projectRoot)\n } catch (err) {\n if (asError(err).message === 'Could not read package.json file') {\n await init({ cwd: options.projectRoot })\n mainManifest = options.packageJson.read(options.projectRoot, {\n reload: true,\n })\n } else {\n throw err\n }\n }\n\n const modifiers = GraphModifier.maybeLoad(options)\n\n const done = graphStep('build')\n const graph = await buildIdealFromStartingGraph({\n ...options,\n add: Object.assign(new Map(), { modifiedDependencies: false }),\n remove: Object.assign(new Map(), { modifiedDependencies: false }),\n graph: new Graph({ ...options, mainManifest }),\n modifiers,\n })\n done()\n\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n\n const diff = await reify({\n ...options,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n })\n\n return { graph, diff }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vltpkg/graph",
3
3
  "description": "A library that helps understanding & expressing what happens on an install",
4
- "version": "0.0.0-19",
4
+ "version": "0.0.0-20",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/vltpkg/vltpkg.git",
@@ -23,23 +23,23 @@
23
23
  "graph-run": "^1.1.0",
24
24
  "path-scurry": "^2.0.0",
25
25
  "promise-call-limit": "^3.0.2",
26
- "@vltpkg/cmd-shim": "0.0.0-19",
27
- "@vltpkg/dss-breadcrumb": "0.0.0-19",
28
- "@vltpkg/error-cause": "0.0.0-19",
29
- "@vltpkg/dep-id": "0.0.0-19",
30
- "@vltpkg/init": "0.0.0-19",
31
- "@vltpkg/fast-split": "0.0.0-19",
32
- "@vltpkg/output": "0.0.0-19",
33
- "@vltpkg/package-info": "0.0.0-19",
34
- "@vltpkg/package-json": "0.0.0-19",
35
- "@vltpkg/rollback-remove": "0.0.0-19",
36
- "@vltpkg/run": "0.0.0-19",
37
- "@vltpkg/pick-manifest": "0.0.0-19",
38
- "@vltpkg/spec": "0.0.0-19",
39
- "@vltpkg/types": "0.0.0-19",
40
- "@vltpkg/vlt-json": "0.0.0-19",
41
- "@vltpkg/satisfies": "0.0.0-19",
42
- "@vltpkg/workspaces": "0.0.0-19"
26
+ "@vltpkg/cmd-shim": "0.0.0-20",
27
+ "@vltpkg/dep-id": "0.0.0-20",
28
+ "@vltpkg/dss-breadcrumb": "0.0.0-20",
29
+ "@vltpkg/error-cause": "0.0.0-20",
30
+ "@vltpkg/fast-split": "0.0.0-20",
31
+ "@vltpkg/init": "0.0.0-20",
32
+ "@vltpkg/output": "0.0.0-20",
33
+ "@vltpkg/package-json": "0.0.0-20",
34
+ "@vltpkg/pick-manifest": "0.0.0-20",
35
+ "@vltpkg/package-info": "0.0.0-20",
36
+ "@vltpkg/rollback-remove": "0.0.0-20",
37
+ "@vltpkg/run": "0.0.0-20",
38
+ "@vltpkg/satisfies": "0.0.0-20",
39
+ "@vltpkg/spec": "0.0.0-20",
40
+ "@vltpkg/vlt-json": "0.0.0-20",
41
+ "@vltpkg/workspaces": "0.0.0-20",
42
+ "@vltpkg/types": "0.0.0-20"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@eslint/js": "^9.28.0",
@@ -52,7 +52,7 @@
52
52
  "typedoc": "~0.27.9",
53
53
  "typescript": "5.7.3",
54
54
  "typescript-eslint": "^8.33.1",
55
- "@vltpkg/vlt-json": "0.0.0-19"
55
+ "@vltpkg/vlt-json": "0.0.0-20"
56
56
  },
57
57
  "license": "BSD-2-Clause-Patent",
58
58
  "engines": {