@vltpkg/graph 0.0.0-17 → 0.0.0-19
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/actual/load.d.ts +12 -2
- package/dist/esm/actual/load.d.ts.map +1 -1
- package/dist/esm/actual/load.js +7 -7
- package/dist/esm/actual/load.js.map +1 -1
- package/dist/esm/browser.d.ts +1 -1
- package/dist/esm/dependencies.d.ts +1 -1
- package/dist/esm/dependencies.d.ts.map +1 -1
- package/dist/esm/dependencies.js.map +1 -1
- package/dist/esm/diff.d.ts +1 -0
- package/dist/esm/diff.d.ts.map +1 -1
- package/dist/esm/diff.js +6 -0
- package/dist/esm/diff.js.map +1 -1
- package/dist/esm/graph.d.ts +9 -6
- package/dist/esm/graph.d.ts.map +1 -1
- package/dist/esm/graph.js +7 -1
- package/dist/esm/graph.js.map +1 -1
- package/dist/esm/ideal/append-nodes.js +2 -2
- package/dist/esm/ideal/append-nodes.js.map +1 -1
- package/dist/esm/ideal/build.d.ts +4 -0
- package/dist/esm/ideal/build.d.ts.map +1 -1
- package/dist/esm/ideal/build.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/install.d.ts +1 -0
- package/dist/esm/install.d.ts.map +1 -1
- package/dist/esm/install.js +125 -23
- package/dist/esm/install.js.map +1 -1
- package/dist/esm/lockfile/load-nodes.d.ts +1 -1
- package/dist/esm/lockfile/load-nodes.d.ts.map +1 -1
- package/dist/esm/lockfile/load-nodes.js +22 -9
- package/dist/esm/lockfile/load-nodes.js.map +1 -1
- package/dist/esm/lockfile/load.d.ts +7 -3
- package/dist/esm/lockfile/load.d.ts.map +1 -1
- package/dist/esm/lockfile/load.js +8 -1
- package/dist/esm/lockfile/load.js.map +1 -1
- package/dist/esm/lockfile/save.d.ts.map +1 -1
- package/dist/esm/lockfile/save.js +7 -10
- package/dist/esm/lockfile/save.js.map +1 -1
- package/dist/esm/lockfile/types.d.ts +4 -3
- package/dist/esm/lockfile/types.d.ts.map +1 -1
- package/dist/esm/lockfile/types.js.map +1 -1
- package/dist/esm/modifiers.d.ts +3 -3
- package/dist/esm/modifiers.d.ts.map +1 -1
- package/dist/esm/modifiers.js +2 -2
- package/dist/esm/modifiers.js.map +1 -1
- package/dist/esm/node.d.ts +8 -8
- package/dist/esm/node.d.ts.map +1 -1
- package/dist/esm/node.js +4 -6
- package/dist/esm/node.js.map +1 -1
- package/dist/esm/reify/add-edge.d.ts +1 -1
- package/dist/esm/reify/add-edge.d.ts.map +1 -1
- package/dist/esm/reify/add-edge.js.map +1 -1
- package/dist/esm/reify/bin-paths.d.ts +1 -1
- package/dist/esm/reify/bin-paths.d.ts.map +1 -1
- package/dist/esm/reify/bin-paths.js.map +1 -1
- package/dist/esm/reify/index.d.ts.map +1 -1
- package/dist/esm/reify/index.js +5 -0
- package/dist/esm/reify/index.js.map +1 -1
- package/dist/esm/reify/update-importers-package-json.js.map +1 -1
- package/dist/esm/remove-optional-subgraph.js +1 -1
- package/dist/esm/remove-optional-subgraph.js.map +1 -1
- package/dist/esm/types.d.ts +6 -6
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/package.json +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"append-nodes.js","sourceRoot":"","sources":["../../../src/ideal/append-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGnD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAI1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAYvE;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAC3B,IAAU,EACV,OAA2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,MAAM,SAAS,GACb,IAAI,CAAC,WAAW,CAAC,CAAA;YAEnB,IAAI,SAAS,IAAI,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC;gBACzD,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;oBACzD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;wBAAE,SAAQ;oBAC/B,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;wBACtC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE;4BAC/B,GAAG,OAAO;4BACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;yBACxB,CAAC;qBACH,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,aAAa,CAAC,IAAI,CAChB,WAAW,CACT,GAAG,EACH,WAAW,EACX,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EAAE,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAC3C,CACF,CAAA;QACH,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAClC,CAAC,CAAC,CACH,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { joinDepIDTuple } from '@vltpkg/dep-id'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport { Spec } from '@vltpkg/spec'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport type { DependencyTypeLong } from '@vltpkg/types'\nimport type { PathScurry } from 'path-scurry'\nimport { asDependency, shorten } from '../dependencies.ts'\nimport type { Dependency } from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport type { Node } from '../node.ts'\nimport { removeOptionalSubgraph } from '../remove-optional-subgraph.ts'\nimport type {\n GraphModifier,\n ModifierActiveEntry,\n} from '../modifiers.ts'\n\ntype FileTypeInfo = {\n id: DepID\n path: string\n isDirectory: boolean\n}\n\n/**\n * Only install devDeps for git dependencies and importers\n * Everything else always gets installed\n */\nconst shouldInstallDepType = (\n node: Node,\n depType: DependencyTypeLong,\n) =>\n depType !== 'devDependencies' ||\n node.importer ||\n node.id.startsWith('git')\n\n/**\n * Retrieve the {@link DepID} and location for a `file:` type {@link Node}.\n */\nconst getFileTypeInfo = (\n spec: Spec,\n fromNode: Node,\n scurry: PathScurry,\n): FileTypeInfo | undefined => {\n const f = spec.final\n if (f.type !== 'file') return\n\n /* c8 ignore start - should be impossible */\n if (!f.file) {\n throw error('no path on file specifier', { spec })\n }\n /* c8 ignore stop */\n\n // Given that both linked folders and local tarballs (both defined with\n // usage of the `file:` spec prefix) location needs to be relative to their\n // parents, build the expected path and use it for both location and id\n const target = scurry.cwd.resolve(fromNode.location).resolve(f.file)\n const path = target.relativePosix()\n const id = joinDepIDTuple(['file', path])\n\n return {\n path,\n id,\n isDirectory: !!target.lstatSync()?.isDirectory(),\n }\n}\n\nconst isStringArray = (a: unknown): a is string[] =>\n Array.isArray(a) && !a.some(b => typeof b !== 'string')\n\nexport const appendNodes = async (\n add: Map<string, Dependency>,\n packageInfo: PackageInfoClient,\n graph: Graph,\n fromNode: Node,\n deps: Dependency[],\n scurry: PathScurry,\n options: SpecOptions,\n seen: Set<DepID>,\n modifiers?: GraphModifier,\n modifierRefs?: Map<string, ModifierActiveEntry>,\n) => {\n /* c8 ignore next */\n if (seen.has(fromNode.id)) return\n seen.add(fromNode.id)\n\n await Promise.all(\n deps.map(async ({ spec, type }) => {\n // see if there's a satisfying node in the graph currently\n const fileTypeInfo = getFileTypeInfo(spec, fromNode, scurry)\n const activeModifier = modifierRefs?.get(spec.name)\n\n // here is the place we swap specs if a edge modifier was defined\n const queryModifier = activeModifier?.modifier.query\n const completeModifier =\n activeModifier &&\n activeModifier.interactiveBreadcrumb.current ===\n activeModifier.modifier.breadcrumb.last\n if (\n queryModifier &&\n completeModifier &&\n 'spec' in activeModifier.modifier\n ) {\n spec = activeModifier.modifier.spec\n if (spec.bareSpec === '-') {\n return\n }\n }\n\n const existingNode = graph.findResolution(\n spec,\n fromNode,\n queryModifier,\n )\n if (existingNode) {\n graph.addEdge(type, spec, fromNode, existingNode)\n return\n }\n\n const edgeOptional =\n type === 'optional' || type === 'peerOptional'\n const mani = await packageInfo\n .manifest(spec, { from: scurry.resolve(fromNode.location) })\n .catch((er: unknown) => {\n // optional deps ignored if inaccessible\n if (edgeOptional || fromNode.optional) {\n return undefined\n }\n throw er\n })\n\n // when an user is adding a nameless dependency, e.g: `github:foo/bar`,\n // `file:./foo/bar`, we need to update the `add` option value to set the\n // correct name once we have it, so that it can properly be stored in\n // the `package.json` file at the end of reify.\n if (mani?.name && spec.name === '(unknown)') {\n const s = add.get(String(spec))\n if (s) {\n // removes the previous, placeholder entry key\n add.delete(String(spec))\n // replaces spec with a version with the correct name\n spec = Spec.parse(mani.name, spec.bareSpec, options)\n // updates the add map with the fixed up spec\n const n = asDependency({\n ...s,\n spec,\n })\n add.set(mani.name, n)\n }\n }\n\n if (!mani) {\n if (!edgeOptional && fromNode.isOptional()) {\n // failed resolution of a non-optional dep of an optional node\n // have to clean up the dependents\n removeOptionalSubgraph(graph, fromNode)\n return\n } else if (edgeOptional) {\n // failed resolution of an optional dep, just ignore it,\n // nothing to prune because we never added it in the first place.\n return\n } else {\n throw error('failed to resolve dependency', {\n spec,\n from: fromNode.location,\n })\n }\n }\n\n const node = graph.placePackage(\n fromNode,\n type,\n spec,\n mani,\n fileTypeInfo?.id,\n queryModifier,\n )\n\n /* c8 ignore start - not possible, already ensured manifest */\n if (!node) {\n throw error('failed to place package', {\n from: fromNode.location,\n spec,\n })\n }\n /* c8 ignore stop */\n\n if (activeModifier) {\n modifiers?.updateActiveEntry(node, activeModifier)\n }\n\n if (fileTypeInfo?.path && fileTypeInfo.isDirectory) {\n node.location = fileTypeInfo.path\n }\n node.setResolved()\n const nestedAppends: Promise<unknown>[] = []\n\n const bundleDeps = node.manifest?.bundleDependencies\n const bundled = new Set<string>(\n (\n node.id.startsWith('git') ||\n node.importer ||\n !isStringArray(bundleDeps)\n ) ?\n []\n : bundleDeps,\n )\n\n const nextDeps: Dependency[] = []\n\n for (const depTypeName of longDependencyTypes) {\n const depRecord: Record<string, string> | undefined =\n mani[depTypeName]\n\n if (depRecord && shouldInstallDepType(node, depTypeName)) {\n for (const [name, bareSpec] of Object.entries(depRecord)) {\n if (bundled.has(name)) continue\n nextDeps.push({\n type: shorten(depTypeName, name, mani),\n spec: Spec.parse(name, bareSpec, {\n ...options,\n registry: spec.registry,\n }),\n })\n }\n }\n }\n\n if (nextDeps.length) {\n nestedAppends.push(\n appendNodes(\n add,\n packageInfo,\n graph,\n node,\n nextDeps,\n scurry,\n options,\n seen,\n modifiers,\n modifiers?.tryDependencies(node, nextDeps),\n ),\n )\n }\n await Promise.all(nestedAppends)\n }),\n )\n}\n"]}
|
|
1
|
+
{"version":3,"file":"append-nodes.js","sourceRoot":"","sources":["../../../src/ideal/append-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGtE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAI1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAYvE;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAC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M,WAAW,IAAI,mBAAmB,EAAE,CAAC;YAC9C,MAAM,SAAS,GACb,IAAI,CAAC,WAAW,CAAC,CAAA;YAEnB,IAAI,SAAS,IAAI,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC;gBACzD,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;oBACzD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;wBAAE,SAAQ;oBAC/B,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;wBACtC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE;4BAC/B,GAAG,OAAO;4BACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;yBACxB,CAAC;qBACH,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,aAAa,CAAC,IAAI,CAChB,WAAW,CACT,GAAG,EACH,WAAW,EACX,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,SAAS,EACT,SAAS,EAAE,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAC3C,CACF,CAAA;QACH,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAClC,CAAC,CAAC,CACH,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { joinDepIDTuple } from '@vltpkg/dep-id'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport { Spec } from '@vltpkg/spec'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport { longDependencyTypes, normalizeManifest } from '@vltpkg/types'\nimport type { DependencyTypeLong, Manifest } from '@vltpkg/types'\nimport type { PathScurry } from 'path-scurry'\nimport { asDependency, shorten } from '../dependencies.ts'\nimport type { Dependency } from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport type { Node } from '../node.ts'\nimport { removeOptionalSubgraph } from '../remove-optional-subgraph.ts'\nimport type {\n GraphModifier,\n ModifierActiveEntry,\n} from '../modifiers.ts'\n\ntype FileTypeInfo = {\n id: DepID\n path: string\n isDirectory: boolean\n}\n\n/**\n * Only install devDeps for git dependencies and importers\n * Everything else always gets installed\n */\nconst shouldInstallDepType = (\n node: Node,\n depType: DependencyTypeLong,\n) =>\n depType !== 'devDependencies' ||\n node.importer ||\n node.id.startsWith('git')\n\n/**\n * Retrieve the {@link DepID} and location for a `file:` type {@link Node}.\n */\nconst getFileTypeInfo = (\n spec: Spec,\n fromNode: Node,\n scurry: PathScurry,\n): FileTypeInfo | undefined => {\n const f = spec.final\n if (f.type !== 'file') return\n\n /* c8 ignore start - should be impossible */\n if (!f.file) {\n throw error('no path on file specifier', { spec })\n }\n /* c8 ignore stop */\n\n // Given that both linked folders and local tarballs (both defined with\n // usage of the `file:` spec prefix) location needs to be relative to their\n // parents, build the expected path and use it for both location and id\n const target = scurry.cwd.resolve(fromNode.location).resolve(f.file)\n const path = target.relativePosix()\n const id = joinDepIDTuple(['file', path])\n\n return {\n path,\n id,\n isDirectory: !!target.lstatSync()?.isDirectory(),\n }\n}\n\nconst isStringArray = (a: unknown): a is string[] =>\n Array.isArray(a) && !a.some(b => typeof b !== 'string')\n\nexport const appendNodes = async (\n add: Map<string, Dependency>,\n packageInfo: PackageInfoClient,\n graph: Graph,\n fromNode: Node,\n deps: Dependency[],\n scurry: PathScurry,\n options: SpecOptions,\n seen: Set<DepID>,\n modifiers?: GraphModifier,\n modifierRefs?: Map<string, ModifierActiveEntry>,\n) => {\n /* c8 ignore next */\n if (seen.has(fromNode.id)) return\n seen.add(fromNode.id)\n\n await Promise.all(\n deps.map(async ({ spec, type }) => {\n // see if there's a satisfying node in the graph currently\n const fileTypeInfo = getFileTypeInfo(spec, fromNode, scurry)\n const activeModifier = modifierRefs?.get(spec.name)\n\n // here is the place we swap specs if a edge modifier was defined\n const queryModifier = activeModifier?.modifier.query\n const completeModifier =\n activeModifier &&\n activeModifier.interactiveBreadcrumb.current ===\n activeModifier.modifier.breadcrumb.last\n if (\n queryModifier &&\n completeModifier &&\n 'spec' in activeModifier.modifier\n ) {\n spec = activeModifier.modifier.spec\n if (spec.bareSpec === '-') {\n return\n }\n }\n\n const existingNode = graph.findResolution(\n spec,\n fromNode,\n queryModifier,\n )\n if (existingNode) {\n graph.addEdge(type, spec, fromNode, existingNode)\n return\n }\n\n const edgeOptional =\n type === 'optional' || type === 'peerOptional'\n const mani = await packageInfo\n .manifest(spec, { from: scurry.resolve(fromNode.location) })\n .catch((er: unknown) => {\n // optional deps ignored if inaccessible\n if (edgeOptional || fromNode.optional) {\n return undefined\n }\n throw er\n })\n\n // when an user is adding a nameless dependency, e.g: `github:foo/bar`,\n // `file:./foo/bar`, we need to update the `add` option value to set the\n // correct name once we have it, so that it can properly be stored in\n // the `package.json` file at the end of reify.\n if (mani?.name && spec.name === '(unknown)') {\n const s = add.get(String(spec))\n if (s) {\n // removes the previous, placeholder entry key\n add.delete(String(spec))\n // replaces spec with a version with the correct name\n spec = Spec.parse(mani.name, spec.bareSpec, options)\n // updates the add map with the fixed up spec\n const n = asDependency({\n ...s,\n spec,\n })\n add.set(mani.name, n)\n }\n }\n\n if (!mani) {\n if (!edgeOptional && fromNode.isOptional()) {\n // failed resolution of a non-optional dep of an optional node\n // have to clean up the dependents\n removeOptionalSubgraph(graph, fromNode)\n return\n } else if (edgeOptional) {\n // failed resolution of an optional dep, just ignore it,\n // nothing to prune because we never added it in the first place.\n return\n } else {\n throw error('failed to resolve dependency', {\n spec,\n from: fromNode.location,\n })\n }\n }\n\n const node = graph.placePackage(\n fromNode,\n type,\n spec,\n normalizeManifest(mani as Manifest),\n fileTypeInfo?.id,\n queryModifier,\n )\n\n /* c8 ignore start - not possible, already ensured manifest */\n if (!node) {\n throw error('failed to place package', {\n from: fromNode.location,\n spec,\n })\n }\n /* c8 ignore stop */\n\n if (activeModifier) {\n modifiers?.updateActiveEntry(node, activeModifier)\n }\n\n if (fileTypeInfo?.path && fileTypeInfo.isDirectory) {\n node.location = fileTypeInfo.path\n }\n node.setResolved()\n const nestedAppends: Promise<unknown>[] = []\n\n const bundleDeps = node.manifest?.bundleDependencies\n const bundled = new Set<string>(\n (\n node.id.startsWith('git') ||\n node.importer ||\n !isStringArray(bundleDeps)\n ) ?\n []\n : bundleDeps,\n )\n\n const nextDeps: Dependency[] = []\n\n for (const depTypeName of longDependencyTypes) {\n const depRecord: Record<string, string> | undefined =\n mani[depTypeName]\n\n if (depRecord && shouldInstallDepType(node, depTypeName)) {\n for (const [name, bareSpec] of Object.entries(depRecord)) {\n if (bundled.has(name)) continue\n nextDeps.push({\n type: shorten(depTypeName, name, mani),\n spec: Spec.parse(name, bareSpec, {\n ...options,\n registry: spec.registry,\n }),\n })\n }\n }\n }\n\n if (nextDeps.length) {\n nestedAppends.push(\n appendNodes(\n add,\n packageInfo,\n graph,\n node,\n nextDeps,\n scurry,\n options,\n seen,\n modifiers,\n modifiers?.tryDependencies(node, nextDeps),\n ),\n )\n }\n await Promise.all(nestedAppends)\n }),\n )\n}\n"]}
|
|
@@ -3,6 +3,10 @@ import type { LoadOptions as LoadActualOptions } from '../actual/load.ts';
|
|
|
3
3
|
import type { AddImportersDependenciesMap, RemoveImportersDependenciesMap } from '../dependencies.ts';
|
|
4
4
|
import type { Graph } from '../graph.ts';
|
|
5
5
|
export type BuildIdealOptions = LoadActualOptions & {
|
|
6
|
+
/**
|
|
7
|
+
* An actual graph
|
|
8
|
+
*/
|
|
9
|
+
actual?: Graph;
|
|
6
10
|
/**
|
|
7
11
|
* A `Map` in which keys are {@link DepID} linking to another `Map` in which
|
|
8
12
|
* keys are the dependency names and values are {@link Dependency}. This
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/ideal/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EACV,2BAA2B,EAC3B,8BAA8B,EAE/B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AASxC,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG;IAClD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,2BAA2B,CAAA;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,8BAA8B,CAAA;IACvC;;OAEG;IACH,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,YACP,iBAAiB,KACzB,OAAO,CAAC,KAAK,CAmCf,CAAA"}
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/ideal/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EACV,2BAA2B,EAC3B,8BAA8B,EAE/B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AASxC,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG;IAClD;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAA;IACd;;;;;OAKG;IACH,GAAG,CAAC,EAAE,2BAA2B,CAAA;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,8BAA8B,CAAA;IACvC;;OAEG;IACH,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,YACP,iBAAiB,KACzB,OAAO,CAAC,KAAK,CAmCf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/ideal/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAQtD,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,GAAG,CAA0B,CAAK,EAAE,EAAE,CAChD,CAAC,IAAK,IAAI,GAAG,EAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/ideal/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAQtD,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,GAAG,CAA0B,CAAK,EAAE,EAAE,CAChD,CAAC,IAAK,IAAI,GAAG,EAAQ,CAAA;AA0BvB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,OAA0B,EACV,EAAE;IAClB,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;IAE/B,yDAAyD;IACzD,iDAAiD;IACjD,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAC9D,MAAM,YAAY,GAChB,OAAO,CAAC,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAC/D,IAAI,KAAK,CAAA;IACT,IAAI,CAAC;QACH,KAAK,GAAG,WAAW,CAAC;YAClB,GAAG,OAAO;YACV,YAAY;YACZ,QAAQ;YACR,iCAAiC,EAAE,IAAI;SACxC,CAAC,CAAA;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,GAAG,UAAU,CAAC;YACjB,GAAG,OAAO;YACV,YAAY;YACZ,QAAQ;YACR,iCAAiC,EAAE,IAAI;SACxC,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,2BAA2B,CAAC;QAC5C,GAAG,OAAO;QACV,MAAM;QACN,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;QACxB,KAAK;QACL,WAAW;QACX,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;KAC/B,CAAC,CAAA;IACF,IAAI,EAAE,CAAA;IACN,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import type { PackageInfoClient } from '@vltpkg/package-info'\nimport { load as loadActual } from '../actual/load.ts'\nimport type { LoadOptions as LoadActualOptions } from '../actual/load.ts'\nimport type {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n Dependency,\n} from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport { load as loadVirtual } from '../lockfile/load.ts'\nimport { buildIdealFromStartingGraph } from './build-ideal-from-starting-graph.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { graphStep } from '@vltpkg/output'\n\nconst getMap = <T extends Map<any, any>>(m?: T) =>\n m ?? (new Map() as T)\n\nexport type BuildIdealOptions = LoadActualOptions & {\n /**\n * An actual graph\n */\n actual?: Graph\n /**\n * A `Map` in which keys are {@link DepID} linking to another `Map` in which\n * keys are the dependency names and values are {@link Dependency}. This\n * structure represents dependencies that need to be added to the importer\n * represented by {@link DepID}.\n */\n add?: AddImportersDependenciesMap\n /**\n * A `Map` object representing nodes to be removed from the ideal graph.\n * Each {@link DepID} key represents an importer node and the `Set` of\n * dependency names to be removed from its dependency list.\n */\n remove?: RemoveImportersDependenciesMap\n /**\n * A {@link PackageInfoClient} instance to read manifest info from.\n */\n packageInfo: PackageInfoClient\n}\n\n/**\n * Builds an ideal {@link Graph} representing the dependencies that\n * should be present in order to fulfill the requirements defined\n * by the `package.json` and `vlt-lock.json` files using either the\n * virtual or actual graph as a starting point. Also add / remove any\n * dependencies listed in the `add` and `remove` properties.\n */\nexport const build = async (\n options: BuildIdealOptions,\n): Promise<Graph> => {\n const done = graphStep('build')\n\n // Creates the shared instances that are going to be used\n // in both the loader methods and the build graph\n const { packageInfo, packageJson, scurry, monorepo } = options\n const mainManifest =\n options.mainManifest ?? packageJson.read(options.projectRoot)\n let graph\n try {\n graph = loadVirtual({\n ...options,\n mainManifest,\n monorepo,\n skipLoadingNodesOnModifiersChange: true,\n })\n } catch {\n graph = loadActual({\n ...options,\n mainManifest,\n monorepo,\n skipLoadingNodesOnModifiersChange: true,\n })\n }\n\n const res = await buildIdealFromStartingGraph({\n ...options,\n scurry,\n add: getMap(options.add),\n graph,\n packageInfo,\n remove: getMap(options.remove),\n })\n done()\n return res\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type { LoadOptions as LockfileLoadOptions } from './lockfile/load.ts';
|
|
|
20
20
|
export declare const lockfile: {
|
|
21
21
|
load: (options: LockfileLoadOptions) => import("./graph.ts").Graph;
|
|
22
22
|
loadEdges: (graph: import("./types.ts").GraphLike, edges: import("./lockfile/types.ts").LockfileData["edges"], options: import("@vltpkg/spec").SpecOptions) => void;
|
|
23
|
-
loadNodes: (graph: import("./types.ts").GraphLike, nodes: import("./lockfile/types.ts").LockfileData["nodes"]) => void;
|
|
23
|
+
loadNodes: (graph: import("./types.ts").GraphLike, nodes: import("./lockfile/types.ts").LockfileData["nodes"], actual?: import("./types.ts").GraphLike) => void;
|
|
24
24
|
save: (options: Omit<import("./lockfile/save.ts").SaveOptions, "saveManifests">) => void;
|
|
25
25
|
};
|
|
26
26
|
export type { ActualLoadOptions, LockfileLoadOptions };
|
package/dist/esm/install.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { LoadOptions } from './actual/load.ts';
|
|
|
3
3
|
import type { AddImportersDependenciesMap } from './dependencies.ts';
|
|
4
4
|
export type InstallOptions = LoadOptions & {
|
|
5
5
|
packageInfo: PackageInfoClient;
|
|
6
|
+
cleanInstall?: boolean;
|
|
6
7
|
};
|
|
7
8
|
export declare const install: (options: InstallOptions, add?: AddImportersDependenciesMap) => Promise<{
|
|
8
9
|
graph: import("./graph.ts").Graph;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,EACV,2BAA2B,EAE5B,MAAM,mBAAmB,CAAA;AAQ1B,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,WAAW,EAAE,iBAAiB,CAAA;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,OAAO,YACT,cAAc,QACjB,2BAA2B;;;EA4KlC,CAAA"}
|
package/dist/esm/install.js
CHANGED
|
@@ -3,8 +3,23 @@ import { build as idealBuild } from "./ideal/build.js";
|
|
|
3
3
|
import { reify } from "./reify/index.js";
|
|
4
4
|
import { GraphModifier } from "./modifiers.js";
|
|
5
5
|
import { init } from '@vltpkg/init';
|
|
6
|
+
import { error } from '@vltpkg/error-cause';
|
|
6
7
|
import { asError } from '@vltpkg/types';
|
|
8
|
+
import { getDependencies } from "./dependencies.js";
|
|
9
|
+
import { RollbackRemove } from '@vltpkg/rollback-remove';
|
|
10
|
+
import { existsSync } from 'node:fs';
|
|
11
|
+
import { resolve } from 'node:path';
|
|
12
|
+
import { load as loadVirtual } from "./lockfile/load.js";
|
|
13
|
+
import { getImporterSpecs } from "./ideal/get-importer-specs.js";
|
|
7
14
|
export const install = async (options, add) => {
|
|
15
|
+
if (options.expectLockfile || options.frozenLockfile) {
|
|
16
|
+
const lockfilePath = resolve(options.projectRoot, 'vlt-lock.json');
|
|
17
|
+
if (!existsSync(lockfilePath)) {
|
|
18
|
+
throw error('vlt-lock.json file is required when using --expect-lockfile, --frozen-lockfile, or ci command', {
|
|
19
|
+
path: lockfilePath,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
8
23
|
let mainManifest = undefined;
|
|
9
24
|
try {
|
|
10
25
|
mainManifest = options.packageJson.read(options.projectRoot);
|
|
@@ -20,28 +35,115 @@ export const install = async (options, add) => {
|
|
|
20
35
|
throw err;
|
|
21
36
|
}
|
|
22
37
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
if (options.frozenLockfile) {
|
|
39
|
+
if (add?.modifiedDependencies) {
|
|
40
|
+
const dependencies = [];
|
|
41
|
+
for (const [, deps] of add) {
|
|
42
|
+
for (const [name] of deps) {
|
|
43
|
+
dependencies.push(name);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
throw error('Cannot add dependencies when using --frozen-lockfile', { found: dependencies.join(', ') });
|
|
47
|
+
}
|
|
48
|
+
const lockfileGraph = loadVirtual({
|
|
49
|
+
...options,
|
|
50
|
+
mainManifest,
|
|
51
|
+
skipLoadingNodesOnModifiersChange: false,
|
|
52
|
+
});
|
|
53
|
+
const emptyAdd = Object.assign(new Map(), { modifiedDependencies: false });
|
|
54
|
+
const emptyRemove = Object.assign(new Map(), {
|
|
55
|
+
modifiedDependencies: false,
|
|
56
|
+
});
|
|
57
|
+
const importerSpecs = getImporterSpecs({
|
|
58
|
+
graph: lockfileGraph,
|
|
59
|
+
add: emptyAdd,
|
|
60
|
+
remove: emptyRemove,
|
|
61
|
+
...options,
|
|
62
|
+
});
|
|
63
|
+
// Check for spec changes by comparing package.json specs with lockfile edges
|
|
64
|
+
const specChanges = [];
|
|
65
|
+
for (const importer of lockfileGraph.importers) {
|
|
66
|
+
const deps = getDependencies(importer, options);
|
|
67
|
+
for (const [depName, dep] of deps) {
|
|
68
|
+
const edge = importer.edgesOut.get(depName);
|
|
69
|
+
if (edge?.spec) {
|
|
70
|
+
if (edge.spec.toString() !== dep.spec.toString()) {
|
|
71
|
+
const node = lockfileGraph.nodes.get(importer.id);
|
|
72
|
+
/* c8 ignore next */
|
|
73
|
+
const location = node?.location || importer.id;
|
|
74
|
+
specChanges.push(` ${location}: ${depName} spec changed from "${edge.spec}" to "${dep.spec}"`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (importerSpecs.add.modifiedDependencies ||
|
|
80
|
+
importerSpecs.remove.modifiedDependencies ||
|
|
81
|
+
specChanges.length > 0) {
|
|
82
|
+
const details = [];
|
|
83
|
+
if (specChanges.length > 0) {
|
|
84
|
+
details.push(...specChanges);
|
|
85
|
+
}
|
|
86
|
+
for (const [importerId, deps] of importerSpecs.add) {
|
|
87
|
+
if (deps.size > 0) {
|
|
88
|
+
const node = lockfileGraph.nodes.get(importerId);
|
|
89
|
+
const location = node?.location || importerId;
|
|
90
|
+
const depNames = Array.from(deps.keys());
|
|
91
|
+
details.push(` ${location}: ${deps.size} dependencies to add (${depNames.join(', ')})`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const [importerId, deps] of importerSpecs.remove) {
|
|
95
|
+
if (deps.size > 0) {
|
|
96
|
+
const node = lockfileGraph.nodes.get(importerId);
|
|
97
|
+
const location = node?.location || importerId;
|
|
98
|
+
const depNames = Array.from(deps);
|
|
99
|
+
details.push(` ${location}: ${deps.size} dependencies to remove (${depNames.join(', ')})`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const lockfilePath = resolve(options.projectRoot, 'vlt-lock.json');
|
|
103
|
+
throw error('Lockfile is out of sync with package.json. Run "vlt install" to update.\n' +
|
|
104
|
+
details.join('\n'), {
|
|
105
|
+
path: lockfilePath,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const remover = new RollbackRemove();
|
|
110
|
+
if (options.cleanInstall) {
|
|
111
|
+
const nodeModulesPath = resolve(options.projectRoot, 'node_modules');
|
|
112
|
+
if (existsSync(nodeModulesPath)) {
|
|
113
|
+
await remover.rm(nodeModulesPath);
|
|
114
|
+
remover.confirm();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const modifiers = GraphModifier.maybeLoad(options);
|
|
119
|
+
const act = actualLoad({
|
|
120
|
+
...options,
|
|
121
|
+
mainManifest,
|
|
122
|
+
loadManifests: true,
|
|
123
|
+
modifiers: undefined, // modifiers should not be used here
|
|
124
|
+
});
|
|
125
|
+
const graph = await idealBuild({
|
|
126
|
+
...options,
|
|
127
|
+
actual: act,
|
|
128
|
+
add,
|
|
129
|
+
mainManifest,
|
|
130
|
+
loadManifests: true,
|
|
131
|
+
modifiers,
|
|
132
|
+
});
|
|
133
|
+
const diff = await reify({
|
|
134
|
+
...options,
|
|
135
|
+
add,
|
|
136
|
+
actual: act,
|
|
137
|
+
graph,
|
|
138
|
+
loadManifests: true,
|
|
139
|
+
modifiers,
|
|
140
|
+
});
|
|
141
|
+
return { graph, diff };
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
/* c8 ignore next */
|
|
145
|
+
await remover.rollback().catch(() => { });
|
|
146
|
+
throw err;
|
|
147
|
+
}
|
|
46
148
|
};
|
|
47
149
|
//# sourceMappingURL=install.js.map
|
package/dist/esm/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAUvC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,OAAuB,EACvB,GAAiC,EACjC,EAAE;IACF,IAAI,YAAY,GAAyB,SAAS,CAAA;IAClD,IAAI,CAAC;QACH,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAC9D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,kCAAkC,EAAE,CAAC;YAChE,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;YACxC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;gBAC3D,MAAM,EAAE,IAAI;aACb,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IACD,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAElD,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC;QAC7B,GAAG,OAAO;QACV,GAAG;QACH,YAAY;QACZ,aAAa,EAAE,IAAI;QACnB,SAAS;KACV,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,UAAU,CAAC;QACrB,GAAG,OAAO;QACV,YAAY;QACZ,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,SAAS,EAAE,oCAAoC;KAC3D,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC;QACvB,GAAG,OAAO;QACV,GAAG;QACH,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 { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { init } from '@vltpkg/init'\nimport { asError } from '@vltpkg/types'\nimport type { Manifest } from '@vltpkg/types'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport type { AddImportersDependenciesMap } from './dependencies.ts'\n\nexport type InstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n}\n\nexport const install = async (\n options: InstallOptions,\n add?: AddImportersDependenciesMap,\n) => {\n let mainManifest: Manifest | 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 const modifiers = GraphModifier.maybeLoad(options)\n\n const graph = await idealBuild({\n ...options,\n add,\n mainManifest,\n loadManifests: true,\n modifiers,\n })\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n modifiers: undefined, // modifiers should not be used here\n })\n const diff = await reify({\n ...options,\n add,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n })\n\n return { graph, diff }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAKnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAOhE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,OAAuB,EACvB,GAAiC,EACjC,EAAE;IACF,IAAI,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QACrD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,eAAe,CAAC,CAAA;QAClE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9B,MAAM,KAAK,CACT,+FAA+F,EAC/F;gBACE,I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GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACxC,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { load as actualLoad } from './actual/load.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { init } from '@vltpkg/init'\nimport { error } from '@vltpkg/error-cause'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport { asError } from '@vltpkg/types'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { getDependencies } from './dependencies.ts'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n} from './dependencies.ts'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { load as loadVirtual } from './lockfile/load.ts'\nimport { getImporterSpecs } from './ideal/get-importer-specs.ts'\n\nexport type InstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n cleanInstall?: boolean // Only set by ci command for clean install\n}\n\nexport const install = async (\n options: InstallOptions,\n add?: AddImportersDependenciesMap,\n) => {\n if (options.expectLockfile || options.frozenLockfile) {\n const lockfilePath = resolve(options.projectRoot, 'vlt-lock.json')\n if (!existsSync(lockfilePath)) {\n throw error(\n 'vlt-lock.json file is required when using --expect-lockfile, --frozen-lockfile, or ci command',\n {\n path: lockfilePath,\n },\n )\n }\n }\n\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 if (options.frozenLockfile) {\n if (add?.modifiedDependencies) {\n const dependencies: string[] = []\n for (const [, deps] of add) {\n for (const [name] of deps) {\n dependencies.push(name)\n }\n }\n throw error(\n 'Cannot add dependencies when using --frozen-lockfile',\n { found: dependencies.join(', ') },\n )\n }\n\n const lockfileGraph = loadVirtual({\n ...options,\n mainManifest,\n skipLoadingNodesOnModifiersChange: false,\n })\n\n const emptyAdd = Object.assign(\n new Map<DepID, Map<string, Dependency>>(),\n { modifiedDependencies: false },\n )\n const emptyRemove = Object.assign(new Map<DepID, Set<string>>(), {\n modifiedDependencies: false,\n })\n const importerSpecs = getImporterSpecs({\n graph: lockfileGraph,\n add: emptyAdd,\n remove: emptyRemove,\n ...options,\n })\n\n // Check for spec changes by comparing package.json specs with lockfile edges\n const specChanges: string[] = []\n for (const importer of lockfileGraph.importers) {\n const deps = getDependencies(importer, options)\n for (const [depName, dep] of deps) {\n const edge = importer.edgesOut.get(depName)\n if (edge?.spec) {\n if (edge.spec.toString() !== dep.spec.toString()) {\n const node = lockfileGraph.nodes.get(importer.id)\n /* c8 ignore next */\n const location = node?.location || importer.id\n specChanges.push(\n ` ${location}: ${depName} spec changed from \"${edge.spec}\" to \"${dep.spec}\"`,\n )\n }\n }\n }\n }\n\n if (\n importerSpecs.add.modifiedDependencies ||\n importerSpecs.remove.modifiedDependencies ||\n specChanges.length > 0\n ) {\n const details: string[] = []\n\n if (specChanges.length > 0) {\n details.push(...specChanges)\n }\n\n for (const [importerId, deps] of importerSpecs.add) {\n if (deps.size > 0) {\n const node = lockfileGraph.nodes.get(importerId)\n const location = node?.location || importerId\n const depNames = Array.from(deps.keys())\n details.push(\n ` ${location}: ${deps.size} dependencies to add (${depNames.join(', ')})`,\n )\n }\n }\n\n for (const [importerId, deps] of importerSpecs.remove) {\n if (deps.size > 0) {\n const node = lockfileGraph.nodes.get(importerId)\n const location = node?.location || importerId\n const depNames = Array.from(deps)\n details.push(\n ` ${location}: ${deps.size} dependencies to remove (${depNames.join(', ')})`,\n )\n }\n }\n\n const lockfilePath = resolve(\n options.projectRoot,\n 'vlt-lock.json',\n )\n throw error(\n 'Lockfile is out of sync with package.json. Run \"vlt install\" to update.\\n' +\n details.join('\\n'),\n {\n path: lockfilePath,\n },\n )\n }\n }\n\n const remover = new RollbackRemove()\n if (options.cleanInstall) {\n const nodeModulesPath = resolve(\n options.projectRoot,\n 'node_modules',\n )\n if (existsSync(nodeModulesPath)) {\n await remover.rm(nodeModulesPath)\n remover.confirm()\n }\n }\n\n try {\n const modifiers = GraphModifier.maybeLoad(options)\n\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n modifiers: undefined, // modifiers should not be used here\n })\n const graph = await idealBuild({\n ...options,\n actual: act,\n add,\n mainManifest,\n loadManifests: true,\n modifiers,\n })\n const diff = await reify({\n ...options,\n add,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n })\n\n return { graph, diff }\n } catch (err) {\n /* c8 ignore next */\n await remover.rollback().catch(() => {})\n throw err\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LockfileData } from './types.ts';
|
|
2
2
|
import type { GraphLike } from '../types.ts';
|
|
3
|
-
export declare const loadNodes: (graph: GraphLike, nodes: LockfileData["nodes"]) => void;
|
|
3
|
+
export declare const loadNodes: (graph: GraphLike, nodes: LockfileData["nodes"], actual?: GraphLike) => void;
|
|
4
4
|
//# sourceMappingURL=load-nodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-nodes.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-nodes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"load-nodes.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-nodes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,WACnB,SAAS,SAqEnB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { splitDepID } from '@vltpkg/dep-id/browser';
|
|
2
2
|
import { getBooleanFlagsFromNum } from "./types.js";
|
|
3
|
-
export const loadNodes = (graph, nodes) => {
|
|
3
|
+
export const loadNodes = (graph, nodes, actual) => {
|
|
4
4
|
const entries = Object.entries(nodes);
|
|
5
5
|
for (const [id, lockfileNode] of entries) {
|
|
6
6
|
// workspace nodes and the project root node are already part of the
|
|
@@ -8,13 +8,19 @@ export const loadNodes = (graph, nodes) => {
|
|
|
8
8
|
if (graph.nodes.has(id))
|
|
9
9
|
continue;
|
|
10
10
|
const [flags, name, integrity, resolved, location, manifest, rawManifest,] = lockfileNode;
|
|
11
|
-
const [type, , maybeExtra, lastExtra] = splitDepID(id);
|
|
11
|
+
const [type, filepath, maybeExtra, lastExtra] = splitDepID(id);
|
|
12
12
|
const extra = type === 'registry' || type === 'git' ? lastExtra : maybeExtra;
|
|
13
13
|
const registrySpec = maybeExtra;
|
|
14
|
+
// The reference node is a node that matches the same id from the
|
|
15
|
+
// current iterating node in the provided `actual` graph, this allows
|
|
16
|
+
// for hydrating missing manifest, integrity, and resolved values
|
|
17
|
+
// that may be missing from the lockfile
|
|
18
|
+
const referenceNode = actual?.nodes.get(id);
|
|
19
|
+
const mani = manifest ?? referenceNode?.manifest;
|
|
14
20
|
// if the lockfile has manifest data then it should just use that
|
|
15
21
|
// otherwise tries to infer name / version value from the lockfile node
|
|
16
|
-
const node =
|
|
17
|
-
graph.addNode(id,
|
|
22
|
+
const node = mani ?
|
|
23
|
+
graph.addNode(id, mani)
|
|
18
24
|
: graph.addNode(id, undefined, undefined, name ?? undefined, (type === 'registry' &&
|
|
19
25
|
registrySpec &&
|
|
20
26
|
registrySpec.indexOf('@') > 0) ?
|
|
@@ -26,14 +32,21 @@ export const loadNodes = (graph, nodes) => {
|
|
|
26
32
|
const { dev, optional } = getBooleanFlagsFromNum(flags);
|
|
27
33
|
node.dev = dev;
|
|
28
34
|
node.optional = optional;
|
|
29
|
-
node.integrity = integrity ??
|
|
30
|
-
node.resolved = resolved ??
|
|
35
|
+
node.integrity = integrity ?? referenceNode?.integrity;
|
|
36
|
+
node.resolved = resolved ?? referenceNode?.resolved;
|
|
31
37
|
if (!node.resolved)
|
|
32
38
|
node.setResolved();
|
|
33
|
-
if (location)
|
|
39
|
+
if (location) {
|
|
34
40
|
node.location = location;
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// set the location to file dependencies based on the id value
|
|
44
|
+
if (type === 'file') {
|
|
45
|
+
node.location = filepath;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (mani && rawManifest) {
|
|
49
|
+
node.setConfusedManifest(mani, rawManifest);
|
|
37
50
|
}
|
|
38
51
|
}
|
|
39
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-nodes.js","sourceRoot":"","sources":["../../../src/lockfile/load-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAKnD,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAgB,EAChB,KAA4B,EAC5B,EAAE;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAA4B,CAAA;IAChE,KAAK,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,IAAI,OAAO,EAAE,CAAC;QACzC,oEAAoE;QACpE,uEAAuE;QACvE,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,SAAQ;QAEjC,MAAM,CACJ,KAAK,EACL,IAAI,EACJ,SAAS,EACT,QAAQ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AC;AACH,CAAC,CAAA","sourcesContent":["import { splitDepID } from '@vltpkg/dep-id/browser'\nimport { getBooleanFlagsFromNum } from './types.ts'\nimport type { LockfileData, LockfileNode } from './types.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { GraphLike } from '../types.ts'\n\nexport const loadNodes = (\n graph: GraphLike,\n nodes: LockfileData['nodes'],\n actual?: GraphLike,\n) => {\n const entries = Object.entries(nodes) as [DepID, LockfileNode][]\n for (const [id, lockfileNode] of entries) {\n // workspace nodes and the project root node are already part of the\n // graph and it should not create new nodes if an existing one is there\n if (graph.nodes.has(id)) continue\n\n const [\n flags,\n name,\n integrity,\n resolved,\n location,\n manifest,\n rawManifest,\n ] = lockfileNode\n const [type, filepath, maybeExtra, lastExtra] = splitDepID(id)\n const extra =\n type === 'registry' || type === 'git' ? lastExtra : maybeExtra\n const registrySpec = maybeExtra\n\n // The reference node is a node that matches the same id from the\n // current iterating node in the provided `actual` graph, this allows\n // for hydrating missing manifest, integrity, and resolved values\n // that may be missing from the lockfile\n const referenceNode = actual?.nodes.get(id)\n const mani = manifest ?? referenceNode?.manifest\n\n // if the lockfile has manifest data then it should just use that\n // otherwise tries to infer name / version value from the lockfile node\n const node =\n mani ?\n graph.addNode(id, mani)\n : graph.addNode(\n id,\n undefined,\n undefined,\n name ?? undefined,\n (\n type === 'registry' &&\n registrySpec &&\n registrySpec.indexOf('@') > 0\n ) ?\n registrySpec.split('@').slice(-1)[0]\n : undefined,\n )\n if (extra) {\n node.modifier = extra\n }\n\n const { dev, optional } = getBooleanFlagsFromNum(flags)\n node.dev = dev\n node.optional = optional\n node.integrity = integrity ?? referenceNode?.integrity\n node.resolved = resolved ?? referenceNode?.resolved\n if (!node.resolved) node.setResolved()\n if (location) {\n node.location = location\n } else {\n // set the location to file dependencies based on the id value\n if (type === 'file') {\n node.location = filepath\n }\n }\n if (mani && rawManifest) {\n node.setConfusedManifest(mani, rawManifest)\n }\n }\n}\n"]}
|
|
@@ -2,11 +2,15 @@ import { PackageJson } from '@vltpkg/package-json';
|
|
|
2
2
|
import { Monorepo } from '@vltpkg/workspaces';
|
|
3
3
|
import { Graph } from '../graph.ts';
|
|
4
4
|
import type { PathScurry } from 'path-scurry';
|
|
5
|
-
import type {
|
|
5
|
+
import type { NormalizedManifest } from '@vltpkg/types';
|
|
6
6
|
import type { SpecOptions } from '@vltpkg/spec';
|
|
7
7
|
import type { LockfileData } from './types.ts';
|
|
8
8
|
import type { GraphModifier } from '../modifiers.ts';
|
|
9
9
|
export type LoadOptions = SpecOptions & {
|
|
10
|
+
/**
|
|
11
|
+
* An optional {@link Graph} object to hydrate extra data from.
|
|
12
|
+
*/
|
|
13
|
+
actual?: Graph;
|
|
10
14
|
/**
|
|
11
15
|
* The project root dirname.
|
|
12
16
|
*/
|
|
@@ -14,7 +18,7 @@ export type LoadOptions = SpecOptions & {
|
|
|
14
18
|
/**
|
|
15
19
|
* The project root manifest.
|
|
16
20
|
*/
|
|
17
|
-
mainManifest:
|
|
21
|
+
mainManifest: NormalizedManifest;
|
|
18
22
|
/**
|
|
19
23
|
* The graph modifiers helper object.
|
|
20
24
|
*/
|
|
@@ -38,5 +42,5 @@ export type LoadOptions = SpecOptions & {
|
|
|
38
42
|
};
|
|
39
43
|
export declare const load: (options: LoadOptions) => Graph;
|
|
40
44
|
export declare const loadHidden: (options: LoadOptions) => Graph;
|
|
41
|
-
export declare const loadObject: (options: LoadOptions, lockfileData: Omit<LockfileData, "options"> & Partial<Pick<LockfileData, "options">>) => Graph;
|
|
45
|
+
export declare const loadObject: (options: LoadOptions, lockfileData: Omit<LockfileData, "options" | "lockfileVersion"> & Partial<Pick<LockfileData, "options" | "lockfileVersion">>) => Graph;
|
|
42
46
|
//# sourceMappingURL=load.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,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MjD,CAAA;AAED,eAAO,MAAM,UAAU,YACZ,WAAW,gBACN,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,iBAAiB,CAAC,GAC7D,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,iBAAiB,CAAC,CAAC,UA4E7D,CAAA"}
|
|
@@ -58,9 +58,16 @@ export const loadObject = (options, lockfileData) => {
|
|
|
58
58
|
const modifiersChanged = lockfileModifiers !== optionsModifiers;
|
|
59
59
|
const shouldLoadDependencies = !(skipLoadingNodesOnModifiersChange && modifiersChanged);
|
|
60
60
|
if (shouldLoadDependencies) {
|
|
61
|
-
loadNodes(graph, lockfileData.nodes);
|
|
61
|
+
loadNodes(graph, lockfileData.nodes, options.actual);
|
|
62
62
|
loadEdges(graph, lockfileData.edges, mergedOptions);
|
|
63
63
|
}
|
|
64
|
+
// hydrate missing node-level registry data
|
|
65
|
+
for (const node of graph.nodes.values()) {
|
|
66
|
+
const [firstEdge] = node.edgesIn;
|
|
67
|
+
if (firstEdge?.spec.registry) {
|
|
68
|
+
node.registry = firstEdge.spec.registry;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
64
71
|
return graph;
|
|
65
72
|
};
|
|
66
73
|
//# sourceMappingURL=load.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../../src/lockfile/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;
|
|
1
|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A;IAC/D,MAAM,sBAAsB,GAAG,CAAC,CAC9B,iCAAiC,IAAI,gBAAgB,CACtD,CAAA;IACD,IAAI,sBAAsB,EAAE,CAAC;QAC3B,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;QACpD,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;IACrD,CAAC;IAED,2CAA2C;IAC3C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,OAAO,CAAA;QAChC,IAAI,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAA;QACzC,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { PackageJson } from '@vltpkg/package-json'\nimport { Monorepo } from '@vltpkg/workspaces'\nimport { readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { loadEdges } from './load-edges.ts'\nimport { loadNodes } from './load-nodes.ts'\nimport { Graph } from '../graph.ts'\nimport type { PathScurry } from 'path-scurry'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { SpecOptions } from '@vltpkg/spec'\nimport type { LockfileData } from './types.ts'\nimport type { GraphModifier } from '../modifiers.ts'\n\nexport type LoadOptions = SpecOptions & {\n /**\n * An optional {@link Graph} object to hydrate extra data from.\n */\n actual?: Graph\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 * Load only importers into the graph if the modifiers have changed.\n */\n skipLoadingNodesOnModifiersChange?: boolean\n}\n\nconst loadLockfile = (projectRoot: string, lockfilePath: string) =>\n JSON.parse(\n readFileSync(resolve(projectRoot, lockfilePath), {\n encoding: 'utf8',\n }),\n ) as LockfileData\n\nexport const load = (options: LoadOptions): Graph => {\n const { projectRoot } = options\n return loadObject(\n options,\n loadLockfile(projectRoot, 'vlt-lock.json'),\n )\n}\n\nexport const loadHidden = (options: LoadOptions): Graph => {\n const { projectRoot } = options\n return loadObject(\n options,\n loadLockfile(projectRoot, 'node_modules/.vlt-lock.json'),\n )\n}\n\nexport const loadObject = (\n options: LoadOptions,\n lockfileData: Omit<LockfileData, 'options' | 'lockfileVersion'> &\n Partial<Pick<LockfileData, 'options' | 'lockfileVersion'>>,\n) => {\n const {\n mainManifest,\n modifiers,\n scurry,\n skipLoadingNodesOnModifiersChange,\n } = options\n const packageJson = options.packageJson ?? new PackageJson()\n const monorepo =\n options.monorepo ??\n Monorepo.maybeLoad(options.projectRoot, { packageJson, scurry })\n const {\n catalog = {},\n catalogs = {},\n modifiers: modifiersLockfileConfig,\n 'scope-registries': scopeRegistries,\n registry,\n registries,\n 'git-hosts': gitHosts,\n 'git-host-archives': gitHostArchives,\n } = lockfileData.options ?? {}\n const mergedOptions = {\n ...options,\n catalog,\n catalogs,\n 'scope-registries': {\n ...options['scope-registries'],\n ...scopeRegistries,\n },\n registry: registry ?? options.registry,\n registries: {\n ...options.registries,\n ...registries,\n },\n 'git-hosts': {\n ...options['git-hosts'],\n ...gitHosts,\n },\n 'git-host-archives': {\n ...options['git-host-archives'],\n ...gitHostArchives,\n },\n }\n const graph = new Graph({\n ...mergedOptions,\n mainManifest,\n monorepo,\n })\n\n // When using the skipLoadingNodesOnModifiersChange option, we should skip loading\n // dependencies in case the modifiers have changed since we'll need to\n // recalculate the graph - useful for refreshing an ideal graph when\n // modifiers are swapped.\n const lockfileModifiers = JSON.stringify(\n modifiersLockfileConfig ?? {},\n )\n const optionsModifiers = JSON.stringify(modifiers?.config)\n const modifiersChanged = lockfileModifiers !== optionsModifiers\n const shouldLoadDependencies = !(\n skipLoadingNodesOnModifiersChange && modifiersChanged\n )\n if (shouldLoadDependencies) {\n loadNodes(graph, lockfileData.nodes, options.actual)\n loadEdges(graph, lockfileData.edges, mergedOptions)\n }\n\n // hydrate missing node-level registry data\n for (const node of graph.nodes.values()) {\n const [firstEdge] = node.edgesIn\n if (firstEdge?.spec.registry) {\n node.registry = firstEdge.spec.registry\n }\n }\n\n return graph\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../../src/lockfile/save.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../../src/lockfile/save.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC;;OAEG;IACH,KAAK,EAAE,KAAK,CAAA;IACZ;;OAEG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAyFD,eAAO,MAAM,YAAY,qNAYtB,WAAW,KAAG,YAyDhB,CAAA;AAeD,eAAO,MAAM,QAAQ,SACb,YAAY,YACR,MAAM,8BAEf,IAIF,CAAA;AAED,eAAO,MAAM,IAAI,YACN,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,KAC1C,IAKF,CAAA;AAED,eAAO,MAAM,UAAU,YACZ,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,KAC1C,IASF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRecordStringString } from '@vltpkg/types';
|
|
1
|
+
import { expandNormalizedManifestSymbols, isRecordStringString, } from '@vltpkg/types';
|
|
2
2
|
import { defaultGitHostArchives, defaultGitHosts, defaultJsrRegistries, defaultRegistries, defaultRegistry, defaultScopeRegistries, } from '@vltpkg/spec';
|
|
3
3
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { dirname, resolve } from 'node:path';
|
|
@@ -14,11 +14,7 @@ const formatNodes = (nodes, saveManifests, registry) => {
|
|
|
14
14
|
const customRegistry = node.resolved && registry && !node.resolved.startsWith(registry);
|
|
15
15
|
const resolved = customRegistry ? node.resolved : undefined;
|
|
16
16
|
// if it's in a location other than the default, stash that
|
|
17
|
-
const location =
|
|
18
|
-
node.location.endsWith('/node_modules/.vlt/' +
|
|
19
|
-
node.id +
|
|
20
|
-
'/node_modules/' +
|
|
21
|
-
node.name)) ?
|
|
17
|
+
const location = node.id.startsWith('file') || node.inVltStore() ?
|
|
22
18
|
undefined
|
|
23
19
|
: node.location;
|
|
24
20
|
const flags = getFlagNumFromNode(node);
|
|
@@ -32,10 +28,10 @@ const formatNodes = (nodes, saveManifests, registry) => {
|
|
|
32
28
|
if (location) {
|
|
33
29
|
lockfileNode[4] = location;
|
|
34
30
|
}
|
|
35
|
-
if (saveManifests) {
|
|
36
|
-
lockfileNode[5] = node.manifest;
|
|
37
|
-
if (node.confused) {
|
|
38
|
-
lockfileNode[6] = node.rawManifest;
|
|
31
|
+
if (saveManifests && node.manifest) {
|
|
32
|
+
lockfileNode[5] = expandNormalizedManifestSymbols(node.manifest);
|
|
33
|
+
if (node.confused && node.rawManifest) {
|
|
34
|
+
lockfileNode[6] = expandNormalizedManifestSymbols(node.rawManifest);
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
res[node.id] = lockfileNode;
|
|
@@ -85,6 +81,7 @@ export const lockfileData = ({ graph, catalog, catalogs, 'git-hosts': gitHosts,
|
|
|
85
81
|
: undefined;
|
|
86
82
|
const hasItems = (clean) => clean && Object.keys(clean).length;
|
|
87
83
|
return {
|
|
84
|
+
lockfileVersion: 0,
|
|
88
85
|
options: {
|
|
89
86
|
...(hasItems(cleanModifiers) ?
|
|
90
87
|
{ modifiers: cleanModifiers }
|