nx 22.1.0-canary.20251110-73ecb30 → 22.1.0-canary.20251111-647d751

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 (48) hide show
  1. package/executors.json +16 -16
  2. package/generators.json +13 -13
  3. package/migrations.json +143 -143
  4. package/package.json +11 -14
  5. package/presets/npm.json +4 -4
  6. package/release/changelog-renderer/index.d.ts.map +1 -1
  7. package/release/changelog-renderer/index.js +13 -8
  8. package/schemas/nx-schema.json +1286 -1286
  9. package/schemas/project-schema.json +359 -359
  10. package/schemas/workspace-schema.json +165 -165
  11. package/src/ai/set-up-ai-agents/schema.json +31 -31
  12. package/src/command-line/release/changelog/commit-utils.d.ts +14 -0
  13. package/src/command-line/release/changelog/commit-utils.d.ts.map +1 -0
  14. package/src/command-line/release/changelog/commit-utils.js +63 -0
  15. package/src/command-line/release/changelog/version-plan-filtering.d.ts +39 -0
  16. package/src/command-line/release/changelog/version-plan-filtering.d.ts.map +1 -0
  17. package/src/command-line/release/changelog/version-plan-filtering.js +151 -0
  18. package/src/command-line/release/changelog/version-plan-utils.d.ts +32 -0
  19. package/src/command-line/release/changelog/version-plan-utils.d.ts.map +1 -0
  20. package/src/command-line/release/changelog/version-plan-utils.js +92 -0
  21. package/src/command-line/release/changelog.d.ts +1 -16
  22. package/src/command-line/release/changelog.d.ts.map +1 -1
  23. package/src/command-line/release/changelog.js +127 -269
  24. package/src/command-line/release/command-object.d.ts +1 -0
  25. package/src/command-line/release/command-object.d.ts.map +1 -1
  26. package/src/command-line/release/command-object.js +6 -0
  27. package/src/command-line/release/utils/shared.d.ts.map +1 -1
  28. package/src/command-line/release/utils/shared.js +2 -2
  29. package/src/core/graph/main.js +1 -1
  30. package/src/executors/noop/schema.json +8 -8
  31. package/src/executors/run-commands/schema.json +187 -187
  32. package/src/executors/run-script/schema.json +25 -25
  33. package/src/native/nx.wasm32-wasi.wasm +0 -0
  34. package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +38 -38
  35. package/src/plugins/js/index.d.ts.map +1 -1
  36. package/src/plugins/js/index.js +55 -7
  37. package/src/plugins/js/lock-file/lock-file.d.ts +5 -2
  38. package/src/plugins/js/lock-file/lock-file.d.ts.map +1 -1
  39. package/src/plugins/js/lock-file/lock-file.js +8 -6
  40. package/src/plugins/js/lock-file/npm-parser.d.ts +5 -2
  41. package/src/plugins/js/lock-file/npm-parser.d.ts.map +1 -1
  42. package/src/plugins/js/lock-file/npm-parser.js +5 -8
  43. package/src/plugins/js/lock-file/pnpm-parser.d.ts +5 -2
  44. package/src/plugins/js/lock-file/pnpm-parser.d.ts.map +1 -1
  45. package/src/plugins/js/lock-file/pnpm-parser.js +5 -7
  46. package/src/plugins/js/lock-file/yarn-parser.d.ts +5 -2
  47. package/src/plugins/js/lock-file/yarn-parser.d.ts.map +1 -1
  48. package/src/plugins/js/lock-file/yarn-parser.js +5 -7
