nx 23.3.0 → 24.0.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 (114) hide show
  1. package/README.md +3 -6
  2. package/dist/nx-cloud-internals.d.ts +1 -0
  3. package/dist/nx-cloud-internals.js +7 -1
  4. package/dist/src/adapter/ngcli-adapter.js +1 -0
  5. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -12
  6. package/dist/src/command-line/graph/graph.js +3 -5
  7. package/dist/src/command-line/init/command-object.js +0 -12
  8. package/dist/src/command-line/init/init-v2.js +0 -2
  9. package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
  10. package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
  11. package/dist/src/command-line/migrate/agentic/master/spawn-master.js +76 -15
  12. package/dist/src/command-line/migrate/execute-migration.d.ts +2 -2
  13. package/dist/src/command-line/migrate/execute-migration.js +18 -10
  14. package/dist/src/command-line/migrate/migrate-commits.d.ts +4 -1
  15. package/dist/src/command-line/migrate/migrate-commits.js +10 -3
  16. package/dist/src/command-line/migrate/migrate.js +43 -6
  17. package/dist/src/command-line/migrate/run/agent-output.d.ts +1 -0
  18. package/dist/src/command-line/migrate/run/agent-output.js +5 -0
  19. package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
  20. package/dist/src/command-line/migrate/run/broker.js +68 -20
  21. package/dist/src/command-line/migrate/run/index.d.ts +4 -3
  22. package/dist/src/command-line/migrate/run/index.js +8 -1
  23. package/dist/src/command-line/migrate/run/orchestrator.js +72 -13
  24. package/dist/src/command-line/migrate/run/runbook.js +19 -0
  25. package/dist/src/command-line/migrate/run/state-machine.js +4 -1
  26. package/dist/src/command-line/migrate/run/util.d.ts +3 -0
  27. package/dist/src/command-line/migrate/run/util.js +7 -1
  28. package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
  29. package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
  30. package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
  31. package/dist/src/command-line/run/executor-utils.js +1 -0
  32. package/dist/src/command-line/run/run-one.d.ts +20 -1
  33. package/dist/src/command-line/run/run-one.js +153 -5
  34. package/dist/src/command-line/show/show-target/info.js +1 -1
  35. package/dist/src/command-line/show/show-target/utils.js +1 -0
  36. package/dist/src/command-line/watch/command-object.js +3 -22
  37. package/dist/src/command-line/watch/watch.d.ts +0 -7
  38. package/dist/src/command-line/watch/watch.js +1 -1
  39. package/dist/src/config/misc-interfaces.d.ts +12 -0
  40. package/dist/src/config/task-graph.d.ts +1 -1
  41. package/dist/src/config/workspace-json-project-json.d.ts +65 -0
  42. package/dist/src/core/graph/main.js +1 -1
  43. package/dist/src/daemon/client/client.d.ts +9 -0
  44. package/dist/src/daemon/client/client.js +89 -37
  45. package/dist/src/daemon/server/shutdown-utils.js +0 -3
  46. package/dist/src/daemon/socket-utils.d.ts +9 -4
  47. package/dist/src/daemon/socket-utils.js +12 -49
  48. package/dist/src/daemon/tmp-dir.d.ts +19 -14
  49. package/dist/src/daemon/tmp-dir.js +142 -354
  50. package/dist/src/devkit-exports.d.ts +1 -1
  51. package/dist/src/devkit-internals.d.ts +1 -1
  52. package/dist/src/devkit-internals.js +1 -0
  53. package/dist/src/hasher/check-task-files.js +4 -4
  54. package/dist/src/hasher/file-hasher.js +9 -7
  55. package/dist/src/hasher/hash-task.js +4 -0
  56. package/dist/src/hasher/native-task-hasher-impl.js +3 -1
  57. package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
  58. package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
  59. package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
  60. package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +145 -0
  61. package/dist/src/native/index.d.ts +180 -12
  62. package/dist/src/native/native-bindings.js +8 -0
  63. package/dist/src/native/nx.wasi-browser.js +1 -0
  64. package/dist/src/native/nx.wasi.cjs +1 -0
  65. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  66. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  67. package/dist/src/nx-cloud/update-manager.d.ts +7 -0
  68. package/dist/src/nx-cloud/update-manager.js +237 -50
  69. package/dist/src/project-graph/affected/affected-tasks.js +1 -0
  70. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
  71. package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
  72. package/dist/src/tasks-runner/create-task-graph.js +47 -26
  73. package/dist/src/tasks-runner/init-tasks-runner.js +13 -0
  74. package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
  75. package/dist/src/tasks-runner/life-cycle.js +7 -0
  76. package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
  77. package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
  78. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
  79. package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
  80. package/dist/src/tasks-runner/readiness/probes.d.ts +9 -0
  81. package/dist/src/tasks-runner/readiness/probes.js +62 -0
  82. package/dist/src/tasks-runner/readiness/ready-when.d.ts +38 -0
  83. package/dist/src/tasks-runner/readiness/ready-when.js +190 -0
  84. package/dist/src/tasks-runner/run-command.js +5 -4
  85. package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
  86. package/dist/src/tasks-runner/task-env.d.ts +10 -0
  87. package/dist/src/tasks-runner/task-env.js +26 -5
  88. package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
  89. package/dist/src/tasks-runner/task-graph-utils.js +17 -12
  90. package/dist/src/tasks-runner/task-orchestrator.d.ts +37 -8
  91. package/dist/src/tasks-runner/task-orchestrator.js +460 -76
  92. package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
  93. package/dist/src/tasks-runner/tasks-schedule.js +64 -6
  94. package/dist/src/tasks-runner/utils.d.ts +20 -5
  95. package/dist/src/tasks-runner/utils.js +70 -35
  96. package/dist/src/ultracache/overrides.js +4 -0
  97. package/dist/src/utils/child-process.js +1 -0
  98. package/dist/src/utils/git-utils.d.ts +6 -1
  99. package/dist/src/utils/git-utils.js +26 -5
  100. package/dist/src/utils/owned-private-dir.d.ts +1 -17
  101. package/dist/src/utils/owned-private-dir.js +10 -62
  102. package/dist/src/utils/perf-hooks.d.ts +1 -0
  103. package/dist/src/utils/plugins/core-plugins.js +1 -1
  104. package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
  105. package/dist/src/utils/spawn-without-terminal.js +110 -0
  106. package/dist/src/utils/string-similarity.d.ts +38 -0
  107. package/dist/src/utils/string-similarity.js +108 -0
  108. package/migrations.json +7 -0
  109. package/package.json +11 -20
  110. package/readme-template.md +3 -3
  111. package/schemas/nx-schema.json +70 -0
  112. package/schemas/project-schema.json +67 -0
  113. package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
  114. package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
