@vltpkg/graph 0.0.0-0.1730239248325 → 0.0.0-10

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 (165) hide show
  1. package/README.md +16 -10
  2. package/dist/esm/actual/load.d.ts +6 -6
  3. package/dist/esm/actual/load.d.ts.map +1 -1
  4. package/dist/esm/actual/load.js +8 -4
  5. package/dist/esm/actual/load.js.map +1 -1
  6. package/dist/esm/browser.d.ts +8 -6
  7. package/dist/esm/browser.d.ts.map +1 -1
  8. package/dist/esm/browser.js +8 -6
  9. package/dist/esm/browser.js.map +1 -1
  10. package/dist/esm/dependencies.d.ts +22 -32
  11. package/dist/esm/dependencies.d.ts.map +1 -1
  12. package/dist/esm/dependencies.js +10 -32
  13. package/dist/esm/dependencies.js.map +1 -1
  14. package/dist/esm/diff.d.ts +4 -4
  15. package/dist/esm/diff.d.ts.map +1 -1
  16. package/dist/esm/diff.js.map +1 -1
  17. package/dist/esm/edge.d.ts +5 -5
  18. package/dist/esm/edge.d.ts.map +1 -1
  19. package/dist/esm/edge.js +1 -1
  20. package/dist/esm/edge.js.map +1 -1
  21. package/dist/esm/graph.d.ts +12 -12
  22. package/dist/esm/graph.d.ts.map +1 -1
  23. package/dist/esm/graph.js +11 -8
  24. package/dist/esm/graph.js.map +1 -1
  25. package/dist/esm/ideal/add-nodes.d.ts +4 -4
  26. package/dist/esm/ideal/add-nodes.d.ts.map +1 -1
  27. package/dist/esm/ideal/add-nodes.js +8 -4
  28. package/dist/esm/ideal/add-nodes.js.map +1 -1
  29. package/dist/esm/ideal/append-nodes.d.ts +8 -8
  30. package/dist/esm/ideal/append-nodes.d.ts.map +1 -1
  31. package/dist/esm/ideal/append-nodes.js +37 -15
  32. package/dist/esm/ideal/append-nodes.js.map +1 -1
  33. package/dist/esm/ideal/build-ideal-from-starting-graph.d.ts +3 -3
  34. package/dist/esm/ideal/build-ideal-from-starting-graph.d.ts.map +1 -1
  35. package/dist/esm/ideal/build-ideal-from-starting-graph.js +28 -5
  36. package/dist/esm/ideal/build-ideal-from-starting-graph.js.map +1 -1
  37. package/dist/esm/ideal/build.d.ts +4 -4
  38. package/dist/esm/ideal/build.d.ts.map +1 -1
  39. package/dist/esm/ideal/build.js +11 -8
  40. package/dist/esm/ideal/build.js.map +1 -1
  41. package/dist/esm/ideal/get-importer-specs.d.ts +2 -2
  42. package/dist/esm/ideal/get-importer-specs.d.ts.map +1 -1
  43. package/dist/esm/ideal/get-importer-specs.js +39 -11
  44. package/dist/esm/ideal/get-importer-specs.js.map +1 -1
  45. package/dist/esm/ideal/remove-nodes.d.ts +1 -1
  46. package/dist/esm/ideal/remove-nodes.d.ts.map +1 -1
  47. package/dist/esm/ideal/remove-nodes.js.map +1 -1
  48. package/dist/esm/ideal/remove-satisfied-specs.d.ts +1 -1
  49. package/dist/esm/ideal/remove-satisfied-specs.d.ts.map +1 -1
  50. package/dist/esm/ideal/remove-satisfied-specs.js.map +1 -1
  51. package/dist/esm/ideal/types.d.ts +3 -3
  52. package/dist/esm/ideal/types.d.ts.map +1 -1
  53. package/dist/esm/ideal/types.js.map +1 -1
  54. package/dist/esm/index.d.ts +25 -22
  55. package/dist/esm/index.d.ts.map +1 -1
  56. package/dist/esm/index.js +20 -17
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/install.d.ts +11 -0
  59. package/dist/esm/install.d.ts.map +1 -0
  60. package/dist/esm/install.js +26 -0
  61. package/dist/esm/install.js.map +1 -0
  62. package/dist/esm/lockfile/load-edges.d.ts +3 -3
  63. package/dist/esm/lockfile/load-edges.d.ts.map +1 -1
  64. package/dist/esm/lockfile/load-edges.js +2 -1
  65. package/dist/esm/lockfile/load-edges.js.map +1 -1
  66. package/dist/esm/lockfile/load-nodes.d.ts +2 -2
  67. package/dist/esm/lockfile/load-nodes.d.ts.map +1 -1
  68. package/dist/esm/lockfile/load-nodes.js +3 -1
  69. package/dist/esm/lockfile/load-nodes.js.map +1 -1
  70. package/dist/esm/lockfile/load.d.ts +4 -4
  71. package/dist/esm/lockfile/load.d.ts.map +1 -1
  72. package/dist/esm/lockfile/load.js +11 -8
  73. package/dist/esm/lockfile/load.js.map +1 -1
  74. package/dist/esm/lockfile/save.d.ts +3 -3
  75. package/dist/esm/lockfile/save.d.ts.map +1 -1
  76. package/dist/esm/lockfile/save.js +1 -1
  77. package/dist/esm/lockfile/save.js.map +1 -1
  78. package/dist/esm/lockfile/types.d.ts +2 -3
  79. package/dist/esm/lockfile/types.d.ts.map +1 -1
  80. package/dist/esm/lockfile/types.js.map +1 -1
  81. package/dist/esm/node.d.ts +19 -15
  82. package/dist/esm/node.d.ts.map +1 -1
  83. package/dist/esm/node.js +26 -17
  84. package/dist/esm/node.js.map +1 -1
  85. package/dist/esm/reify/add-edge.d.ts +4 -4
  86. package/dist/esm/reify/add-edge.d.ts.map +1 -1
  87. package/dist/esm/reify/add-edge.js +22 -11
  88. package/dist/esm/reify/add-edge.js.map +1 -1
  89. package/dist/esm/reify/add-edges.d.ts +2 -2
  90. package/dist/esm/reify/add-edges.d.ts.map +1 -1
  91. package/dist/esm/reify/add-edges.js +2 -2
  92. package/dist/esm/reify/add-edges.js.map +1 -1
  93. package/dist/esm/reify/add-nodes.d.ts +5 -5
  94. package/dist/esm/reify/add-nodes.d.ts.map +1 -1
  95. package/dist/esm/reify/add-nodes.js +10 -7
  96. package/dist/esm/reify/add-nodes.js.map +1 -1
  97. package/dist/esm/reify/bin-paths.d.ts +1 -1
  98. package/dist/esm/reify/bin-paths.d.ts.map +1 -1
  99. package/dist/esm/reify/bin-paths.js.map +1 -1
  100. package/dist/esm/reify/build.d.ts +3 -3
  101. package/dist/esm/reify/build.d.ts.map +1 -1
  102. package/dist/esm/reify/build.js +9 -9
  103. package/dist/esm/reify/build.js.map +1 -1
  104. package/dist/esm/reify/delete-edge.d.ts +3 -3
  105. package/dist/esm/reify/delete-edge.d.ts.map +1 -1
  106. package/dist/esm/reify/delete-edge.js +3 -3
  107. package/dist/esm/reify/delete-edge.js.map +1 -1
  108. package/dist/esm/reify/delete-edges.d.ts +3 -3
  109. package/dist/esm/reify/delete-edges.d.ts.map +1 -1
  110. package/dist/esm/reify/delete-edges.js +1 -1
  111. package/dist/esm/reify/delete-edges.js.map +1 -1
  112. package/dist/esm/reify/delete-nodes.d.ts +3 -3
  113. package/dist/esm/reify/delete-nodes.d.ts.map +1 -1
  114. package/dist/esm/reify/delete-nodes.js +4 -0
  115. package/dist/esm/reify/delete-nodes.js.map +1 -1
  116. package/dist/esm/reify/index.d.ts +6 -5
  117. package/dist/esm/reify/index.d.ts.map +1 -1
  118. package/dist/esm/reify/index.js +25 -19
  119. package/dist/esm/reify/index.js.map +1 -1
  120. package/dist/esm/reify/optional-fail.d.ts +2 -2
  121. package/dist/esm/reify/optional-fail.d.ts.map +1 -1
  122. package/dist/esm/reify/optional-fail.js +1 -1
  123. package/dist/esm/reify/optional-fail.js.map +1 -1
  124. package/dist/esm/reify/rollback.d.ts +2 -2
  125. package/dist/esm/reify/rollback.d.ts.map +1 -1
  126. package/dist/esm/reify/rollback.js +1 -1
  127. package/dist/esm/reify/rollback.js.map +1 -1
  128. package/dist/esm/reify/update-importers-package-json.d.ts +2 -2
  129. package/dist/esm/reify/update-importers-package-json.d.ts.map +1 -1
  130. package/dist/esm/reify/update-importers-package-json.js +25 -6
  131. package/dist/esm/reify/update-importers-package-json.js.map +1 -1
  132. package/dist/esm/remove-optional-subgraph.d.ts +2 -2
  133. package/dist/esm/remove-optional-subgraph.d.ts.map +1 -1
  134. package/dist/esm/remove-optional-subgraph.js.map +1 -1
  135. package/dist/esm/resolve-save-type.d.ts +7 -0
  136. package/dist/esm/resolve-save-type.d.ts.map +1 -0
  137. package/dist/esm/resolve-save-type.js +5 -0
  138. package/dist/esm/resolve-save-type.js.map +1 -0
  139. package/dist/esm/stringify-node.d.ts +1 -1
  140. package/dist/esm/stringify-node.d.ts.map +1 -1
  141. package/dist/esm/stringify-node.js.map +1 -1
  142. package/dist/esm/types.d.ts +13 -10
  143. package/dist/esm/types.d.ts.map +1 -1
  144. package/dist/esm/types.js.map +1 -1
  145. package/dist/esm/uninstall.d.ts +11 -0
  146. package/dist/esm/uninstall.d.ts.map +1 -0
  147. package/dist/esm/uninstall.js +26 -0
  148. package/dist/esm/uninstall.js.map +1 -0
  149. package/dist/esm/visualization/human-readable-output.d.ts +9 -7
  150. package/dist/esm/visualization/human-readable-output.d.ts.map +1 -1
  151. package/dist/esm/visualization/human-readable-output.js +31 -19
  152. package/dist/esm/visualization/human-readable-output.js.map +1 -1
  153. package/dist/esm/visualization/json-output.d.ts +4 -4
  154. package/dist/esm/visualization/json-output.d.ts.map +1 -1
  155. package/dist/esm/visualization/json-output.js +1 -1
  156. package/dist/esm/visualization/json-output.js.map +1 -1
  157. package/dist/esm/visualization/mermaid-output.d.ts +3 -3
  158. package/dist/esm/visualization/mermaid-output.d.ts.map +1 -1
  159. package/dist/esm/visualization/mermaid-output.js +2 -2
  160. package/dist/esm/visualization/mermaid-output.js.map +1 -1
  161. package/dist/esm/visualization/object-like-output.d.ts +1 -1
  162. package/dist/esm/visualization/object-like-output.d.ts.map +1 -1
  163. package/dist/esm/visualization/object-like-output.js +5 -6
  164. package/dist/esm/visualization/object-like-output.js.map +1 -1
  165. package/package.json +33 -28
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/ideal/build.ts"],"names":[],"mappings":"AACA,OAAO,EACL,IAAI,IAAI,UAAU,GAEnB,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAA;AAsBlF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,OAA0B,EACV,EAAE;IAClB,yDAAyD;IACzD,iDAAiD;IACjD,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAC9D,MAAM,YAAY,GAChB,OAAO,CAAC,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAA;IACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,GAAG,EAAE,CAAA;IAE1C,IAAI,KAAK,CAAA;IACT,IAAI,CAAC;QACH,KAAK,GAAG,WAAW,CAAC;YAClB,GAAG,OAAO;YACV,YAAY;YACZ,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,GAAG,UAAU,CAAC;YACjB,GAAG,OAAO;YACV,YAAY;YACZ,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,2BAA2B,CAAC;QACjC,GAAG,OAAO;QACV,MAAM;QACN,GAAG;QACH,KAAK;QACL,WAAW;QACX,MAAM;KACP,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { PackageInfoClient } from '@vltpkg/package-info'\nimport {\n load as loadActual,\n LoadOptions as LoadActualOptions,\n} from '../actual/load.js'\nimport {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n} from '../dependencies.js'\nimport { Graph } from '../graph.js'\nimport { load as loadVirtual } from '../lockfile/load.js'\nimport { buildIdealFromStartingGraph } from './build-ideal-from-starting-graph.js'\n\nexport type BuildIdealOptions = LoadActualOptions & {\n /**\n * A `Map` in which keys are {@link DepID} linking to another `Map` in which\n * keys are the dependency names and values are {@link Dependency}. This\n * structure represents dependencies that need to be added to the importer\n * represented by {@link DepID}.\n */\n add?: AddImportersDependenciesMap\n /**\n * A `Map` object representing nodes to be removed from the ideal graph.\n * Each {@link DepID} key represents an importer node and the `Set` of\n * dependency names to be removed from its dependency list.\n */\n remove?: RemoveImportersDependenciesMap\n /**\n * A {@link PackageInfoClient} instance to read manifest info from.\n */\n packageInfo: PackageInfoClient\n}\n\n/**\n * Builds an ideal {@link Graph} representing the dependencies that\n * should be present in order to fulfill the requirements defined\n * by the `package.json` and `vlt-lock.json` files using either the\n * virtual or actual graph as a starting point. Also add / remove any\n * dependencies listed in the `add` and `remove` properties.\n */\nexport const build = async (\n options: BuildIdealOptions,\n): Promise<Graph> => {\n // Creates the shared instances that are going to be used\n // in both the loader methods and the build graph\n const { packageInfo, packageJson, scurry, monorepo } = options\n const mainManifest =\n options.mainManifest ?? packageJson.read(options.projectRoot)\n const add = options.add ?? new Map()\n const remove = options.remove ?? new Map()\n\n let graph\n try {\n graph = loadVirtual({\n ...options,\n mainManifest,\n monorepo,\n })\n } catch {\n graph = loadActual({\n ...options,\n mainManifest,\n monorepo,\n })\n }\n\n return buildIdealFromStartingGraph({\n ...options,\n scurry,\n add,\n graph,\n packageInfo,\n remove,\n })\n}\n"]}
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/ideal/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAQtD,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,GAAG,CAA0B,CAAK,EAAE,EAAE,CAChD,CAAC,IAAK,IAAI,GAAG,EAAQ,CAAA;AAsBvB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,OAA0B,EACV,EAAE;IAClB,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;IAE/B,yDAAyD;IACzD,iDAAiD;IACjD,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAC9D,MAAM,YAAY,GAChB,OAAO,CAAC,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAC/D,IAAI,KAAK,CAAA;IACT,IAAI,CAAC;QACH,KAAK,GAAG,WAAW,CAAC;YAClB,GAAG,OAAO;YACV,YAAY;YACZ,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,GAAG,UAAU,CAAC;YACjB,GAAG,OAAO;YACV,YAAY;YACZ,QAAQ;SACT,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,2BAA2B,CAAC;QAC5C,GAAG,OAAO;QACV,MAAM;QACN,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;QACxB,KAAK;QACL,WAAW;QACX,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;KAC/B,CAAC,CAAA;IACF,IAAI,EAAE,CAAA;IACN,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA","sourcesContent":["import type { PackageInfoClient } from '@vltpkg/package-info'\nimport { load as loadActual } from '../actual/load.ts'\nimport type { LoadOptions as LoadActualOptions } from '../actual/load.ts'\nimport type {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n Dependency,\n} from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\nimport { load as loadVirtual } from '../lockfile/load.ts'\nimport { buildIdealFromStartingGraph } from './build-ideal-from-starting-graph.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { graphStep } from '@vltpkg/output'\n\nconst getMap = <T extends Map<any, any>>(m?: T) =>\n m ?? (new Map() as T)\n\nexport type BuildIdealOptions = LoadActualOptions & {\n /**\n * A `Map` in which keys are {@link DepID} linking to another `Map` in which\n * keys are the dependency names and values are {@link Dependency}. This\n * structure represents dependencies that need to be added to the importer\n * represented by {@link DepID}.\n */\n add?: AddImportersDependenciesMap\n /**\n * A `Map` object representing nodes to be removed from the ideal graph.\n * Each {@link DepID} key represents an importer node and the `Set` of\n * dependency names to be removed from its dependency list.\n */\n remove?: RemoveImportersDependenciesMap\n /**\n * A {@link PackageInfoClient} instance to read manifest info from.\n */\n packageInfo: PackageInfoClient\n}\n\n/**\n * Builds an ideal {@link Graph} representing the dependencies that\n * should be present in order to fulfill the requirements defined\n * by the `package.json` and `vlt-lock.json` files using either the\n * virtual or actual graph as a starting point. Also add / remove any\n * dependencies listed in the `add` and `remove` properties.\n */\nexport const build = async (\n options: BuildIdealOptions,\n): Promise<Graph> => {\n const done = graphStep('build')\n\n // Creates the shared instances that are going to be used\n // in both the loader methods and the build graph\n const { packageInfo, packageJson, scurry, monorepo } = options\n const mainManifest =\n options.mainManifest ?? packageJson.read(options.projectRoot)\n let graph\n try {\n graph = loadVirtual({\n ...options,\n mainManifest,\n monorepo,\n })\n } catch {\n graph = loadActual({\n ...options,\n mainManifest,\n monorepo,\n })\n }\n\n const res = await buildIdealFromStartingGraph({\n ...options,\n scurry,\n add: getMap(options.add),\n graph,\n packageInfo,\n remove: getMap(options.remove),\n })\n done()\n return res\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { AddImportersDependenciesMap, RemoveImportersDependenciesMap } from '../dependencies.js';
2
- import { BuildIdealAddOptions, BuildIdealFromGraphOptions, BuildIdealRemoveOptions } from './types.js';
1
+ import type { AddImportersDependenciesMap, RemoveImportersDependenciesMap } from '../dependencies.ts';
2
+ import type { BuildIdealAddOptions, BuildIdealFromGraphOptions, BuildIdealRemoveOptions } from './types.ts';
3
3
  export type GetImporterSpecsOptions = BuildIdealAddOptions & BuildIdealFromGraphOptions & BuildIdealRemoveOptions;
4
4
  /**
5
5
  * Given a {@link Graph} and a list of {@link Dependency}, merges the
@@ -1 +1 @@
1
- {"version":3,"file":"get-importer-specs.d.ts","sourceRoot":"","sources":["../../../src/ideal/get-importer-specs.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAE3B,8BAA8B,EAE/B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAInB,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GACxD,0BAA0B,GAC1B,uBAAuB,CAAA;AAWzB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,4BAI1B,uBAAuB;;;CA+DzB,CAAA"}
1
+ {"version":3,"file":"get-importer-specs.d.ts","sourceRoot":"","sources":["../../../src/ideal/get-importer-specs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,2BAA2B,EAE3B,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAOnB,MAAM,MAAM,uBAAuB,GAAG,oBAAoB,GACxD,0BAA0B,GAC1B,uBAAuB,CAAA;AAyBzB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,4BAI1B,uBAAuB;;;CA4FzB,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import { error } from '@vltpkg/error-cause';
2
- import { longDependencyTypes, } from '../dependencies.js';
3
- import { removeSatisfiedSpecs } from './remove-satisfied-specs.js';
2
+ import { longDependencyTypes } from '@vltpkg/types';
3
+ import { shorten, asDependency } from "../dependencies.js";
4
+ import { removeSatisfiedSpecs } from "./remove-satisfied-specs.js";
5
+ import { Spec } from '@vltpkg/spec';
4
6
  const hasDepName = (importer, edge) => {
5
7
  for (const depType of longDependencyTypes) {
6
8
  const listedDeps = importer.manifest?.[depType];
@@ -9,29 +11,47 @@ const hasDepName = (importer, edge) => {
9
11
  }
10
12
  return false;
11
13
  };
14
+ class AddImportersDependenciesMapImpl extends Map {
15
+ modifiedDependencies = false;
16
+ }
17
+ class RemoveImportersDependenciesMapImpl extends Map {
18
+ modifiedDependencies = false;
19
+ }
12
20
  /**
13
21
  * Given a {@link Graph} and a list of {@link Dependency}, merges the
14
22
  * dependencies info found in the graph importers and returns the add & remove
15
23
  * results as a Map in which keys are {@link DepID} of each importer node.
16
24
  */
17
25
  export const getImporterSpecs = ({ add, graph, remove, }) => {
18
- const addResult = new Map();
19
- const removeResult = new Map();
26
+ const addResult = new AddImportersDependenciesMapImpl();
27
+ const removeResult = new RemoveImportersDependenciesMapImpl();
20
28
  // traverse the list of importers in the starting graph
21
29
  for (const importer of graph.importers) {
22
30
  // uses a Map keying to the spec.name in order to easily make sure there's
23
31
  // only a single dependency entry for a given dependency for each importer
24
32
  const addDeps = new Map();
25
33
  const removeDeps = new Set();
34
+ // if an edge from the graph is not listed in the manifest,
35
+ // add that edge to the list of dependencies to be removed
26
36
  for (const edge of importer.edgesOut.values()) {
27
- if (hasDepName(importer, edge)) {
28
- addDeps.set(edge.name, {
29
- spec: edge.spec,
30
- type: edge.type,
31
- });
32
- }
33
- else {
37
+ if (!hasDepName(importer, edge) &&
38
+ !add.get(importer.id)?.has(edge.name)) {
34
39
  removeDeps.add(edge.name);
40
+ removeResult.modifiedDependencies = true;
41
+ }
42
+ }
43
+ // if a dependency is listed in the manifest but not in the graph,
44
+ // add that dependency to the list of dependencies to be added
45
+ for (const depType of longDependencyTypes) {
46
+ const deps = Object.entries(importer.manifest?.[depType] ?? {});
47
+ for (const [depName, depSpec] of deps) {
48
+ const edge = importer.edgesOut.get(depName);
49
+ if (!edge?.to) {
50
+ addDeps.set(depName, asDependency({
51
+ spec: Spec.parse(depName, depSpec),
52
+ type: shorten(depType, depName, importer.manifest),
53
+ }));
54
+ }
35
55
  }
36
56
  }
37
57
  addResult.set(importer.id, addDeps);
@@ -68,6 +88,14 @@ export const getImporterSpecs = ({ add, graph, remove, }) => {
68
88
  add: addResult,
69
89
  graph,
70
90
  });
91
+ // set the modifiedDependencies flag if any
92
+ // of the importers have modified dependencies
93
+ for (const addDeps of addResult.values()) {
94
+ if (addDeps.size > 0) {
95
+ addResult.modifiedDependencies = true;
96
+ break;
97
+ }
98
+ }
71
99
  return {
72
100
  add: addResult,
73
101
  remove: removeResult,
@@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CAAC;QAC7C,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC1B,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,oBAAoB,CAAC;QACnB,GAAG,EAAE,SAAS;QACd,KAAK;KACN,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,EAAE,SAAS;QACd,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n longDependencyTypes,\n} from '../dependencies.js'\nimport { removeSatisfiedSpecs } from './remove-satisfied-specs.js'\nimport {\n BuildIdealAddOptions,\n BuildIdealFromGraphOptions,\n BuildIdealRemoveOptions,\n} from './types.js'\nimport { Edge } from '../edge.js'\nimport { Node } from '../node.js'\n\nexport type GetImporterSpecsOptions = BuildIdealAddOptions &\n BuildIdealFromGraphOptions &\n BuildIdealRemoveOptions\n\nconst hasDepName = (importer: Node, edge: Edge): boolean => {\n for (const depType of longDependencyTypes) {\n const listedDeps = importer.manifest?.[depType]\n if (listedDeps && Object.hasOwn(listedDeps, edge.name))\n return true\n }\n return false\n}\n\n/**\n * Given a {@link Graph} and a list of {@link Dependency}, merges the\n * dependencies info found in the graph importers and returns the add & remove\n * results as a Map in which keys are {@link DepID} of each importer node.\n */\nexport const getImporterSpecs = ({\n add,\n graph,\n remove,\n}: GetImporterSpecsOptions) => {\n const addResult: AddImportersDependenciesMap = new Map()\n const removeResult: RemoveImportersDependenciesMap = new Map()\n\n // traverse the list of importers in the starting graph\n for (const importer of graph.importers) {\n // uses a Map keying to the spec.name in order to easily make sure there's\n // only a single dependency entry for a given dependency for each importer\n const addDeps = new Map<string, Dependency>()\n const removeDeps = new Set<string>()\n for (const edge of importer.edgesOut.values()) {\n if (hasDepName(importer, edge)) {\n addDeps.set(edge.name, {\n spec: edge.spec,\n type: edge.type,\n })\n } else {\n removeDeps.add(edge.name)\n }\n }\n addResult.set(importer.id, addDeps)\n removeResult.set(importer.id, removeDeps)\n }\n\n // merges any provided specs to add to the current found results\n for (const [id, addDeps] of add.entries()) {\n const deps = addResult.get(id)\n if (!deps) {\n throw error('Not an importer', { found: id })\n }\n for (const [name, dep] of addDeps.entries()) {\n deps.set(name, dep)\n }\n }\n\n // Merges results from user-provided `remove` option with any remove\n // results found from comparing the manifest with the loaded graph\n for (const [key, removeSet] of remove) {\n const importerRemoveItem = removeResult.get(key)\n if (importerRemoveItem) {\n for (const depName of removeSet) {\n importerRemoveItem.add(depName)\n }\n }\n }\n\n // Removes any references to an importer that no longer has specs\n for (const [key, removeItem] of removeResult) {\n if (removeItem.size === 0) {\n removeResult.delete(key)\n }\n }\n\n // removes already satisfied dependencies from the dependencies list\n removeSatisfiedSpecs({\n add: addResult,\n graph,\n })\n\n return {\n add: addResult,\n remove: removeResult,\n }\n}\n"]}
1
+ {"version":3,"file":"get-importer-specs.js","sourceRoot":"","sources":["../../../src/ideal/get-importer-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAM1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAUlE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAMnC,MAAM,UAAU,GAAG,CAAC,QAAc,EAAE,IAAU,EAAW,EAAE;IACzD,KAAK,MAAM,OAAO,IAAI,mBAAmB,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAA;QAC/C,IAAI,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC;YACpD,O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AAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAChD,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;gBAChC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACjC,CAAC;QACH,CAAC;IACH,CAAC;IAED,iEAAiE;IACjE,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,YAAY,EAAE,CAAC;QAC7C,IAAI,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC1B,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,oBAAoB,CAAC;QACnB,GAAG,EAAE,SAAS;QACd,KAAK;KACN,CAAC,CAAA;IAEF,2CAA2C;IAC3C,8CAA8C;IAC9C,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC;QACzC,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACrB,SAAS,CAAC,oBAAoB,GAAG,IAAI,CAAA;YACrC,MAAK;QACP,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,EAAE,SAAS;QACd,MAAM,EAAE,YAAY;KACrB,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { longDependencyTypes } from '@vltpkg/types'\nimport { shorten, asDependency } from '../dependencies.ts'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport { removeSatisfiedSpecs } from './remove-satisfied-specs.ts'\nimport type {\n BuildIdealAddOptions,\n BuildIdealFromGraphOptions,\n BuildIdealRemoveOptions,\n} from './types.ts'\nimport type { Edge } from '../edge.ts'\nimport type { Node } from '../node.ts'\nimport type { Graph } from '../graph.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport { Spec } from '@vltpkg/spec'\n\nexport type GetImporterSpecsOptions = BuildIdealAddOptions &\n BuildIdealFromGraphOptions &\n BuildIdealRemoveOptions\n\nconst hasDepName = (importer: Node, edge: Edge): boolean => {\n for (const depType of longDependencyTypes) {\n const listedDeps = importer.manifest?.[depType]\n if (listedDeps && Object.hasOwn(listedDeps, edge.name))\n return true\n }\n return false\n}\n\nclass AddImportersDependenciesMapImpl\n extends Map\n implements AddImportersDependenciesMap\n{\n modifiedDependencies = false\n}\n\nclass RemoveImportersDependenciesMapImpl\n extends Map\n implements RemoveImportersDependenciesMap\n{\n modifiedDependencies = false\n}\n\n/**\n * Given a {@link Graph} and a list of {@link Dependency}, merges the\n * dependencies info found in the graph importers and returns the add & remove\n * results as a Map in which keys are {@link DepID} of each importer node.\n */\nexport const getImporterSpecs = ({\n add,\n graph,\n remove,\n}: GetImporterSpecsOptions) => {\n const addResult: AddImportersDependenciesMap =\n new AddImportersDependenciesMapImpl()\n const removeResult: RemoveImportersDependenciesMap =\n new RemoveImportersDependenciesMapImpl()\n\n // traverse the list of importers in the starting graph\n for (const importer of graph.importers) {\n // uses a Map keying to the spec.name in order to easily make sure there's\n // only a single dependency entry for a given dependency for each importer\n const addDeps = new Map<string, Dependency>()\n const removeDeps = new Set<string>()\n // if an edge from the graph is not listed in the manifest,\n // add that edge to the list of dependencies to be removed\n for (const edge of importer.edgesOut.values()) {\n if (\n !hasDepName(importer, edge) &&\n !add.get(importer.id)?.has(edge.name)\n ) {\n removeDeps.add(edge.name)\n removeResult.modifiedDependencies = true\n }\n }\n // if a dependency is listed in the manifest but not in the graph,\n // add that dependency to the list of dependencies to be added\n for (const depType of longDependencyTypes) {\n const deps = Object.entries(importer.manifest?.[depType] ?? {})\n for (const [depName, depSpec] of deps) {\n const edge = importer.edgesOut.get(depName)\n if (!edge?.to) {\n addDeps.set(\n depName,\n asDependency({\n spec: Spec.parse(depName, depSpec),\n type: shorten(depType, depName, importer.manifest),\n }),\n )\n }\n }\n }\n addResult.set(importer.id, addDeps)\n removeResult.set(importer.id, removeDeps)\n }\n\n // merges any provided specs to add to the current found results\n for (const [id, addDeps] of add.entries()) {\n const deps = addResult.get(id)\n if (!deps) {\n throw error('Not an importer', { found: id })\n }\n for (const [name, dep] of addDeps.entries()) {\n deps.set(name, dep)\n }\n }\n\n // Merges results from user-provided `remove` option with any remove\n // results found from comparing the manifest with the loaded graph\n for (const [key, removeSet] of remove) {\n const importerRemoveItem = removeResult.get(key)\n if (importerRemoveItem) {\n for (const depName of removeSet) {\n importerRemoveItem.add(depName)\n }\n }\n }\n\n // Removes any references to an importer that no longer has specs\n for (const [key, removeItem] of removeResult) {\n if (removeItem.size === 0) {\n removeResult.delete(key)\n }\n }\n\n // removes already satisfied dependencies from the dependencies list\n removeSatisfiedSpecs({\n add: addResult,\n graph,\n })\n\n // set the modifiedDependencies flag if any\n // of the importers have modified dependencies\n for (const addDeps of addResult.values()) {\n if (addDeps.size > 0) {\n addResult.modifiedDependencies = true\n break\n }\n }\n\n return {\n add: addResult,\n remove: removeResult,\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { BuildIdealFromGraphOptions, BuildIdealRemoveOptions } from './types.js';
1
+ import type { BuildIdealFromGraphOptions, BuildIdealRemoveOptions } from './types.ts';
2
2
  export type RemoveNodesOptions = BuildIdealFromGraphOptions & BuildIdealRemoveOptions;
3
3
  /**
4
4
  * Remove nodes from the current `graph`.
@@ -1 +1 @@
1
- {"version":3,"file":"remove-nodes.d.ts","sourceRoot":"","sources":["../../../src/ideal/remove-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAGnB,MAAM,MAAM,kBAAkB,GAAG,0BAA0B,GACzD,uBAAuB,CAAA;AAEzB;;GAEG;AACH,eAAO,MAAM,WAAW,uBAGrB,kBAAkB,SAapB,CAAA"}
1
+ {"version":3,"file":"remove-nodes.d.ts","sourceRoot":"","sources":["../../../src/ideal/remove-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,YAAY,CAAA;AAGnB,MAAM,MAAM,kBAAkB,GAAG,0BAA0B,GACzD,uBAAuB,CAAA;AAEzB;;GAEG;AACH,eAAO,MAAM,WAAW,uBAGrB,kBAAkB,SAapB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"remove-nodes.js","sourceRoot":"","sources":["../../../src/ideal/remove-nodes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAK3C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,MAAM,GACa,EAAE,EAAE;IACvB,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;QAC1D,CAAC;QAED,2DAA2D;QAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;YAC5C,IAAI,IAAI;gBAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAClC,CAAC;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import {\n BuildIdealFromGraphOptions,\n BuildIdealRemoveOptions,\n} from './types.js'\nimport { error } from '@vltpkg/error-cause'\n\nexport type RemoveNodesOptions = BuildIdealFromGraphOptions &\n BuildIdealRemoveOptions\n\n/**\n * Remove nodes from the current `graph`.\n */\nexport const removeNodes = ({\n graph,\n remove,\n}: RemoveNodesOptions) => {\n for (const [depID, names] of remove) {\n const importer = graph.nodes.get(depID)\n if (!importer) {\n throw error('Could not find importer', { found: depID })\n }\n\n // Removes any edges / nodes pointing to the specified name\n for (const name of names) {\n const node = importer.edgesOut.get(name)?.to\n if (node) graph.removeNode(node)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"remove-nodes.js","sourceRoot":"","sources":["../../../src/ideal/remove-nodes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAK3C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,KAAK,EACL,MAAM,GACa,EAAE,EAAE;IACvB,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;QAC1D,CAAC;QAED,2DAA2D;QAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;YAC5C,IAAI,IAAI;gBAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAClC,CAAC;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import type {\n BuildIdealFromGraphOptions,\n BuildIdealRemoveOptions,\n} from './types.ts'\nimport { error } from '@vltpkg/error-cause'\n\nexport type RemoveNodesOptions = BuildIdealFromGraphOptions &\n BuildIdealRemoveOptions\n\n/**\n * Remove nodes from the current `graph`.\n */\nexport const removeNodes = ({\n graph,\n remove,\n}: RemoveNodesOptions) => {\n for (const [depID, names] of remove) {\n const importer = graph.nodes.get(depID)\n if (!importer) {\n throw error('Could not find importer', { found: depID })\n }\n\n // Removes any edges / nodes pointing to the specified name\n for (const name of names) {\n const node = importer.edgesOut.get(name)?.to\n if (node) graph.removeNode(node)\n }\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { BuildIdealAddOptions, BuildIdealFromGraphOptions } from './types.js';
1
+ import type { BuildIdealAddOptions, BuildIdealFromGraphOptions } from './types.ts';
2
2
  export type RemoveSatisfiedSpecsOptions = BuildIdealAddOptions & BuildIdealFromGraphOptions;
3
3
  /**
4
4
  * Traverse the objects defined in `add` and removes any references to specs
@@ -1 +1 @@
1
- {"version":3,"file":"remove-satisfied-specs.d.ts","sourceRoot":"","sources":["../../../src/ideal/remove-satisfied-specs.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAC5D,0BAA0B,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,oBAG9B,2BAA2B,SAqC7B,CAAA"}
1
+ {"version":3,"file":"remove-satisfied-specs.d.ts","sourceRoot":"","sources":["../../../src/ideal/remove-satisfied-specs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAC5D,0BAA0B,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,oBAAoB,oBAG9B,2BAA2B,SAqC7B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"remove-satisfied-specs.js","sourceRoot":"","sources":["../../../src/ideal/remove-satisfied-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAS7C;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,GAAG,EACH,KAAK,GACuB,EAAE,EAAE;IAChC,KAAK,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,8CAA8C,EAAE;gBAC1D,KAAK,EAAE,KAAK;aACb,CAAC,CAAA;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,YAAY,EAAE,CAAC;YAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACxC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,6BAA6B;gBAC7B,SAAQ;YACV,CAAC;YAED,kEAAkE;YAClE,kEAAkE;YAClE,IACE,SAAS,CACP,IAAI,CAAC,EAAE,EAAE,EAAE,EACX,UAAU,CAAC,IAAI,EACf,IAAI,CAAC,IAAI,CAAC,QAAQ,EAClB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,QAAQ,CACf,EACD,CAAC;gBACD,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,iEAAiE;IACjE,KAAK,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QAClD,IAAI,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC5B,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { satisfies } from '@vltpkg/satisfies'\nimport {\n BuildIdealAddOptions,\n BuildIdealFromGraphOptions,\n} from './types.js'\n\nexport type RemoveSatisfiedSpecsOptions = BuildIdealAddOptions &\n BuildIdealFromGraphOptions\n\n/**\n * Traverse the objects defined in `add` and removes any references to specs\n * that are already satisfied by the contents of the actual `graph`.\n */\nexport const removeSatisfiedSpecs = ({\n add,\n graph,\n}: RemoveSatisfiedSpecsOptions) => {\n for (const [depID, dependencies] of add.entries()) {\n const importer = graph.nodes.get(depID)\n if (!importer) {\n throw error('Referred importer node id could not be found', {\n found: depID,\n })\n }\n for (const [name, dependency] of dependencies) {\n const edge = importer.edgesOut.get(name)\n if (!edge) {\n // brand new edge being added\n continue\n }\n\n // If the current graph edge is already valid, then we remove that\n // dependency item from the list of items to be added to the graph\n if (\n satisfies(\n edge.to?.id,\n dependency.spec,\n edge.from.location,\n graph.projectRoot,\n graph.monorepo,\n )\n ) {\n dependencies.delete(name)\n }\n }\n }\n\n // Removes any references to an importer that no longer has specs\n for (const [depID, dependencies] of add.entries()) {\n if (dependencies.size === 0) {\n add.delete(depID)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"remove-satisfied-specs.js","sourceRoot":"","sources":["../../../src/ideal/remove-satisfied-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAS7C;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,GAAG,EACH,KAAK,GACuB,EAAE,EAAE;IAChC,KAAK,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,8CAA8C,EAAE;gBAC1D,KAAK,EAAE,KAAK;aACb,CAAC,CAAA;QACJ,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,YAAY,EAAE,CAAC;YAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACxC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,6BAA6B;gBAC7B,SAAQ;YACV,CAAC;YAED,kEAAkE;YAClE,kEAAkE;YAClE,IACE,SAAS,CACP,IAAI,CAAC,EAAE,EAAE,EAAE,EACX,UAAU,CAAC,IAAI,EACf,IAAI,CAAC,IAAI,CAAC,QAAQ,EAClB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,QAAQ,CACf,EACD,CAAC;gBACD,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED,iEAAiE;IACjE,KAAK,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;QAClD,IAAI,YAAY,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC5B,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { error } from '@vltpkg/error-cause'\nimport { satisfies } from '@vltpkg/satisfies'\nimport type {\n BuildIdealAddOptions,\n BuildIdealFromGraphOptions,\n} from './types.ts'\n\nexport type RemoveSatisfiedSpecsOptions = BuildIdealAddOptions &\n BuildIdealFromGraphOptions\n\n/**\n * Traverse the objects defined in `add` and removes any references to specs\n * that are already satisfied by the contents of the actual `graph`.\n */\nexport const removeSatisfiedSpecs = ({\n add,\n graph,\n}: RemoveSatisfiedSpecsOptions) => {\n for (const [depID, dependencies] of add.entries()) {\n const importer = graph.nodes.get(depID)\n if (!importer) {\n throw error('Referred importer node id could not be found', {\n found: depID,\n })\n }\n for (const [name, dependency] of dependencies) {\n const edge = importer.edgesOut.get(name)\n if (!edge) {\n // brand new edge being added\n continue\n }\n\n // If the current graph edge is already valid, then we remove that\n // dependency item from the list of items to be added to the graph\n if (\n satisfies(\n edge.to?.id,\n dependency.spec,\n edge.from.location,\n graph.projectRoot,\n graph.monorepo,\n )\n ) {\n dependencies.delete(name)\n }\n }\n }\n\n // Removes any references to an importer that no longer has specs\n for (const [depID, dependencies] of add.entries()) {\n if (dependencies.size === 0) {\n add.delete(depID)\n }\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { AddImportersDependenciesMap, RemoveImportersDependenciesMap } from '../dependencies.js';
2
- import { Graph } from '../graph.js';
3
- import { PackageInfoClient } from '@vltpkg/package-info';
1
+ import type { PackageInfoClient } from '@vltpkg/package-info';
2
+ import type { AddImportersDependenciesMap, RemoveImportersDependenciesMap } from '../dependencies.ts';
3
+ import type { Graph } from '../graph.ts';
4
4
  export type BuildIdealAddOptions = {
5
5
  /**
6
6
  * A {@link AddImportersDependenciesMap} in which keys are {@link DepID}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ideal/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,GAAG,EAAE,2BAA2B,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;OAKG;IACH,MAAM,EAAE,8BAA8B,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ideal/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EACV,2BAA2B,EAE3B,8BAA8B,EAC/B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,GAAG,EAAE,2BAA2B,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;OAKG;IACH,MAAM,EAAE,8BAA8B,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ideal/types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n AddImportersDependenciesMap,\n RemoveImportersDependenciesMap,\n} from '../dependencies.js'\nimport { Graph } from '../graph.js'\nimport { PackageInfoClient } from '@vltpkg/package-info'\n\nexport type BuildIdealAddOptions = {\n /**\n * A {@link AddImportersDependenciesMap} in which keys are {@link DepID}\n * linking to another `Map` in which keys are the dependency names and values\n * are {@link Dependency}. This structure represents dependencies that need\n * to be added to the importer represented by {@link DepID}.\n */\n add: AddImportersDependenciesMap\n}\n\nexport type BuildIdealRemoveOptions = {\n /**\n * A {@link RemoveImportersDependenciesMap} object representing nodes to be\n * removed from the ideal graph. Each {@link DepID} key represents an\n * importer node and the `Set` of dependency names to be removed from its\n * dependency list.\n */\n remove: RemoveImportersDependenciesMap\n}\n\nexport type BuildIdealFromGraphOptions = {\n /**\n * An initial {@link Graph} to start building from, adding nodes to any\n * missing edges and appending any new specs defined in `addSpecs`.\n */\n graph: Graph\n}\n\nexport type BuildIdealPackageInfoOptions = {\n /**\n * A {@link PackageInfoClient} instance to read manifest info from.\n */\n packageInfo: PackageInfoClient\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ideal/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DepID } from '@vltpkg/dep-id'\nimport type { PackageInfoClient } from '@vltpkg/package-info'\nimport type {\n AddImportersDependenciesMap,\n Dependency,\n RemoveImportersDependenciesMap,\n} from '../dependencies.ts'\nimport type { Graph } from '../graph.ts'\n\nexport type BuildIdealAddOptions = {\n /**\n * A {@link AddImportersDependenciesMap} in which keys are {@link DepID}\n * linking to another `Map` in which keys are the dependency names and values\n * are {@link Dependency}. This structure represents dependencies that need\n * to be added to the importer represented by {@link DepID}.\n */\n add: AddImportersDependenciesMap\n}\n\nexport type BuildIdealRemoveOptions = {\n /**\n * A {@link RemoveImportersDependenciesMap} object representing nodes to be\n * removed from the ideal graph. Each {@link DepID} key represents an\n * importer node and the `Set` of dependency names to be removed from its\n * dependency list.\n */\n remove: RemoveImportersDependenciesMap\n}\n\nexport type BuildIdealFromGraphOptions = {\n /**\n * An initial {@link Graph} to start building from, adding nodes to any\n * missing edges and appending any new specs defined in `addSpecs`.\n */\n graph: Graph\n}\n\nexport type BuildIdealPackageInfoOptions = {\n /**\n * A {@link PackageInfoClient} instance to read manifest info from.\n */\n packageInfo: PackageInfoClient\n}\n"]}
@@ -1,31 +1,34 @@
1
- export * from './edge.js';
2
- export * from './graph.js';
3
- export * from './node.js';
4
- export * from './dependencies.js';
5
- export * from './lockfile/types.js';
6
- export * from './visualization/json-output.js';
7
- export * from './visualization/human-readable-output.js';
8
- export * from './visualization/mermaid-output.js';
9
- export * from './stringify-node.js';
10
- export * from './types.js';
1
+ export * from './edge.ts';
2
+ export * from './graph.ts';
3
+ export * from './node.ts';
4
+ export * from './dependencies.ts';
5
+ export * from './lockfile/types.ts';
6
+ export * from './visualization/json-output.ts';
7
+ export * from './visualization/human-readable-output.ts';
8
+ export * from './visualization/mermaid-output.ts';
9
+ export * from './stringify-node.ts';
10
+ export * from './types.ts';
11
+ export * from './install.ts';
12
+ export * from './uninstall.ts';
13
+ export * from './diff.ts';
14
+ import type { LoadOptions as ActualLoadOptions } from './actual/load.ts';
11
15
  export declare const actual: {
12
- load: (options: ActualLoadOptions) => import("./graph.js").Graph;
16
+ load: (options: ActualLoadOptions) => import("./graph.ts").Graph;
13
17
  };
18
+ import type { LoadOptions as LockfileLoadOptions } from './lockfile/load.ts';
14
19
  export declare const lockfile: {
15
- load: (options: LockfileLoadOptions) => import("./graph.js").Graph;
16
- loadEdges: (graph: import("./types.js").GraphLike, edges: import("./lockfile/types.js").LockfileData["edges"], options: import("@vltpkg/spec").SpecOptions) => void;
17
- loadNodes: (graph: import("./types.js").GraphLike, nodes: import("./lockfile/types.js").LockfileData["nodes"]) => void;
18
- save: (options: import("./lockfile/save.js").SaveOptions) => void;
20
+ load: (options: LockfileLoadOptions) => import("./graph.ts").Graph;
21
+ loadEdges: (graph: import("./types.ts").GraphLike, edges: import("./lockfile/types.ts").LockfileData["edges"], options: import("@vltpkg/spec").SpecOptions) => void;
22
+ loadNodes: (graph: import("./types.ts").GraphLike, nodes: import("./lockfile/types.ts").LockfileData["nodes"]) => void;
23
+ save: (options: import("./lockfile/save.ts").SaveOptions) => void;
19
24
  };
20
- import type { LoadOptions as ActualLoadOptions } from './actual/load.js';
21
- import type { LoadOptions as LockfileLoadOptions } from './lockfile/load.js';
22
25
  export type { ActualLoadOptions, LockfileLoadOptions };
23
- export type { SaveOptions } from './lockfile/save.js';
24
- import { BuildIdealOptions } from './ideal/build.js';
26
+ export type { SaveOptions } from './lockfile/save.ts';
27
+ import type { BuildIdealOptions } from './ideal/build.ts';
25
28
  export type { BuildIdealOptions };
26
29
  export declare const ideal: {
27
- build: (options: BuildIdealOptions) => Promise<import("./graph.js").Graph>;
30
+ build: (options: BuildIdealOptions) => Promise<import("./graph.ts").Graph>;
28
31
  };
29
- export { reify } from './reify/index.js';
30
- export type { ReifyOptions } from './reify/index.js';
32
+ export { reify } from './reify/index.ts';
33
+ export type { ReifyOptions } from './reify/index.ts';
31
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AACxD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAG1B,eAAO,MAAM,MAAM;;CAAuB,CAAA;AAM1C,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAA;AAED,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC5E,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EAAE,iBAAiB,EAAS,MAAM,kBAAkB,CAAA;AAC3D,YAAY,EAAE,iBAAiB,EAAE,CAAA;AACjC,eAAO,MAAM,KAAK;;CAAY,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AACxD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AAGzB,OAAO,KAAK,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,eAAO,MAAM,MAAM;;CAAuB,CAAA;AAG1C,OAAO,KAAK,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAI5E,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAA;AAED,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,YAAY,EAAE,iBAAiB,EAAE,CAAA;AACjC,eAAO,MAAM,KAAK;;CAAY,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/esm/index.js CHANGED
@@ -1,26 +1,29 @@
1
- export * from './edge.js';
2
- export * from './graph.js';
3
- export * from './node.js';
4
- export * from './dependencies.js';
5
- export * from './lockfile/types.js';
6
- export * from './visualization/json-output.js';
7
- export * from './visualization/human-readable-output.js';
8
- export * from './visualization/mermaid-output.js';
9
- export * from './stringify-node.js';
10
- export * from './types.js';
11
- import { load as actualLoad } from './actual/load.js';
1
+ export * from "./edge.js";
2
+ export * from "./graph.js";
3
+ export * from "./node.js";
4
+ export * from "./dependencies.js";
5
+ export * from "./lockfile/types.js";
6
+ export * from "./visualization/json-output.js";
7
+ export * from "./visualization/human-readable-output.js";
8
+ export * from "./visualization/mermaid-output.js";
9
+ export * from "./stringify-node.js";
10
+ export * from "./types.js";
11
+ export * from "./install.js";
12
+ export * from "./uninstall.js";
13
+ export * from "./diff.js";
14
+ import { load as actualLoad } from "./actual/load.js";
12
15
  export const actual = { load: actualLoad };
13
- import { load as lockfileLoad } from './lockfile/load.js';
14
- import { loadEdges } from './lockfile/load-edges.js';
15
- import { loadNodes } from './lockfile/load-nodes.js';
16
- import { save } from './lockfile/save.js';
16
+ import { load as lockfileLoad } from "./lockfile/load.js";
17
+ import { loadEdges } from "./lockfile/load-edges.js";
18
+ import { loadNodes } from "./lockfile/load-nodes.js";
19
+ import { save } from "./lockfile/save.js";
17
20
  export const lockfile = {
18
21
  load: lockfileLoad,
19
22
  loadEdges,
20
23
  loadNodes,
21
24
  save,
22
25
  };
23
- import { build } from './ideal/build.js';
26
+ import { build } from "./ideal/build.js";
24
27
  export const ideal = { build };
25
- export { reify } from './reify/index.js';
28
+ export { reify } from "./reify/index.js";
26
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AACxD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;AAE1C,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,YAAY;IAClB,SAAS;IACT,SAAS;IACT,IAAI;CACL,CAAA;AAOD,OAAO,EAAqB,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAE3D,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["export * from './edge.js'\nexport * from './graph.js'\nexport * from './node.js'\nexport * from './dependencies.js'\nexport * from './lockfile/types.js'\nexport * from './visualization/json-output.js'\nexport * from './visualization/human-readable-output.js'\nexport * from './visualization/mermaid-output.js'\nexport * from './stringify-node.js'\nexport * from './types.js'\n\nimport { load as actualLoad } from './actual/load.js'\nexport const actual = { load: actualLoad }\n\nimport { load as lockfileLoad } from './lockfile/load.js'\nimport { loadEdges } from './lockfile/load-edges.js'\nimport { loadNodes } from './lockfile/load-nodes.js'\nimport { save } from './lockfile/save.js'\nexport const lockfile = {\n load: lockfileLoad,\n loadEdges,\n loadNodes,\n save,\n}\n\nimport type { LoadOptions as ActualLoadOptions } from './actual/load.js'\nimport type { LoadOptions as LockfileLoadOptions } from './lockfile/load.js'\nexport type { ActualLoadOptions, LockfileLoadOptions }\nexport type { SaveOptions } from './lockfile/save.js'\n\nimport { BuildIdealOptions, build } from './ideal/build.js'\nexport type { BuildIdealOptions }\nexport const ideal = { build }\nexport { reify } from './reify/index.js'\nexport type { ReifyOptions } from './reify/index.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0CAA0C,CAAA;AACxD,cAAc,mCAAmC,CAAA;AACjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;AAE1C,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,YAAY;IAClB,SAAS;IACT,SAAS;IACT,IAAI;CACL,CAAA;AAKD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAGxC,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["export * from './edge.ts'\nexport * from './graph.ts'\nexport * from './node.ts'\nexport * from './dependencies.ts'\nexport * from './lockfile/types.ts'\nexport * from './visualization/json-output.ts'\nexport * from './visualization/human-readable-output.ts'\nexport * from './visualization/mermaid-output.ts'\nexport * from './stringify-node.ts'\nexport * from './types.ts'\nexport * from './install.ts'\nexport * from './uninstall.ts'\nexport * from './diff.ts'\n\nimport { load as actualLoad } from './actual/load.ts'\nimport type { LoadOptions as ActualLoadOptions } from './actual/load.ts'\nexport const actual = { load: actualLoad }\n\nimport { load as lockfileLoad } from './lockfile/load.ts'\nimport type { LoadOptions as LockfileLoadOptions } from './lockfile/load.ts'\nimport { loadEdges } from './lockfile/load-edges.ts'\nimport { loadNodes } from './lockfile/load-nodes.ts'\nimport { save } from './lockfile/save.ts'\nexport const lockfile = {\n load: lockfileLoad,\n loadEdges,\n loadNodes,\n save,\n}\n\nexport type { ActualLoadOptions, LockfileLoadOptions }\nexport type { SaveOptions } from './lockfile/save.ts'\n\nimport { build } from './ideal/build.ts'\nimport type { BuildIdealOptions } from './ideal/build.ts'\nexport type { BuildIdealOptions }\nexport const ideal = { build }\nexport { reify } from './reify/index.ts'\nexport type { ReifyOptions } from './reify/index.ts'\n"]}
@@ -0,0 +1,11 @@
1
+ import type { PackageInfoClient } from '@vltpkg/package-info';
2
+ import type { LoadOptions } from './actual/load.ts';
3
+ import type { AddImportersDependenciesMap } from './dependencies.ts';
4
+ export type InstallOptions = LoadOptions & {
5
+ packageInfo: PackageInfoClient;
6
+ };
7
+ export declare const install: (options: InstallOptions, add?: AddImportersDependenciesMap) => Promise<{
8
+ graph: import("./graph.ts").Graph;
9
+ diff: import("./diff.ts").Diff;
10
+ }>;
11
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAIpE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,WAAW,EAAE,iBAAiB,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,OAAO,YACT,cAAc,QACjB,2BAA2B;;;EAwBlC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { load as actualLoad } from "./actual/load.js";
2
+ import { build as idealBuild } from "./ideal/build.js";
3
+ import { reify } from "./reify/index.js";
4
+ export const install = async (options, add) => {
5
+ const mainManifest = options.packageJson.read(options.projectRoot);
6
+ const graph = await idealBuild({
7
+ ...options,
8
+ add,
9
+ mainManifest,
10
+ loadManifests: true,
11
+ });
12
+ const act = actualLoad({
13
+ ...options,
14
+ mainManifest,
15
+ loadManifests: true,
16
+ });
17
+ const diff = await reify({
18
+ ...options,
19
+ add,
20
+ actual: act,
21
+ graph,
22
+ loadManifests: true,
23
+ });
24
+ return { graph, diff };
25
+ };
26
+ //# sourceMappingURL=install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAMxC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAC1B,OAAuB,EACvB,GAAiC,EACjC,EAAE;IACF,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAElE,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC;QAC7B,GAAG,OAAO;QACV,GAAG;QACH,YAAY;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,UAAU,CAAC;QACrB,GAAG,OAAO;QACV,YAAY;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC;QACvB,GAAG,OAAO;QACV,GAAG;QACH,MAAM,EAAE,GAAG;QACX,KAAK;QACL,aAAa,EAAE,IAAI;KACpB,CAAC,CAAA;IAEF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACxB,CAAC,CAAA","sourcesContent":["import type { PackageInfoClient } from '@vltpkg/package-info'\nimport type { LoadOptions } from './actual/load.ts'\nimport { load as actualLoad } from './actual/load.ts'\nimport type { AddImportersDependenciesMap } from './dependencies.ts'\nimport { build as idealBuild } from './ideal/build.ts'\nimport { reify } from './reify/index.ts'\n\nexport type InstallOptions = LoadOptions & {\n packageInfo: PackageInfoClient\n}\n\nexport const install = async (\n options: InstallOptions,\n add?: AddImportersDependenciesMap,\n) => {\n const mainManifest = options.packageJson.read(options.projectRoot)\n\n const graph = await idealBuild({\n ...options,\n add,\n mainManifest,\n loadManifests: true,\n })\n const act = actualLoad({\n ...options,\n mainManifest,\n loadManifests: true,\n })\n const diff = await reify({\n ...options,\n add,\n actual: act,\n graph,\n loadManifests: true,\n })\n\n return { graph, diff }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { type SpecOptions } from '@vltpkg/spec/browser';
2
- import type { GraphLike } from '../types.js';
3
- import { LockfileData } from './types.js';
1
+ import type { SpecOptions } from '@vltpkg/spec/browser';
2
+ import type { GraphLike } from '../types.ts';
3
+ import type { LockfileData } from './types.ts';
4
4
  export declare const loadEdges: (graph: GraphLike, edges: LockfileData["edges"], options: SpecOptions) => void;
5
5
  //# sourceMappingURL=load-edges.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-edges.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-edges.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAK7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,YAAY,EAGb,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,WACnB,WAAW,SA0CrB,CAAA"}
1
+ {"version":3,"file":"load-edges.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-edges.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,WACnB,WAAW,SA0CrB,CAAA"}
@@ -2,7 +2,8 @@ import { asDepID } from '@vltpkg/dep-id/browser';
2
2
  import { error } from '@vltpkg/error-cause';
3
3
  import { fastSplit } from '@vltpkg/fast-split';
4
4
  import { Spec } from '@vltpkg/spec/browser';
5
- import { isDependencyTypeShort, longDependencyTypes, } from '../dependencies.js';
5
+ import { longDependencyTypes } from '@vltpkg/types';
6
+ import { isDependencyTypeShort } from "../dependencies.js";
6
7
  export const loadEdges = (graph, edges, options) => {
7
8
  const entries = Object.entries(edges);
8
9
  for (const [key, value] of entries) {
@@ -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,EAAoB,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oBAAoB,CAAA;AAQ3B,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAgB,EAChB,KAA4B,EAC5B,OAAoB,EACpB,EAAE;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAGjC,CAAA;IACH,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QACjD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;QACnD,MAAM,OAAO,GAAG,O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AAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IACxC,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, type SpecOptions } from '@vltpkg/spec/browser'\nimport {\n isDependencyTypeShort,\n longDependencyTypes,\n} from '../dependencies.js'\nimport type { GraphLike } from '../types.js'\nimport {\n LockfileData,\n LockfileEdgeKey,\n LockfileEdgeValue,\n} from './types.js'\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 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 // 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 const spec = Spec.parse(\n specName,\n valRest.substring(0, vrSplit),\n options,\n )\n const toId = valRest.substring(vrSplit + 1)\n const from = graph.nodes.get(asDepID(fromId))\n if (!from) {\n throw error('Edge info missing its `from` node', {\n found: {\n nodes: [...graph.nodes].map(([id]) => id),\n from,\n fromId,\n edge: { [key]: value },\n },\n })\n }\n const to =\n toId === 'MISSING' ? undefined : graph.nodes.get(asDepID(toId))\n if (!isDependencyTypeShort(depType)) {\n throw error('Found unsupported dependency type in lockfile', {\n validOptions: [...longDependencyTypes],\n })\n }\n graph.addEdge(depType, spec, from, to)\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,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CAAA;QAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,KAAK,CAAC,mCAAmC,EAAE;gBAC/C,KAAK,EAAE;oBACL,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;oBACzC,IAAI;oBACJ,MAAM;oBACN,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE;iBACvB;aACF,CAAC,CAAA;QACJ,CAAC;QACD,MAAM,EAAE,GACN,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QACjE,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC,+CAA+C,EAAE;gBAC3D,YAAY,EAAE,CAAC,GAAG,mBAAmB,CAAC;aACvC,CAAC,CAAA;QACJ,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IACxC,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 { isDependencyTypeShort } from '../dependencies.ts'\nimport type { GraphLike } from '../types.ts'\nimport type {\n LockfileData,\n LockfileEdgeKey,\n LockfileEdgeValue,\n} from './types.ts'\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 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 // 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 const spec = Spec.parse(\n specName,\n valRest.substring(0, vrSplit),\n options,\n )\n const toId = valRest.substring(vrSplit + 1)\n const from = graph.nodes.get(asDepID(fromId))\n if (!from) {\n throw error('Edge info missing its `from` node', {\n found: {\n nodes: [...graph.nodes].map(([id]) => id),\n from,\n fromId,\n edge: { [key]: value },\n },\n })\n }\n const to =\n toId === 'MISSING' ? undefined : graph.nodes.get(asDepID(toId))\n if (!isDependencyTypeShort(depType)) {\n throw error('Found unsupported dependency type in lockfile', {\n validOptions: [...longDependencyTypes],\n })\n }\n graph.addEdge(depType, spec, from, to)\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { type LockfileData } from './types.js';
2
- import type { GraphLike } from '../types.js';
1
+ import type { LockfileData } from './types.ts';
2
+ import type { GraphLike } from '../types.ts';
3
3
  export declare const loadNodes: (graph: GraphLike, nodes: LockfileData["nodes"]) => void;
4
4
  //# sourceMappingURL=load-nodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-nodes.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-nodes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,SAkC7B,CAAA"}
1
+ {"version":3,"file":"load-nodes.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load-nodes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,eAAO,MAAM,SAAS,UACb,SAAS,SACT,YAAY,CAAC,OAAO,CAAC,SAmC7B,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { splitDepID } from '@vltpkg/dep-id/browser';
2
- import { getBooleanFlagsFromNum, } from './types.js';
2
+ import { getBooleanFlagsFromNum } from "./types.js";
3
3
  export const loadNodes = (graph, nodes) => {
4
4
  const entries = Object.entries(nodes);
5
5
  for (const [id, lockfileNode] of entries) {
@@ -21,6 +21,8 @@ export const loadNodes = (graph, nodes) => {
21
21
  node.optional = optional;
22
22
  node.integrity = integrity ?? undefined;
23
23
  node.resolved = resolved ?? undefined;
24
+ if (!node.resolved)
25
+ node.setResolved();
24
26
  if (location)
25
27
  node.location = location;
26
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"load-nodes.js","sourceRoot":"","sources":["../../../src/lockfile/load-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAEL,sBAAsB,GAEvB,MAAM,YAAY,CAAA;AAInB,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAgB,EAChB,KAA4B,EAC5B,EAAE;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAA4B,CAAA;IAChE,KAAK,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,IAAI,OAAO,EAAE,CAAC;QACzC,oEAAoE;QACpE,uEAAuE;QACvE,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,SAAQ;QAEjC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAC1D,YAAY,CAAA;QACd,MAAM,CAAC,IAAI,EAAE,AAAD,EAAG,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;QAErC,iEAAiE;QACjE,uEAAuE;QACvE,MAAM,IAAI,GACR,QAAQ,CAAC,CAAC;YACR,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC;YAC7B,CAAC,CAAC,KAAK,CAAC,OAAO,CACX,EAAE,EACF,SAAS,EACT,SAAS,EACT,IAAI,IAAI,SAAS,EACjB,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9B,CAAC,CAAC,SAAS,CACZ,CAAA;QAEL,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;QACvD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,SAAS,CAAA;QACvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,SAAS,CAAA;QACrC,IAAI,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACxC,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { splitDepID } from '@vltpkg/dep-id/browser'\nimport {\n type LockfileData,\n getBooleanFlagsFromNum,\n type LockfileNode,\n} from './types.js'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { GraphLike } from '../types.js'\n\nexport const loadNodes = (\n graph: GraphLike,\n nodes: LockfileData['nodes'],\n) => {\n const entries = Object.entries(nodes) as [DepID, LockfileNode][]\n for (const [id, lockfileNode] of entries) {\n // workspace nodes and the project root node are already part of the\n // graph and it should not create new nodes if an existing one is there\n if (graph.nodes.has(id)) continue\n\n const [flags, name, integrity, resolved, location, manifest] =\n lockfileNode\n const [type, , spec] = splitDepID(id)\n\n // if the lockfile has manifest data then it should just use that\n // otherwise tries to infer name / version value from the lockfile node\n const node =\n manifest ?\n graph.addNode(id, manifest)\n : graph.addNode(\n id,\n undefined,\n undefined,\n name ?? undefined,\n type === 'registry' && spec.indexOf('@') > 0 ?\n spec.split('@').slice(-1)[0]\n : undefined,\n )\n\n const { dev, optional } = getBooleanFlagsFromNum(flags)\n node.dev = dev\n node.optional = optional\n node.integrity = integrity ?? undefined\n node.resolved = resolved ?? undefined\n if (location) node.location = location\n }\n}\n"]}
1
+ {"version":3,"file":"load-nodes.js","sourceRoot":"","sources":["../../../src/lockfile/load-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAKnD,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAgB,EAChB,KAA4B,EAC5B,EAAE;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAA4B,CAAA;IAChE,KAAK,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,IAAI,OAAO,EAAE,CAAC;QACzC,oEAAoE;QACpE,uEAAuE;QACvE,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,SAAQ;QAEjC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAC1D,YAAY,CAAA;QACd,MAAM,CAAC,IAAI,EAAE,AAAD,EAAG,IAAI,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;QAErC,iEAAiE;QACjE,uEAAuE;QACvE,MAAM,IAAI,GACR,QAAQ,CAAC,CAAC;YACR,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC;YAC7B,CAAC,CAAC,KAAK,CAAC,OAAO,CACX,EAAE,EACF,SAAS,EACT,SAAS,EACT,IAAI,IAAI,SAAS,EACjB,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC9B,CAAC,CAAC,SAAS,CACZ,CAAA;QAEL,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;QACvD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,SAAS,CAAA;QACvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,SAAS,CAAA;QACrC,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,WAAW,EAAE,CAAA;QACtC,IAAI,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACxC,CAAC;AACH,CAAC,CAAA","sourcesContent":["import { splitDepID } from '@vltpkg/dep-id/browser'\nimport { getBooleanFlagsFromNum } from './types.ts'\nimport type { LockfileData, LockfileNode } from './types.ts'\nimport type { DepID } from '@vltpkg/dep-id'\nimport type { GraphLike } from '../types.ts'\n\nexport const loadNodes = (\n graph: GraphLike,\n nodes: LockfileData['nodes'],\n) => {\n const entries = Object.entries(nodes) as [DepID, LockfileNode][]\n for (const [id, lockfileNode] of entries) {\n // workspace nodes and the project root node are already part of the\n // graph and it should not create new nodes if an existing one is there\n if (graph.nodes.has(id)) continue\n\n const [flags, name, integrity, resolved, location, manifest] =\n lockfileNode\n const [type, , spec] = splitDepID(id)\n\n // if the lockfile has manifest data then it should just use that\n // otherwise tries to infer name / version value from the lockfile node\n const node =\n manifest ?\n graph.addNode(id, manifest)\n : graph.addNode(\n id,\n undefined,\n undefined,\n name ?? undefined,\n type === 'registry' && spec.indexOf('@') > 0 ?\n spec.split('@').slice(-1)[0]\n : undefined,\n )\n\n const { dev, optional } = getBooleanFlagsFromNum(flags)\n node.dev = dev\n node.optional = optional\n node.integrity = integrity ?? undefined\n node.resolved = resolved ?? undefined\n if (!node.resolved) node.setResolved()\n if (location) node.location = location\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import { PackageJson } from '@vltpkg/package-json';
2
- import { Manifest } from '@vltpkg/types';
2
+ import type { Manifest } from '@vltpkg/types';
3
3
  import { Monorepo } from '@vltpkg/workspaces';
4
4
  import type { SpecOptions } from '@vltpkg/spec';
5
- import { PathScurry } from 'path-scurry';
6
- import { Graph } from '../graph.js';
7
- import type { LockfileData } from './types.js';
5
+ import type { PathScurry } from 'path-scurry';
6
+ import { Graph } from '../graph.ts';
7
+ import type { LockfileData } from './types.ts';
8
8
  export type LoadOptions = SpecOptions & {
9
9
  /**
10
10
  * The project root dirname.
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,YAAY,EAAE,QAAQ,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,WAAW,KAAG,KAU3C,CAAA;AAED,eAAO,MAAM,UAAU,YAAa,WAAW,KAAG,KAWjD,CAAA;AAED,eAAO,MAAM,UAAU,YACZ,WAAW,gBACN,YAAY,UA4C3B,CAAA"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/lockfile/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAG/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,YAAY,EAAE,QAAQ,CAAA;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAA;CACpB,CAAA;AASD,eAAO,MAAM,IAAI,YAAa,WAAW,KAAG,KAM3C,CAAA;AAED,eAAO,MAAM,UAAU,YAAa,WAAW,KAAG,KAMjD,CAAA;AAED,eAAO,MAAM,UAAU,YACZ,WAAW,gBACN,YAAY,UA6C3B,CAAA"}
@@ -2,25 +2,28 @@ import { PackageJson } from '@vltpkg/package-json';
2
2
  import { Monorepo } from '@vltpkg/workspaces';
3
3
  import { readFileSync } from 'node:fs';
4
4
  import { resolve } from 'node:path';
5
- import { loadEdges } from './load-edges.js';
6
- import { loadNodes } from './load-nodes.js';
7
- import { Graph } from '../graph.js';
5
+ import { loadEdges } from "./load-edges.js";
6
+ import { loadNodes } from "./load-nodes.js";
7
+ import { Graph } from "../graph.js";
8
+ const loadLockfile = (projectRoot, lockfilePath) => JSON.parse(readFileSync(resolve(projectRoot, lockfilePath), {
9
+ encoding: 'utf8',
10
+ }));
8
11
  export const load = (options) => {
9
12
  const { projectRoot } = options;
10
- return loadObject(options, JSON.parse(readFileSync(resolve(projectRoot, 'vlt-lock.json'), {
11
- encoding: 'utf8',
12
- })));
13
+ return loadObject(options, loadLockfile(projectRoot, 'vlt-lock.json'));
13
14
  };
14
15
  export const loadHidden = (options) => {
15
16
  const { projectRoot } = options;
16
- return loadObject(options, JSON.parse(readFileSync(resolve(projectRoot, 'node_modules/.vlt-lock.json'), { encoding: 'utf8' })));
17
+ return loadObject(options, loadLockfile(projectRoot, 'node_modules/.vlt-lock.json'));
17
18
  };
18
19
  export const loadObject = (options, lockfileData) => {
19
20
  const { mainManifest, scurry } = options;
20
21
  const packageJson = options.packageJson ?? new PackageJson();
21
22
  const monorepo = options.monorepo ??
22
23
  Monorepo.maybeLoad(options.projectRoot, { packageJson, scurry });
23
- const { 'scope-registries': scopeRegistries, registry, registries, 'git-hosts': gitHosts, 'git-host-archives': gitHostArchives, } = lockfileData.options;
24
+ const { 'scope-registries': scopeRegistries, registry, registries, 'git-hosts': gitHosts, 'git-host-archives': gitHostArchives,
25
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
26
+ } = lockfileData.options || {};
24
27
  const mergedOptions = {
25
28
  ...options,
26
29
  'scope-registries': {