@vltpkg/graph 1.0.0-rc.6 → 1.0.0-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/esm/actual/load.js +8 -10
  2. package/dist/esm/actual/load.js.map +1 -1
  3. package/dist/esm/fixup-added-names.d.ts +16 -0
  4. package/dist/esm/fixup-added-names.d.ts.map +1 -0
  5. package/dist/esm/fixup-added-names.js +31 -0
  6. package/dist/esm/fixup-added-names.js.map +1 -0
  7. package/dist/esm/ideal/append-nodes.d.ts +2 -1
  8. package/dist/esm/ideal/append-nodes.d.ts.map +1 -1
  9. package/dist/esm/ideal/append-nodes.js +42 -20
  10. package/dist/esm/ideal/append-nodes.js.map +1 -1
  11. package/dist/esm/ideal/build-ideal-from-starting-graph.d.ts +4 -1
  12. package/dist/esm/ideal/build-ideal-from-starting-graph.d.ts.map +1 -1
  13. package/dist/esm/ideal/build-ideal-from-starting-graph.js +21 -17
  14. package/dist/esm/ideal/build-ideal-from-starting-graph.js.map +1 -1
  15. package/dist/esm/ideal/build.d.ts.map +1 -1
  16. package/dist/esm/ideal/build.js +29 -0
  17. package/dist/esm/ideal/build.js.map +1 -1
  18. package/dist/esm/ideal/get-importer-specs.d.ts +9 -2
  19. package/dist/esm/ideal/get-importer-specs.d.ts.map +1 -1
  20. package/dist/esm/ideal/get-importer-specs.js +80 -5
  21. package/dist/esm/ideal/get-importer-specs.js.map +1 -1
  22. package/dist/esm/ideal/refresh-ideal-graph.d.ts +12 -2
  23. package/dist/esm/ideal/refresh-ideal-graph.d.ts.map +1 -1
  24. package/dist/esm/ideal/refresh-ideal-graph.js +2 -2
  25. package/dist/esm/ideal/refresh-ideal-graph.js.map +1 -1
  26. package/dist/esm/ideal/types.d.ts +13 -0
  27. package/dist/esm/ideal/types.d.ts.map +1 -1
  28. package/dist/esm/ideal/types.js.map +1 -1
  29. package/dist/esm/index.d.ts +1 -0
  30. package/dist/esm/index.d.ts.map +1 -1
  31. package/dist/esm/index.js +1 -0
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/esm/install.d.ts.map +1 -1
  34. package/dist/esm/install.js +9 -1
  35. package/dist/esm/install.js.map +1 -1
  36. package/dist/esm/lockfile/load-edges.d.ts.map +1 -1
  37. package/dist/esm/lockfile/load-edges.js +4 -3
  38. package/dist/esm/lockfile/load-edges.js.map +1 -1
  39. package/dist/esm/reify/add-edges.d.ts +1 -1
  40. package/dist/esm/reify/add-edges.d.ts.map +1 -1
  41. package/dist/esm/reify/add-edges.js +2 -1
  42. package/dist/esm/reify/add-edges.js.map +1 -1
  43. package/dist/esm/reify/index.js +1 -1
  44. package/dist/esm/reify/index.js.map +1 -1
  45. package/dist/esm/reify/update-importers-package-json.d.ts +1 -1
  46. package/dist/esm/reify/update-importers-package-json.d.ts.map +1 -1
  47. package/dist/esm/reify/update-importers-package-json.js +18 -15
  48. package/dist/esm/reify/update-importers-package-json.js.map +1 -1
  49. package/dist/esm/uninstall.d.ts.map +1 -1
  50. package/dist/esm/uninstall.js +10 -0
  51. package/dist/esm/uninstall.js.map +1 -1
  52. package/dist/esm/update.d.ts.map +1 -1
  53. package/dist/esm/update.js +10 -0
  54. package/dist/esm/update.js.map +1 -1
  55. package/dist/esm/visualization/mermaid-output.d.ts.map +1 -1
  56. package/dist/esm/visualization/mermaid-output.js +57 -16
  57. package/dist/esm/visualization/mermaid-output.js.map +1 -1
  58. package/package.json +21 -21
