nx 24.1.0-beta.0 → 24.1.0-beta.1

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 (84) hide show
  1. package/dist/bin/init-local.js +2 -4
  2. package/dist/bin/nx-cloud.js +2 -1
  3. package/dist/bin/nx.js +12 -14
  4. package/dist/bin/run-executor.js +5 -0
  5. package/dist/src/adapter/compat.d.ts +1 -1
  6. package/dist/src/adapter/compat.js +1 -0
  7. package/dist/src/command-line/completion/scripts/bash.sh +9 -2
  8. package/dist/src/command-line/completion/scripts/fish.fish +10 -2
  9. package/dist/src/command-line/completion/scripts/zsh.zsh +8 -2
  10. package/dist/src/command-line/completion/scripts.js +18 -8
  11. package/dist/src/command-line/conformance/command-object.d.ts +3 -0
  12. package/dist/src/command-line/conformance/command-object.js +66 -0
  13. package/dist/src/command-line/generate/generate.js +2 -4
  14. package/dist/src/command-line/generate/generator-utils.d.ts +1 -0
  15. package/dist/src/command-line/generate/generator-utils.js +9 -0
  16. package/dist/src/command-line/import/import.js +26 -2
  17. package/dist/src/command-line/import/utils/ai-output.d.ts +9 -1
  18. package/dist/src/command-line/import/utils/ai-output.js +20 -1
  19. package/dist/src/command-line/nx-commands.d.ts +1 -1
  20. package/dist/src/command-line/nx-commands.js +82 -132
  21. package/dist/src/command-line/release/command-object.d.ts +1 -0
  22. package/dist/src/command-line/release/command-object.js +4 -0
  23. package/dist/src/command-line/release/release.js +6 -4
  24. package/dist/src/command-line/release/utils/resolve-nx-json-error-message.js +2 -24
  25. package/dist/src/command-line/report/report.js +1 -1
  26. package/dist/src/config/nx-json.d.ts +117 -0
  27. package/dist/src/config/workspace-json-project-json.d.ts +6 -7
  28. package/dist/src/daemon/server/project-graph-incremental-recomputation.js +13 -20
  29. package/dist/src/devkit-exports.d.ts +1 -1
  30. package/dist/src/devkit-internals.d.ts +11 -4
  31. package/dist/src/devkit-internals.js +26 -4
  32. package/dist/src/executors/run-commands/run-commands.impl.d.ts +1 -1
  33. package/dist/src/executors/run-commands/run-commands.impl.js +35 -13
  34. package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.d.ts +4 -0
  35. package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.js +117 -0
  36. package/dist/src/migrations/update-24-1-0/replace-powerpack-conformance.md +38 -0
  37. package/dist/src/native/index.d.ts +6 -4
  38. package/dist/src/native/index.js +5 -0
  39. package/dist/src/native/native-bindings.js +1 -0
  40. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  41. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  42. package/dist/src/native/transform-objects.d.ts +2 -0
  43. package/dist/src/native/transform-objects.js +15 -0
  44. package/dist/src/plugins/js/lock-file/bun-parser.d.ts +1 -2
  45. package/dist/src/plugins/js/lock-file/bun-parser.js +5 -3
  46. package/dist/src/plugins/js/lock-file/lock-file-names.d.ts +6 -0
  47. package/dist/src/plugins/js/lock-file/lock-file-names.js +16 -0
  48. package/dist/src/plugins/js/lock-file/lock-file.d.ts +1 -2
  49. package/dist/src/plugins/js/lock-file/lock-file.js +24 -31
  50. package/dist/src/plugins/js/project-graph/affected/npm-packages.js +50 -2
  51. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +5 -0
  52. package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +75 -13
  53. package/dist/src/plugins/js/utils/register.js +13 -6
  54. package/dist/src/project-graph/build-project-graph.js +5 -2
  55. package/dist/src/project-graph/nx-deps-cache.d.ts +3 -2
  56. package/dist/src/project-graph/nx-deps-cache.js +8 -2
  57. package/dist/src/project-graph/utils/project-graph-paths.d.ts +8 -0
  58. package/dist/src/project-graph/utils/project-graph-paths.js +170 -0
  59. package/dist/src/tasks-runner/batch/run-batch.js +3 -13
  60. package/dist/src/tasks-runner/cache.js +19 -18
  61. package/dist/src/tasks-runner/run-command.js +6 -3
  62. package/dist/src/tasks-runner/task-orchestrator.d.ts +1 -0
  63. package/dist/src/tasks-runner/task-orchestrator.js +13 -2
  64. package/dist/src/utils/child-process.js +2 -1
  65. package/dist/src/utils/find-workspace-root.js +2 -4
  66. package/dist/src/utils/git-utils.d.ts +5 -0
  67. package/dist/src/utils/git-utils.js +23 -1
  68. package/dist/src/utils/handle-import.js +6 -0
  69. package/dist/src/utils/installation-directory.d.ts +16 -0
  70. package/dist/src/utils/installation-directory.js +96 -2
  71. package/dist/src/utils/json.d.ts +7 -0
  72. package/dist/src/utils/json.js +27 -0
  73. package/dist/src/utils/nx-key.js +11 -8
  74. package/dist/src/utils/output.d.ts +5 -0
  75. package/dist/src/utils/output.js +11 -4
  76. package/dist/src/utils/owned-private-dir.d.ts +10 -0
  77. package/dist/src/utils/owned-private-dir.js +28 -0
  78. package/dist/src/utils/require-nx-key.js +6 -4
  79. package/dist/src/utils/workspace-root.d.ts +12 -0
  80. package/dist/src/utils/workspace-root.js +56 -7
  81. package/migrations.json +6 -0
  82. package/package.json +13 -11
  83. package/schemas/nx-schema.json +75 -9
  84. package/schemas/project-schema.json +5 -0
