@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":"index.js","sourceRoot":"","sources":["../../../src/reify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAKtD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EACL,YAAY,EACZ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InfoClient } from '@vltpkg/package-info'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { availableParallelism } from 'node:os'\nimport { callLimit } from 'promise-call-limit'\nimport type { LoadOptions } from '../actual/load.ts'\nimport { load as loadActual } from '../actual/load.ts'\nimport type {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport { Diff } from '../diff.ts'\nimport type { Graph } from '../graph.ts'\nimport { lockfile } from '../index.ts'\nimport type { GraphModifier } from '../modifiers.ts'\nimport {\n lockfileData,\n saveData,\n saveHidden,\n} from '../lockfile/save.ts'\nimport { addEdges } from './add-edges.ts'\nimport { addNodes } from './add-nodes.ts'\nimport { build } from './build.ts'\nimport { deleteEdges } from './delete-edges.ts'\nimport { deleteNodes } from './delete-nodes.ts'\nimport { internalHoist } from './internal-hoist.ts'\nimport { rollback } from './rollback.ts'\nimport { updatePackageJson } from './update-importers-package-json.ts'\nimport { copyFileSync } from 'node:fs'\n\nconst limit = Math.max(availableParallelism() - 1, 1) * 8\n\n// - [ ] depid's with peer resolutions\n// - [ ] depid shortening\n\nexport type ReifyOptions = LoadOptions & {\n add?: AddImportersDependenciesMap\n remove?: RemoveImportersDependenciesMap\n graph: Graph\n actual?: Graph\n packageInfo: PackageInfoClient\n modifiers?: GraphModifier\n}\n\n/**\n * Make the current project match the supplied graph.\n */\nexport const reify = async (options: ReifyOptions) => {\n const done = graphStep('reify')\n\n const { graph, scurry } = options\n\n const actual =\n options.actual ??\n loadActual({\n ...options,\n loadManifests: true,\n })\n\n const diff = new Diff(actual, graph)\n const remover = new RollbackRemove()\n let success = false\n try {\n await reify_(options, diff, remover)\n remover.confirm()\n success = true\n } finally {\n /* c8 ignore start */\n if (!success) {\n await rollback(remover, diff, scurry).catch(() => {})\n }\n /* c8 ignore stop */\n }\n\n done()\n\n return diff\n}\n\nconst reify_ = async (\n options: ReifyOptions,\n diff: Diff,\n remover: RollbackRemove,\n) => {\n const { add, remove, packageInfo, packageJson, scurry } = options\n const saveImportersPackageJson =\n add?.modifiedDependencies || remove?.modifiedDependencies ?\n updatePackageJson({\n add,\n remove,\n graph: options.graph,\n packageJson,\n })\n : undefined\n\n // before anything else happens, grab the ideal tree as it was resolved\n // so that we can store it in the lockfile. We do this here so that\n // any failed/removed optional deps are not reflected in the lockfile\n // data as it is saved.\n const lfData = lockfileData(options)\n const actions: (() => Promise<unknown>)[] = addNodes(\n diff,\n scurry,\n remover,\n options,\n packageInfo,\n ).concat(deleteEdges(diff, scurry, remover))\n\n // need to wait, so that the nodes exist to link to\n if (actions.length) await callLimit(actions, { limit })\n\n // create all node_modules symlinks, and link bins to nm/.bin\n const edgeActions: Promise<unknown>[] = addEdges(\n diff,\n packageJson,\n scurry,\n remover,\n )\n if (edgeActions.length) await Promise.all(edgeActions)\n\n await internalHoist(diff.to, options, remover)\n\n // run lifecycles and chmod bins\n await build(diff, packageJson, scurry)\n\n // save the lockfile\n lockfile.save(options)\n\n // if we had to change the actual graph along the way,\n // make sure we do not leave behind any unreachable nodes\n if (diff.hadOptionalFailures) {\n for (const node of options.graph.gc().values()) {\n diff.nodes.add.delete(node)\n diff.nodes.delete.add(node)\n }\n }\n saveHidden(options)\n\n // delete garbage from the store.\n const rmActions: Promise<unknown>[] = deleteNodes(\n diff,\n remover,\n scurry,\n )\n if (rmActions.length) await Promise.all(rmActions)\n\n // updates package.json files if anything was added / removed\n saveImportersPackageJson?.()\n\n // write the ideal graph data to the lockfile\n saveData(lfData, scurry.resolve('vlt-lock.json'), false)\n\n // update the store config reference if a config file was used\n if (scurry.lstatSync('vlt.json')) {\n copyFileSync(\n scurry.resolve('vlt.json'),\n scurry.resolve('node_modules/.vlt/vlt.json'),\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAy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,CAAC,CAAA;IAElD,6DAA6D;IAC7D,wBAAwB,EAAE,EAAE,CAAA;IAE5B,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,CAAA;IAExD,8DAA8D;IAC9D,IAAI,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QACjC,YAAY,CACV,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAC1B,MAAM,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAC7C,CAAA;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { graphStep } from '@vltpkg/output'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { availableParallelism } from 'node:os'\nimport { callLimit } from 'promise-call-limit'\nimport type { LoadOptions } from '../actual/load.ts'\nimport { load as loadActual } from '../actual/load.ts'\nimport type {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport { Diff } from '../diff.ts'\nimport type { Graph } from '../graph.ts'\nimport { lockfile } from '../index.ts'\nimport type { GraphModifier } from '../modifiers.ts'\nimport {\n lockfileData,\n saveData,\n saveHidden,\n} from '../lockfile/save.ts'\nimport { addEdges } from './add-edges.ts'\nimport { addNodes } from './add-nodes.ts'\nimport { build } from './build.ts'\nimport { deleteEdges } from './delete-edges.ts'\nimport { deleteNodes } from './delete-nodes.ts'\nimport { internalHoist } from './internal-hoist.ts'\nimport { rollback } from './rollback.ts'\nimport { updatePackageJson } from './update-importers-package-json.ts'\nimport { copyFileSync } from 'node:fs'\n\nconst limit = Math.max(availableParallelism() - 1, 1) * 8\n\n// - [ ] depid's with peer resolutions\n// - [ ] depid shortening\n\nexport type ReifyOptions = LoadOptions & {\n add?: AddImportersDependenciesMap\n remove?: RemoveImportersDependenciesMap\n graph: Graph\n actual?: Graph\n packageInfo: PackageInfoClient\n modifiers?: GraphModifier\n}\n\n/**\n * Make the current project match the supplied graph.\n */\nexport const reify = async (options: ReifyOptions) => {\n const done = graphStep('reify')\n\n const { graph, scurry } = options\n\n const actual =\n options.actual ??\n loadActual({\n ...options,\n loadManifests: true,\n })\n\n const diff = new Diff(actual, graph)\n if (!diff.hasChanges()) {\n // nothing to do, so just return the diff\n done()\n return diff\n }\n\n const remover = new RollbackRemove()\n let success = false\n try {\n await reify_(options, diff, remover)\n remover.confirm()\n success = true\n } finally {\n /* c8 ignore start */\n if (!success) {\n await rollback(remover, diff, scurry).catch(() => {})\n }\n /* c8 ignore stop */\n }\n\n done()\n\n return diff\n}\n\nconst reify_ = async (\n options: ReifyOptions,\n diff: Diff,\n remover: RollbackRemove,\n) => {\n const { add, remove, packageInfo, packageJson, scurry } = options\n const saveImportersPackageJson =\n add?.modifiedDependencies || remove?.modifiedDependencies ?\n updatePackageJson({\n add,\n remove,\n graph: options.graph,\n packageJson,\n })\n : undefined\n\n // before anything else happens, grab the ideal tree as it was resolved\n // so that we can store it in the lockfile. We do this here so that\n // any failed/removed optional deps are not reflected in the lockfile\n // data as it is saved.\n const lfData = lockfileData(options)\n const actions: (() => Promise<unknown>)[] = addNodes(\n diff,\n scurry,\n remover,\n options,\n packageInfo,\n ).concat(deleteEdges(diff, scurry, remover))\n\n // need to wait, so that the nodes exist to link to\n if (actions.length) await callLimit(actions, { limit })\n\n // create all node_modules symlinks, and link bins to nm/.bin\n const edgeActions: Promise<unknown>[] = addEdges(\n diff,\n packageJson,\n scurry,\n remover,\n )\n if (edgeActions.length) await Promise.all(edgeActions)\n\n await internalHoist(diff.to, options, remover)\n\n // run lifecycles and chmod bins\n await build(diff, packageJson, scurry)\n\n // save the lockfile\n lockfile.save(options)\n\n // if we had to change the actual graph along the way,\n // make sure we do not leave behind any unreachable nodes\n if (diff.hadOptionalFailures) {\n for (const node of options.graph.gc().values()) {\n diff.nodes.add.delete(node)\n diff.nodes.delete.add(node)\n }\n }\n saveHidden(options)\n\n // delete garbage from the store.\n const rmActions: Promise<unknown>[] = deleteNodes(\n diff,\n remover,\n scurry,\n )\n if (rmActions.length) await Promise.all(rmActions)\n\n // updates package.json files if anything was added / removed\n saveImportersPackageJson?.()\n\n // write the ideal graph data to the lockfile\n saveData(lfData, scurry.resolve('vlt-lock.json'), false)\n\n // update the store config reference if a config file was used\n if (scurry.lstatSync('vlt.json')) {\n copyFileSync(\n scurry.resolve('vlt.json'),\n scurry.resolve('node_modules/.vlt/vlt.json'),\n )\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-importers-package-json.js","sourceRoot":"","sources":["../../../src/reify/update-importers-package-json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAO3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAOnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,WAAW,GAAG,IAAI,GAAG,CAA0C;IACnE,CAAC,MAAM,EAAE,cAAc,CAAC;IACxB,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAC1B,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAC5B,CAAC,cAAc,EAAE,kBAAkB,CAAC;IACpC,CAAC,UAAU,EAAE,sBAAsB,CAAC;CACrC,CAAC,CAAA;AA8BF,MAAM,eAAe,GAAG,CACtB,UAAiB,EACjB,KAAY,EACZ,WAEkC,EACZ,EAAE;IACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,kCAAkC,EAAE;YAC9C,KAAK,EAAE,UAAU;SAClB,CAAC,CAAA;IACJ,CAAC;IACD,MA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,CAAA;AACf,CAAC,CAAA","sourcesContent":["import type { DepID } from '@vltpkg/dep-id'\nimport { splitDepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type {\n DependencyTypeLong,\n DependencyTypeShort,\n Manifest,\n} from '@vltpkg/types'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport { resolveSaveType } from '../resolve-save-type.ts'\nimport { calculateSaveValue } from './calculate-save-value.ts'\n\nconst depTypesMap = new Map<DependencyTypeShort, DependencyTypeLong>([\n ['prod', 'dependencies'],\n ['dev', 'devDependencies'],\n ['peer', 'peerDependencies'],\n ['peerOptional', 'peerDependencies'],\n ['optional', 'optionalDependencies'],\n])\n\nexport type UpdatePackageJsonOptions = {\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 * The {@link Graph} instance that contain the importer nodes to which\n * the manifest data (and it's corresponding `package.json` file) are\n * going to be updated.\n */\n graph: Graph\n /**\n * An instance of {@link PackageJson} to use when writing updated manifest\n * data to `package.json` files. It's necessary that this is the same\n * instance used to load these `package.json` files previously.\n */\n packageJson: PackageJson\n}\n\nconst addOrRemoveDeps = (\n importerId: DepID,\n graph: Graph,\n addOrRemove?:\n | AddImportersDependenciesMap\n | RemoveImportersDependenciesMap,\n): Manifest | undefined => {\n const importer = graph.nodes.get(importerId)\n if (!importer) {\n throw error('Failed to retrieve importer node', {\n found: importerId,\n })\n }\n const manifest = importer.manifest\n if (!manifest) {\n throw error('Could not find manifest data for node', {\n found: importerId,\n })\n }\n const deps = addOrRemove?.get(importerId)\n /* c8 ignore start -- impossible but TS doesn't know that */\n if (!deps) {\n throw error('Failed to retrieve added deps info', {\n manifest,\n })\n }\n let manifestChanged = false\n /* c8 ignore stop */\n for (const deleteNameOrAddItem of deps) {\n if (typeof deleteNameOrAddItem === 'string') {\n const name = deleteNameOrAddItem\n for (const depType of longDependencyTypes) {\n if (manifest[depType]?.[name]) {\n delete manifest[depType][name]\n manifestChanged = true\n }\n }\n if (manifest.peerDependenciesMeta?.[name]) {\n delete manifest.peerDependenciesMeta[name]\n manifestChanged = true\n }\n } else {\n const [name, dep] = deleteNameOrAddItem\n // peerOptional also needs to add peerDependenciesMeta entry\n const depTypeShort = resolveSaveType(importer, name, dep.type)\n const depType = depTypesMap.get(depTypeShort)\n if (!depType) {\n throw error('Failed to retrieve dependency type', {\n validOptions: [...depTypesMap.keys()],\n found: dep.type,\n })\n }\n const node = importer.edgesOut.get(name)?.to\n if (!node) {\n throw error('Dependency node could not be found')\n }\n const [nodeType] = splitDepID(node.id)\n\n for (const dtype of longDependencyTypes) {\n if (dtype === depType || !manifest[dtype]) continue\n delete manifest[dtype][name]\n }\n if (depTypeShort === 'peerOptional') {\n manifest.peerDependenciesMeta ??= {}\n manifest.peerDependenciesMeta[name] = { optional: true }\n } else if (manifest.peerDependenciesMeta?.[name]) {\n delete manifest.peerDependenciesMeta[name]\n }\n\n const dependencies =\n manifest[depType] ?? (manifest[depType] = {})\n // check to see if we need to save a different version\n // - If you install a single specific version, that is deliberate,\n // we save that exact version, no matter what.\n // - If the requested spec matches the manifest, make no change\n // If the requested spec had no bareSpec, and the manifest has\n // a dependency entry, make no change.\n // If the requested spec has a bareSpec that did NOT match the manifest,\n // then update it.\n // If the manifest does not contain anything, then update it.\n // Only for registry dependencies\n const existing = dependencies[name]\n const saveValue = calculateSaveValue(\n nodeType,\n dep.spec,\n existing,\n node.version,\n )\n dependencies[name] = saveValue\n manifestChanged = manifestChanged || saveValue !== existing\n }\n }\n return manifestChanged ? manifest : undefined\n}\n\n/**\n * Updates the importers of a provided {@link Graph} accordingly to the\n * provided add or remove arguments.\n */\nexport const updatePackageJson = ({\n add,\n graph,\n packageJson,\n remove,\n}: UpdatePackageJsonOptions) => {\n const manifestsToUpdate = new Set<Manifest>()\n const operations = new Set([add, remove])\n\n for (const operation of operations) {\n if (operation) {\n for (const importerId of operation.keys()) {\n const manifest = addOrRemoveDeps(importerId, graph, operation)\n if (manifest) {\n manifestsToUpdate.add(manifest)\n }\n }\n }\n }\n\n const commit = () => {\n for (const manifest of manifestsToUpdate) {\n packageJson.save(manifest)\n }\n }\n\n return commit\n}\n"]}
|
|
1
|
+
{"version":3,"file":"update-importers-package-json.js","sourceRoot":"","sources":["../../../src/reify/update-importers-package-json.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAO3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAOnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,WAAW,GAAG,IAAI,GAAG,CAA0C;IACnE,CAAC,MAAM,EAAE,cAAc,CAAC;IACxB,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAC1B,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAC5B,CAAC,cAAc,EAAE,kBAAkB,CAAC;IACpC,CAAC,UAAU,EAAE,sBAAsB,CAAC;CACrC,CAAC,CAAA;AA8BF,MAAM,eAAe,GAAG,CACtB,UAAiB,EACjB,KAAY,EACZ,WAEkC,EACF,EAAE;IAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,M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ACzC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA","sourcesContent":["import type { DepID } from '@vltpkg/dep-id'\nimport { splitDepID } from '@vltpkg/dep-id'\nimport { error } from '@vltpkg/error-cause'\nimport type { PackageJson } from '@vltpkg/package-json'\nimport type {\n DependencyTypeLong,\n DependencyTypeShort,\n NormalizedManifest,\n} from '@vltpkg/types'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport { resolveSaveType } from '../resolve-save-type.ts'\nimport { calculateSaveValue } from './calculate-save-value.ts'\n\nconst depTypesMap = new Map<DependencyTypeShort, DependencyTypeLong>([\n ['prod', 'dependencies'],\n ['dev', 'devDependencies'],\n ['peer', 'peerDependencies'],\n ['peerOptional', 'peerDependencies'],\n ['optional', 'optionalDependencies'],\n])\n\nexport type UpdatePackageJsonOptions = {\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 * The {@link Graph} instance that contain the importer nodes to which\n * the manifest data (and it's corresponding `package.json` file) are\n * going to be updated.\n */\n graph: Graph\n /**\n * An instance of {@link PackageJson} to use when writing updated manifest\n * data to `package.json` files. It's necessary that this is the same\n * instance used to load these `package.json` files previously.\n */\n packageJson: PackageJson\n}\n\nconst addOrRemoveDeps = (\n importerId: DepID,\n graph: Graph,\n addOrRemove?:\n | AddImportersDependenciesMap\n | RemoveImportersDependenciesMap,\n): NormalizedManifest | undefined => {\n const importer = graph.nodes.get(importerId)\n if (!importer) {\n throw error('Failed to retrieve importer node', {\n found: importerId,\n })\n }\n const manifest = importer.manifest\n if (!manifest) {\n throw error('Could not find manifest data for node', {\n found: importerId,\n })\n }\n const deps = addOrRemove?.get(importerId)\n /* c8 ignore start -- impossible but TS doesn't know that */\n if (!deps) {\n throw error('Failed to retrieve added deps info', {\n manifest,\n })\n }\n let manifestChanged = false\n /* c8 ignore stop */\n for (const deleteNameOrAddItem of deps) {\n if (typeof deleteNameOrAddItem === 'string') {\n const name = deleteNameOrAddItem\n for (const depType of longDependencyTypes) {\n if (manifest[depType]?.[name]) {\n delete manifest[depType][name]\n manifestChanged = true\n }\n }\n if (manifest.peerDependenciesMeta?.[name]) {\n delete manifest.peerDependenciesMeta[name]\n manifestChanged = true\n }\n } else {\n const [name, dep] = deleteNameOrAddItem\n // peerOptional also needs to add peerDependenciesMeta entry\n const depTypeShort = resolveSaveType(importer, name, dep.type)\n const depType = depTypesMap.get(depTypeShort)\n if (!depType) {\n throw error('Failed to retrieve dependency type', {\n validOptions: [...depTypesMap.keys()],\n found: dep.type,\n })\n }\n const node = importer.edgesOut.get(name)?.to\n if (!node) {\n throw error('Dependency node could not be found')\n }\n const [nodeType] = splitDepID(node.id)\n\n for (const dtype of longDependencyTypes) {\n if (dtype === depType || !manifest[dtype]) continue\n delete manifest[dtype][name]\n }\n if (depTypeShort === 'peerOptional') {\n manifest.peerDependenciesMeta ??= {}\n manifest.peerDependenciesMeta[name] = { optional: true }\n } else if (manifest.peerDependenciesMeta?.[name]) {\n delete manifest.peerDependenciesMeta[name]\n }\n\n const dependencies =\n manifest[depType] ?? (manifest[depType] = {})\n // check to see if we need to save a different version\n // - If you install a single specific version, that is deliberate,\n // we save that exact version, no matter what.\n // - If the requested spec matches the manifest, make no change\n // If the requested spec had no bareSpec, and the manifest has\n // a dependency entry, make no change.\n // If the requested spec has a bareSpec that did NOT match the manifest,\n // then update it.\n // If the manifest does not contain anything, then update it.\n // Only for registry dependencies\n const existing = dependencies[name]\n const saveValue = calculateSaveValue(\n nodeType,\n dep.spec,\n existing,\n node.version,\n )\n dependencies[name] = saveValue\n manifestChanged = manifestChanged || saveValue !== existing\n }\n }\n return manifestChanged ? manifest : undefined\n}\n\n/**\n * Updates the importers of a provided {@link Graph} accordingly to the\n * provided add or remove arguments.\n */\nexport const updatePackageJson = ({\n add,\n graph,\n packageJson,\n remove,\n}: UpdatePackageJsonOptions) => {\n const manifestsToUpdate = new Set<NormalizedManifest>()\n const operations = new Set([add, remove])\n\n for (const operation of operations) {\n if (operation) {\n for (const importerId of operation.keys()) {\n const manifest = addOrRemoveDeps(importerId, graph, operation)\n if (manifest) {\n manifestsToUpdate.add(manifest)\n }\n }\n }\n }\n\n const commit = () => {\n for (const manifest of manifestsToUpdate) {\n packageJson.save(manifest)\n }\n }\n\n return commit\n}\n"]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
export const removeOptionalSubgraph = (graph, startingNode) => {
|
|
15
15
|
const removed = new Set();
|
|
16
16
|
for (const node of findOptionalSubgraph(startingNode)) {
|
|
17
|
-
graph.removeNode(node);
|
|
17
|
+
graph.removeNode(node, undefined, true);
|
|
18
18
|
removed.add(node);
|
|
19
19
|
}
|
|
20
20
|
return removed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-optional-subgraph.js","sourceRoot":"","sources":["../../src/remove-optional-subgraph.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAY,EACZ,YAAuC,EACvC,EAAE;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAQ,CAAA;IAC/B,KAAK,MAAM,IAAI,IAAI,oBAAoB,CAAC,YAAY,CAAC,EAAE,CAAC;QACtD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"remove-optional-subgraph.js","sourceRoot":"","sources":["../../src/remove-optional-subgraph.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAAY,EACZ,YAAuC,EACvC,EAAE;IACF,MAAM,OAAO,GAAG,IAAI,GAAG,EAAQ,CAAA;IAC/B,KAAK,MAAM,IAAI,IAAI,oBAAoB,CAAC,YAAY,CAAC,EAAE,CAAC;QACtD,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;QACvC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACnB,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,SAAS,CAAC,CAAC,oBAAoB,CACnC,IAA+B,EAC/B,OAAO,IAAI,GAAG,EAA6B;IAE3C,mCAAmC;IACnC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAM;IAE1B,qDAAqD;IACrD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACd,MAAM,IAAI,CAAA;IAEV,mDAAmD;IACnD,KAAK,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAC9C,qEAAqE;QACrE,oEAAoE;QACpE,2CAA2C;QAC3C,IAAI,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnC,KAAK,MAAM,GAAG,IAAI,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC;gBAAE,MAAM,GAAG,CAAA;QAC/D,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { Graph } from './graph.ts'\nimport type { Node } from './node.ts'\n\n/**\n * Remove the affected optional nodes starting from a given optional node\n * that failed to resolve/install.\n *\n * Removing these dependents will frequently leave optional *dependencies*\n * behind that are made unreachable from any project importer. For performance\n * reasons, `graph.gc()` is not called automatically by this method, since\n * multiple optional subgraphs may need to be removed in a single operation,\n * and the mark-and-sweep garbage collection (a) can be excessively expensive,\n * and (b) may need to communicate the set of garbage-collected nodes\n * for cleanup (as in the case of optional node build failures during\n * reification).\n */\nexport const removeOptionalSubgraph = (\n graph: Graph,\n startingNode: Node & { optional: true },\n) => {\n const removed = new Set<Node>()\n for (const node of findOptionalSubgraph(startingNode)) {\n graph.removeNode(node, undefined, true)\n removed.add(node)\n }\n return removed\n}\n\n/**\n * Given a starting node, this generator will walk back from the optional node\n * to all of its optional dependents, emitting each one, and skipping any\n * cycles.\n *\n * Note that when these are removed, it may create unreachable nodes in the\n * graph! Be sure to call `graph.gc()` if these are removed.\n */\nexport function* findOptionalSubgraph(\n node: Node & { optional: true },\n seen = new Set<Node & { optional: true }>(),\n): Generator<Node & { optional: true }, void> {\n // already visited, prevent looping\n if (seen.has(node)) return\n\n // the node itself is part of the subgraph, of course\n seen.add(node)\n yield node\n\n // and any of its dependents that are also optional\n for (const { from, optional } of node.edgesIn) {\n // if it's an optional *edge*, we don't need to remove it, because it\n // doesn't need the node anyway. But if the node is optional and the\n // dep isn't, then we do need to remove it.\n if (from.isOptional() && !optional) {\n for (const dep of findOptionalSubgraph(from, seen)) yield dep\n }\n }\n}\n"]}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DepID } from '@vltpkg/dep-id';
|
|
2
|
-
import type {
|
|
2
|
+
import type { NormalizedManifest, DependencyTypeShort } from '@vltpkg/types';
|
|
3
3
|
import type { Spec, SpecLikeBase } from '@vltpkg/spec';
|
|
4
4
|
export type EdgeLike = {
|
|
5
5
|
name: string;
|
|
@@ -18,7 +18,7 @@ export type GraphLike = {
|
|
|
18
18
|
nodesByName: Map<string, Set<NodeLike>>;
|
|
19
19
|
edges: Set<EdgeLike>;
|
|
20
20
|
addEdge: (type: DependencyTypeShort, spec: Spec, from: NodeLike, to?: NodeLike) => EdgeLike;
|
|
21
|
-
addNode: (id?: DepID, manifest?:
|
|
21
|
+
addNode: (id?: DepID, manifest?: NormalizedManifest, spec?: Spec, name?: string, version?: string) => NodeLike;
|
|
22
22
|
};
|
|
23
23
|
export type NodeLike = {
|
|
24
24
|
id: DepID;
|
|
@@ -26,8 +26,8 @@ export type NodeLike = {
|
|
|
26
26
|
edgesIn: Set<EdgeLike>;
|
|
27
27
|
edgesOut: Map<string, EdgeLike>;
|
|
28
28
|
location?: string;
|
|
29
|
-
manifest?:
|
|
30
|
-
rawManifest?:
|
|
29
|
+
manifest?: NormalizedManifest | null;
|
|
30
|
+
rawManifest?: NormalizedManifest | null;
|
|
31
31
|
name?: string | null;
|
|
32
32
|
version?: string | null;
|
|
33
33
|
integrity?: string | null;
|
|
@@ -45,7 +45,7 @@ export type NodeLike = {
|
|
|
45
45
|
};
|
|
46
46
|
toString(): string;
|
|
47
47
|
setResolved(): void;
|
|
48
|
-
setConfusedManifest(fixed:
|
|
49
|
-
maybeSetConfusedManifest(spec: Spec, confused?:
|
|
48
|
+
setConfusedManifest(fixed: NormalizedManifest, confused?: NormalizedManifest): void;
|
|
49
|
+
maybeSetConfusedManifest(spec: Spec, confused?: NormalizedManifest): void;
|
|
50
50
|
};
|
|
51
51
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEtD,MAAM,MA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AAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;IACvC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,SAAS,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,EAAE,OAAO,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,IAAI,CAChB,QAAQ,EACN,IAAI,GACJ,MAAM,GACN,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,GACV,aAAa,GACb,WAAW,GACX,UAAU,GACV,KAAK,GACL,UAAU,GACV,UAAU,CACb,GAAG;QACF,WAAW,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAA;KACnC,CAAA;IACD,QAAQ,IAAI,MAAM,CAAA;IAClB,WAAW,IAAI,IAAI,CAAA;IACnB,mBAAmB,CACjB,KAAK,EAAE,kBAAkB,EACzB,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,IAAI,CAAA;IACP,wBAAwB,CACtB,IAAI,EAAE,IAAI,EACV,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,IAAI,CAAA;CACR,CAAA"}
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DepID } from '@vltpkg/dep-id'\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DepID } from '@vltpkg/dep-id'\nimport type {\n NormalizedManifest,\n DependencyTypeShort,\n} from '@vltpkg/types'\nimport type { Spec, SpecLikeBase } from '@vltpkg/spec'\n\nexport type EdgeLike = {\n name: string\n from: NodeLike\n spec: SpecLikeBase\n to?: NodeLike\n type: DependencyTypeShort\n optional?: boolean\n peer?: boolean\n}\n\nexport type GraphLike = {\n importers: Set<NodeLike>\n mainImporter: NodeLike\n projectRoot: string\n nodes: Map<DepID, NodeLike>\n nodesByName: Map<string, Set<NodeLike>>\n edges: Set<EdgeLike>\n addEdge: (\n type: DependencyTypeShort,\n spec: Spec,\n from: NodeLike,\n to?: NodeLike,\n ) => EdgeLike\n addNode: (\n id?: DepID,\n manifest?: NormalizedManifest,\n spec?: Spec,\n name?: string,\n version?: string,\n ) => NodeLike\n}\n\nexport type NodeLike = {\n id: DepID\n confused: boolean\n edgesIn: Set<EdgeLike>\n edgesOut: Map<string, EdgeLike>\n location?: string\n manifest?: NormalizedManifest | null\n rawManifest?: NormalizedManifest | null\n name?: string | null\n version?: string | null\n integrity?: string | null\n resolved?: string | null\n importer: boolean\n graph: GraphLike\n mainImporter: boolean\n projectRoot: string\n dev: boolean\n optional: boolean\n modifier?: string | undefined\n registry?: string\n toJSON: () => Pick<\n NodeLike,\n | 'id'\n | 'name'\n | 'version'\n | 'location'\n | 'importer'\n | 'manifest'\n | 'projectRoot'\n | 'integrity'\n | 'resolved'\n | 'dev'\n | 'optional'\n | 'confused'\n > & {\n rawManifest?: NodeLike['manifest']\n }\n toString(): string\n setResolved(): void\n setConfusedManifest(\n fixed: NormalizedManifest,\n confused?: NormalizedManifest,\n ): void\n maybeSetConfusedManifest(\n spec: Spec,\n confused?: NormalizedManifest,\n ): void\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-19",
|
|
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/
|
|
27
|
-
"@vltpkg/
|
|
28
|
-
"@vltpkg/
|
|
29
|
-
"@vltpkg/dep-id": "0.0.0-
|
|
30
|
-
"@vltpkg/
|
|
31
|
-
"@vltpkg/
|
|
32
|
-
"@vltpkg/
|
|
33
|
-
"@vltpkg/package-info": "0.0.0-
|
|
34
|
-
"@vltpkg/
|
|
35
|
-
"@vltpkg/
|
|
36
|
-
"@vltpkg/
|
|
37
|
-
"@vltpkg/
|
|
38
|
-
"@vltpkg/
|
|
39
|
-
"@vltpkg/types": "0.0.0-
|
|
40
|
-
"@vltpkg/
|
|
41
|
-
"@vltpkg/
|
|
42
|
-
"@vltpkg/workspaces": "0.0.0-
|
|
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"
|
|
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-
|
|
55
|
+
"@vltpkg/vlt-json": "0.0.0-19"
|
|
56
56
|
},
|
|
57
57
|
"license": "BSD-2-Clause-Patent",
|
|
58
58
|
"engines": {
|