@@ -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,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SACR,CAAC,CAAA;QAEF,oEAAoE;QACpE,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,8DAA8D;YAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;YACnC,MAAM,wBAAwB;YAC5B,oBAAoB;YACpB,GAAG,EAAE,oBAAoB,IAAI,MAAM,CAAC,oBAAoB,CAAC,CAAC;gBACxD,iBAAiB,CAAC;oBAChB,GAAG,OAAO;oBACV,GAAG;oBACH,KAAK;oBACL,MAAM;iBACP,CAAC;gBACJ,CAAC,CAAC,SAAS,CAAA;YACb,wBAAwB,EAAE,EAAE,CAAA;YAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;QACnC,CAAC;QAED,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,KAAK,CAAC;YACvC,GAAG,OAAO;YACV,GAAG;YACH,MAAM,EAAE,GAAG;YACX,KAAK;YACL,aAAa,EAAE,IAAI;YACnB,SAAS;YACT,MAAM;YACN,OAAO;SACR,CAAC,CAAA;QAEF,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IACpC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,oBAAoB;QACpB,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,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 RemoveImportersDependenciesMap,\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'\nimport { lockfile } from './index.ts'\nimport type { Graph } from './index.ts'\nimport { updatePackageJson } from './reify/update-importers-package-json.ts'\n\nexport type InstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n cleanInstall?: boolean // Only set by ci command for clean install\n allowScripts: string\n}\n\nexport const install = async (\n options: InstallOptions,\n add?: AddImportersDependenciesMap,\n) => {\n // Validate incompatible options\n if (options.lockfileOnly && options.cleanInstall) {\n throw error(\n 'Cannot use --lockfile-only with --clean-install (ci command). Clean install requires filesystem operations.',\n )\n }\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 // validates no add/remove operations are requested\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 })\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 const depLabelAdd =\n deps.size === 1 ? 'dependency' : 'dependencies'\n details.push(\n ` ${location}: ${deps.size} ${depLabelAdd} 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 const depLabelRemove =\n deps.size === 1 ?\n 'dependency'\n : /* c8 ignore next */ 'dependencies'\n details.push(\n ` ${location}: ${deps.size} ${depLabelRemove} 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 remove = Object.assign(new Map<DepID, Set<string>>(), {\n modifiedDependencies: false,\n }) as RemoveImportersDependenciesMap\n const modifiers = GraphModifier.maybeLoad(options)\n\n let act: Graph | undefined = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n modifiers: undefined, // modifiers should not be used here\n })\n // if the actual graph has no dependencies, it's simpler to ignore it\n // this allows us to check for its availability later on for properly\n // handling situations like resetting edges for refreshing the ideal graph\n if (act.importers.size === act.nodes.size) {\n act = undefined\n }\n const graph = await idealBuild({\n ...options,\n actual: act,\n add,\n mainManifest,\n loadManifests: true,\n modifiers,\n remove,\n remover,\n })\n\n // If lockfileOnly is enabled, skip reify and only save the lockfile\n if (options.lockfileOnly) {\n // Save only the main lockfile, skip all filesystem operations\n lockfile.save({ graph, modifiers })\n const saveImportersPackageJson =\n /* c8 ignore next */\n add?.modifiedDependencies || remove.modifiedDependencies ?\n updatePackageJson({\n ...options,\n add,\n graph,\n remove,\n })\n : undefined\n saveImportersPackageJson?.()\n return { graph, diff: undefined }\n }\n\n const { diff, buildQueue } = await reify({\n ...options,\n add,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n remove,\n remover,\n })\n\n return { buildQueue, graph, diff }\n } catch (err) {\n /* c8 ignore next */\n await remover.rollback().catch(() => {})\n throw err\n }\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,EA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AC,CAAA,CAAC;QACV,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 RemoveImportersDependenciesMap,\n} from './dependencies.ts'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { existsSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { load as loadVirtual } from './lockfile/load.ts'\nimport { getImporterSpecs } from './ideal/get-importer-specs.ts'\nimport { lockfile } from './index.ts'\nimport type { Graph } from './index.ts'\nimport { updatePackageJson } from './reify/update-importers-package-json.ts'\n\nexport type InstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n cleanInstall?: boolean // Only set by ci command for clean install\n allowScripts: string\n}\n\nexport const install = async (\n options: InstallOptions,\n add?: AddImportersDependenciesMap,\n) => {\n // Validate incompatible options\n if (options.lockfileOnly && options.cleanInstall) {\n throw error(\n 'Cannot use --lockfile-only with --clean-install (ci command). Clean install requires filesystem operations.',\n )\n }\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 // validates no add/remove operations are requested\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 })\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 const depLabelAdd =\n deps.size === 1 ? 'dependency' : 'dependencies'\n details.push(\n ` ${location}: ${deps.size} ${depLabelAdd} 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 const depLabelRemove =\n deps.size === 1 ?\n 'dependency'\n : /* c8 ignore next */ 'dependencies'\n details.push(\n ` ${location}: ${deps.size} ${depLabelRemove} 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 remove = Object.assign(new Map<DepID, Set<string>>(), {\n modifiedDependencies: false,\n }) as RemoveImportersDependenciesMap\n const modifiers = GraphModifier.maybeLoad(options)\n\n let act: Graph | undefined = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n modifiers: undefined, // modifiers should not be used here\n })\n // if the actual graph has no dependencies, it's simpler to ignore it\n // this allows us to check for its availability later on for properly\n // handling situations like resetting edges for refreshing the ideal graph\n if (act.importers.size === act.nodes.size) {\n act = undefined\n }\n const graph = await idealBuild({\n ...options,\n actual: act,\n add,\n mainManifest,\n loadManifests: true,\n modifiers,\n remove,\n remover,\n })\n\n // If lockfileOnly is enabled, skip reify and only save the lockfile\n if (options.lockfileOnly) {\n // Save only the main lockfile, skip all filesystem operations\n lockfile.save({ graph, modifiers })\n const saveImportersPackageJson =\n /* c8 ignore next */\n add?.modifiedDependencies || remove.modifiedDependencies ?\n updatePackageJson({\n ...options,\n add,\n graph,\n remove,\n })\n : undefined\n saveImportersPackageJson?.()\n return { graph, diff: undefined }\n }\n\n const { diff, buildQueue } = await reify({\n ...options,\n add,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n remove,\n remover,\n })\n\n return { buildQueue, graph, diff }\n } catch (err) {\n /* c8 ignore next */\n await remover.rollback().catch(() => {})\n // Remove hidden lockfile on failure\n try {\n const hiddenLockfile = resolve(\n options.projectRoot,\n 'node_modules/.vlt-lock.json',\n )\n if (existsSync(hiddenLockfile)) {\n rmSync(hiddenLockfile, { force: true })\n }\n } catch {}\n throw err\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"load-edges.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-edges.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACT,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC5B,OAAO,EAAE,mBAAmB,CAAA;IAC5B,IAAI,EAAE,IAAI,CAAA;CACX,CAAA;AA0BD,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,WACnB,WAAW,SA2GrB,CAAA"}
1
+ {"version":3,"file":"load-edges.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-edges.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACT,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC5B,OAAO,EAAE,mBAAmB,CAAA;IAC5B,IAAI,EAAE,IAAI,CAAA;CACX,CAAA;AA0BD,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,WACnB,WAAW,SAuGrB,CAAA"}
@@ -79,9 +79,10 @@ export const loadEdges = (graph, edges, options) => {
79
79
  }
80
80
  }
81
81
  // Parse spec once we know the nodes are valid