@@ -1 +1 @@
1
- {"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,cAAc,EACf,MAAM,gCAAgC,CAAC;AA8BxC,eAAO,MAAM,SAAS,UAMrB,CAAC;AAQF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAqC1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,EAAE,CA8B7B;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBtE;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAgCtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,cAAc,GAAE,cAAoD,GACnE,MAAM,CAmDR"}
1
+ {"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,cAAc,EACf,MAAM,gCAAgC,CAAC;AA8BxC,eAAO,MAAM,SAAS,UAMrB,CAAC;AAQF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,oBAAoB,GAC5B;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1B,CAsCA;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,yBAAyB,EAClC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GACvB,yBAAyB,EAAE,CAmD7B;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBtE;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAgCtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,cAAc,GAAE,cAAoD,GACnE,MAAM,CAmDR"}
@@ -59,7 +59,8 @@ function getLockFileNodes(packageManager, contents, lockFileHash, context) {
59
59
  const lockFilePath = getLockFilePath(packageManager);
60
60
  if (lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)) {
61
61
  // Use new text-based parser
62
- return (0, bun_parser_1.getBunTextLockfileNodes)(contents, lockFileHash);
62
+ const nodes = (0, bun_parser_1.getBunTextLockfileNodes)(contents, lockFileHash);
63
+ return { nodes, keyMap: new Map() };
63
64
  }
64
65
  else {
65
66
  // Fallback to yarn parser for binary format
@@ -82,25 +83,26 @@ function getLockFileNodes(packageManager, contents, lockFileHash, context) {
82
83
  /**
83
84
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
84
85
  */
85
- function getLockFileDependencies(packageManager, contents, lockFileHash, context) {
86
+ function getLockFileDependencies(packageManager, contents, lockFileHash, context, keyMap) {
86
87
  try {
87
88
  if (packageManager === 'yarn') {
88
- return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context);
89
+ return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context, keyMap);
89
90
  }
90
91
  if (packageManager === 'pnpm') {
91
- return (0, pnpm_parser_1.getPnpmLockfileDependencies)(contents, lockFileHash, context);
92
+ return (0, pnpm_parser_1.getPnpmLockfileDependencies)(contents, lockFileHash, context, keyMap);
92
93
  }
93
94
  if (packageManager === 'npm') {
94
- return (0, npm_parser_1.getNpmLockfileDependencies)(contents, lockFileHash, context);
95
+ return (0, npm_parser_1.getNpmLockfileDependencies)(contents, lockFileHash, context, keyMap);
95
96
  }
96
97
  if (packageManager === 'bun') {
97
98
  const lockFilePath = getLockFilePath(packageManager);
98
99
  if (lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)) {
100
+ // Bun parser doesn't use keyMap
99
101
  return (0, bun_parser_1.getBunTextLockfileDependencies)(contents, lockFileHash, context);
100
102
  }
101
103
  else {
102
104
  // Fallback to yarn parser for binary format
103
- return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context);
105
+ return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context, keyMap);
104
106
  }
105
107
  }
106
108
  }
@@ -2,7 +2,10 @@ import { NormalizedPackageJson } from './utils/package-json';
2
2
  import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
3
3
  import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
4
4
  import { CreateDependenciesContext } from '../../../project-graph/plugins';
5
- export declare function getNpmLockfileNodes(lockFileContent: string, lockFileHash: string): Record<string, ProjectGraphExternalNode>;
6
- export declare function getNpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
5
+ export declare function getNpmLockfileNodes(lockFileContent: string, lockFileHash: string): {
6
+ nodes: Record<string, ProjectGraphExternalNode>;
7
+ keyMap: Map<string, ProjectGraphExternalNode>;
8
+ };
9
+ export declare function getNpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext, keyMap: Map<string, ProjectGraphExternalNode>): RawProjectGraphDependency[];
7
10
  export declare function stringifyNpmLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson): string;
8
11
  //# sourceMappingURL=npm-parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"npm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/npm-parser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA6D3E,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,4CASrB;AAED,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,+BAQ/B;AAuSD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,GACjC,MAAM,CA8BR"}