@@ -5,44 +5,44 @@ const tslib_1 = require("tslib");
5
5
  const pc = tslib_1.__importStar(require("picocolors"));
6
6
  const yargs = tslib_1.__importStar(require("yargs"));
7
7
  const analytics_1 = require("../analytics");
8
- const output_1 = require("../utils/output");
9
8
  const command_object_1 = require("./add/command-object");
10
- const command_object_2 = require("./affected/command-object");
11
- const command_object_3 = require("./configure-ai-agents/command-object");
12
- const command_object_4 = require("./daemon/command-object");
9
+ const command_object_2 = require("./conformance/command-object");
10
+ const command_object_3 = require("./affected/command-object");
11
+ const command_object_4 = require("./configure-ai-agents/command-object");
12
+ const command_object_5 = require("./daemon/command-object");
13
13
  const command_objects_1 = require("./deprecated/command-objects");
14
- const command_object_5 = require("./exec/command-object");
15
- const command_object_6 = require("./format/command-object");
16
- const command_object_7 = require("./generate/command-object");
17
- const command_object_8 = require("./graph/command-object");
18
- const command_object_9 = require("./import/command-object");
19
- const command_object_10 = require("./init/command-object");
20
- const command_object_11 = require("./list/command-object");
21
- const command_object_12 = require("./mcp/command-object");
22
- const command_object_13 = require("./migrate/command-object");
23
- const command_object_14 = require("./new/command-object");
24
- const command_object_15 = require("./nx-cloud/apply-locally/command-object");
25
- const command_object_16 = require("./nx-cloud/complete-run/command-object");
26
- const command_object_17 = require("./nx-cloud/connect/command-object");
27
- const command_object_18 = require("./nx-cloud/download-cloud-client/command-object");
28
- const command_object_19 = require("./nx-cloud/fix-ci/command-object");
29
- const command_object_20 = require("./nx-cloud/login/command-object");
30
- const command_object_21 = require("./nx-cloud/logout/command-object");
31
- const command_object_22 = require("./nx-cloud/record/command-object");
32
- const command_object_23 = require("./nx-cloud/start-agent/command-object");
33
- const command_object_24 = require("./nx-cloud/start-ci-run/command-object");
34
- const command_object_25 = require("./nx-cloud/start-nx-agents/command-object");
35
- const command_object_26 = require("./register/command-object");
36
- const command_object_27 = require("./release/command-object");
37
- const command_object_28 = require("./repair/command-object");
38
- const command_object_29 = require("./report/command-object");
39
- const command_object_30 = require("./reset/command-object");
40
- const command_object_31 = require("./run-many/command-object");
41
- const command_object_32 = require("./run/command-object");
42
- const command_object_33 = require("./show/command-object");
43
- const command_object_34 = require("./sync/command-object");
44
- const command_object_35 = require("./watch/command-object");
45
- const command_object_36 = require("./completion/command-object");
14
+ const command_object_6 = require("./exec/command-object");
15
+ const command_object_7 = require("./format/command-object");
16
+ const command_object_8 = require("./generate/command-object");
17
+ const command_object_9 = require("./graph/command-object");
18
+ const command_object_10 = require("./import/command-object");
19
+ const command_object_11 = require("./init/command-object");
20
+ const command_object_12 = require("./list/command-object");
21
+ const command_object_13 = require("./mcp/command-object");
22
+ const command_object_14 = require("./migrate/command-object");
23
+ const command_object_15 = require("./new/command-object");
24
+ const command_object_16 = require("./nx-cloud/apply-locally/command-object");
25
+ const command_object_17 = require("./nx-cloud/complete-run/command-object");
26
+ const command_object_18 = require("./nx-cloud/connect/command-object");
27
+ const command_object_19 = require("./nx-cloud/download-cloud-client/command-object");
28
+ const command_object_20 = require("./nx-cloud/fix-ci/command-object");
29
+ const command_object_21 = require("./nx-cloud/login/command-object");
30
+ const command_object_22 = require("./nx-cloud/logout/command-object");
31
+ const command_object_23 = require("./nx-cloud/record/command-object");
32
+ const command_object_24 = require("./nx-cloud/start-agent/command-object");
33
+ const command_object_25 = require("./nx-cloud/start-ci-run/command-object");
34
+ const command_object_26 = require("./nx-cloud/start-nx-agents/command-object");
35
+ const command_object_27 = require("./register/command-object");
36
+ const command_object_28 = require("./release/command-object");
37
+ const command_object_29 = require("./repair/command-object");
38
+ const command_object_30 = require("./report/command-object");
39
+ const command_object_31 = require("./reset/command-object");
40
+ const command_object_32 = require("./run-many/command-object");
41
+ const command_object_33 = require("./run/command-object");
42
+ const command_object_34 = require("./show/command-object");
43
+ const command_object_35 = require("./sync/command-object");
44
+ const command_object_36 = require("./watch/command-object");
45
+ const command_object_37 = require("./completion/command-object");
46
46
  const trigger_1 = require("./completion/trigger");