@@ -44,6 +44,7 @@ projects) {
44
44
  const batchImplementationFactory = executorConfig.batchImplementation
45
45
  ? (0, schema_utils_1.getImplementationFactory)(executorConfig.batchImplementation, executorsDir, nodeModule, projects)
46
46
  : null;
47
+ // TODO(v25): remove custom hasher support.
47
48
  const hasherFactory = executorConfig.hasher
48
49
  ? (0, schema_utils_1.getImplementationFactory)(executorConfig.hasher, executorsDir, nodeModule, projects)
49
50
  : null;
@@ -1,5 +1,5 @@
1
1
  import { NxJsonConfiguration } from '../../config/nx-json';
2
- import { ProjectGraph } from '../../config/project-graph';
2
+ import { ProjectGraph, ProjectGraphProjectNode } from '../../config/project-graph';
3
3
  import { TargetDependencyConfig } from '../../config/workspace-json-project-json';
4
4
  export declare function runOne(cwd: string, args: {
5
5
  [k: string]: any;
@@ -7,6 +7,25 @@ export declare function runOne(cwd: string, args: {
7
7
  excludeTaskDependencies: boolean;
8
8
  loadDotEnvFiles: boolean;
9
9
  }): Promise<void>;
10
+ /**
11
+ * Builds the error shown when the project itself can't be found. Matches the
12
+ * attempted `project:target[:configuration]` against every runnable task id so
13
+ * a project typo (e.g. `webpai:build`) still surfaces the intended task
14
+ * (`webapi:build`).
15
+ */
16
+ export declare function getCannotFindProjectError(projectGraph: ProjectGraph, projectName: string, target: string, configuration?: string): {
17
+ title: string;
18
+ bodyLines: string[];
19
+ };
20
+ /**
21
+ * Validates that `target` exists on the resolved project. When it does not,
22
+ * returns an error describing the available targets (and the closest match, if
23
+ * any) so the user can recover from a typo or discover what they can run.
24
+ */
25
+ export declare function getRunOneTargetError(project: ProjectGraphProjectNode, target: string, configuration?: string): {
26
+ title: string;
27
+ bodyLines: string[];
28
+ } | null;
10
29
  export declare function parseRunOneOptions(cwd: string, parsedArgs: {
11
30
  [k: string]: any;
12
31
  }, projectGraph: ProjectGraph, nxJson: NxJsonConfiguration): {
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runOne = runOne;
4
+ exports.getCannotFindProjectError = getCannotFindProjectError;
5
+ exports.getRunOneTargetError = getRunOneTargetError;
4
6
  exports.parseRunOneOptions = parseRunOneOptions;
5
7
  const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
6
8
  const configuration_1 = require("../../config/configuration");
@@ -11,6 +13,7 @@ const command_line_utils_1 = require("../../utils/command-line-utils");
11
13
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
12
14
  const output_1 = require("../../utils/output");
13
15
  const split_target_1 = require("../../utils/split-target");
16
+ const string_similarity_1 = require("../../utils/string-similarity");
14
17
  const workspace_root_1 = require("../../utils/workspace-root");
15
18
  const graph_1 = require("../graph/graph");
16
19
  const connect_to_nx_cloud_1 = require("../nx-cloud/connect/connect-to-nx-cloud");
@@ -28,7 +31,12 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
28
31
  configuration: opts.configuration,
29
32
  targets: [opts.target],
30
33
  }, 'run-one', { printWarnings: args.graph !== 'stdout' }, nxJson);
31
- const { projects, projectName } = getProjects(projectGraph, opts.project);
34
+ const { projects, projectName } = getProjects(projectGraph, opts.project, opts.target, opts.configuration);
35
+ const targetError = getRunOneTargetError(projects[0], opts.target, opts.configuration);
36
+ if (targetError) {
37
+ output_1.output.error(targetError);
38
+ process.exit(1);
39
+ }
32
40
  if (nxArgs.help) {
33
41
  await (await (0, handle_import_1.handleImport)('./run.js', __dirname)).printTargetRunHelp({
34
42
  ...opts,
@@ -59,7 +67,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
59
67
  process.exit(status);
60
68
  }
61
69
  }
62
- function getProjects(projectGraph, projectName) {
70
+ function getProjects(projectGraph, projectName, target, configuration) {
63
71
  if (projectGraph.nodes[projectName]) {
64
72
  return {
65
73
  projectName: projectName,
@@ -90,11 +98,151 @@ function getProjects(projectGraph, projectName) {
90
98
  process.exit(1);
91
99
  }
92
100
  }
93
- output_1.output.error({
94
- title: `Cannot find project '${projectName}'`,
95
- });
101
+ output_1.output.error(getCannotFindProjectError(projectGraph, projectName, target, configuration));
96
102
  process.exit(1);
97
103
  }
104
+ // Keep error output scannable: only show a handful of targets/suggestions.
105
+ const MAX_LISTED_TARGETS = 5;
106
+ const MAX_SUGGESTIONS = 3;
107
+ /**
108
+ * Builds the list of all runnable `project:target` task ids in the workspace,
109
+ * used to suggest the right invocation when a project or target can't be found.
110
+ */
111
+ function getProjectTargetIds(projectGraph) {
112
+ const ids = [];
113
+ for (const projectName of Object.keys(projectGraph.nodes)) {
114
+ const targets = projectGraph.nodes[projectName].data.targets ?? {};
115
+ for (const targetName of Object.keys(targets)) {
116
+ ids.push(`${projectName}:${targetName}`);
117
+ }
118
+ }
119
+ return ids;
120
+ }
121
+ /**
122
+ * A target (and even a configuration) name can legally contain ':'. When the
123
+ * user typos such a name, `splitTarget` splits on every ':' and parses the
124
+ * trailing segment(s) as separate parts (e.g. `nx:zzcustom:variantt` becomes
125
+ * project `nx`, target `zzcustom`, configuration `variantt`).
126
+ *
127
+ * To match the real name we therefore score the fully-rejoined specifier and
128
+ * every progressively shorter form, and keep whichever produced the closest
129
+ * candidate. Rejoining wins for colon-containing names, while the shorter forms
130
+ * keep matching genuine `target` + `configuration` typos (where the real target
131
+ * name does not carry the configuration suffix). Ties go to the longer form,
132
+ * which is the one that reproduces the name the user actually typed.
133
+ */
134
+ function findClosestSpecifier(parts, candidates, limit = 1) {
135
+ const present = parts.filter((part) => !!part);
136
+ let best = [];
137
+ for (let end = present.length; end >= 1; end--) {
138
+ const matches = (0, string_similarity_1.rankSuggestions)(present.slice(0, end).join(':'), candidates);
139
+ if (matches.length &&
140
+ (!best.length || matches[0].distance < best[0].distance)) {
141
+ best = matches;
142
+ }
143
+ }
144
+ return best.slice(0, limit).map(({ candidate }) => candidate);
145
+ }
146
+ /**
147
+ * Finds the closest available target to what the user typed, staying
148
+ * config-aware. When a configuration was parsed off the specifier, the rejoined
149
+ * `target:configuration` is scored too, so a colon-containing real target name
150
+ * (e.g. `zzcustom:variant`) still matches. Both forms are scored and the closest
151
+ * candidate wins, ties going to the rejoined form -- mirroring
152
+ * `findClosestSpecifier`'s preference order. The bare-`target` tier reuses the
153
+ * precomputed `ranked` list (its head, gated by the suggestion threshold)
154
+ * instead of recomputing distances.
155
+ */
156
+ function findClosestTarget(target, configuration, availableTargets, ranked) {
157
+ let best;
158
+ if (configuration) {
159
+ [best] = (0, string_similarity_1.rankSuggestions)(`${target}:${configuration}`, availableTargets);
160
+ }
161
+ const nearest = ranked[0];
162
+ if (nearest &&
163
+ (0, string_similarity_1.isWithinSuggestionThreshold)(target, nearest.candidate, nearest.distance) &&
164
+ (!best || nearest.distance < best.distance)) {
165
+ best = nearest;
166
+ }
167
+ return best?.candidate;
168
+ }
169
+ /**
170
+ * Lists up to `MAX_LISTED_TARGETS` targets from a list already ranked by how
171
+ * closely they resemble the target the user typed (closest first, ties broken
172
+ * alphabetically) so the most likely intended targets surface first.
173
+ * `closestMatch` is dropped because it is already surfaced separately as the
174
+ * "Did you mean" suggestion. Appends a "...and N more" line when the project has
175
+ * more targets than we show, and returns no lines at all when the suggestion was
176
+ * the project's only target -- a bare "Available targets:" header reads as "this
177
+ * project has none".
178
+ */
179
+ function formatAvailableTargets(ranked, closestMatch) {
180
+ const targets = ranked
181
+ .map(({ candidate }) => candidate)
182
+ .filter((candidate) => candidate !== closestMatch);
183
+ if (!targets.length) {
184
+ return [];
185
+ }
186
+ const shown = targets.slice(0, MAX_LISTED_TARGETS);
187
+ const lines = ['Available targets:', ...shown.map((t) => ` - ${t}`)];
188
+ if (targets.length > shown.length) {
189
+ lines.push(` ...and ${targets.length - shown.length} more`);
190
+ }
191
+ return lines;
192
+ }
193
+ /**
194
+ * Builds the error shown when the project itself can't be found. Matches the
195
+ * attempted `project:target[:configuration]` against every runnable task id so
196
+ * a project typo (e.g. `webpai:build`) still surfaces the intended task
197
+ * (`webapi:build`).
198
+ */
199
+ function getCannotFindProjectError(projectGraph, projectName, target, configuration) {
200
+ const bodyLines = [];
201
+ const suggestions = findClosestSpecifier([projectName, target, configuration], getProjectTargetIds(projectGraph), MAX_SUGGESTIONS);
202
+ if (suggestions.length) {
203
+ bodyLines.push('Did you mean one of these?', ...suggestions.map((id) => ` - ${id}`));
204
+ }
205
+ return {
206
+ title: `Cannot find project '${projectName}'`,
207
+ bodyLines,
208
+ };
209
+ }
210
+ /**
211
+ * Validates that `target` exists on the resolved project. When it does not,
212
+ * returns an error describing the available targets (and the closest match, if
213
+ * any) so the user can recover from a typo or discover what they can run.
214
+ */
215
+ function getRunOneTargetError(project, target, configuration) {
216
+ const availableTargets = Object.keys(project.data.targets ?? {});
217
+ if (availableTargets.includes(target)) {
218
+ return null;
219
+ }
220
+ const bodyLines = [];
221
+ // Rank the available targets by distance to the bare target ONCE. This drives
222
+ // the ordered "Available targets" block and doubles as the bare-target tier of
223
+ // the closest-match lookup, so distances are not computed twice.
224
+ const ranked = (0, string_similarity_1.rankByDistance)(target, availableTargets);
225
+ const closestMatch = findClosestTarget(target, configuration, availableTargets, ranked);
226
+ if (closestMatch) {
227
+ bodyLines.push(`Did you mean "${closestMatch}"?`);
228
+ }
229
+ if (!availableTargets.length) {
230
+ bodyLines.push(`The project "${project.name}" does not have any targets configured.`);
231
+ }
232
+ else {
233
+ const targetLines = formatAvailableTargets(ranked, closestMatch);
234
+ if (targetLines.length) {
235
+ if (bodyLines.length) {
236
+ bodyLines.push('');
237
+ }
238
+ bodyLines.push(...targetLines);
239
+ }
240
+ }
241
+ return {
242
+ title: `Cannot find target "${target}" for project "${project.name}"`,
243
+ bodyLines,
244
+ };
245
+ }
98
246
  const targetAliases = {
99
247
  b: 'build',
100
248
  e: 'e2e',
@@ -126,7 +126,7 @@ function resolveTaskGraphDependencies(graph, extraTargetDeps, projectName, targe
126
126
  const directDeps = [
127
127
  ...(taskGraph.dependencies[rootId] ?? []),
128
128
  ...(taskGraph.continuousDependencies[rootId] ?? []),
129
- ];
129
+ ].map((edge) => edge.id);
130
130
  const directDepSet = new Set(directDeps);
131
131
  const depSourceIndices = directDeps.map((depTaskId) => {
132
132
  const task = taskGraph.tasks[depTaskId];
@@ -142,6 +142,7 @@ function validateConfiguration(projectName, targetName, configuration, targetCon
142
142
  }
143
143
  }
144
144
  // ── Custom hasher detection ──────────────────────────────────────────
145
+ // TODO(v25): remove custom hasher support.
145
146
  /**
146
147
  * Checks whether a target's executor defines a custom hasher.
147
148
  * Returns true if the executor has a hasherFactory — meaning the
@@ -13,7 +13,7 @@ exports.yargsWatchCommand = {
13
13
  },
14
14
  };
15
15
  function withWatchOptions(yargs) {
16
- return ((0, shared_options_1.withVerbose)(yargs)
16
+ return (0, shared_options_1.withVerbose)(yargs)
17
17
  .parserConfiguration({
18
18
  'strip-dashed': true,
19
19
  'populate--': true,
@@ -32,12 +32,6 @@ function withWatchOptions(yargs) {
32
32
  type: 'boolean',
33
33
  description: 'When watching selected projects, also include the projects they depend on.',
34
34
  alias: 'd',
35
- })
36
- // TODO(v24): remove the deprecated --includeDependentProjects alias
37
- .option('includeDependentProjects', {
38
- type: 'boolean',
39
- hidden: true,
40
- describe: "Deprecated in favor of --includeDependencies; will be removed in Nx 24. The flag name was misleading since it includes the watched project's dependencies, not its dependents. The new flag is functionally identical.",
41
35
  })
42
36
  .option('includeGlobalWorkspaceFiles', {
43
37
  type: 'boolean',
@@ -59,6 +53,7 @@ function withWatchOptions(yargs) {
59
53
  .conflicts({
60
54
  all: 'projects',
61
55
  })
56
+ .strictOptions()
62
57
  .check((args) => {
63
58
  if (!args.all && !args.projects) {
64
59
  throw Error('Please specify either --all or --projects');
@@ -73,19 +68,5 @@ function withWatchOptions(yargs) {
73
68
  else {
74
69
  throw Error('No command specified for watch mode.');
75
70
  }
76
- // --includeDependentProjects was renamed to --includeDependencies in
77
- // Nx 23 because the original name was misleading: it includes the
78
- // watched project's *dependencies*, not its dependents. The new flag
79
- // is functionally identical — only the name changed. Map the legacy
80
- // name through so existing scripts keep working during the
81
- // deprecation window.
82
- // TODO(v24): remove the legacy includeDependentProjects pass-through
83
- const a = args;
84
- if (a.includeDependentProjects !== undefined &&
85
- a.includeDependencies === undefined) {
86
- a.includeDependencies = a.includeDependentProjects;
87
- // eslint-disable-next-line no-console
88
- console.warn("--includeDependentProjects is deprecated in favor of --includeDependencies and will be removed in Nx 24. The flag name was misleading since it includes the watched project's dependencies, not its dependents. The new flag is functionally identical.");
89
- }
90
- }, true));
71
+ }, true);
91
72
  }
@@ -3,13 +3,6 @@ export interface WatchArguments {
3
3
  projects?: string[];
4
4
  all?: boolean;
5
5
  includeDependencies?: boolean;
6
- /**
7
- * @deprecated Renamed to {@link WatchArguments.includeDependencies}; will be
8
- * removed in Nx 24. The original name was misleading: this flag includes
9
- * the watched project's dependencies, not its dependents. The new property
10
- * is functionally identical — only the name changed.
11
- */
12
- includeDependentProjects?: boolean;
13
6
  includeGlobalWorkspaceFiles?: boolean;
14
7
  verbose?: boolean;
15
8
  command?: string;
@@ -149,7 +149,7 @@ async function watch(args) {
149
149
  }
150
150
  await client_1.daemonClient.registerFileWatcher({
151
151
  watchProjects: whatToWatch,
152
- includeDependencies: args.includeDependencies ?? args.includeDependentProjects,
152
+ includeDependencies: args.includeDependencies,
153
153
  includeGlobalWorkspaceFiles: args.includeGlobalWorkspaceFiles,
154
154
  }, async (err, data) => {
155
155
  if (err === 'reconnecting') {
@@ -32,6 +32,9 @@ export interface ExecutorJsonEntryConfig {
32
32
  batchImplementation?: string;
33
33
  preferBatch?: boolean;
34
34
  description?: string;
35
+ /**
36
+ * @deprecated Use target inputs instead. This will be removed in Nx 25.
37
+ */
35
38
  hasher?: string;
36
39
  }
37
40
  export type ExecutorsJsonEntry = string | ExecutorJsonEntryConfig;
@@ -143,6 +146,9 @@ export interface ExecutorConfig {
143
146
  outputCapture?: OutputCaptureMethod;
144
147
  continuous?: boolean;
145
148
  } & Schema;
149
+ /**
150
+ * @deprecated Use target inputs instead. This will be removed in Nx 25.
151
+ */
146
152
  hasherFactory?: () => CustomHasher;
147
153
  implementationFactory: () => Executor;
148
154
  batchImplementationFactory?: () => TaskGraphExecutor;
@@ -172,6 +178,9 @@ options: T, context: ExecutorContext) => AsyncIterableIterator<{
172
178
  * Implementation of a target of a project
173
179
  */
174
180
  export type Executor<T = any> = PromiseExecutor<T> | AsyncIteratorExecutor<T>;
181
+ /**
182
+ * @deprecated Use target inputs instead. This will be removed in Nx 25.
183
+ */
175
184
  export interface HasherContext {
176
185
  hasher: TaskHasher;
177
186
  projectGraph: ProjectGraph;
@@ -179,6 +188,9 @@ export interface HasherContext {
179
188
  projectsConfigurations: ProjectsConfigurations;
180
189
  nxJsonConfiguration: NxJsonConfiguration;
181
190
  }
191
+ /**
192
+ * @deprecated Use target inputs instead. This will be removed in Nx 25.
193
+ */
182
194
  export type CustomHasher = (task: Task, context: HasherContext) => Promise<Hash>;
183
195
  export type TaskResult = {
184
196
  success: boolean;
@@ -3,4 +3,4 @@
3
3
  * `packages/nx/src/native/tasks/types.rs` and exposed to TypeScript via NAPI.
4
4
  * This file re-exports them so existing imports keep working.
5
5
  */
6
- export type { Task, TaskGraph, TaskTarget, TaskHashDetails, TaskUltracacheSettings, } from '../native';
6
+ export type { Task, TaskGraph, TaskGraphEdge, TaskTarget, TaskHashDetails, TaskUltracacheSettings, } from '../native';
@@ -163,6 +163,54 @@ export type Spreadable<T> = T & {
163
163
  * permits `'...'`, which target merging resolves away.
164
164
  */
165
165
  export type TargetUltracacheSettings = Spreadable<TaskUltracacheSettings>;
166
+ export interface ReadyWhenOptions {
167
+ /**
168
+ * Milliseconds to wait for readiness before failing dependents that wait
169
+ * for it. Default is 60000.
170
+ */
171
+ timeout?: number;
172
+ /**
173
+ * Milliseconds between probe attempts. By default attempts back off from
174
+ * 100 to 1000 milliseconds. Unused by `logMatches`.
175
+ */
176
+ interval?: number;
177
+ }
178
+ /**
179
+ * Readiness probe of a continuous target. Exactly one of `url`, `port`,
180
+ * `command` or `logMatches` must be set. Strings may use the `{workspaceRoot}`,
181
+ * `{projectRoot}`, `{projectName}` and `{options.*}` placeholders, resolved
182
+ * against the options the task runs with.
183
+ */
184
+ export type ReadyWhen = ({
185
+ /**
186
+ * Ready when an HTTP or HTTPS GET gets a status from 200 to 403. A
187
+ * redirect counts as ready and is not followed.
188
+ */
189
+ url: string;
190
+ } & ReadyWhenOptions) | ({
191
+ /**
192
+ * Ready when a TCP connection to the port succeeds. A string must
193
+ * resolve to a port number through a placeholder such as
194
+ * `{options.port}`.
195
+ */
196
+ port: number | string;
197
+ /**
198
+ * Host to connect to. By default 127.0.0.1 and ::1 are both tried.
199
+ */
200
+ host?: string;
201
+ } & ReadyWhenOptions) | ({
202
+ /**
203
+ * Ready when the command, run through the shell at the workspace root,
204
+ * exits with code 0.
205
+ */
206
+ command: string;
207
+ } & ReadyWhenOptions) | ({
208
+ /**
209
+ * Ready when every one of these substrings has appeared in the task's
210
+ * output.
211
+ */
212
+ logMatches: string | string[];
213
+ } & ReadyWhenOptions);
166
214
  export interface TargetDependencyConfig {
167
215
  /**
168
216
  * A list of projects that have `target`.
@@ -187,6 +235,17 @@ export interface TargetDependencyConfig {
187
235
  * Whether to forward task options to the dependency target.
188
236
  */
189
237
  options?: 'ignore' | 'forward';
238
+ /**
239
+ * Set to `false` to keep a continuous dependency's inputs out of this
240
+ * target's hash. It still runs first. Has no effect on other dependencies.
241
+ */
242
+ inputs?: boolean;
243
+ /**
244
+ * When the dependency is a continuous task, whether this target waits for
245
+ * it to have started (default) or to be ready per its `readyWhen`.
246
+ * Ignored when the dependency is not continuous or declares no `readyWhen`.
247
+ */
248
+ waitFor?: 'started' | 'ready';
190
249
  }
191
250
  export type InputDefinition = {
192
251
  input: string;
@@ -277,6 +336,12 @@ export interface TargetConfiguration<T = any> {
277
336
  * Whether this target runs continuously
278
337
  */
279
338
  continuous?: boolean;
339
+ /**
340
+ * How Nx detects that this continuous target is ready. Only honored when
341
+ * `continuous` is true; dependents opt in with `waitFor: 'ready'` on their
342
+ * `dependsOn` entry.
343
+ */
344
+ readyWhen?: ReadyWhen;
280
345
  /**
281
346
  * List of generators to run before the target to ensure the workspace
282
347
  * is up to date.