1
+ {"version":3,"file":"npm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/npm-parser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAyD3E,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;CAC/C,CAOA;AAED,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,EAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,+BAQ9C;AAwSD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,GACjC,MAAM,CA8BR"}
@@ -11,15 +11,12 @@ const project_graph_builder_1 = require("../../../project-graph/project-graph-bu
11
11
  const project_graph_1 = require("../../../config/project-graph");
12
12
  const file_hasher_1 = require("../../../hasher/file-hasher");
13
13
  const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
14
- // we use key => node map to avoid duplicate work when parsing keys
15
- let keyMap = new Map();
16
14
  let currentLockFileHash;
17
15
  let parsedLockFile;
18
16
  function parsePackageLockFile(lockFileContent, lockFileHash) {
19
17
  if (lockFileHash === currentLockFileHash) {
20
18
  return parsedLockFile;
21
19
  }
22
- keyMap.clear();
23
20
  const results = JSON.parse(lockFileContent);
24
21
  parsedLockFile = results;
25
22
  currentLockFileHash = lockFileHash;
@@ -27,14 +24,14 @@ function parsePackageLockFile(lockFileContent, lockFileHash) {
27
24
  }
28
25
  function getNpmLockfileNodes(lockFileContent, lockFileHash) {
29
26
  const data = parsePackageLockFile(lockFileContent, lockFileHash);
30
- // we use key => node map to avoid duplicate work when parsing keys
31
- return getNodes(data, keyMap);
27
+ return getNodes(data);
32
28
  }
33
- function getNpmLockfileDependencies(lockFileContent, lockFileHash, ctx) {
29
+ function getNpmLockfileDependencies(lockFileContent, lockFileHash, ctx, keyMap) {
34
30
  const data = parsePackageLockFile(lockFileContent, lockFileHash);
35
31
  return getDependencies(data, keyMap, ctx);
36
32
  }
37
- function getNodes(data, keyMap) {
33
+ function getNodes(data) {
34
+ const keyMap = new Map();
38
35
  const nodes = new Map();
39
36
  if (data.lockfileVersion > 1) {
40
37
  Object.entries(data.packages).forEach(([path, snapshot]) => {
@@ -77,7 +74,7 @@ function getNodes(data, keyMap) {
77
74
  results[node.name] = node;
78
75
  });
79
76
  }
80
- return results;
77
+ return { nodes: results, keyMap };
81
78
  }
82
79
  function addV1Node(packageName, snapshot, path, nodes, keyMap) {
83
80
  createNode(packageName, snapshot.version, path, nodes, keyMap, snapshot);
@@ -2,7 +2,10 @@ import { NormalizedPackageJson } from './utils/package-json';
2
2
  import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
3
3
  import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
4
4
  import { CreateDependenciesContext } from '../../../project-graph/plugins';
5
- export declare function getPnpmLockfileNodes(lockFileContent: string, lockFileHash: string): Record<string, ProjectGraphExternalNode>;
6
- export declare function getPnpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
5
+ export declare function getPnpmLockfileNodes(lockFileContent: string, lockFileHash: string): {
6
+ nodes: Record<string, ProjectGraphExternalNode>;
7
+ keyMap: Map<string, Set<ProjectGraphExternalNode>>;
8
+ };
9
+ export declare function getPnpmLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext, keyMap: Map<string, Set<ProjectGraphExternalNode>>): RawProjectGraphDependency[];
7
10
  export declare function stringifyPnpmLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson, workspaceRoot: string): string;
8
11
  //# sourceMappingURL=pnpm-parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pnpm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/pnpm-parser.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA2B3E,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAS1C;AAED,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,+BAU/B;AAkUD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,EAClC,aAAa,EAAE,MAAM,GACpB,MAAM,CAuCR"}
1
+ {"version":3,"file":"pnpm-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/pnpm-parser.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAuB3E,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC;CACpD,CASA;AAED,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,EAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,wBAAwB,CAAC,CAAC,+BAUnD;AAqUD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,EAClC,aAAa,EAAE,MAAM,GACpB,MAAM,CAuCR"}
@@ -13,15 +13,12 @@ const catalog_1 = require("../../../utils/catalog");
13
13
  const project_graph_pruning_1 = require("./project-graph-pruning");
14
14
  const path_1 = require("path");
15
15
  const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
16
- // we use key => node map to avoid duplicate work when parsing keys
17
- let keyMap = new Map();
18
16
  let currentLockFileHash;
19
17
  let parsedLockFile;
20
18
  function parsePnpmLockFile(lockFileContent, lockFileHash) {
21
19
  if (lockFileHash === currentLockFileHash) {
22
20
  return parsedLockFile;
23
21
  }
24
- keyMap.clear();
25
22
  const results = (0, pnpm_normalizer_1.parseAndNormalizePnpmLockfile)(lockFileContent);
26
23
  parsedLockFile = results;
27
24
  currentLockFileHash = lockFileHash;
@@ -33,9 +30,9 @@ function getPnpmLockfileNodes(lockFileContent, lockFileHash) {
33
30
  console.warn('Nx was tested only with pnpm lockfile version 5-9. If you encounter any issues, please report them and downgrade to older version of pnpm.');
34
31
  }
35
32
  const isV5 = (0, pnpm_normalizer_1.isV5Syntax)(data);
36
- return getNodes(data, keyMap, isV5);
33
+ return getNodes(data, isV5);
37
34
  }
38
- function getPnpmLockfileDependencies(lockFileContent, lockFileHash, ctx) {
35
+ function getPnpmLockfileDependencies(lockFileContent, lockFileHash, ctx, keyMap) {
39
36
  const data = parsePnpmLockFile(lockFileContent, lockFileHash);
40
37
  if (+data.lockfileVersion.toString() >= 10) {
41
38
  console.warn('Nx was tested only with pnpm lockfile version 5-9. If you encounter any issues, please report them and downgrade to older version of pnpm.');
@@ -71,7 +68,8 @@ function createHashFromSnapshot(snapshot) {
71
68
  function isAliasVersion(depVersion) {
72
69
  return depVersion.startsWith('/') || depVersion.includes('@');
73
70
  }
74
- function getNodes(data, keyMap, isV5) {
71
+ function getNodes(data, isV5) {
72
+ const keyMap = new Map();
75
73
  const nodes = new Map();
76
74
  const maybeAliasedPackageVersions = new Map(); // <version, alias>
77
75
  if (data.importers['.'].optionalDependencies) {
@@ -232,7 +230,7 @@ function getNodes(data, keyMap, isV5) {
232
230
  results[node.name] = node;
233
231
  });
234
232
  }
235
- return results;
233
+ return { nodes: results, keyMap };
236
234
  }
237
235
  function getHoistedVersion(hoistedDependencies, packageName, isV5) {
238
236
  let version = (0, package_json_1.getHoistedPackageVersion)(packageName);
@@ -2,7 +2,10 @@ import { NormalizedPackageJson } from './utils/package-json';
2
2
  import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
3
3
  import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
4
4
  import { CreateDependenciesContext } from '../../../project-graph/plugins';
5
- export declare function getYarnLockfileNodes(lockFileContent: string, lockFileHash: string, packageJson: NormalizedPackageJson): Record<string, ProjectGraphExternalNode>;
6
- export declare function getYarnLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext): RawProjectGraphDependency[];
5
+ export declare function getYarnLockfileNodes(lockFileContent: string, lockFileHash: string, packageJson: NormalizedPackageJson): {
6
+ nodes: Record<string, ProjectGraphExternalNode>;
7
+ keyMap: Map<string, ProjectGraphExternalNode>;
8
+ };
9
+ export declare function getYarnLockfileDependencies(lockFileContent: string, lockFileHash: string, ctx: CreateDependenciesContext, keyMap: Map<string, ProjectGraphExternalNode>): RawProjectGraphDependency[];
7
10
  export declare function stringifyYarnLockfile(graph: ProjectGraph, rootLockFileContent: string, packageJson: NormalizedPackageJson): string;
8
11
  //# sourceMappingURL=yarn-parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"yarn-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/yarn-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA8C3E,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,qBAAqB,4CAanC;AAED,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,+BAa/B;AAiQD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,GACjC,MAAM,CA8BR"}
1
+ {"version":3,"file":"yarn-parser.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/yarn-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,yBAAyB,EAE1B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAEL,YAAY,EACZ,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA0C3E,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,qBAAqB,GACjC;IACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;CAC/C,CAYA;AAED,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,yBAAyB,EAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,wBAAwB,CAAC,+BAa9C;AAsQD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,qBAAqB,GACjC,MAAM,CA8BR"}
@@ -12,14 +12,11 @@ const object_sort_1 = require("../../../utils/object-sort");
12
12
  const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
13
13
  let currentLockFileHash;
14
14
  let cachedParsedLockFile;
15
- // we use key => node map to avoid duplicate work when parsing keys
16
- let keyMap = new Map();
17
15
  function parseLockFile(lockFileContent, lockFileHash) {
18
16
  if (currentLockFileHash === lockFileHash) {
19
17
  return cachedParsedLockFile;
20
18
  }
21
19
  const { parseSyml } = require('@yarnpkg/parsers');
22
- keyMap.clear();
23
20
  const result = parseSyml(lockFileContent);
24
21
  cachedParsedLockFile = result;
25
22
  currentLockFileHash = lockFileHash;
@@ -32,12 +29,12 @@ function getYarnLockfileNodes(lockFileContent, lockFileHash, packageJson) {
32
29
  const groupedDependencies = groupDependencies(dependencies, isBerry);
33
30
  return getNodes(groupedDependencies, packageJson, isBerry);
34
31
  }
35
- function getYarnLockfileDependencies(lockFileContent, lockFileHash, ctx) {
32
+ function getYarnLockfileDependencies(lockFileContent, lockFileHash, ctx, keyMap) {
36
33
  const { __metadata, ...dependencies } = parseLockFile(lockFileContent, lockFileHash);
37
34
  const isBerry = !!__metadata;
38
35
  // yarn classic splits keys when parsing so we need to stich them back together
39
36
  const groupedDependencies = groupDependencies(dependencies, isBerry);
40
- return getDependencies(groupedDependencies, ctx);
37
+ return getDependencies(groupedDependencies, ctx, keyMap);
41
38
  }
42
39
  function getPackageNameKeyPairs(keys) {
43
40
  const result = new Map();
@@ -53,6 +50,7 @@ function getPackageNameKeyPairs(keys) {
53
50
  return result;
54
51
  }
55
52
  function getNodes(dependencies, packageJson, isBerry) {
53
+ const keyMap = new Map();
56
54
  const nodes = new Map();
57
55
  const combinedDeps = {
58
56
  ...packageJson.dependencies,
@@ -115,7 +113,7 @@ function getNodes(dependencies, packageJson, isBerry) {
115
113
  externalNodes[node.name] = node;
116
114
  });
117
115
  }
118
- return externalNodes;
116
+ return { nodes: externalNodes, keyMap };
119
117
  }
120
118
  function findHoistedNode(packageName, versionMap, combinedDeps) {
121
119
  const hoistedVersion = getHoistedVersion(packageName);
@@ -194,7 +192,7 @@ function getHoistedVersion(packageName) {
194
192
  return version;
195
193
  }
196
194
  }
197
- function getDependencies(dependencies, ctx) {
195
+ function getDependencies(dependencies, ctx, keyMap) {
198
196
  const projectGraphDependencies = [];
199
197
  Object.keys(dependencies).forEach((keys) => {
200
198
  const snapshot = dependencies[keys];