47
47
  // Ensure that the output takes up the available width of the terminal.
48
48
  yargs.wrap(yargs.terminalWidth());
@@ -60,55 +60,55 @@ exports.commandsObject = yargs
60
60
  .parserConfiguration(exports.parserConfiguration)
61
61
  .usage(pc.bold('Smart Monorepos · Fast Builds'))
62
62
  .demandCommand(1, '')
63
- .command(command_object_26.yargsRegisterCommand)
63
+ .command(command_object_27.yargsRegisterCommand)
64
64
  .command(command_object_1.yargsAddCommand)
65
- .command(command_object_3.yargsConfigureAiAgentsCommand)
66
- .command(command_object_2.yargsAffectedBuildCommand)
67
- .command(command_object_2.yargsAffectedCommand)
68
- .command(command_object_2.yargsAffectedE2ECommand)
69
- .command(command_object_2.yargsAffectedLintCommand)
70
- .command(command_object_2.yargsAffectedTestCommand)
65
+ .command(command_object_4.yargsConfigureAiAgentsCommand)
66
+ .command(command_object_3.yargsAffectedBuildCommand)
67
+ .command(command_object_3.yargsAffectedCommand)
68
+ .command(command_object_3.yargsAffectedE2ECommand)
69
+ .command(command_object_3.yargsAffectedLintCommand)
70
+ .command(command_object_3.yargsAffectedTestCommand)
71
71
  .command(command_objects_1.yargsAffectedGraphCommand)
72
- .command(command_object_17.yargsConnectCommand)
73
- .command(command_object_4.yargsDaemonCommand)
74
- .command(command_object_8.yargsGraphCommand)
75
- .command(command_object_5.yargsExecCommand)
76
- .command(command_object_6.yargsFormatCheckCommand)
77
- .command(command_object_6.yargsFormatWriteCommand)
78
- .command(command_object_7.yargsGenerateCommand)
79
- .command(command_object_9.yargsImportCommand)
80
- .command(command_object_10.yargsInitCommand)
81
- .command(command_object_13.yargsInternalMigrateCommand)
82
- .command(command_object_11.yargsListCommand)
83
- .command(command_object_13.yargsMigrateCommand)
84
- .command(command_object_14.yargsNewCommand)
72
+ .command(command_object_18.yargsConnectCommand)
73
+ .command(command_object_5.yargsDaemonCommand)
74
+ .command(command_object_9.yargsGraphCommand)
75
+ .command(command_object_6.yargsExecCommand)
76
+ .command(command_object_7.yargsFormatCheckCommand)
77
+ .command(command_object_7.yargsFormatWriteCommand)
78
+ .command(command_object_8.yargsGenerateCommand)
79
+ .command(command_object_10.yargsImportCommand)
80
+ .command(command_object_11.yargsInitCommand)
81
+ .command(command_object_14.yargsInternalMigrateCommand)
82
+ .command(command_object_12.yargsListCommand)
83
+ .command(command_object_14.yargsMigrateCommand)
84
+ .command(command_object_15.yargsNewCommand)
85
85
  .command(command_objects_1.yargsPrintAffectedCommand)
