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,10 +1,10 @@
1
1
  {
2
- "version": 2,
3
- "title": "Noop",
4
- "description": "An executor that does nothing.",
5
- "type": "object",
6
- "cli": "nx",
7
- "outputCapture": "pipe",
8
- "properties": {},
9
- "additionalProperties": true
2
+ "version": 2,
3
+ "title": "Noop",
4
+ "description": "An executor that does nothing.",
5
+ "type": "object",
6
+ "cli": "nx",
7
+ "outputCapture": "pipe",
8
+ "properties": {},
9
+ "additionalProperties": true
10
10
  }
@@ -1,198 +1,198 @@
1
1
  {
2
- "version": 2,
3
- "title": "Run Commands",
4
- "description": "Run any custom commands with Nx.",
5
- "type": "object",
6
- "cli": "nx",
7
- "outputCapture": "pipe",
8
- "presets": [
9
- {
10
- "name": "Arguments forwarding",
11
- "keys": ["commands"]
12
- },
13
- {
14
- "name": "Custom done conditions",
15
- "keys": ["commands", "readyWhen"]
16
- },
17
- {
18
- "name": "Setting the cwd",
19
- "keys": ["commands", "cwd"]
20
- }
21
- ],
22
- "properties": {
23
- "commands": {
24
- "type": "array",
25
- "description": "Commands to run in child process.",
26
- "items": {
27
- "oneOf": [
28
- {
29
- "type": "object",
30
- "properties": {
31
- "command": {
32
- "type": "string",
33
- "description": "Command to run in child process."
34
- },
35
- "forwardAllArgs": {
36
- "type": "boolean",
37
- "description": "Whether arguments should be forwarded when interpolation is not present."
38
- },
39
- "prefix": {
40
- "type": "string",
41
- "description": "Prefix in front of every line out of the output"
42
- },
43
- "prefixColor": {
44
- "type": "string",
45
- "description": "Color of the prefix",
46
- "enum": [
47
- "black",
48
- "red",
49
- "green",
50
- "yellow",
51
- "blue",
52
- "magenta",
53
- "cyan",
54
- "white"
55
- ]
56
- },
57
- "color": {
58
- "type": "string",
59
- "description": "Color of the output",
60
- "enum": [
61
- "black",
62
- "red",
63
- "green",
64
- "yellow",
65
- "blue",
66
- "magenta",
67
- "cyan",
68
- "white"
69
- ]
70
- },
71
- "bgColor": {
72
- "type": "string",
73
- "description": "Background color of the output",
74
- "enum": [
75
- "bgBlack",
76
- "bgRed",
77
- "bgGreen",
78
- "bgYellow",
79
- "bgBlue",
80
- "bgMagenta",
81
- "bgCyan",
82
- "bgWhite"
83
- ]
84
- },
85
- "description": {
86
- "type": "string",
87
- "description": "An optional description useful for inline documentation purposes. It is not used as part of the execution of the command."
88
- }
89
- },
90
- "additionalProperties": false,
91
- "required": ["command"]
92
- },
93
- {
94
- "type": "string"
95
- }
96
- ]
97
- },
98
- "x-priority": "important"
99
- },
100
- "command": {
101
- "oneOf": [
2
+ "version": 2,
3
+ "title": "Run Commands",
4
+ "description": "Run any custom commands with Nx.",
5
+ "type": "object",
6
+ "cli": "nx",
7
+ "outputCapture": "pipe",
8
+ "presets": [
9
+ {
10
+ "name": "Arguments forwarding",
11
+ "keys": ["commands"]
12
+ },
102
13
  {
103
- "type": "array",
104
- "description": "Command to run in child process, but divided into parts.",
105
- "items": {
106
- "type": "string"
107
- },
108
- "x-priority": "important"
14
+ "name": "Custom done conditions",
15
+ "keys": ["commands", "readyWhen"]
109
16
  },
110
17
  {
111
- "type": "string",
112
- "description": "Command to run in child process."
18
+ "name": "Setting the cwd",
19
+ "keys": ["commands", "cwd"]
20
+ }
21
+ ],
22
+ "properties": {
23
+ "commands": {
24
+ "type": "array",
25
+ "description": "Commands to run in child process.",
26
+ "items": {
27
+ "oneOf": [
28
+ {
29
+ "type": "object",
30
+ "properties": {
31
+ "command": {
32
+ "type": "string",
33
+ "description": "Command to run in child process."
34
+ },
35
+ "forwardAllArgs": {
36
+ "type": "boolean",
37
+ "description": "Whether arguments should be forwarded when interpolation is not present."
38
+ },
39
+ "prefix": {
40
+ "type": "string",
41
+ "description": "Prefix in front of every line out of the output"
42
+ },
43
+ "prefixColor": {
44
+ "type": "string",
45
+ "description": "Color of the prefix",
46
+ "enum": [
47
+ "black",
48
+ "red",
49
+ "green",
50
+ "yellow",
51
+ "blue",
52
+ "magenta",
53
+ "cyan",
54
+ "white"
55
+ ]
56
+ },
57
+ "color": {
58
+ "type": "string",
59
+ "description": "Color of the output",
60
+ "enum": [
61
+ "black",
62
+ "red",
63
+ "green",
64
+ "yellow",
65
+ "blue",
66
+ "magenta",
67
+ "cyan",
68
+ "white"
69
+ ]
70
+ },
71
+ "bgColor": {
72
+ "type": "string",
73
+ "description": "Background color of the output",
74
+ "enum": [
75
+ "bgBlack",
76
+ "bgRed",
77
+ "bgGreen",
78
+ "bgYellow",
79
+ "bgBlue",
80
+ "bgMagenta",
81
+ "bgCyan",
82
+ "bgWhite"
83
+ ]
84
+ },
85
+ "description": {
86
+ "type": "string",
87
+ "description": "An optional description useful for inline documentation purposes. It is not used as part of the execution of the command."
88
+ }
89
+ },
90
+ "additionalProperties": false,
91
+ "required": ["command"]
92
+ },
93
+ {
94
+ "type": "string"
95
+ }
96
+ ]
97
+ },
98
+ "x-priority": "important"
99
+ },
100
+ "command": {
101
+ "oneOf": [
102
+ {
103
+ "type": "array",
104
+ "description": "Command to run in child process, but divided into parts.",
105
+ "items": {
106
+ "type": "string"
107
+ },
108
+ "x-priority": "important"
109
+ },
110
+ {
111
+ "type": "string",
112
+ "description": "Command to run in child process."
113
+ }
114
+ ],
115
+ "type": "string",
116
+ "description": "Command to run in child process.",
117
+ "x-priority": "important"
118
+ },
119
+ "parallel": {
120
+ "type": "boolean",
121
+ "description": "Run commands in parallel.",
122
+ "default": true,
123
+ "x-priority": "important"
124
+ },
125
+ "readyWhen": {
126
+ "description": "String or array of strings to appear in `stdout` or `stderr` that indicate that the task is done. When running multiple commands, this option can only be used when `parallel` is set to `true`. If not specified, the task is done when all the child processes complete.",
127
+ "oneOf": [
128
+ { "type": "string" },
129
+ { "type": "array", "items": { "type": "string" } }
130
+ ]
131
+ },
132
+ "args": {
133
+ "oneOf": [
134
+ {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ }
139
+ },
140
+ {
141
+ "type": "string"
142
+ }
143
+ ],
144
+ "description": "Extra arguments. You can pass them as follows: nx run project:target --args='--wait=100'. You can then use {args.wait} syntax to interpolate them in the workspace config file. See example [above](#chaining-commands-interpolating-args-and-setting-the-cwd)"
145
+ },
146
+ "envFile": {
147
+ "type": "string",
148
+ "description": "You may specify a custom .env file path."
149
+ },
150
+ "color": {
151
+ "type": "boolean",
152
+ "description": "Use colors when showing output of command.",
153
+ "default": false
154
+ },
155
+ "cwd": {
156
+ "type": "string",
157
+ "description": "Current working directory of the commands. If it's not specified the commands will run in the workspace root, if a relative path is specified the commands will run in that path relative to the workspace root and if it's an absolute path the commands will run in that path."
158
+ },
159
+ "env": {
160
+ "type": "object",
161
+ "description": "Environment variables that will be made available to the commands. This property has priority over the `.env` files.",
162
+ "additionalProperties": {
163
+ "type": "string"
164
+ }
165
+ },
166
+ "__unparsed__": {
167
+ "hidden": true,
168
+ "type": "array",
169
+ "items": {
170
+ "type": "string"
171
+ },
172
+ "$default": {
173
+ "$source": "unparsed"
174
+ },
175
+ "x-priority": "internal"
176
+ },
177
+ "forwardAllArgs": {
178
+ "type": "boolean",
179
+ "description": "Whether arguments should be forwarded when interpolation is not present.",
180
+ "default": true
181
+ },
182
+ "tty": {
183
+ "type": "boolean",
184
+ "description": "Whether commands should be run with a tty terminal",
185
+ "hidden": true
113
186
  }
114
- ],
115
- "type": "string",
116
- "description": "Command to run in child process.",
117
- "x-priority": "important"
118
- },
119
- "parallel": {
120
- "type": "boolean",
121
- "description": "Run commands in parallel.",
122
- "default": true,
123
- "x-priority": "important"
124
- },
125
- "readyWhen": {
126
- "description": "String or array of strings to appear in `stdout` or `stderr` that indicate that the task is done. When running multiple commands, this option can only be used when `parallel` is set to `true`. If not specified, the task is done when all the child processes complete.",
127
- "oneOf": [
128
- { "type": "string" },
129
- { "type": "array", "items": { "type": "string" } }
130
- ]
131
187
  },
132
- "args": {
133
- "oneOf": [
188
+ "additionalProperties": true,
189
+ "oneOf": [
134
190
  {
135
- "type": "array",
136
- "items": {
137
- "type": "string"
138
- }
191
+ "required": ["commands"]
139
192
  },
140
193
  {
141
- "type": "string"
194
+ "required": ["command"]
142
195
  }
143
- ],
144
- "description": "Extra arguments. You can pass them as follows: nx run project:target --args='--wait=100'. You can then use {args.wait} syntax to interpolate them in the workspace config file. See example [above](#chaining-commands-interpolating-args-and-setting-the-cwd)"
145
- },
146
- "envFile": {
147
- "type": "string",
148
- "description": "You may specify a custom .env file path."
149
- },
150
- "color": {
151
- "type": "boolean",
152
- "description": "Use colors when showing output of command.",
153
- "default": false
154
- },
155
- "cwd": {
156
- "type": "string",
157
- "description": "Current working directory of the commands. If it's not specified the commands will run in the workspace root, if a relative path is specified the commands will run in that path relative to the workspace root and if it's an absolute path the commands will run in that path."
158
- },
159
- "env": {
160
- "type": "object",
161
- "description": "Environment variables that will be made available to the commands. This property has priority over the `.env` files.",
162
- "additionalProperties": {
163
- "type": "string"
164
- }
165
- },
166
- "__unparsed__": {
167
- "hidden": true,
168
- "type": "array",
169
- "items": {
170
- "type": "string"
171
- },
172
- "$default": {
173
- "$source": "unparsed"
174
- },
175
- "x-priority": "internal"
176
- },
177
- "forwardAllArgs": {
178
- "type": "boolean",
179
- "description": "Whether arguments should be forwarded when interpolation is not present.",
180
- "default": true
181
- },
182
- "tty": {
183
- "type": "boolean",
184
- "description": "Whether commands should be run with a tty terminal",
185
- "hidden": true
186
- }
187
- },
188
- "additionalProperties": true,
189
- "oneOf": [
190
- {
191
- "required": ["commands"]
192
- },
193
- {
194
- "required": ["command"]
195
- }
196
- ],
197
- "examplesFile": "../../../docs/run-commands-examples.md"
196
+ ],
197
+ "examplesFile": "../../../docs/run-commands-examples.md"
198
198
  }