82
- const spec = Spec.parse(specName, valRest.substring(0, vrSplit), options);
83
- // sets a registry for this spec to inherit from
84
- spec.inheritedRegistry = fromNode.registry;
82
+ const spec = Spec.parse(specName, valRest.substring(0, vrSplit), {
83
+ ...options,
84
+ registry: fromNode.registry,
85
+ });
85
86
  if (useOptimizations) {
86
87
  edgeProcessingQueue.push({
87
88
  fromNode,
@@ -1 +1 @@
1
- {"version":3,"file":"load-edges.js","sourceRoot":"","sources":["../../../src/lockfile/load-edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAMnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAc1D,MAAM,qBAAqB,GAAG,CAC5B,GAAW,EACX,KAAa,EACb,KAAgB,EAChB,MAAc,EACd,SAAiC,EACvB,EAAE;IACZ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAClD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,KAAK,CAAC,mCAAmC,EAAE;YAC/C,KAAK,EAAE;gBACL,KAAK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AAS,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;oBAC7B,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CACrB,QAAQ,EACR,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,EAC7B,OAAO,CACR,CAAA;QAED,gDAAgD;QAChD,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,QAAQ,CAAA;QAE1C,IAAI,gBAAgB,EAAE,CAAC;YACrB,mBAAmB,CAAC,IAAI,CAAC;gBACvB,QAAQ;gBACR,MAAM;gBACN,OAAO;gBACP,IAAI;aACL,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,uCAAuC;YACvC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,wDAAwD;IACxD,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,GACL,IAAI,mBAAmB,EAAE,CAAC;YACzB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { asDepID } from '@vltpkg/dep-id/browser'\nimport { error } from '@vltpkg/error-cause'\nimport { fastSplit } from '@vltpkg/fast-split'\nimport { Spec } from '@vltpkg/spec/browser'\nimport type { SpecOptions } from '@vltpkg/spec/browser'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport type {\n DependencyTypeShort,\n GraphLike,\n NodeLike,\n} from '@vltpkg/types'\nimport { isDependencyTypeShort } from '../dependencies.ts'\nimport type {\n LockfileData,\n LockfileEdgeKey,\n LockfileEdgeValue,\n} from './types.ts'\n\nexport type ProcessingEdge = {\n fromNode: NodeLike\n toNode: NodeLike | undefined\n depType: DependencyTypeShort\n spec: Spec\n}\n\nconst retrieveNodeFromGraph = (\n key: string,\n value: string,\n graph: GraphLike,\n fromId: string,\n seenNodes?: Map<string, NodeLike>,\n): NodeLike => {\n const foundNode = graph.nodes.get(asDepID(fromId))\n if (!foundNode) {\n throw error('Edge info missing its `from` node', {\n found: {\n nodes: [...graph.nodes].map(([id]) => id),\n from: foundNode,\n fromId,\n edge: { [key]: value },\n },\n })\n }\n if (seenNodes) {\n seenNodes.set(fromId, foundNode)\n }\n return foundNode\n}\n\nexport const loadEdges = (\n graph: GraphLike,\n edges: LockfileData['edges'],\n options: SpecOptions,\n) => {\n const entries = Object.entries(edges) as [\n LockfileEdgeKey,\n LockfileEdgeValue,\n ][]\n\n const edgeCount = entries.length\n // Only use optimizations for non-trivial graphs\n const useOptimizations = edgeCount > 50\n const edgeProcessingQueue: ProcessingEdge[] = []\n\n // Cache for frequently accessed nodes to avoid repeated Map lookups\n const seenNodes =\n useOptimizations ? new Map<string, NodeLike>() : undefined\n\n for (const [key, value] of entries) {\n const [fromId, specName] = fastSplit(key, ' ', 2)\n const [depType, valRest] = fastSplit(value, ' ', 2)\n const vrSplit = valRest?.lastIndexOf(' ') ?? -1\n\n // not a valid edge record\n /* c8 ignore start */\n if (!valRest || !depType || !fromId || !specName || vrSplit < 1) {\n continue\n }\n /* c8 ignore stop */\n\n // Validate dependency type early\n if (!isDependencyTypeShort(depType)) {\n throw error('Found unsupported dependency type in lockfile', {\n validOptions: [...longDependencyTypes],\n })\n }\n\n // Use cached node lookup for large graphs, direct lookup for small ones\n let fromNode: NodeLike\n if (seenNodes) {\n const seen = seenNodes.get(fromId)\n if (seen) {\n fromNode = seen\n } else {\n fromNode = retrieveNodeFromGraph(\n key,\n value,\n graph,\n fromId,\n seenNodes,\n )\n }\n } else {\n fromNode = retrieveNodeFromGraph(key, value, graph, fromId)\n }\n\n const toId = valRest.substring(vrSplit + 1)\n let toNode: NodeLike | undefined = undefined\n\n if (toId !== 'MISSING') {\n if (seenNodes) {\n const seen = seenNodes.get(toId)\n if (seen) {\n toNode = seen\n } else {\n toNode = graph.nodes.get(asDepID(toId))\n if (toNode) {\n seenNodes.set(toId, toNode)\n }\n }\n } else {\n toNode = graph.nodes.get(asDepID(toId))\n }\n }\n\n // Parse spec once we know the nodes are valid\n const spec = Spec.parse(\n specName,\n valRest.substring(0, vrSplit),\n options,\n )\n\n // sets a registry for this spec to inherit from\n spec.inheritedRegistry = fromNode.registry\n\n if (useOptimizations) {\n edgeProcessingQueue.push({\n fromNode,\n toNode,\n depType,\n spec,\n })\n } else {\n // Process immediately for small graphs\n graph.addEdge(depType, spec, fromNode, toNode)\n }\n }\n\n // Batch process all edges (only for non-trivial graphs)\n if (useOptimizations) {\n for (const {\n fromNode,\n toNode,\n depType,\n spec,\n } of edgeProcessingQueue) {\n graph.addEdge(depType, spec, fromNode, toNode)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"load-edges.js","sourceRoot":"","sources":["../../../src/lockfile/load-edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAE3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAMnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAc1D,MAAM,qBAAqB,GAAG,CAC5B,GAAW,EACX,KAAa,EACb,KAAgB,EAChB,MAAc,EACd,SAAiC,EACvB,EAAE;IACZ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,G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f,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;oBACvC,IAAI,MAAM,EAAE,CAAC;wBACX,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;oBAC7B,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE;YAC/D,GAAG,OAAO;YACV,QAAQ,EAAE,QAAQ,CAAC,QAAQ;SAC5B,CAAC,CAAA;QAEF,IAAI,gBAAgB,EAAE,CAAC;YACrB,mBAAmB,CAAC,IAAI,CAAC;gBACvB,QAAQ;gBACR,MAAM;gBACN,OAAO;gBACP,IAAI;aACL,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,uCAAuC;YACvC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,wDAAwD;IACxD,IAAI,gBAAgB,EAAE,CAAC;QACrB,KAAK,MAAM,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,GACL,IAAI,mBAAmB,EAAE,CAAC;YACzB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { asDepID } from '@vltpkg/dep-id/browser'\nimport { error } from '@vltpkg/error-cause'\nimport { fastSplit } from '@vltpkg/fast-split'\nimport { Spec } from '@vltpkg/spec/browser'\nimport type { SpecOptions } from '@vltpkg/spec/browser'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport type {\n DependencyTypeShort,\n GraphLike,\n NodeLike,\n} from '@vltpkg/types'\nimport { isDependencyTypeShort } from '../dependencies.ts'\nimport type {\n LockfileData,\n LockfileEdgeKey,\n LockfileEdgeValue,\n} from './types.ts'\n\nexport type ProcessingEdge = {\n fromNode: NodeLike\n toNode: NodeLike | undefined\n depType: DependencyTypeShort\n spec: Spec\n}\n\nconst retrieveNodeFromGraph = (\n key: string,\n value: string,\n graph: GraphLike,\n fromId: string,\n seenNodes?: Map<string, NodeLike>,\n): NodeLike => {\n const foundNode = graph.nodes.get(asDepID(fromId))\n if (!foundNode) {\n throw error('Edge info missing its `from` node', {\n found: {\n nodes: [...graph.nodes].map(([id]) => id),\n from: foundNode,\n fromId,\n edge: { [key]: value },\n },\n })\n }\n if (seenNodes) {\n seenNodes.set(fromId, foundNode)\n }\n return foundNode\n}\n\nexport const loadEdges = (\n graph: GraphLike,\n edges: LockfileData['edges'],\n options: SpecOptions,\n) => {\n const entries = Object.entries(edges) as [\n LockfileEdgeKey,\n LockfileEdgeValue,\n ][]\n\n const edgeCount = entries.length\n // Only use optimizations for non-trivial graphs\n const useOptimizations = edgeCount > 50\n const edgeProcessingQueue: ProcessingEdge[] = []\n\n // Cache for frequently accessed nodes to avoid repeated Map lookups\n const seenNodes =\n useOptimizations ? new Map<string, NodeLike>() : undefined\n\n for (const [key, value] of entries) {\n const [fromId, specName] = fastSplit(key, ' ', 2)\n const [depType, valRest] = fastSplit(value, ' ', 2)\n const vrSplit = valRest?.lastIndexOf(' ') ?? -1\n\n // not a valid edge record\n /* c8 ignore start */\n if (!valRest || !depType || !fromId || !specName || vrSplit < 1) {\n continue\n }\n /* c8 ignore stop */\n\n // Validate dependency type early\n if (!isDependencyTypeShort(depType)) {\n throw error('Found unsupported dependency type in lockfile', {\n validOptions: [...longDependencyTypes],\n })\n }\n\n // Use cached node lookup for large graphs, direct lookup for small ones\n let fromNode: NodeLike\n if (seenNodes) {\n const seen = seenNodes.get(fromId)\n if (seen) {\n fromNode = seen\n } else {\n fromNode = retrieveNodeFromGraph(\n key,\n value,\n graph,\n fromId,\n seenNodes,\n )\n }\n } else {\n fromNode = retrieveNodeFromGraph(key, value, graph, fromId)\n }\n\n const toId = valRest.substring(vrSplit + 1)\n let toNode: NodeLike | undefined = undefined\n\n if (toId !== 'MISSING') {\n if (seenNodes) {\n const seen = seenNodes.get(toId)\n if (seen) {\n toNode = seen\n } else {\n toNode = graph.nodes.get(asDepID(toId))\n if (toNode) {\n seenNodes.set(toId, toNode)\n }\n }\n } else {\n toNode = graph.nodes.get(asDepID(toId))\n }\n }\n\n // Parse spec once we know the nodes are valid\n const spec = Spec.parse(specName, valRest.substring(0, vrSplit), {\n ...options,\n registry: fromNode.registry,\n })\n\n if (useOptimizations) {\n edgeProcessingQueue.push({\n fromNode,\n toNode,\n depType,\n spec,\n })\n } else {\n // Process immediately for small graphs\n graph.addEdge(depType, spec, fromNode, toNode)\n }\n }\n\n // Batch process all edges (only for non-trivial graphs)\n if (useOptimizations) {\n for (const {\n fromNode,\n toNode,\n depType,\n spec,\n } of edgeProcessingQueue) {\n graph.addEdge(depType, spec, fromNode, toNode)\n }\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { RollbackRemove } from '@vltpkg/rollback-remove';
2
2
  import type { PathScurry } from 'path-scurry';
3
3
  import type { Diff } from '../diff.ts';
4
- export declare const addEdges: (diff: Diff, scurry: PathScurry, remover: RollbackRemove) => Promise<unknown>[];
4
+ export declare const addEdges: (diff: Diff, scurry: PathScurry, remover: RollbackRemove) => (() => Promise<unknown>)[];
5
5
  //# sourceMappingURL=add-edges.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-edges.d.ts","sourceRoot":"","sources":["../../../src/reify/add-edges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGtC,eAAO,MAAM,QAAQ,SACb,IAAI,UACF,UAAU,WACT,cAAc,KACtB,OAAO,CAAC,OAAO,CAAC,EAQlB,CAAA"}
1
+ {"version":3,"file":"add-edges.d.ts","sourceRoot":"","sources":["../../../src/reify/add-edges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGtC,eAAO,MAAM,QAAQ,SACb,IAAI,UACF,UAAU,WACT,cAAc,KACtB,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,EAS1B,CAAA"}
@@ -5,7 +5,8 @@ export const addEdges = (diff, scurry, remover) => {
5
5
  const { to } = edge;
6
6
  if (!to)
7
7
  continue;
8
- actions.push(addEdge(edge, scurry, remover, to.bins));
8
+ const bins = to.bins;
9
+ actions.push(() => addEdge(edge, scurry, remover, bins));
9
10
  }
10
11
  return actions;
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"add-edges.js","sourceRoot":"","sources":["../../../src/reify/add-edges.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAU,EACV,MAAkB,EAClB,OAAuB,EACH,EAAE;IACtB,MAAM,OAAO,GAAuB,EAAE,CAAA;IACtC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,EAAE;YAAE,SAAQ;QACjB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IACvD,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport { addEdge } from './add-edge.ts'\n\nexport const addEdges = (\n diff: Diff,\n scurry: PathScurry,\n remover: RollbackRemove,\n): Promise<unknown>[] => {\n const actions: Promise<unknown>[] = []\n for (const edge of diff.edges.add) {\n const { to } = edge\n if (!to) continue\n actions.push(addEdge(edge, scurry, remover, to.bins))\n }\n return actions\n}\n"]}
1
+ {"version":3,"file":"add-edges.js","sourceRoot":"","sources":["../../../src/reify/add-edges.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAU,EACV,MAAkB,EAClB,OAAuB,EACK,EAAE;IAC9B,MAAM,OAAO,GAA+B,EAAE,CAAA;IAC9C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,EAAE;YAAE,SAAQ;QACjB,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAA;QACpB,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;IAC1D,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport type { PathScurry } from 'path-scurry'\nimport type { Diff } from '../diff.ts'\nimport { addEdge } from './add-edge.ts'\n\nexport const addEdges = (\n diff: Diff,\n scurry: PathScurry,\n remover: RollbackRemove,\n): (() => Promise<unknown>)[] => {\n const actions: (() => Promise<unknown>)[] = []\n for (const edge of diff.edges.add) {\n const { to } = edge\n if (!to) continue\n const bins = to.bins\n actions.push(() => addEdge(edge, scurry, remover, bins))\n }\n return actions\n}\n"]}
@@ -115,7 +115,7 @@ const reify_ = async (options, diff, remover) => {
115
115
  // create all node_modules symlinks, and link bins to nm/.bin
116
116
  const edgeActions = addEdges(diff, scurry, remover);
117
117
  if (edgeActions.length)
118
- await Promise.all(edgeActions);
118
+ await callLimit(edgeActions, { limit });
119
119
  await internalHoist(diff.to, options, remover);
120
120
  // looks up all nodes setting buildState = 'needed'
121
121
  // on nodes that require building
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAKtD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,UAAU,GACX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAA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AAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;IACD,oBAAoB;IACpB,UAAU,CAAC,OAAO,CAAC,CAAA;IAEnB,iCAAiC;IACjC,MAAM,SAAS,GAAuB,WAAW,CAC/C,IAAI,EACJ,OAAO,EACP,MAAM,CACP,CAAA;IACD,IAAI,SAAS,CAAC,MAAM;QAAE,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,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;IAED,4BAA4B;IAC5B,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import { graphStep } from '@vltpkg/output'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { availableParallelism } from 'node:os'\nimport { callLimit } from 'promise-call-limit'\nimport type { DepID } from '@vltpkg/dep-id'\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 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 { checkNeededBuild } from './check-needed-build.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'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\nimport type { NodeLike } from '@vltpkg/types'\nimport { binChmodAll } from './bin-chmod.ts'\n\nconst limit = Math.max(availableParallelism() - 1, 1) * 8\n\n/**\n * Filter nodes using a DSS query string\n */\nconst filterNodesByQuery = async (\n graph: Graph,\n allowScriptsQuery?: string,\n): Promise<Set<DepID>> => {\n // shortcut no packages included\n if (\n allowScriptsQuery === ':not(*)' /* c8 ignore next */ ||\n !allowScriptsQuery\n ) {\n return new Set()\n }\n // shortcut all packages included\n if (allowScriptsQuery === '*') {\n return new Set(graph.nodes.keys())\n }\n /* c8 ignore start */\n const securityArchive =\n Query.hasSecuritySelectors(allowScriptsQuery) ?\n await SecurityArchive.start({\n nodes: [...graph.nodes.values()],\n })\n : undefined\n /* c8 ignore stop */\n\n const edges = graph.edges\n const nodes = new Set<NodeLike>(graph.nodes.values())\n const importers = graph.importers\n\n const query = new Query({\n edges,\n nodes,\n importers,\n securityArchive,\n })\n\n const { nodes: resultNodes } = await query.search(\n allowScriptsQuery,\n {\n signal: new AbortController().signal,\n },\n )\n\n return new Set(resultNodes.map(node => node.id))\n}\n\n// - [ ] depid's with peer resolutions\n// - [ ] depid shortening\n\nexport type ReifyOptions = LoadOptions & {\n add?: AddImportersDependenciesMap\n allowScripts: string\n remove?: RemoveImportersDependenciesMap\n graph: Graph\n actual?: Graph\n packageInfo: PackageInfoClient\n modifiers?: GraphModifier\n remover: RollbackRemove\n}\n\nexport type ReifyResult = {\n /**\n * The diff object that was used to reify the project.\n */\n diff: Diff\n /**\n * Optional queue of DepIDs that requires building (running lifecycle scripts\n * and binary linking) after the reification is complete.\n */\n buildQueue?: DepID[]\n}\n\n/**\n * Make the current project match the supplied graph.\n */\nexport const reify = async (\n options: ReifyOptions,\n): Promise<ReifyResult> => {\n const done = graphStep('reify')\n\n const { graph, scurry, remover } = 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 noModifiedDependencies =\n !options.add?.modifiedDependencies &&\n !options.remove?.modifiedDependencies\n const skipOptionalOnly = noModifiedDependencies && diff.optionalOnly\n const res: ReifyResult = { diff }\n if (!diff.hasChanges() || skipOptionalOnly) {\n // nothing to do, so just return the diff\n done()\n return res\n }\n\n let success = false\n try {\n const { buildQueue } = await reify_(options, diff, remover)\n remover.confirm()\n success = true\n res.buildQueue = buildQueue\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 res\n}\n\nconst reify_ = async (\n options: ReifyOptions,\n diff: Diff,\n remover: RollbackRemove,\n): Promise<Omit<ReifyResult, 'diff'>> => {\n const res: Omit<ReifyResult, 'diff'> = {}\n const {\n add,\n remove,\n packageInfo,\n packageJson,\n scurry,\n allowScripts,\n } = options\n const saveImportersPackageJson =\n /* c8 ignore next */\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 scurry,\n remover,\n )\n if (edgeActions.length) await Promise.all(edgeActions)\n\n await internalHoist(diff.to, options, remover)\n\n // looks up all nodes setting buildState = 'needed'\n // on nodes that require building\n checkNeededBuild({ diff })\n\n // Filter nodes allowed to run scripts if allowScripts query is provided\n const allowScriptsNodes = await filterNodesByQuery(\n diff.to,\n allowScripts,\n )\n\n // ensure that all added bins are chmod +x\n await binChmodAll(diff.nodes.add, scurry)\n\n // run install lifecycle scripts and link any binary files\n await build(diff, packageJson, scurry, allowScriptsNodes)\n\n // set the buildQueue on the result object containing\n // an array with all the ids of nodes that need building\n res.buildQueue = [...diff.nodes.add]\n .filter(node => node.buildState === 'needed')\n .map(node => node.id)\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 // TODO: add tests to cover this\n /* c8 ignore start */\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 /* c8 ignore stop */\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 // returns the result object\n return res\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAKtD,OAAO,EAAE,IAAI,EAAE,MAA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["import { graphStep } from '@vltpkg/output'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { availableParallelism } from 'node:os'\nimport { callLimit } from 'promise-call-limit'\nimport type { DepID } from '@vltpkg/dep-id'\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 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 { checkNeededBuild } from './check-needed-build.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'\nimport { Query } from '@vltpkg/query'\nimport { SecurityArchive } from '@vltpkg/security-archive'\nimport type { NodeLike } from '@vltpkg/types'\nimport { binChmodAll } from './bin-chmod.ts'\n\nconst limit = Math.max(availableParallelism() - 1, 1) * 8\n\n/**\n * Filter nodes using a DSS query string\n */\nconst filterNodesByQuery = async (\n graph: Graph,\n allowScriptsQuery?: string,\n): Promise<Set<DepID>> => {\n // shortcut no packages included\n if (\n allowScriptsQuery === ':not(*)' /* c8 ignore next */ ||\n !allowScriptsQuery\n ) {\n return new Set()\n }\n // shortcut all packages included\n if (allowScriptsQuery === '*') {\n return new Set(graph.nodes.keys())\n }\n /* c8 ignore start */\n const securityArchive =\n Query.hasSecuritySelectors(allowScriptsQuery) ?\n await SecurityArchive.start({\n nodes: [...graph.nodes.values()],\n })\n : undefined\n /* c8 ignore stop */\n\n const edges = graph.edges\n const nodes = new Set<NodeLike>(graph.nodes.values())\n const importers = graph.importers\n\n const query = new Query({\n edges,\n nodes,\n importers,\n securityArchive,\n })\n\n const { nodes: resultNodes } = await query.search(\n allowScriptsQuery,\n {\n signal: new AbortController().signal,\n },\n )\n\n return new Set(resultNodes.map(node => node.id))\n}\n\n// - [ ] depid's with peer resolutions\n// - [ ] depid shortening\n\nexport type ReifyOptions = LoadOptions & {\n add?: AddImportersDependenciesMap\n allowScripts: string\n remove?: RemoveImportersDependenciesMap\n graph: Graph\n actual?: Graph\n packageInfo: PackageInfoClient\n modifiers?: GraphModifier\n remover: RollbackRemove\n}\n\nexport type ReifyResult = {\n /**\n * The diff object that was used to reify the project.\n */\n diff: Diff\n /**\n * Optional queue of DepIDs that requires building (running lifecycle scripts\n * and binary linking) after the reification is complete.\n */\n buildQueue?: DepID[]\n}\n\n/**\n * Make the current project match the supplied graph.\n */\nexport const reify = async (\n options: ReifyOptions,\n): Promise<ReifyResult> => {\n const done = graphStep('reify')\n\n const { graph, scurry, remover } = 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 noModifiedDependencies =\n !options.add?.modifiedDependencies &&\n !options.remove?.modifiedDependencies\n const skipOptionalOnly = noModifiedDependencies && diff.optionalOnly\n const res: ReifyResult = { diff }\n if (!diff.hasChanges() || skipOptionalOnly) {\n // nothing to do, so just return the diff\n done()\n return res\n }\n\n let success = false\n try {\n const { buildQueue } = await reify_(options, diff, remover)\n remover.confirm()\n success = true\n res.buildQueue = buildQueue\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 res\n}\n\nconst reify_ = async (\n options: ReifyOptions,\n diff: Diff,\n remover: RollbackRemove,\n): Promise<Omit<ReifyResult, 'diff'>> => {\n const res: Omit<ReifyResult, 'diff'> = {}\n const {\n add,\n remove,\n packageInfo,\n packageJson,\n scurry,\n allowScripts,\n } = options\n const saveImportersPackageJson =\n /* c8 ignore next */\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 = addEdges(diff, scurry, remover)\n if (edgeActions.length) await callLimit(edgeActions, { limit })\n\n await internalHoist(diff.to, options, remover)\n\n // looks up all nodes setting buildState = 'needed'\n // on nodes that require building\n checkNeededBuild({ diff })\n\n // Filter nodes allowed to run scripts if allowScripts query is provided\n const allowScriptsNodes = await filterNodesByQuery(\n diff.to,\n allowScripts,\n )\n\n // ensure that all added bins are chmod +x\n await binChmodAll(diff.nodes.add, scurry)\n\n // run install lifecycle scripts and link any binary files\n await build(diff, packageJson, scurry, allowScriptsNodes)\n\n // set the buildQueue on the result object containing\n // an array with all the ids of nodes that need building\n res.buildQueue = [...diff.nodes.add]\n .filter(node => node.buildState === 'needed')\n .map(node => node.id)\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 // TODO: add tests to cover this\n /* c8 ignore start */\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 /* c8 ignore stop */\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 // returns the result object\n return res\n}\n"]}
@@ -29,7 +29,7 @@ export type UpdatePackageJsonOptions = {
29
29
  packageJson: PackageJson;
30
30
  };
31
31
  /**
32
- * Updates the importers of a provided {@link Graph} accordingly to the
32
+ * Updates nodes of a provided {@link Graph} accordingly to the
33
33
  * provided add or remove arguments.
34
34
  */
35
35
  export declare const updatePackageJson: ({ add, graph, packageJson, remove, }: UpdatePackageJsonOptions) => () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"update-importers-package-json.d.ts","sourceRoot":"","sources":["../../../src/reify/update-importers-package-json.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAOvD,OAAO,KAAK,EACV,2BAA2B,EAE3B,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAYxC,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,2BAA2B,CAAA;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,8BAA8B,CAAA;IACvC;;;;OAIG;IACH,KAAK,EAAE,KAAK,CAAA;IACZ;;;;OAIG;IACH,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAiGD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,yCAK3B,wBAAwB,eAsB1B,CAAA"}
1
+ {"version":3,"file":"update-importers-package-json.d.ts","sourceRoot":"","sources":["../../../src/reify/update-importers-package-json.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAOvD,OAAO,KAAK,EACV,2BAA2B,EAE3B,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAYxC,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,2BAA2B,CAAA;IACjC;;;;OAIG;IACH,MAAM,CAAC,EAAE,8BAA8B,CAAA;IACvC;;;;OAIG;IACH,KAAK,EAAE,KAAK,CAAA;IACZ;;;;OAIG;IACH,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAiGD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,yCAK3B,wBAAwB,eAyB1B,CAAA"}
@@ -10,20 +10,20 @@ const depTypesMap = new Map([
10
10
  ['peerOptional', 'peerDependencies'],
11
11
  ['optional', 'optionalDependencies'],
12
12
  ]);
13
- const addOrRemoveDeps = (importerId, graph, addOrRemove) => {
14
- const importer = graph.nodes.get(importerId);
15
- if (!importer) {
16
- throw error('Failed to retrieve importer node', {
17
- found: importerId,
13
+ const addOrRemoveDeps = (nodeId, graph, addOrRemove) => {
14
+ const node = graph.nodes.get(nodeId);
15
+ if (!node) {
16
+ throw error('Failed to retrieve node', {
17
+ found: nodeId,
18
18
  });
19
19
  }
20
- const manifest = importer.manifest;
20
+ const manifest = node.manifest;
21
21
  if (!manifest) {
22
22
  throw error('Could not find manifest data for node', {
23
- found: importerId,
23
+ found: nodeId,
24
24
  });
25
25
  }
26
- const deps = addOrRemove?.get(importerId);
26
+ const deps = addOrRemove?.get(nodeId);
27
27
  /* c8 ignore start -- impossible but TS doesn't know that */
28
28
  if (!deps) {
29
29
  throw error('Failed to retrieve added deps info', {
@@ -49,7 +49,7 @@ const addOrRemoveDeps = (importerId, graph, addOrRemove) => {
49
49
  else {
50
50
  const [name, dep] = deleteNameOrAddItem;
51
51
  // peerOptional also needs to add peerDependenciesMeta entry
52
- const depTypeShort = resolveSaveType(importer, name, dep.type);
52
+ const depTypeShort = resolveSaveType(node, name, dep.type);
53
53
  const depType = depTypesMap.get(depTypeShort);
54
54
  if (!depType) {
55
55
  throw error('Failed to retrieve dependency type', {
@@ -57,11 +57,11 @@ const addOrRemoveDeps = (importerId, graph, addOrRemove) => {
57
57
  found: dep.type,
58
58
  });
59
59
  }
60
- const node = importer.edgesOut.get(name)?.to;
61
- if (!node) {
60
+ const n = node.edgesOut.get(name)?.to;
61
+ if (!n) {
62
62
  throw error('Dependency node could not be found');
63
63
  }
64
- const [nodeType] = splitDepID(node.id);
64
+ const [nodeType] = splitDepID(n.id);
65
65
  for (const dtype of longDependencyTypes) {
66
66
  if (dtype === depType || !manifest[dtype])
67
67
  continue;
@@ -94,7 +94,7 @@ const addOrRemoveDeps = (importerId, graph, addOrRemove) => {
94
94
  return manifestChanged ? manifest : undefined;
95
95
  };
96
96
  /**
97
- * Updates the importers of a provided {@link Graph} accordingly to the
97
+ * Updates nodes of a provided {@link Graph} accordingly to the
98
98
  * provided add or remove arguments.
99
99
  */
100
100
  export const updatePackageJson = ({ add, graph, packageJson, remove, }) => {
@@ -102,8 +102,11 @@ export const updatePackageJson = ({ add, graph, packageJson, remove, }) => {
102
102
  const operations = new Set([add, remove]);
103
103
  for (const operation of operations) {
104
104
  if (operation) {
105
- for (const importerId of operation.keys()) {
106
- const manifest = addOrRemoveDeps(importerId, graph, operation);
105
+ // These node ids are from either importer nodes or dependencies
106
+ // that are nested folders from which the user can also add new
107
+ // dependencies to
108
+ for (const nodeId of operation.keys()) {
109
+ const manifest = addOrRemoveDeps(nodeId, graph, operation);
107
110
  if (manifest) {
108
111
  manifestsToUpdate.add(manifest);
109
112
  }
@@ -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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AAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAA;IAEzC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC1C,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;gBAC9D,IAAI,QAAQ,EAAE,CAAC;oBACb,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;YACzC,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"]}
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,q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ACX,MAAM,GACmB,EAAE,EAAE;IAC7B,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAsB,CAAA;IACvD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAA;IAEzC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,SAAS,EAAE,CAAC;YACd,gEAAgE;YAChE,+DAA+D;YAC/D,kBAAkB;YAClB,KAAK,MAAM,MAAM,IAAI,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;gBACtC,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;gBAC1D,IAAI,QAAQ,EAAE,CAAC;oBACb,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;YACzC,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 nodeId: DepID,\n graph: Graph,\n addOrRemove?:\n | AddImportersDependenciesMap\n | RemoveImportersDependenciesMap,\n): NormalizedManifest | undefined => {\n const node = graph.nodes.get(nodeId)\n if (!node) {\n throw error('Failed to retrieve node', {\n found: nodeId,\n })\n }\n const manifest = node.manifest\n if (!manifest) {\n throw error('Could not find manifest data for node', {\n found: nodeId,\n })\n }\n const deps = addOrRemove?.get(nodeId)\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(node, 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 n = node.edgesOut.get(name)?.to\n if (!n) {\n throw error('Dependency node could not be found')\n }\n const [nodeType] = splitDepID(n.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 nodes 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 // These node ids are from either importer nodes or dependencies\n // that are nested folders from which the user can also add new\n // dependencies to\n for (const nodeId of operation.keys()) {\n const manifest = addOrRemoveDeps(nodeId, 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 +1 @@
1
- {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAA;AAQvE,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,WAAW,EAAE,iBAAiB,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,SAAS,YACX,gBAAgB,WAChB,8BAA8B;;;;;;EAqDxC,CAAA"}
1
+ {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAA;AAUvE,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,WAAW,EAAE,iBAAiB,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,SAAS,YACX,gBAAgB,WAChB,8BAA8B;;;;;;EA+DxC,CAAA"}
@@ -5,6 +5,8 @@ import { reify } from "./reify/index.js";
5
5
  import { lockfile } from "./index.js";
6
6
  import { updatePackageJson } from "./reify/update-importers-package-json.js";
7
7
  import { RollbackRemove } from '@vltpkg/rollback-remove';
8
+ import { existsSync, rmSync } from 'node:fs';
9
+ import { resolve } from 'node:path';
8
10
  export const uninstall = async (options, remove) => {
9
11
  const mainManifest = options.packageJson.read(options.projectRoot);
10
12
  const modifiers = GraphModifier.maybeLoad(options);
@@ -51,6 +53,14 @@ export const uninstall = async (options, remove) => {
51
53
  }
52
54
  catch (err) {
53
55
  await remover.rollback().catch(() => { });
56
+ // Remove hidden lockfile on failure
57
+ try {
58
+ const hiddenLockfile = resolve(options.projectRoot, 'node_modules/.vlt-lock.json');
59
+ if (existsSync(hiddenLockfile)) {
60
+ rmSync(hiddenLockfile, { force: true });
61
+ }
62
+ }
63
+ catch { }
54
64
  throw err;
55
65
  }
56
66
  /* c8 ignore stop */
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAOxD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,OAAyB,EACzB,MAAuC,EACvC,EAAE;IACF,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAClE,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAClD,MAAM,OAAO,GAAG,IAAI,cAAc,EAAE,CAAA;IAEpC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC;YAC7B,GAAG,OAAO;YACV,MAAM;YACN,YAAY;YACZ,aAAa,EAAE,IAAI;YACnB,OAAO;SACR,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,UAAU,CAAC;YACrB,GAAG,OAAO;YACV,YAAY;YACZ,aAAa,EAAE,IAAI;SACpB,CAAC,CAAA;QAEF,oEAAoE;QACpE,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,8DAA8D;YAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;YACnC,MAAM,wBAAwB;YAC5B,oBAAoB;YACpB,MAAM,EAAE,oBAAoB,CAAC,CAAC;gBAC5B,iBAAiB,CAAC;oBAChB,GAAG,OAAO;oBACV,MAAM;oBACN,KAAK;iBACN,CAAC;gBACJ,CAAC,CAAC,SAAS,CAAA;YACb,wBAAwB,EAAE,EAAE,CAAA;YAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;QACnC,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC;YACvB,GAAG,OAAO;YACV,MAAM;YACN,MAAM,EAAE,GAAG;YACX,KAAK;YACL,aAAa,EAAE,IAAI;YACnB,OAAO;SACR,CAAC,CAAA;QAEF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;QACtB,qBAAqB;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACxC,MAAM,GAAG,CAAA;IACX,CAAC;IACD,oBAAoB;AACtB,CAAC,CAAA","sourcesContent":["import type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { load as actualLoad } from './actual/load.ts'\nimport type { RemoveImportersDependenciesMap } from './dependencies.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\nimport { lockfile } from './index.ts'\nimport { updatePackageJson } from './reify/update-importers-package-json.ts'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\n\nexport type UninstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n allowScripts: string\n}\n\nexport const uninstall = async (\n options: UninstallOptions,\n remove?: RemoveImportersDependenciesMap,\n) => {\n const mainManifest = options.packageJson.read(options.projectRoot)\n const modifiers = GraphModifier.maybeLoad(options)\n const remover = new RollbackRemove()\n\n try {\n const graph = await idealBuild({\n ...options,\n remove,\n mainManifest,\n loadManifests: true,\n remover,\n })\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n\n // If lockfileOnly is enabled, skip reify and only save the lockfile\n if (options.lockfileOnly) {\n // Save only the main lockfile, skip all filesystem operations\n lockfile.save({ graph, modifiers })\n const saveImportersPackageJson =\n /* c8 ignore next */\n remove?.modifiedDependencies ?\n updatePackageJson({\n ...options,\n remove,\n graph,\n })\n : undefined\n saveImportersPackageJson?.()\n return { graph, diff: undefined }\n }\n\n const diff = await reify({\n ...options,\n remove,\n actual: act,\n graph,\n loadManifests: true,\n remover,\n })\n\n return { graph, diff }\n /* c8 ignore start */\n } catch (err) {\n await remover.rollback().catch(() => {})\n throw err\n }\n /* c8 ignore stop */\n}\n"]}
1
+ {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/uninstall.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,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G,EAAE,CAAC;QACb,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACxC,oCAAoC;QACpC,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,OAAO,CAC5B,OAAO,CAAC,WAAW,EACnB,6BAA6B,CAC9B,CAAA;YACD,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;gBAC/B,MAAM,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACV,MAAM,GAAG,CAAA;IACX,CAAC;IACD,oBAAoB;AACtB,CAAC,CAAA","sourcesContent":["import type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { load as actualLoad } from './actual/load.ts'\nimport type { RemoveImportersDependenciesMap } from './dependencies.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\nimport { lockfile } from './index.ts'\nimport { updatePackageJson } from './reify/update-importers-package-json.ts'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { existsSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport type UninstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n allowScripts: string\n}\n\nexport const uninstall = async (\n options: UninstallOptions,\n remove?: RemoveImportersDependenciesMap,\n) => {\n const mainManifest = options.packageJson.read(options.projectRoot)\n const modifiers = GraphModifier.maybeLoad(options)\n const remover = new RollbackRemove()\n\n try {\n const graph = await idealBuild({\n ...options,\n remove,\n mainManifest,\n loadManifests: true,\n remover,\n })\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n\n // If lockfileOnly is enabled, skip reify and only save the lockfile\n if (options.lockfileOnly) {\n // Save only the main lockfile, skip all filesystem operations\n lockfile.save({ graph, modifiers })\n const saveImportersPackageJson =\n /* c8 ignore next */\n remove?.modifiedDependencies ?\n updatePackageJson({\n ...options,\n remove,\n graph,\n })\n : undefined\n saveImportersPackageJson?.()\n return { graph, diff: undefined }\n }\n\n const diff = await reify({\n ...options,\n remove,\n actual: act,\n graph,\n loadManifests: true,\n remover,\n })\n\n return { graph, diff }\n /* c8 ignore start */\n } catch (err) {\n await remover.rollback().catch(() => {})\n // Remove hidden lockfile on failure\n try {\n const hiddenLockfile = resolve(\n options.projectRoot,\n 'node_modules/.vlt-lock.json',\n )\n if (existsSync(hiddenLockfile)) {\n rmSync(hiddenLockfile, { force: true })\n }\n } catch {}\n throw err\n }\n /* c8 ignore stop */\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIlC,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,WAAW,EAAE,iBAAiB,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,MAAM,YAAmB,aAAa;;;;EAsDlD,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAMlC,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,WAAW,EAAE,iBAAiB,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,MAAM,YAAmB,aAAa;;;;EAgElD,CAAA"}
@@ -7,6 +7,8 @@ import { asError } from '@vltpkg/types';
7
7
  import { Graph } from "./graph.js";
8
8
  import { graphStep } from '@vltpkg/output';
9
9
  import { RollbackRemove } from '@vltpkg/rollback-remove';
10
+ import { existsSync, rmSync } from 'node:fs';
11
+ import { resolve } from 'node:path';
10
12
  export const update = async (options) => {
11
13
  let mainManifest = undefined;
12
14
  try {
@@ -56,6 +58,14 @@ export const update = async (options) => {
56
58
  }
57
59
  catch (err) {
58
60
  await remover.rollback().catch(() => { });
61
+ // Remove hidden lockfile on failure
62
+ try {
63
+ const hiddenLockfile = resolve(options.projectRoot, 'node_modules/.vlt-lock.json');
64
+ if (existsSync(hiddenLockfile)) {
65
+ rmSync(hiddenLockfile, { force: true });
66
+ }
67
+ }
68
+ catch { }
59
69
  throw err;
60
70
  }
61
71
  /* c8 ignore stop */
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAA;AACxF,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;AAIvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAOxD,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAsB,EAAE,EAAE;IACrD,IAAI,YAAY,GAAmC,SAAS,CAAA;IAC5D,IAAI,CAAC;QACH,YAAY,GAAG,OAAO,CAA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AAO;YACV,MAAM,EAAE,GAAG;YACX,KAAK;YACL,aAAa,EAAE,IAAI;YACnB,SAAS;YACT,OAAO;SACR,CAAC,CAAA;QAEF,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;QAClC,qBAAqB;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACxC,MAAM,GAAG,CAAA;IACX,CAAC;IACD,oBAAoB;AACtB,CAAC,CAAA","sourcesContent":["import { load as actualLoad } from './actual/load.ts'\nimport { buildIdealFromStartingGraph } from './ideal/build-ideal-from-starting-graph.ts'\nimport { reify } from './reify/index.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { init } from '@vltpkg/init'\nimport { asError } from '@vltpkg/types'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { Graph } from './graph.ts'\nimport { graphStep } from '@vltpkg/output'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\n\nexport type UpdateOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n allowScripts: string\n}\n\nexport const update = async (options: UpdateOptions) => {\n let mainManifest: NormalizedManifest | undefined = undefined\n try {\n mainManifest = options.packageJson.read(options.projectRoot)\n } catch (err) {\n if (asError(err).message === 'Could not read package.json file') {\n await init({ cwd: options.projectRoot })\n mainManifest = options.packageJson.read(options.projectRoot, {\n reload: true,\n })\n } else {\n throw err\n }\n }\n\n const modifiers = GraphModifier.maybeLoad(options)\n const remover = new RollbackRemove()\n\n try {\n const done = graphStep('build')\n const graph = await buildIdealFromStartingGraph({\n ...options,\n add: Object.assign(new Map(), { modifiedDependencies: false }),\n remove: Object.assign(new Map(), {\n modifiedDependencies: false,\n }),\n graph: new Graph({ ...options, mainManifest }),\n modifiers,\n remover,\n })\n done()\n\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n\n const { buildQueue, diff } = await reify({\n ...options,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n remover,\n })\n\n return { buildQueue, graph, diff }\n /* c8 ignore start */\n } catch (err) {\n await remover.rollback().catch(() => {})\n throw err\n }\n /* c8 ignore stop */\n}\n"]}
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAA;AACxF,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;AAIvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAsB,EAAE,EAAE;IACrD,IAAI,YAAY,GAAmC,SAAS,CAAA;IAC5D,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,OAA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ACb,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACxC,oCAAoC;QACpC,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,OAAO,CAC5B,OAAO,CAAC,WAAW,EACnB,6BAA6B,CAC9B,CAAA;YACD,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;gBAC/B,MAAM,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;YACzC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACV,MAAM,GAAG,CAAA;IACX,CAAC;IACD,oBAAoB;AACtB,CAAC,CAAA","sourcesContent":["import { load as actualLoad } from './actual/load.ts'\nimport { buildIdealFromStartingGraph } from './ideal/build-ideal-from-starting-graph.ts'\nimport { reify } from './reify/index.ts'\nimport { GraphModifier } from './modifiers.ts'\nimport { init } from '@vltpkg/init'\nimport { asError } from '@vltpkg/types'\nimport type { NormalizedManifest } from '@vltpkg/types'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { Graph } from './graph.ts'\nimport { graphStep } from '@vltpkg/output'\nimport { RollbackRemove } from '@vltpkg/rollback-remove'\nimport { existsSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport type UpdateOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n allowScripts: string\n}\n\nexport const update = async (options: UpdateOptions) => {\n let mainManifest: NormalizedManifest | undefined = undefined\n try {\n mainManifest = options.packageJson.read(options.projectRoot)\n } catch (err) {\n if (asError(err).message === 'Could not read package.json file') {\n await init({ cwd: options.projectRoot })\n mainManifest = options.packageJson.read(options.projectRoot, {\n reload: true,\n })\n } else {\n throw err\n }\n }\n\n const modifiers = GraphModifier.maybeLoad(options)\n const remover = new RollbackRemove()\n\n try {\n const done = graphStep('build')\n const graph = await buildIdealFromStartingGraph({\n ...options,\n add: Object.assign(new Map(), { modifiedDependencies: false }),\n remove: Object.assign(new Map(), {\n modifiedDependencies: false,\n }),\n graph: new Graph({ ...options, mainManifest }),\n modifiers,\n remover,\n })\n done()\n\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n\n const { buildQueue, diff } = await reify({\n ...options,\n actual: act,\n graph,\n loadManifests: true,\n modifiers,\n remover,\n })\n\n return { buildQueue, graph, diff }\n /* c8 ignore start */\n } catch (err) {\n await remover.rollback().catch(() => {})\n // Remove hidden lockfile on failure\n try {\n const hiddenLockfile = resolve(\n options.projectRoot,\n 'node_modules/.vlt-lock.json',\n )\n if (existsSync(hiddenLockfile)) {\n rmSync(hiddenLockfile, { force: true })\n }\n } catch {}\n throw err\n }\n /* c8 ignore stop */\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mermaid-output.d.ts","sourceRoot":"","sources":["../../../src/visualization/mermaid-output.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;IACxB,KAAK,EAAE,QAAQ,EAAE,CAAA;CAClB,CAAA;AASD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA0BrD;AA+ED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,SAAS,EACT,KAAK,GACN,EAAE,kBAAkB,UA+CpB"}
1
+ {"version":3,"file":"mermaid-output.d.ts","sourceRoot":"","sources":["../../../src/visualization/mermaid-output.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;IACxB,KAAK,EAAE,QAAQ,EAAE,CAAA;CAClB,CAAA;AASD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA0BrD;AAgID;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,SAAS,EACT,KAAK,GACN,EAAE,kBAAkB,UAwEpB"}