86
- .command(command_object_27.yargsReleaseCommand)
87
- .command(command_object_28.yargsRepairCommand)
88
- .command(command_object_29.yargsReportCommand)
89
- .command(command_object_30.yargsResetCommand)
90
- .command(command_object_32.yargsRunCommand)
91
- .command(command_object_31.yargsRunManyCommand)
92
- .command(command_object_33.yargsShowCommand)
93
- .command(command_object_34.yargsSyncCommand)
94
- .command(command_object_34.yargsSyncCheckCommand)
95
- .command(command_object_17.yargsViewLogsCommand)
96
- .command(command_object_35.yargsWatchCommand)
97
- .command(command_object_32.yargsNxInfixCommand)
98
- .command(command_object_20.yargsLoginCommand)
99
- .command(command_object_21.yargsLogoutCommand)
100
- .command(command_object_22.yargsRecordCommand)
101
- .command(command_object_24.yargsStartCiRunCommand)
102
- .command(command_object_25.yargsStartNxAgentsCommand)
103
- .command(command_object_23.yargsStartAgentCommand)
104
- .command(command_object_16.yargsStopAllAgentsCommand)
105
- .command(command_object_19.yargsFixCiCommand)
106
- .command(command_object_15.yargsApplyLocallyCommand)
107
- .command(command_object_18.yargsDownloadCloudClientCommand)
108
- .command(command_object_12.yargsMcpCommand)
109
- .command(command_object_36.yargsCompletionCommand)
110
- .command(resolveConformanceCommandObject())
111
- .command(resolveConformanceCheckCommandObject())
86
+ .command(command_object_28.yargsReleaseCommand)
87
+ .command(command_object_29.yargsRepairCommand)
88
+ .command(command_object_30.yargsReportCommand)
89
+ .command(command_object_31.yargsResetCommand)
90
+ .command(command_object_33.yargsRunCommand)
91
+ .command(command_object_32.yargsRunManyCommand)
92
+ .command(command_object_34.yargsShowCommand)
93
+ .command(command_object_35.yargsSyncCommand)
94
+ .command(command_object_35.yargsSyncCheckCommand)
95
+ .command(command_object_18.yargsViewLogsCommand)
96
+ .command(command_object_36.yargsWatchCommand)
97
+ .command(command_object_33.yargsNxInfixCommand)
98
+ .command(command_object_21.yargsLoginCommand)
99
+ .command(command_object_22.yargsLogoutCommand)
100
+ .command(command_object_23.yargsRecordCommand)
101
+ .command(command_object_25.yargsStartCiRunCommand)
102
+ .command(command_object_26.yargsStartNxAgentsCommand)
103
+ .command(command_object_24.yargsStartAgentCommand)
104
+ .command(command_object_17.yargsStopAllAgentsCommand)
105
+ .command(command_object_20.yargsFixCiCommand)
106
+ .command(command_object_16.yargsApplyLocallyCommand)
107
+ .command(command_object_19.yargsDownloadCloudClientCommand)
108
+ .command(command_object_13.yargsMcpCommand)
109
+ .command(command_object_37.yargsCompletionCommand)
110
+ .command((0, command_object_2.resolveConformanceCommandObject)('conformance'))
111
+ .command((0, command_object_2.resolveConformanceCommandObject)('conformance:check'))
112
112
  .scriptName('nx')