@@ -1,28 +1,28 @@
1
1
  {
2
- "version": 2,
3
- "title": "Run Script",
4
- "description": "Run any NPM script of a project in the project's root directory.",
5
- "type": "object",
6
- "cli": "nx",
7
- "outputCapture": "pipe",
8
- "properties": {
9
- "script": {
10
- "type": "string",
11
- "description": "An npm script name in the `package.json` file of the project (e.g., `build`)."
2
+ "version": 2,
3
+ "title": "Run Script",
4
+ "description": "Run any NPM script of a project in the project's root directory.",
5
+ "type": "object",
6
+ "cli": "nx",
7
+ "outputCapture": "pipe",
8
+ "properties": {
9
+ "script": {
10
+ "type": "string",
11
+ "description": "An npm script name in the `package.json` file of the project (e.g., `build`)."
12
+ },
13
+ "__unparsed__": {
14
+ "hidden": true,
15
+ "type": "array",
16
+ "items": {
17
+ "type": "string"
18
+ },
19
+ "$default": {
20
+ "$source": "unparsed"
21
+ },
22
+ "x-priority": "internal"
23
+ }
12
24
  },
13
- "__unparsed__": {
14
- "hidden": true,
15
- "type": "array",
16
- "items": {
17
- "type": "string"
18
- },
19
- "$default": {
20
- "$source": "unparsed"
21
- },
22
- "x-priority": "internal"
23
- }
24
- },
25
- "additionalProperties": true,
26
- "required": ["script"],
27
- "examplesFile": "../../../docs/run-script-examples.md"
25
+ "additionalProperties": true,
26
+ "required": ["script"],
27
+ "examplesFile": "../../../docs/run-script-examples.md"
28
28
  }
Binary file
@@ -1,41 +1,41 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
3
- "id": "NxCloudInit",
4
- "title": "Add Nx Cloud Configuration to the workspace",
5
- "description": "Connect a workspace to Nx Cloud.",
6
- "type": "object",
7
- "cli": "nx",
8
- "properties": {
9
- "analytics": {
10
- "type": "boolean",
11
- "description": "Anonymously store hashed machine ID for task runs",
12
- "default": false
2
+ "$schema": "https://json-schema.org/schema",
3
+ "id": "NxCloudInit",
4
+ "title": "Add Nx Cloud Configuration to the workspace",
5
+ "description": "Connect a workspace to Nx Cloud.",
6
+ "type": "object",
7
+ "cli": "nx",
8
+ "properties": {
9
+ "analytics": {
10
+ "type": "boolean",
11
+ "description": "Anonymously store hashed machine ID for task runs",
12
+ "default": false
13
+ },
14
+ "installationSource": {
15
+ "type": "string",
16
+ "description": "Name of Nx Cloud installation invoker (ex. user, add-nx-to-monorepo, create-nx-workspace, nx-upgrade",
17
+ "default": "user"
18
+ },
19
+ "hideFormatLogs": {
20
+ "type": "boolean",
21
+ "description": "Hide formatting logs",
22
+ "x-priority": "internal"
23
+ },
24
+ "generateToken": {
25
+ "type": "boolean",
26
+ "description": "Explicitly asks for a token to be created, do not override existing tokens from Nx Cloud"
27
+ },
28
+ "github": {
29
+ "type": "boolean",
30
+ "description": "If the user will be using GitHub as their git hosting provider",
31
+ "default": false
32
+ },
33
+ "directory": {
34
+ "type": "string",
35
+ "description": "The directory where the workspace is located",
36
+ "x-priority": "internal"
37
+ }
13
38
  },
14
- "installationSource": {
15
- "type": "string",
16
- "description": "Name of Nx Cloud installation invoker (ex. user, add-nx-to-monorepo, create-nx-workspace, nx-upgrade",
17
- "default": "user"
18
- },
19
- "hideFormatLogs": {
20
- "type": "boolean",
21
- "description": "Hide formatting logs",
22
- "x-priority": "internal"
23
- },
24
- "generateToken": {
25
- "type": "boolean",
26
- "description": "Explicitly asks for a token to be created, do not override existing tokens from Nx Cloud"
27
- },
28
- "github": {
29
- "type": "boolean",
30
- "description": "If the user will be using GitHub as their git hosting provider",
31
- "default": false
32
- },
33
- "directory": {
34
- "type": "string",
35
- "description": "The directory where the workspace is located",
36
- "x-priority": "internal"
37
- }
38
- },
39
- "additionalProperties": false,
40
- "required": []
39
+ "additionalProperties": false,
40
+ "required": []
41
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/plugins/js/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAIlB,aAAa,EACd,MAAM,6BAA6B,CAAC;AAkBrC,eAAO,MAAM,IAAI,oCAAoC,CAAC;AAKtD,eAAO,MAAM,aAAa,EAAE,aAK3B,CAAC;AAkDF,eAAO,MAAM,kBAAkB,EAAE,kBAgDhC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/plugins/js/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,kBAAkB,EAIlB,aAAa,EACd,MAAM,6BAA6B,CAAC;AAkBrC,eAAO,MAAM,IAAI,oCAAoC,CAAC;AAMtD,eAAO,MAAM,aAAa,EAAE,aAK3B,CAAC;AAoDF,eAAO,MAAM,kBAAkB,EAAE,kBAiDhC,CAAC"}
@@ -18,6 +18,7 @@ const config_1 = require("./utils/config");
18
18
  exports.name = 'nx/js/dependencies-and-lockfile';
19
19
  // Separate in-memory caches
20
20
  let cachedExternalNodes;
21
+ let cachedKeyMap;
21
22
  exports.createNodesV2 = [
22
23
  (0, globs_1.combineGlobPatterns)(lock_file_1.LOCKFILES),
23
24
  (files, _, context) => {
@@ -40,15 +41,17 @@ function internalCreateNodes(lockFile, _, context) {
40
41
  : (0, bun_parser_1.readBunLockFile)(lockFilePath);
41
42
  const lockFileHash = getLockFileHash(lockFileContents);
42
43
  if (!lockFileNeedsReprocessing(lockFileHash, externalNodesHashFile)) {
43
- const nodes = readCachedExternalNodes();
44
+ const { nodes, keyMap } = readCachedExternalNodes();
44
45
  cachedExternalNodes = nodes;
46
+ cachedKeyMap = keyMap;
45
47
  return {
46
48
  externalNodes: nodes,
47
49
  };
48
50
  }
49
- const externalNodes = (0, lock_file_1.getLockFileNodes)(packageManager, lockFileContents, lockFileHash, context);
51
+ const { nodes: externalNodes, keyMap } = (0, lock_file_1.getLockFileNodes)(packageManager, lockFileContents, lockFileHash, context);
50
52
  cachedExternalNodes = externalNodes;
51
- writeExternalNodesCache(lockFileHash, externalNodes);
53
+ cachedKeyMap = keyMap;
54
+ writeExternalNodesCache(lockFileHash, externalNodes, keyMap);
52
55
  return {
53
56
  externalNodes,
54
57
  };
@@ -70,7 +73,7 @@ const createDependencies = (_, ctx) => {
70
73
  lockfileDependencies = readCachedDependencies();
71
74
  }
72
75
  else {
73
- lockfileDependencies = (0, lock_file_1.getLockFileDependencies)(packageManager, lockFileContents, lockFileHash, ctx);
76
+ lockfileDependencies = (0, lock_file_1.getLockFileDependencies)(packageManager, lockFileContents, lockFileHash, ctx, cachedKeyMap);
74
77
  writeDependenciesCache(lockFileHash, lockfileDependencies);
75
78
  }
76
79
  }
@@ -84,6 +87,48 @@ exports.createDependencies = createDependencies;
84
87
  function getLockFileHash(lockFileContents) {
85
88
  return (0, file_hasher_1.hashArray)([versions_1.nxVersion, lockFileContents]);
86
89
  }
90
+ // Serialize keyMap to JSON-friendly format
91
+ function serializeKeyMap(keyMap) {
92
+ const serialized = {};
93
+ for (const [key, value] of keyMap.entries()) {
94
+ if (value instanceof Set) {
95
+ // pnpm: Map<string, Set<ProjectGraphExternalNode>>
96
+ serialized[key] = Array.from(value).map((node) => node.name);
97
+ }
98
+ else if (value && typeof value === 'object' && 'name' in value) {
99
+ // npm/yarn: Map<string, ProjectGraphExternalNode>
100
+ serialized[key] = value.name;
101
+ }
102
+ else {
103
+ serialized[key] = value;
104
+ }
105
+ }
106
+ return serialized;
107
+ }
108
+ // Deserialize keyMap from JSON format using ctx.externalNodes
109
+ function deserializeKeyMap(serialized, externalNodes) {
110
+ const keyMap = new Map();
111
+ for (const [key, value] of Object.entries(serialized)) {
112
+ if (Array.isArray(value)) {
113
+ // pnpm: reconstruct Set<ProjectGraphExternalNode>
114
+ const nodes = value
115
+ .map((nodeName) => externalNodes[nodeName])
116
+ .filter(Boolean);
117
+ keyMap.set(key, new Set(nodes));
118
+ }
119
+ else if (typeof value === 'string') {
120
+ // npm/yarn: reconstruct ProjectGraphExternalNode
121
+ const node = externalNodes[value];
122
+ if (node) {
123
+ keyMap.set(key, node);
124
+ }
125
+ }
126
+ else {
127
+ keyMap.set(key, value);
128
+ }
129
+ }
130
+ return keyMap;
131
+ }
87
132
  function lockFileNeedsReprocessing(lockHash, hashFilePath) {
88
133
  try {
89
134
  return (0, fs_1.readFileSync)(hashFilePath).toString() !== lockHash;
@@ -93,13 +138,16 @@ function lockFileNeedsReprocessing(lockHash, hashFilePath) {
93
138
  }
94
139
  }
95
140
  // External nodes cache functions
96
- function writeExternalNodesCache(hash, nodes) {
141
+ function writeExternalNodesCache(hash, nodes, keyMap) {
97
142
  (0, fs_1.mkdirSync)((0, path_1.dirname)(externalNodesHashFile), { recursive: true });
98
- (0, fs_1.writeFileSync)(externalNodesCache, JSON.stringify(nodes, null, 2));
143
+ const serializedKeyMap = serializeKeyMap(keyMap);
144
+ const cacheData = { nodes, keyMap: serializedKeyMap };
145
+ (0, fs_1.writeFileSync)(externalNodesCache, JSON.stringify(cacheData, null, 2));
99
146
  (0, fs_1.writeFileSync)(externalNodesHashFile, hash);
100
147
  }
101
148
  function readCachedExternalNodes() {
102
- return JSON.parse((0, fs_1.readFileSync)(externalNodesCache).toString());
149
+ const { nodes, keyMap } = JSON.parse((0, fs_1.readFileSync)(externalNodesCache, 'utf-8'));
150
+ return { nodes, keyMap: deserializeKeyMap(keyMap, nodes) };
103
151
  }
104
152
  // Dependencies cache functions
105
153
  function writeDependenciesCache(hash, dependencies) {
@@ -11,11 +11,14 @@ export declare const LOCKFILES: string[];
11
11
  /**
12
12
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
13
13
  */
14
- export declare function getLockFileNodes(packageManager: PackageManager, contents: string, lockFileHash: string, context: CreateNodesContextV2): Record<string, ProjectGraphExternalNode>;
14
+ export declare function getLockFileNodes(packageManager: PackageManager, contents: string, lockFileHash: string, context: CreateNodesContextV2): {
15
+ nodes: Record<string, ProjectGraphExternalNode>;
16
+ keyMap: Map<string, any>;
17
+ };
15
18
  /**
16
19
  * Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
17
20
  */
18
- export declare function getLockFileDependencies(packageManager: PackageManager, contents: string, lockFileHash: string, context: CreateDependenciesContext): RawProjectGraphDependency[];
21
+ export declare function getLockFileDependencies(packageManager: PackageManager, contents: string, lockFileHash: string, context: CreateDependenciesContext, keyMap: Map<string, any>): RawProjectGraphDependency[];
19
22
  export declare function lockFileExists(packageManager: PackageManager): boolean;
20
23
  /**
21
24
  * Returns lock file name based on the detected package manager in the root