@vltpkg/graph 0.0.0-4 → 0.0.0-6
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/dist/esm/install.d.ts +3 -2
- package/dist/esm/install.d.ts.map +1 -1
- package/dist/esm/install.js +0 -3
- package/dist/esm/install.js.map +1 -1
- package/dist/esm/node.d.ts.map +1 -1
- package/dist/esm/node.js +3 -0
- package/dist/esm/node.js.map +1 -1
- package/dist/esm/uninstall.d.ts +3 -2
- 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/package.json +16 -16
package/dist/esm/install.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PackageInfoClient } from '@vltpkg/package-info';
|
|
2
2
|
import type { PackageJson } from '@vltpkg/package-json';
|
|
3
3
|
import type { LoadOptions } from './actual/load.ts';
|
|
4
4
|
import type { AddImportersDependenciesMap } from './dependencies.ts';
|
|
5
|
-
export type InstallOptions =
|
|
5
|
+
export type InstallOptions = LoadOptions & {
|
|
6
6
|
projectRoot: string;
|
|
7
7
|
packageJson: PackageJson;
|
|
8
|
+
packageInfo: PackageInfoClient;
|
|
8
9
|
};
|
|
9
10
|
export declare const install: (options: InstallOptions, add?: AddImportersDependenciesMap) => Promise<{
|
|
10
11
|
graph: import("./graph.ts").Graph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAIpE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,WAAW,CAAA;IACxB,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,OAAO,YACT,cAAc,QACjB,2BAA2B;;;EAwBlC,CAAA"}
|
package/dist/esm/install.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PackageInfoClient } from '@vltpkg/package-info';
|
|
2
1
|
import { load as actualLoad } from "./actual/load.js";
|
|
3
2
|
import { build as idealBuild } from "./ideal/build.js";
|
|
4
3
|
import { reify } from "./reify/index.js";
|
|
@@ -9,7 +8,6 @@ export const install = async (options, add) => {
|
|
|
9
8
|
add,
|
|
10
9
|
mainManifest,
|
|
11
10
|
loadManifests: true,
|
|
12
|
-
packageInfo: new PackageInfoClient(options),
|
|
13
11
|
});
|
|
14
12
|
const act = actualLoad({
|
|
15
13
|
...options,
|
|
@@ -18,7 +16,6 @@ export const install = async (options, add) => {
|
|
|
18
16
|
});
|
|
19
17
|
const diff = await reify({
|
|
20
18
|
...options,
|
|
21
|
-
packageInfo: new PackageInfoClient(options),
|
|
22
19
|
add,
|
|
23
20
|
actual: act,
|
|
24
21
|
graph,
|
package/dist/esm/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAQxC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,OAAuB,EACvB,GAAiC,EACjC,EAAE;IACF,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAElE,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC;QAC7B,GAAG,OAAO;QACV,GAAG;QACH,YAAY;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,UAAU,CAAC;QACrB,GAAG,OAAO;QACV,YAAY;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC;QACvB,GAAG,OAAO;QACV,GAAG;QACH,MAAM,EAAE,GAAG;QACX,KAAK;QACL,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IAEF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type { LoadOptions } from './actual/load.ts'\nimport { load as actualLoad } from './actual/load.ts'\nimport type { AddImportersDependenciesMap } from './dependencies.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\n\nexport type InstallOptions = LoadOptions & {\n projectRoot: string\n packageJson: PackageJson\n packageInfo: PackageInfoClient\n}\n\nexport const install = async (\n options: InstallOptions,\n add?: AddImportersDependenciesMap,\n) => {\n const mainManifest = options.packageJson.read(options.projectRoot)\n\n const graph = await idealBuild({\n ...options,\n add,\n mainManifest,\n loadManifests: true,\n })\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n const diff = await reify({\n ...options,\n add,\n actual: act,\n graph,\n loadManifests: true,\n })\n\n return { graph, diff }\n}\n"]}
|
package/dist/esm/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{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AAU,GAAG,MAAM;gBAQrC,OAAO,EAAE,WAAW,EACpB,EAAE,CAAC,EAAE,KAAK,EACV,QAAQ,CAAC,EAAE,QAAQ,EACnB,IAAI,CAAC,EAAE,IAAI,EACX,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM;IA2BlB;;;;OAIG;IACH,UAAU,IAAI,OAAO;IAkBrB,MAAM,CAAC,KAAK,EAAE,IAAI;IAIlB;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM;IAKpC;;;;OAIG;IACH,WAAW;IAgBX,kBAAkB;IAclB;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI;IAO7D,MAAM;;;;;;;;;;;;;IAgBN,QAAQ;CAGT"}
|
package/dist/esm/node.js
CHANGED
|
@@ -181,6 +181,9 @@ export class Node {
|
|
|
181
181
|
this.manifest = manifest;
|
|
182
182
|
this.#name = name || this.manifest?.name;
|
|
183
183
|
this.version = version || this.manifest?.version;
|
|
184
|
+
if (this.version?.startsWith('v')) {
|
|
185
|
+
this.version = this.version.slice(1);
|
|
186
|
+
}
|
|
184
187
|
}
|
|
185
188
|
/**
|
|
186
189
|
* return true if this node is located in the vlt store
|
package/dist/esm/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAO/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAQnD,MAAM,OAAO,IAAI;IACf,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,oBAAoB,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AAI,CAAC,GAAG;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC;IAED,QAAQ;QACN,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;CACF","sourcesContent":["import type { PathScurry } from 'path-scurry'\nimport { getId, hydrateTuple, splitDepID } from '@vltpkg/dep-id'\nimport type { DepID, DepIDTuple } from '@vltpkg/dep-id'\nimport { typeError } from '@vltpkg/error-cause'\nimport type { Spec, SpecOptions } from '@vltpkg/spec'\nimport type {\n Integrity,\n Manifest,\n DependencyTypeShort,\n} from '@vltpkg/types'\nimport { Edge } from './edge.ts'\nimport type { GraphLike, NodeLike } from './types.ts'\nimport { stringifyNode } from './stringify-node.ts'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\n\nexport type NodeOptions = SpecOptions & {\n projectRoot: string\n graph: GraphLike\n}\n\nexport class Node implements NodeLike {\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Node'\n }\n\n #options: SpecOptions\n #location?: string\n\n #optional = false\n /**\n * True if a node is only reachable via optional or peerOptional edges from\n * any importer.\n *\n * Setting this to false, if previously set to true, will also unset\n * the flag on any optional-flagged non-optional dependencies.\n */\n get optional() {\n return this.#optional\n }\n set optional(optional: boolean) {\n const before = this.#optional\n this.#optional = optional\n if (before && !optional) {\n // unset for all deps, as well\n for (const { to, optional } of this.edgesOut.values()) {\n if (!optional && to?.optional) to.optional = false\n }\n }\n }\n\n isOptional(): this is Node & { optional: true } {\n return this.#optional\n }\n\n #dev = false\n /**\n * True if a node is only reachable via dev edges from any importer.\n *\n * Setting this to false, if previously set to true, will also unset\n * the flag on any dev-flagged non-dev dependencies.\n */\n get dev() {\n return this.#dev\n }\n set dev(dev: boolean) {\n const before = this.#dev\n this.#dev = dev\n if (before && !dev) {\n // unset for all deps, as well\n for (const { to, dev } of this.edgesOut.values()) {\n if (!dev && to?.dev) to.dev = false\n }\n }\n }\n\n isDev(): this is Node & { dev: true } {\n return this.#dev\n }\n\n /**\n * List of edges coming into this node.\n */\n edgesIn = new Set<Edge>()\n\n /**\n * List of edges from this node into other nodes. This usually represents\n * that the connected node is a direct dependency of this node.\n */\n edgesOut = new Map<string, Edge>()\n\n /**\n * A reference to the {@link DepID} this node represents in the graph.\n */\n id: DepID\n\n /**\n * True if this node is an importer node.\n */\n importer = false\n\n /**\n * True if this node is the project root node.\n */\n mainImporter = false\n\n /**\n * A reference to the graph this node is a part of.\n */\n graph: GraphLike\n\n /**\n * The manifest integrity value.\n */\n integrity?: Integrity\n\n /**\n * The manifest this node represents in the graph.\n */\n manifest?: Manifest\n\n /**\n * Project where this node resides\n */\n projectRoot: string\n\n /**\n * For registry nodes, this is the registry we fetched them from.\n * Needed because their un-prefixed dependencies need to come from\n * the same registry, if it's not the default.\n */\n registry?: string\n\n /**\n * The name of the package represented by this node, this is usually\n * equivalent to `manifest.name` but in a few ways it may differ such as\n * nodes loaded from a lockfile that lacks a loaded manifest.\n * This field should be used to retrieve package names instead.\n */\n #name?: string\n get name() {\n if (this.#name) return this.#name\n this.#name = this.id\n return this.#name\n }\n\n /**\n * The version of the package represented by this node, this is usually\n * equivalent to `manifest.version` but in a few ways it may differ such as\n * nodes loaded from a lockfile that lacks a loaded manifest.\n * This field should be used to retrieve package versions instead.\n */\n version?: string\n\n /**\n * An address {@link PackageInfoClient} may use to extract this package.\n */\n resolved?: string\n\n /**\n * The file system location for this node.\n */\n get location(): string {\n if (this.#location) {\n return this.#location\n }\n this.#location = `./node_modules/.vlt/${this.id}/node_modules/${this.name}`\n // if using the default location, it is in the store\n this.inVltStore = () => true\n return this.#location\n }\n\n set location(location: string) {\n this.#location = location\n // reset memoization, since it might be elsewhere now\n if (this.inVltStore !== Node.prototype.inVltStore) {\n this.inVltStore = Node.prototype.inVltStore\n }\n }\n\n /**\n * The resolved location of the node in the file system.\n */\n resolvedLocation(scurry: PathScurry): string {\n return scurry.cwd.resolve(this.location).fullpath()\n }\n\n /**\n * The location of the node_modules folder where this node's edgesOut\n * should be linked into. For nodes in the store, this is the parent\n * directory, since they're extracted into a node_modules folder\n * side by side with links to their deps. For nodes outside of the store\n * (ie, importers and arbitrary link deps) this is the node_modules folder\n * directly inside the node's directory.\n */\n nodeModules(scurry: PathScurry): string {\n const loc = this.resolvedLocation(scurry)\n return this.inVltStore() ?\n loc.substring(0, loc.length - this.name.length - 1)\n : scurry.resolve(loc, 'node_modules')\n }\n\n constructor(\n options: NodeOptions,\n id?: DepID,\n manifest?: Manifest,\n spec?: Spec,\n name?: string,\n version?: string,\n ) {\n this.#options = options\n this.projectRoot = options.projectRoot\n if (id) {\n this.id = id\n } else {\n if (!manifest || !spec) {\n throw typeError(\n 'A new Node needs either a manifest & spec or an id parameter',\n {\n manifest,\n },\n )\n }\n this.id = getId(spec, manifest)\n }\n this.graph = options.graph\n this.manifest = manifest\n this.#name = name || this.manifest?.name\n this.version = version || this.manifest?.version\n }\n\n /**\n * return true if this node is located in the vlt store\n * memoized the first time it's called, since the store location\n * doesn't change within the context of a single operation.\n */\n inVltStore(): boolean {\n // technically this just means it's in *a* vlt store, but we can safely\n // assume that a user won't construct a path like this by accident,\n // and there's only ever one store in any given project.\n const inStore = this.location.endsWith(\n `.vlt/${this.id}/node_modules/${this.name}`,\n )\n this.inVltStore = () => inStore\n return inStore\n }\n\n #registryNodeResolved(tuple: DepIDTuple) {\n const spec = hydrateTuple(tuple, this.#name, this.#options)\n this.resolved =\n this.manifest?.dist?.tarball || spec.conventionalRegistryTarball\n this.integrity ??= this.manifest?.dist?.integrity\n }\n\n equals(other: Node) {\n return this.id === other.id && this.location === other.location\n }\n\n /**\n * Sets the node as an importer along with its location.\n */\n setImporterLocation(location: string) {\n this.#location = location\n this.importer = true\n }\n\n /**\n * Sets the appropriate resolve / integrity value for this node.\n * Note that other places might also set these values, like for\n * example the lockfile that might have already have this info.\n */\n setResolved() {\n // file | remote | workspace type of ids all points to a URI that\n // can be used as the `resolved` value, so we split the dep id\n // for these cases.\n const tuple = splitDepID(this.id)\n const [type, resolved] = tuple\n switch (type) {\n case 'registry':\n this.#registryNodeResolved(tuple)\n break\n default:\n this.resolved = resolved\n break\n }\n }\n\n setDefaultLocation() {\n const def = `./node_modules/.vlt/${this.id}/node_modules/${this.name}`\n\n // only relocate if the location is in node_modules already\n if (\n !this.importer &&\n (!this.#location ||\n (this.#location !== def &&\n /^(?:\\.\\/)?node_modules\\//.test(this.#location)))\n ) {\n this.#location = def\n }\n }\n\n /**\n * Add an edge from this node connecting it to a direct dependency.\n */\n addEdgesTo(type: DependencyTypeShort, spec: Spec, node?: Node) {\n const edge = new Edge(type, spec, this, node)\n node?.edgesIn.add(edge)\n this.edgesOut.set(spec.name, edge)\n return edge\n }\n\n toJSON() {\n return {\n id: this.id,\n name: this.name,\n version: this.version,\n location: this.location,\n importer: this.importer,\n manifest: this.manifest,\n projectRoot: this.projectRoot,\n integrity: this.integrity,\n resolved: this.resolved,\n dev: this.dev,\n optional: this.optional,\n }\n }\n\n toString() {\n return stringifyNode(this)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAO/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAQnD,MAAM,OAAO,IAAI;IACf,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,oBAAoB,CAAA;IAC7B,CAAC;IAED,QAAQ,CAAa;IACrB,SAAS,CAAS;IAElB,SAAS,GAAG,KAAK,CAAA;IACjB;;;;;;OAMG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IACD,IAAI,QAAQ,CAAC,QAAiB;QAC5B,MAAM,MAAM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Q;SACxB,CAAA;IACH,CAAC;IAED,QAAQ;QACN,OAAO,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;CACF","sourcesContent":["import type { PathScurry } from 'path-scurry'\nimport { getId, hydrateTuple, splitDepID } from '@vltpkg/dep-id'\nimport type { DepID, DepIDTuple } from '@vltpkg/dep-id'\nimport { typeError } from '@vltpkg/error-cause'\nimport type { Spec, SpecOptions } from '@vltpkg/spec'\nimport type {\n Integrity,\n Manifest,\n DependencyTypeShort,\n} from '@vltpkg/types'\nimport { Edge } from './edge.ts'\nimport type { GraphLike, NodeLike } from './types.ts'\nimport { stringifyNode } from './stringify-node.ts'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\n\nexport type NodeOptions = SpecOptions & {\n projectRoot: string\n graph: GraphLike\n}\n\nexport class Node implements NodeLike {\n get [Symbol.toStringTag]() {\n return '@vltpkg/graph.Node'\n }\n\n #options: SpecOptions\n #location?: string\n\n #optional = false\n /**\n * True if a node is only reachable via optional or peerOptional edges from\n * any importer.\n *\n * Setting this to false, if previously set to true, will also unset\n * the flag on any optional-flagged non-optional dependencies.\n */\n get optional() {\n return this.#optional\n }\n set optional(optional: boolean) {\n const before = this.#optional\n this.#optional = optional\n if (before && !optional) {\n // unset for all deps, as well\n for (const { to, optional } of this.edgesOut.values()) {\n if (!optional && to?.optional) to.optional = false\n }\n }\n }\n\n isOptional(): this is Node & { optional: true } {\n return this.#optional\n }\n\n #dev = false\n /**\n * True if a node is only reachable via dev edges from any importer.\n *\n * Setting this to false, if previously set to true, will also unset\n * the flag on any dev-flagged non-dev dependencies.\n */\n get dev() {\n return this.#dev\n }\n set dev(dev: boolean) {\n const before = this.#dev\n this.#dev = dev\n if (before && !dev) {\n // unset for all deps, as well\n for (const { to, dev } of this.edgesOut.values()) {\n if (!dev && to?.dev) to.dev = false\n }\n }\n }\n\n isDev(): this is Node & { dev: true } {\n return this.#dev\n }\n\n /**\n * List of edges coming into this node.\n */\n edgesIn = new Set<Edge>()\n\n /**\n * List of edges from this node into other nodes. This usually represents\n * that the connected node is a direct dependency of this node.\n */\n edgesOut = new Map<string, Edge>()\n\n /**\n * A reference to the {@link DepID} this node represents in the graph.\n */\n id: DepID\n\n /**\n * True if this node is an importer node.\n */\n importer = false\n\n /**\n * True if this node is the project root node.\n */\n mainImporter = false\n\n /**\n * A reference to the graph this node is a part of.\n */\n graph: GraphLike\n\n /**\n * The manifest integrity value.\n */\n integrity?: Integrity\n\n /**\n * The manifest this node represents in the graph.\n */\n manifest?: Manifest\n\n /**\n * Project where this node resides\n */\n projectRoot: string\n\n /**\n * For registry nodes, this is the registry we fetched them from.\n * Needed because their un-prefixed dependencies need to come from\n * the same registry, if it's not the default.\n */\n registry?: string\n\n /**\n * The name of the package represented by this node, this is usually\n * equivalent to `manifest.name` but in a few ways it may differ such as\n * nodes loaded from a lockfile that lacks a loaded manifest.\n * This field should be used to retrieve package names instead.\n */\n #name?: string\n get name() {\n if (this.#name) return this.#name\n this.#name = this.id\n return this.#name\n }\n\n /**\n * The version of the package represented by this node, this is usually\n * equivalent to `manifest.version` but in a few ways it may differ such as\n * nodes loaded from a lockfile that lacks a loaded manifest.\n * This field should be used to retrieve package versions instead.\n */\n version?: string\n\n /**\n * An address {@link PackageInfoClient} may use to extract this package.\n */\n resolved?: string\n\n /**\n * The file system location for this node.\n */\n get location(): string {\n if (this.#location) {\n return this.#location\n }\n this.#location = `./node_modules/.vlt/${this.id}/node_modules/${this.name}`\n // if using the default location, it is in the store\n this.inVltStore = () => true\n return this.#location\n }\n\n set location(location: string) {\n this.#location = location\n // reset memoization, since it might be elsewhere now\n if (this.inVltStore !== Node.prototype.inVltStore) {\n this.inVltStore = Node.prototype.inVltStore\n }\n }\n\n /**\n * The resolved location of the node in the file system.\n */\n resolvedLocation(scurry: PathScurry): string {\n return scurry.cwd.resolve(this.location).fullpath()\n }\n\n /**\n * The location of the node_modules folder where this node's edgesOut\n * should be linked into. For nodes in the store, this is the parent\n * directory, since they're extracted into a node_modules folder\n * side by side with links to their deps. For nodes outside of the store\n * (ie, importers and arbitrary link deps) this is the node_modules folder\n * directly inside the node's directory.\n */\n nodeModules(scurry: PathScurry): string {\n const loc = this.resolvedLocation(scurry)\n return this.inVltStore() ?\n loc.substring(0, loc.length - this.name.length - 1)\n : scurry.resolve(loc, 'node_modules')\n }\n\n constructor(\n options: NodeOptions,\n id?: DepID,\n manifest?: Manifest,\n spec?: Spec,\n name?: string,\n version?: string,\n ) {\n this.#options = options\n this.projectRoot = options.projectRoot\n if (id) {\n this.id = id\n } else {\n if (!manifest || !spec) {\n throw typeError(\n 'A new Node needs either a manifest & spec or an id parameter',\n {\n manifest,\n },\n )\n }\n this.id = getId(spec, manifest)\n }\n this.graph = options.graph\n this.manifest = manifest\n this.#name = name || this.manifest?.name\n\n this.version = version || this.manifest?.version\n if (this.version?.startsWith('v')) {\n this.version = this.version.slice(1)\n }\n }\n\n /**\n * return true if this node is located in the vlt store\n * memoized the first time it's called, since the store location\n * doesn't change within the context of a single operation.\n */\n inVltStore(): boolean {\n // technically this just means it's in *a* vlt store, but we can safely\n // assume that a user won't construct a path like this by accident,\n // and there's only ever one store in any given project.\n const inStore = this.location.endsWith(\n `.vlt/${this.id}/node_modules/${this.name}`,\n )\n this.inVltStore = () => inStore\n return inStore\n }\n\n #registryNodeResolved(tuple: DepIDTuple) {\n const spec = hydrateTuple(tuple, this.#name, this.#options)\n this.resolved =\n this.manifest?.dist?.tarball || spec.conventionalRegistryTarball\n this.integrity ??= this.manifest?.dist?.integrity\n }\n\n equals(other: Node) {\n return this.id === other.id && this.location === other.location\n }\n\n /**\n * Sets the node as an importer along with its location.\n */\n setImporterLocation(location: string) {\n this.#location = location\n this.importer = true\n }\n\n /**\n * Sets the appropriate resolve / integrity value for this node.\n * Note that other places might also set these values, like for\n * example the lockfile that might have already have this info.\n */\n setResolved() {\n // file | remote | workspace type of ids all points to a URI that\n // can be used as the `resolved` value, so we split the dep id\n // for these cases.\n const tuple = splitDepID(this.id)\n const [type, resolved] = tuple\n switch (type) {\n case 'registry':\n this.#registryNodeResolved(tuple)\n break\n default:\n this.resolved = resolved\n break\n }\n }\n\n setDefaultLocation() {\n const def = `./node_modules/.vlt/${this.id}/node_modules/${this.name}`\n\n // only relocate if the location is in node_modules already\n if (\n !this.importer &&\n (!this.#location ||\n (this.#location !== def &&\n /^(?:\\.\\/)?node_modules\\//.test(this.#location)))\n ) {\n this.#location = def\n }\n }\n\n /**\n * Add an edge from this node connecting it to a direct dependency.\n */\n addEdgesTo(type: DependencyTypeShort, spec: Spec, node?: Node) {\n const edge = new Edge(type, spec, this, node)\n node?.edgesIn.add(edge)\n this.edgesOut.set(spec.name, edge)\n return edge\n }\n\n toJSON() {\n return {\n id: this.id,\n name: this.name,\n version: this.version,\n location: this.location,\n importer: this.importer,\n manifest: this.manifest,\n projectRoot: this.projectRoot,\n integrity: this.integrity,\n resolved: this.resolved,\n dev: this.dev,\n optional: this.optional,\n }\n }\n\n toString() {\n return stringifyNode(this)\n }\n}\n"]}
|
package/dist/esm/uninstall.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PackageInfoClient } from '@vltpkg/package-info';
|
|
2
2
|
import type { PackageJson } from '@vltpkg/package-json';
|
|
3
3
|
import type { LoadOptions } from './actual/load.ts';
|
|
4
4
|
import type { RemoveImportersDependenciesMap } from './dependencies.ts';
|
|
5
|
-
export type UninstallOptions =
|
|
5
|
+
export type UninstallOptions = LoadOptions & {
|
|
6
6
|
projectRoot: string;
|
|
7
7
|
packageJson: PackageJson;
|
|
8
|
+
packageInfo: PackageInfoClient;
|
|
8
9
|
};
|
|
9
10
|
export declare const uninstall: (options: UninstallOptions, remove?: RemoveImportersDependenciesMap) => Promise<{
|
|
10
11
|
graph: import("./graph.ts").Graph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAA;AAIvE,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,WAAW,CAAA;IACxB,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,SAAS,YACX,gBAAgB,WAChB,8BAA8B;;;EAwBxC,CAAA"}
|
package/dist/esm/uninstall.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PackageInfoClient } from '@vltpkg/package-info';
|
|
2
1
|
import { load as actualLoad } from "./actual/load.js";
|
|
3
2
|
import { build as idealBuild } from "./ideal/build.js";
|
|
4
3
|
import { reify } from "./reify/index.js";
|
|
@@ -6,7 +5,6 @@ export const uninstall = async (options, remove) => {
|
|
|
6
5
|
const mainManifest = options.packageJson.read(options.projectRoot);
|
|
7
6
|
const graph = await idealBuild({
|
|
8
7
|
...options,
|
|
9
|
-
packageInfo: new PackageInfoClient(options),
|
|
10
8
|
remove,
|
|
11
9
|
mainManifest,
|
|
12
10
|
loadManifests: true,
|
|
@@ -18,7 +16,6 @@ export const uninstall = async (options, remove) => {
|
|
|
18
16
|
});
|
|
19
17
|
const diff = await reify({
|
|
20
18
|
...options,
|
|
21
|
-
packageInfo: new PackageInfoClient(options),
|
|
22
19
|
remove,
|
|
23
20
|
actual: act,
|
|
24
21
|
graph,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAQxC,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,OAAyB,EACzB,MAAuC,EACvC,EAAE;IACF,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAElE,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC;QAC7B,GAAG,OAAO;QACV,MAAM;QACN,YAAY;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,UAAU,CAAC;QACrB,GAAG,OAAO;QACV,YAAY;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC;QACvB,GAAG,OAAO;QACV,MAAM;QACN,MAAM,EAAE,GAAG;QACX,KAAK;QACL,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IAEF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type { LoadOptions } from './actual/load.ts'\nimport { load as actualLoad } from './actual/load.ts'\nimport type { RemoveImportersDependenciesMap } from './dependencies.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\n\nexport type UninstallOptions = LoadOptions & {\n projectRoot: string\n packageJson: PackageJson\n packageInfo: PackageInfoClient\n}\n\nexport const uninstall = async (\n options: UninstallOptions,\n remove?: RemoveImportersDependenciesMap,\n) => {\n const mainManifest = options.packageJson.read(options.projectRoot)\n\n const graph = await idealBuild({\n ...options,\n remove,\n mainManifest,\n loadManifests: true,\n })\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n const diff = await reify({\n ...options,\n remove,\n actual: act,\n graph,\n loadManifests: true,\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-
|
|
4
|
+
"version": "0.0.0-6",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
"graph-run": "^1.0.4",
|
|
24
24
|
"path-scurry": "^2.0.0",
|
|
25
25
|
"promise-call-limit": "^3.0.2",
|
|
26
|
-
"@vltpkg/
|
|
27
|
-
"@vltpkg/
|
|
28
|
-
"@vltpkg/fast-split": "0.0.0-
|
|
29
|
-
"@vltpkg/
|
|
30
|
-
"@vltpkg/package-
|
|
31
|
-
"@vltpkg/
|
|
32
|
-
"@vltpkg/
|
|
33
|
-
"@vltpkg/
|
|
34
|
-
"@vltpkg/
|
|
35
|
-
"@vltpkg/
|
|
36
|
-
"@vltpkg/semver": "0.0.0-
|
|
37
|
-
"@vltpkg/
|
|
38
|
-
"@vltpkg/
|
|
39
|
-
"@vltpkg/
|
|
40
|
-
"@vltpkg/
|
|
26
|
+
"@vltpkg/dep-id": "0.0.0-6",
|
|
27
|
+
"@vltpkg/error-cause": "0.0.0-6",
|
|
28
|
+
"@vltpkg/fast-split": "0.0.0-6",
|
|
29
|
+
"@vltpkg/output": "0.0.0-6",
|
|
30
|
+
"@vltpkg/package-info": "0.0.0-6",
|
|
31
|
+
"@vltpkg/rollback-remove": "0.0.0-6",
|
|
32
|
+
"@vltpkg/package-json": "0.0.0-6",
|
|
33
|
+
"@vltpkg/run": "0.0.0-6",
|
|
34
|
+
"@vltpkg/registry-client": "0.0.0-6",
|
|
35
|
+
"@vltpkg/satisfies": "0.0.0-6",
|
|
36
|
+
"@vltpkg/semver": "0.0.0-6",
|
|
37
|
+
"@vltpkg/spec": "0.0.0-6",
|
|
38
|
+
"@vltpkg/types": "0.0.0-6",
|
|
39
|
+
"@vltpkg/pick-manifest": "0.0.0-6",
|
|
40
|
+
"@vltpkg/workspaces": "0.0.0-6"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@eslint/js": "^9.20.0",
|