113
113
  .middleware((args) => {
114
114
  // Skip analytics during shell completion (defensive — bin/nx.ts exits
@@ -133,53 +133,3 @@ exports.commandsObject = yargs
133
133
  // so that it shows up in help. The default yargs implementation of --version is not
134
134
  // hit, as the implementation in nx.ts is hit first and calls process.exit(0).
135
135
  .version();
136
- function createMissingConformanceCommand(command) {
137
- return {
138
- command,
139
- // Hide from --help output in the common case of not having the plugin installed
140
- describe: false,
141
- handler: () => {
142
- output_1.output.error({
143
- title: `${command} is not available`,
144
- bodyLines: [
145
- `In order to use the \`nx ${command}\` command you must have an active Nx key and the \`@nx/conformance\` plugin installed.`,
146
- '',
147
- 'To learn more, visit https://nx.dev/nx-enterprise/powerpack/conformance',
148
- ],
149
- });
150
- process.exit(1);
151
- },
152
- };
153
- }
154
- function resolveConformanceCommandObject() {
155
- try {
156
- const { yargsConformanceCommand } = (() => {
157
- try {
158
- return require('@nx/powerpack-conformance');
159
- }
160
- catch {
161
- return require('@nx/conformance');
162
- }
163
- })();
164
- return yargsConformanceCommand;
165
- }
166
- catch {
167
- return createMissingConformanceCommand('conformance');
168
- }
169
- }
170
- function resolveConformanceCheckCommandObject() {
171
- try {
172
- const { yargsConformanceCheckCommand } = (() => {
173
- try {
174
- return require('@nx/powerpack-conformance');
175
- }
176
- catch {
177
- return require('@nx/conformance');
178
- }
179
- })();
180
- return yargsConformanceCheckCommand;
181
- }
182
- catch {
183
- return createMissingConformanceCommand('conformance:check');
184
- }
185
- }
@@ -85,6 +85,7 @@ export type ReleaseOptions = NxReleaseArgs & FirstReleaseArgs & DockerVersionSch
85
85
  preid?: VersionOptions['preid'];
86
86
  skipPublish?: boolean;
87
87
  otp?: number;
88
+ gitPush?: boolean;
88
89
  };
89
90
  export type VersionPlanArgs = {
90
91
  deleteVersionPlans?: boolean;
@@ -90,6 +90,10 @@ const releaseCommand = {
90
90
  .option('skip-publish', {
91
91
  type: 'boolean',
92
92
  description: 'Skip publishing by automatically answering no to the confirmation prompt for publishing.',
93
+ })
94
+ .option('git-push', {
95
+ describe: 'Whether or not to automatically push the changes made by this command to the remote git repository.',
96
+ type: 'boolean',
93
97
  })
94
98
  .option('otp', {
95
99
  type: 'number',
@@ -74,12 +74,14 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
74
74
  const shouldCommit = userProvidedReleaseConfig.git?.commit ?? true;
75
75
  const shouldStage = (shouldCommit || userProvidedReleaseConfig.git?.stageChanges) ?? false;
76
76
  const shouldTag = userProvidedReleaseConfig.git?.tag ?? true;
77
+ const shouldPushFromGitConfig = args.gitPush ?? nxReleaseConfig.git.push;
77
78
  const shouldCreateWorkspaceRemoteRelease = shouldCreateRemoteRelease(nxReleaseConfig.changelog.workspaceChangelog);
78
79
  const { workspaceVersion, projectsVersionData, releaseGraph, } = await releaseVersion({
79
80
  ...args,
80
81
  stageChanges: shouldStage,
81
82
  gitCommit: false,
82
83
  gitTag: false,
84
+ gitPush: false,
83
85
  deleteVersionPlans: false,
84
86
  });
85
87
  // Suppress the filter log for the changelog command as it would have already been printed by the version command
@@ -185,10 +187,10 @@ function createAPI(overrideReleaseConfig, ignoreNxJsonConfig) {
185
187
  }
186
188
  }
187
189
  let hasPushedChanges = false;
188
- // If the workspace or any of the release groups specify that a remote release should be created, we need to push the changes to the remote
189
- const shouldPush = (shouldCreateWorkspaceRemoteRelease ||
190
- releaseGraph.releaseGroups.some((group) => shouldCreateRemoteRelease(group.changelog))) ??
191
- false;
190
+ // Push the release commit and tags when git push is enabled, or when a remote release needs them on the remote.
191
+ const shouldPush = shouldPushFromGitConfig ||
192
+ shouldCreateWorkspaceRemoteRelease ||
193
+ releaseGraph.releaseGroups.some((group) => shouldCreateRemoteRelease(group.changelog));
192
194
  if (shouldPush) {
193
195
  output_1.output.logSingleLine(`Pushing to git remote "origin"`);
194
196
  await (0, git_1.gitPush)({
@@ -4,6 +4,7 @@ exports.resolveNxJsonConfigErrorMessage = resolveNxJsonConfigErrorMessage;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
6
  const handle_import_1 = require("../../../utils/handle-import");
7
+ const json_1 = require("../../../utils/json");
7
8
  const path_1 = require("../../../utils/path");
8
9
  const workspace_root_1 = require("../../../utils/workspace-root");
9
10
  async function resolveNxJsonConfigErrorMessage(propPath) {
@@ -22,32 +23,9 @@ async function getJsonConfigLinesForErrorMessage(rawConfig, jsonPath) {
22
23
  const jsonParser = await (0, handle_import_1.handleImport)('jsonc-parser');
23
24
  const rootNode = jsonParser.parseTree(rawConfig);
24
25
  const node = jsonParser.findNodeAtLocation(rootNode, jsonPath);
25
- return computeJsonLineNumbers(rawConfig, node?.offset, node?.length);
26
+ return (0, json_1.computeJsonLineNumbers)(rawConfig, node?.offset, node?.length);
26
27
  }
27
28
  catch {
28
29
  return null;
29
30
  }
30
31
  }
31
- function computeJsonLineNumbers(inputText, startOffset, characterCount) {
32
- let lines = inputText.split('\n');
33
- let totalChars = 0;
34
- let startLine = 0;
35
- let endLine = 0;
36
- for (let i = 0; i < lines.length; i++) {
37
- totalChars += lines[i].length + 1; // +1 for '\n' character
38
- if (!startLine && totalChars >= startOffset) {
39
- startLine = i + 1; // +1 because arrays are 0-based
40
- }
41
- if (totalChars >= startOffset + characterCount) {
42
- endLine = i + 1; // +1 because arrays are 0-based
43
- break;
44
- }
45
- }
46
- if (!startLine) {
47
- throw new Error('Start offset exceeds the text length');
48
- }
49
- if (!endLine) {
50
- throw new Error('Character count exceeds the text length after start offset');
51
- }
52
- return { startLine, endLine };
53
- }
@@ -394,7 +394,7 @@ function findMisalignedPackagesForPackage(base) {
394
394
  }
395
395
  function findInstalledPowerpackPlugins() {
396
396
  const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
397
- return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/(conformance|owners|enterprise*)').test(dep.name));
397
+ return installedPlugins.filter((dep) => new RegExp('@nx/powerpack*|@nx/(.+)-cache|@nx/enterprise*').test(dep.name));
398
398
  }
399
399
  function findInstalledCommunityPlugins() {
400
400
  const installedPlugins = (0, installed_plugins_1.findInstalledPlugins)();
@@ -688,6 +688,115 @@ export interface NxReleaseConfiguration {
688
688
  */
689
689
  versionPlans?: NxReleaseVersionPlansConfiguration | boolean;
690
690
  }
691
+ /**
692
+ * Configuration for the `nx conformance` command, provided by `@nx/conformance`.
693
+ */
694
+ export interface NxConformanceConfiguration {
695
+ /**
696
+ * Optional path to write the conformance results to, defaults to "dist/conformance-result.json".
697
+ * Set to false to disable writing the conformance results to a file.
698
+ */
699
+ outputPath?: string | false;
700
+ rules: {
701
+ /**
702
+ * Relative path to a local rule implementation, node_module path or nx-cloud rule ID for Nx Cloud Enterprise.
703
+ */
704
+ rule: string;
705
+ /**
706
+ * Rule specific configuration options.
707
+ */
708
+ options?: Record<string, unknown>;
709
+ /**
710
+ * The projects array allows users to opt in or out of violations for specific projects being reported by the current rule.
711
+ * The array can contain any valid matchers for findMatchingProjects(), by default the implied value is ["*"].
712
+ *
713
+ * We additionally provide an object syntax for projects which allows users to provide by a matcher string and an
714
+ * explanation to communicate to their colleagues why a particular project or projects was included or excluded from
715
+ * consideration from the rule.
716
+ *
717
+ * The explanation currently does nothing to affect any functionality.
718
+ */
719
+ projects?: Array<string | {
720
+ matcher: string;
721
+ explanation: string;
722
+ }>;
723
+ /**
724
+ * Optional explanation field for users to be able to communicate to their colleague why a particular rule is
725
+ * enabled and important to the workspace in question.
726
+ *
727
+ * Currently does nothing to affect any functionality.
728
+ */
729
+ explanation?: string;
730
+ /**
731
+ * Override the default status of the rule, which is "enforced".
732
+ *
733
+ * If set to "evaluated", the rule will be reported as normal, but not enforced (will exit with code 0).
734
+ * If set to "disabled", the rule will not be evaluated at all.
735
+ */
736
+ status?: 'enforced' | 'evaluated' | 'disabled';
737
+ }[];
738
+ }
739
+ type NxOwnersPatternBase = {
740
+ /**
741
+ * Owner IDs for the matched files, or `false` to mark them as having no owners
742
+ * (e.g. files managed by a bot user).
743
+ */
744
+ owners: string[] | false;
745
+ description?: string;
746
+ /**
747
+ * Whether the root `owners.prefix` applies to this pattern. Defaults to `true`.
748
+ */
749
+ applyPrefix?: boolean;
750
+ /**
751
+ * Prefix for this pattern's owners, taking precedence over the root `owners.prefix`.
752
+ */
753
+ prefix?: string;
754
+ };
755
+ type NxOwnersPattern = NxOwnersPatternBase & NxOwnersPatternTarget;
756
+ type NxOwnersSectionPattern = Omit<NxOwnersPatternBase, 'owners'> & Partial<Pick<NxOwnersPatternBase, 'owners'>> & NxOwnersPatternTarget;
757
+ /**
758
+ * When both `projects` and `files` are provided, file patterns are evaluated relative to each
759
+ * matched project root instead of the workspace root.
760
+ */
761
+ type NxOwnersPatternTarget = {
762
+ files: string[];
763
+ } | {
764
+ projects: string[];
765
+ } | {
766
+ projects: string[];
767
+ files: string[];
768
+ };
769
+ /**
770
+ * Configuration for CODEOWNERS generation, provided by `@nx/owners`.
771
+ */
772
+ export interface NxOwnersConfiguration {
773
+ /**
774
+ * Defaults to `github`.
775
+ */
776
+ format?: 'github' | 'gitlab' | 'bitbucket';
777
+ /**
778
+ * Defaults to the format's conventional location, e.g. `.github/CODEOWNERS`.
779
+ */
780
+ outputPath?: string;
781
+ /**
782
+ * Prefix applied to owner strings, e.g. `@org`.
783
+ */
784
+ prefix?: string;
785
+ patterns?: NxOwnersPattern[];
786
+ /**
787
+ * GitLab only. Groups patterns with approval requirements.
788
+ */
789
+ sections?: {
790
+ name: string;
791
+ /**
792
+ * A pattern without `owners` uses the section's `defaultOwners`.
793
+ */
794
+ patterns: NxOwnersSectionPattern[];
795
+ defaultOwners?: string[];
796
+ numberOfRequiredApprovals?: number;
797
+ optional?: boolean;
798
+ }[];
799
+ }
691
800
  export interface NxSyncConfiguration {
692
801
  /**
693
802
  * List of workspace-wide sync generators to be run (not attached to targets).
@@ -935,6 +1044,14 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
935
1044
  * Configuration for the `nx migrate` command.
936
1045
  */
937
1046
  migrate?: NxMigrateConfiguration;
1047
+ /**
1048
+ * Configuration for the `nx conformance` command.
1049
+ */
1050
+ conformance?: NxConformanceConfiguration;
1051
+ /**
1052
+ * Configuration for CODEOWNERS generation. Set to `true` to enable it with defaults.
1053
+ */
1054
+ owners?: NxOwnersConfiguration | boolean;
938
1055
  /**
939
1056
  * Sets the maximum size of the local cache. Accepts a number followed by a unit (e.g. 100MB). Accepted units are B, KB, MB, and GB.
940
1057
  */
@@ -371,13 +371,12 @@ export interface TargetConfiguration<T = any> {
371
371
  */
372
372
  syncGenerators?: string[];
373
373
  /**
374
- * Spread token used when merging target configurations. When set to `true`,
375
- * base (inferred) values take priority over this target's values for any
376
- * shared keys — effectively "only add new keys without overwriting inferred
377
- * values". Keys that do not exist in the base target are still added.
378
- *
379
- * The position of `'...'` in the object's key order follows standard
380
- * last-write-wins semantics with {@link https://nx.dev/reference/project-configuration#spread-token}.
374
+ * Spread token used when merging with a compatible base (inferred) target.
375
+ * Keys before it defer to the base value; keys after it win. In project
376
+ * configuration, a target with a different executor, command or script
377
+ * replaces the base regardless. `options`, `configurations`, `ultracache`
378
+ * and `metadata` merge by their own rules wherever the token sits.
379
+ * See {@link https://nx.dev/reference/project-configuration#spread-token}.
381
380
  */
382
381
  '...'?: true;
383
382
  }
@@ -82,7 +82,7 @@ function kickOffRecompute() {
82
82
  // Plugin set we just loaded may already be stale vs disk.
83
83
  if (isStale(myPluginsHash))
84
84
  return chainToSuccessor(myPromise);
85
- const result = await processFilesAndCreateAndSerializeProjectGraph(plugins);
85
+ const result = await processFilesAndCreateAndSerializeProjectGraph(plugins, myPromise);
86
86
  // Compute may have run against plugins that are now stale.
87
87
  if (isStale(myPluginsHash))
88
88
  return chainToSuccessor(myPromise);
@@ -111,16 +111,17 @@ function kickOffRecompute() {
111
111
  function isStale(expectedHash) {
112
112
  return readNxJsonPluginsHash() !== expectedHash;
113
113
  }
114
- /**
115
- * Starts a successor recompute only when this IIFE is still the cached one.
116
- * If a newer recompute already replaced the cached pointer, that newer
117
- * recompute will produce the fresh result and we just need to return the
118
- * pointer so awaiters chain onto it.
119
- */
120
114
  function chainToSuccessor(myPromise) {
121
115
  logger_1.serverLogger.log('Discarding stale recompute result (nx.json plugins changed mid-compute).');
122
- if (cachedSerializedProjectGraphPromise === myPromise)
116
+ return successorOf(myPromise);
117
+ }
118
+ // Kicks a successor unless a newer computation holds the cache: a cleared
119
+ // cache leaves nothing to chain to, and our own promise would await itself.
120
+ function successorOf(myPromise) {
121
+ if (!cachedSerializedProjectGraphPromise ||
122
+ cachedSerializedProjectGraphPromise === myPromise) {
123
123
  kickOffRecompute();
124
+ }
124
125
  return cachedSerializedProjectGraphPromise;
125
126
  }
126
127
  function readNxJsonPluginsHash() {
@@ -403,7 +404,7 @@ function invalidateGraphCache() {
403
404
  function getRecomputationGeneration() {
404
405
  return recomputationGeneration;
405
406
  }
406
- async function processFilesAndCreateAndSerializeProjectGraph(separatedPlugins) {
407
+ async function processFilesAndCreateAndSerializeProjectGraph(separatedPlugins, myPromise) {
407
408
  const plugins = [
408
409
  ...separatedPlugins.specifiedPlugins,
409
410
  ...separatedPlugins.defaultPlugins,
@@ -417,23 +418,15 @@ async function processFilesAndCreateAndSerializeProjectGraph(separatedPlugins) {
417
418
  // forced. A callback landing after this claim re-records and re-queues, and
418
419
  // its stamp then marks this computation stale at the drain.
419
420
  (0, dotenv_graph_changes_1.clearDotEnvFileHashes)();
420
- // A newer kickOffRecompute has already replaced
421
- // cachedSerializedProjectGraphPromise. Returning it lets the async
422
- // unwrap chain our caller onto the newer compute's result; pass
421
+ // The generation moved past ours. Returning the cached promise lets the
422
+ // async unwrap chain our caller onto a newer compute's result; pass
423
423
  // notifyAbort=true when the graph-phase counters still need balancing.
424
424
  const chainToLatest = (notifyAbort) => {
425
425
  if (myGeneration === recomputationGeneration)
426
426
  return null;
427
427
  if (notifyAbort)
428
428
  notifyPluginsGraphAborted(plugins);
429
- // Defensive: if the cache was cleared (e.g. resetInternalState ran)
430
- // there is nothing to chain to. Returning undefined lets `if (stale)
431
- // return stale` fall through and the compute commits stale data.
432
- // Kick off a successor so we always have a real promise to chain to.
433
- if (!cachedSerializedProjectGraphPromise) {
434
- kickOffRecompute();
435
- }
436
- return cachedSerializedProjectGraphPromise;
429
+ return successorOf(myPromise);
437
430
  };
438
431
  try {
439
432
  const updatedFilesSnapshot = new Map(collectedUpdatedFiles);
@@ -29,7 +29,7 @@ export type { TaskResult, TaskResults } from './tasks-runner/life-cycle';
29
29
  /**
30
30
  * @category Workspace
31
31
  */
32
- export type { ExpandedPluginConfiguration, ImplicitDependencyEntry, ImplicitJsonSubsetDependency, NxAffectedConfig, NxJsonConfiguration, PluginConfiguration, TargetDefaults, TargetDefaultEntry, TargetDefaultValue, TargetDefaultArrayEntry, TargetDefaultFilter, } from './config/nx-json';
32
+ export type { ExpandedPluginConfiguration, ImplicitDependencyEntry, ImplicitJsonSubsetDependency, NxAffectedConfig, NxConformanceConfiguration, NxOwnersConfiguration, NxJsonConfiguration, PluginConfiguration, TargetDefaults, TargetDefaultEntry, TargetDefaultValue, TargetDefaultArrayEntry, TargetDefaultFilter, } from './config/nx-json';
33
33
  /**
34
34
  * @category Logger
35
35
  */
@@ -56,6 +56,9 @@ export { formatFilesWithOxfmt, oxfmtConfigFiles, } from './utils/formatters/oxfm
56
56
  export { readYamlFile } from './utils/fileutils';
57
57
  export { globalSpinner } from './utils/spinner';
58
58
  export { signalToCode } from './utils/exit-codes';
59
+ export { handleErrors } from './utils/handle-errors';
60
+ export { computeJsonLineNumbers } from './utils/json';
61
+ export { checkCircularPath, circularPathHasPair, expandIgnoredCircularDependencies, findFilesInCircularPath, findFilesWithDynamicImports, getPath, pathExists, } from './project-graph/utils/project-graph-paths';
59
62
  export { handleImport } from './utils/handle-import';
60
63
  export { PluginCache, safeWriteFileCache } from './utils/plugin-cache-utils';
61
64
  export { emitPluginWorkerLog } from './project-graph/plugins/isolation/worker-streaming';
@@ -82,12 +85,13 @@ export type { ChangedFile, UnregisterCallback } from './daemon/client/client';
82
85
  export { daemonClient } from './daemon/client/client';
83
86
  export type { RunCommandsOptions } from './executors/run-commands/run-commands.impl';
84
87
  export { LARGE_BUFFER, interpolateArgsIntoCommand, normalizeArgs as normalizeRunCommandsArgs, } from './executors/run-commands/run-commands.impl';
85
- export { FsTree } from './generators/tree';
88
+ export { FsTree, flushChanges } from './generators/tree';
86
89
  export { getRelativeProjectJsonSchemaPath } from './generators/utils/project-configuration';
87
90
  export { hashFile } from './hasher/file-hasher';
88
91
  export { filterUsingGlobPatterns, getTargetInputs } from './hasher/task-hasher';
89
92
  export type { JsonInput } from './native';
90
- export { isAiAgent, killProcessTreeGraceful, readShebangHeaders, } from './native';
93
+ export { isAiAgent, killProcessTreeGraceful, readShebangHeaders, unmatchedProjectPatterns, } from './native';
94
+ export { transformProjectGraphForProjectMatching } from './native/transform-objects';
91
95
  export { killChildOnHostExit } from './utils/kill-child-on-host-exit';
92
96
  export { connectToNxCloud } from './nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud';
93
97
  export type { NxCloudOnBoardingStatus } from './nx-cloud/models/onboarding-status';
@@ -103,10 +107,12 @@ export { buildPackageJsonPatterns, buildPackageJsonWorkspacesMatcher, } from './
103
107
  export type { Change, FileChange } from './project-graph/file-utils';
104
108
  export { DeletedFileChange, LockFileChange, TEN_MEGABYTES, WholeFileChange, calculateFileChanges, defaultFileRead, isDeletedFileChange, isLockFileChange, isWholeFileChange, readPackageJson, } from './project-graph/file-utils';
105
109
  export type { FileMapCache } from './project-graph/nx-deps-cache';
106
- export { readFileMapCache } from './project-graph/nx-deps-cache';
110
+ export { readFileMapCache, readSourceMapsCache, } from './project-graph/nx-deps-cache';
111
+ export { findClosestMatches } from './utils/string-similarity';
107
112
  export { isNpmProject } from './project-graph/operators';
108
113
  export { buildProjectGraphAndSourceMapsWithoutDaemon, createProjectGraphAndSourceMapsAsync, handleProjectGraphError, preventRecursionInGraphConstruction, readCachedProjectConfiguration, } from './project-graph/project-graph';
109
114
  export type { ProjectRootMappings } from './project-graph/utils/find-project-for-path';
115
+ export { createFileMapUsingProjectGraph } from './project-graph/file-map-utils';
110
116
  export type { BatchResults } from './tasks-runner/batch/batch-messages';
111
117
  export type { CachedResult, TaskWithCachedResult } from './tasks-runner/cache';
112
118
  export { Cache } from './tasks-runner/cache';
@@ -123,7 +129,7 @@ export { runNxSync } from './utils/child-process';
123
129
  export { codeFrameColumns } from './utils/code-frames';
124
130
  export { deduceDefaultBase } from './utils/default-base';
125
131
  export { createDirectory, directoryExists, fileExists, isRelativePath, readFileIfExisting, } from './utils/fileutils';
126
- export { getLatestCommitSha } from './utils/git-utils';
132
+ export { getLatestCommitSha, getVcsRemoteInfo } from './utils/git-utils';
127
133
  export { combineGlobPatterns, isGlobPattern } from './utils/globs';
128
134
  export { getNxRequirePaths } from './utils/installation-directory';
129
135
  export { NX_PREFIX } from './utils/logger';
@@ -145,3 +151,4 @@ export { getFilesInDirectoryUsingContext, globWithWorkspaceContext, resetWorkspa
145
151
  export { setWorkspaceRoot, workspaceRootInner } from './utils/workspace-root';
146
152
  export { safeExecFileSync, safeSpawn } from './utils/safe-spawn';
147
153
  export { resolveStartupHost } from './tasks-runner/readiness/startup-host';
154
+ export type { ProjectMetadata } from './config/workspace-json-project-json';