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.
- package/README.md +3 -6
- package/dist/nx-cloud-internals.d.ts +1 -0
- package/dist/nx-cloud-internals.js +7 -1
- package/dist/src/adapter/ngcli-adapter.js +1 -0
- package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +0 -12
- package/dist/src/command-line/graph/graph.js +3 -5
- package/dist/src/command-line/init/command-object.js +0 -12
- package/dist/src/command-line/init/init-v2.js +0 -2
- package/dist/src/command-line/migrate/agentic/close-agent-session.d.ts +1 -1
- package/dist/src/command-line/migrate/agentic/close-agent-session.js +4 -3
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +76 -15
- package/dist/src/command-line/migrate/execute-migration.d.ts +2 -2
- package/dist/src/command-line/migrate/execute-migration.js +18 -10
- package/dist/src/command-line/migrate/migrate-commits.d.ts +4 -1
- package/dist/src/command-line/migrate/migrate-commits.js +10 -3
- package/dist/src/command-line/migrate/migrate.js +43 -6
- package/dist/src/command-line/migrate/run/agent-output.d.ts +1 -0
- package/dist/src/command-line/migrate/run/agent-output.js +5 -0
- package/dist/src/command-line/migrate/run/broker.d.ts +14 -5
- package/dist/src/command-line/migrate/run/broker.js +68 -20
- package/dist/src/command-line/migrate/run/index.d.ts +4 -3
- package/dist/src/command-line/migrate/run/index.js +8 -1
- package/dist/src/command-line/migrate/run/orchestrator.js +72 -13
- package/dist/src/command-line/migrate/run/runbook.js +19 -0
- package/dist/src/command-line/migrate/run/state-machine.js +4 -1
- package/dist/src/command-line/migrate/run/util.d.ts +3 -0
- package/dist/src/command-line/migrate/run/util.js +7 -1
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +17 -12
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +5 -6
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +5 -6
- package/dist/src/command-line/run/executor-utils.js +1 -0
- package/dist/src/command-line/run/run-one.d.ts +20 -1
- package/dist/src/command-line/run/run-one.js +153 -5
- package/dist/src/command-line/show/show-target/info.js +1 -1
- package/dist/src/command-line/show/show-target/utils.js +1 -0
- package/dist/src/command-line/watch/command-object.js +3 -22
- package/dist/src/command-line/watch/watch.d.ts +0 -7
- package/dist/src/command-line/watch/watch.js +1 -1
- package/dist/src/config/misc-interfaces.d.ts +12 -0
- package/dist/src/config/task-graph.d.ts +1 -1
- package/dist/src/config/workspace-json-project-json.d.ts +65 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/client.d.ts +9 -0
- package/dist/src/daemon/client/client.js +89 -37
- package/dist/src/daemon/server/shutdown-utils.js +0 -3
- package/dist/src/daemon/socket-utils.d.ts +9 -4
- package/dist/src/daemon/socket-utils.js +12 -49
- package/dist/src/daemon/tmp-dir.d.ts +19 -14
- package/dist/src/daemon/tmp-dir.js +142 -354
- package/dist/src/devkit-exports.d.ts +1 -1
- package/dist/src/devkit-internals.d.ts +1 -1
- package/dist/src/devkit-internals.js +1 -0
- package/dist/src/hasher/check-task-files.js +4 -4
- package/dist/src/hasher/file-hasher.js +9 -7
- package/dist/src/hasher/hash-task.js +4 -0
- package/dist/src/hasher/native-task-hasher-impl.js +3 -1
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.js +100 -0
- package/dist/src/migrations/update-24-0-0/find-custom-hashers.md +63 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +145 -0
- package/dist/src/native/index.d.ts +180 -12
- package/dist/src/native/native-bindings.js +8 -0
- package/dist/src/native/nx.wasi-browser.js +1 -0
- package/dist/src/native/nx.wasi.cjs +1 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/update-manager.d.ts +7 -0
- package/dist/src/nx-cloud/update-manager.js +237 -50
- package/dist/src/project-graph/affected/affected-tasks.js +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +7 -0
- package/dist/src/tasks-runner/create-task-graph.d.ts +8 -7
- package/dist/src/tasks-runner/create-task-graph.js +47 -26
- package/dist/src/tasks-runner/init-tasks-runner.js +13 -0
- package/dist/src/tasks-runner/life-cycle.d.ts +4 -1
- package/dist/src/tasks-runner/life-cycle.js +7 -0
- package/dist/src/tasks-runner/life-cycles/performance-analysis.d.ts +5 -2
- package/dist/src/tasks-runner/life-cycles/performance-analysis.js +13 -7
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.d.ts +4 -3
- package/dist/src/tasks-runner/life-cycles/performance-life-cycle.js +9 -2
- package/dist/src/tasks-runner/readiness/probes.d.ts +9 -0
- package/dist/src/tasks-runner/readiness/probes.js +62 -0
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +38 -0
- package/dist/src/tasks-runner/readiness/ready-when.js +190 -0
- package/dist/src/tasks-runner/run-command.js +5 -4
- package/dist/src/tasks-runner/running-tasks/node-child-process.js +5 -4
- package/dist/src/tasks-runner/task-env.d.ts +10 -0
- package/dist/src/tasks-runner/task-env.js +26 -5
- package/dist/src/tasks-runner/task-graph-utils.d.ts +9 -6
- package/dist/src/tasks-runner/task-graph-utils.js +17 -12
- package/dist/src/tasks-runner/task-orchestrator.d.ts +37 -8
- package/dist/src/tasks-runner/task-orchestrator.js +460 -76
- package/dist/src/tasks-runner/tasks-schedule.d.ts +18 -1
- package/dist/src/tasks-runner/tasks-schedule.js +64 -6
- package/dist/src/tasks-runner/utils.d.ts +20 -5
- package/dist/src/tasks-runner/utils.js +70 -35
- package/dist/src/ultracache/overrides.js +4 -0
- package/dist/src/utils/child-process.js +1 -0
- package/dist/src/utils/git-utils.d.ts +6 -1
- package/dist/src/utils/git-utils.js +26 -5
- package/dist/src/utils/owned-private-dir.d.ts +1 -17
- package/dist/src/utils/owned-private-dir.js +10 -62
- package/dist/src/utils/perf-hooks.d.ts +1 -0
- package/dist/src/utils/plugins/core-plugins.js +1 -1
- package/dist/src/utils/spawn-without-terminal.d.ts +27 -0
- package/dist/src/utils/spawn-without-terminal.js +110 -0
- package/dist/src/utils/string-similarity.d.ts +38 -0
- package/dist/src/utils/string-similarity.js +108 -0
- package/migrations.json +7 -0
- package/package.json +11 -20
- package/readme-template.md +3 -3
- package/schemas/nx-schema.json +70 -0
- package/schemas/project-schema.json +67 -0
- package/dist/src/tasks-runner/legacy-depends-on-warning.d.ts +0 -18
- package/dist/src/tasks-runner/legacy-depends-on-warning.js +0 -109
|
@@ -102,6 +102,17 @@
|
|
|
102
102
|
"description": "Configuration for params handling.",
|
|
103
103
|
"enum": ["ignore", "forward"],
|
|
104
104
|
"default": "ignore"
|
|
105
|
+
},
|
|
106
|
+
"inputs": {
|
|
107
|
+
"type": "boolean",
|
|
108
|
+
"description": "Set to false to keep a continuous dependency's inputs out of this target's hash and affected calculation. Has no effect on dependencies that are not continuous.",
|
|
109
|
+
"default": true
|
|
110
|
+
},
|
|
111
|
+
"waitFor": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"description": "For a continuous dependency, whether to wait until it has started or until it is ready per its readyWhen. Ignored when the dependency is not continuous or has no readyWhen.",
|
|
114
|
+
"enum": ["started", "ready"],
|
|
115
|
+
"default": "started"
|
|
105
116
|
}
|
|
106
117
|
},
|
|
107
118
|
"oneOf": [
|
|
@@ -174,6 +185,9 @@
|
|
|
174
185
|
"default": false,
|
|
175
186
|
"description": "Whether this target runs continuously until stopped"
|
|
176
187
|
},
|
|
188
|
+
"readyWhen": {
|
|
189
|
+
"$ref": "#/definitions/readyWhen"
|
|
190
|
+
},
|
|
177
191
|
"parallelism": {
|
|
178
192
|
"type": "boolean",
|
|
179
193
|
"default": true,
|
|
@@ -234,6 +248,59 @@
|
|
|
234
248
|
}
|
|
235
249
|
},
|
|
236
250
|
"definitions": {
|
|
251
|
+
"readyWhen": {
|
|
252
|
+
"description": "How Nx detects that this continuous target is ready. Dependents opt in with \"waitFor\": \"ready\" on their dependsOn entry. Strings may use the {workspaceRoot}, {projectRoot}, {projectName} and {options.*} placeholders, resolved against the options the task runs with.",
|
|
253
|
+
"type": "object",
|
|
254
|
+
"properties": {
|
|
255
|
+
"url": {
|
|
256
|
+
"type": "string",
|
|
257
|
+
"description": "Ready when an HTTP or HTTPS GET gets a status from 200 to 403. A redirect counts as ready and is not followed"
|
|
258
|
+
},
|
|
259
|
+
"port": {
|
|
260
|
+
"type": ["integer", "string"],
|
|
261
|
+
"minimum": 1,
|
|
262
|
+
"maximum": 65535,
|
|
263
|
+
"description": "Ready when a TCP connection to this port succeeds. A string must resolve to a port number through a placeholder such as {options.port}"
|
|
264
|
+
},
|
|
265
|
+
"host": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"description": "Host to connect to with port. By default 127.0.0.1 and ::1 are both tried"
|
|
268
|
+
},
|
|
269
|
+
"command": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"description": "Ready when this command, run through the shell at the workspace root, exits with code 0"
|
|
272
|
+
},
|
|
273
|
+
"logMatches": {
|
|
274
|
+
"description": "Ready when every one of these substrings has appeared in the task's output",
|
|
275
|
+
"oneOf": [
|
|
276
|
+
{ "type": "string" },
|
|
277
|
+
{
|
|
278
|
+
"type": "array",
|
|
279
|
+
"items": { "type": "string" },
|
|
280
|
+
"minItems": 1
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
"timeout": {
|
|
285
|
+
"type": "integer",
|
|
286
|
+
"minimum": 1,
|
|
287
|
+
"default": 60000,
|
|
288
|
+
"description": "Milliseconds to wait for readiness before failing dependents that wait for it"
|
|
289
|
+
},
|
|
290
|
+
"interval": {
|
|
291
|
+
"type": "integer",
|
|
292
|
+
"minimum": 1,
|
|
293
|
+
"description": "Milliseconds between probe attempts. By default attempts back off from 100 to 1000 milliseconds. Unused by logMatches"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"oneOf": [
|
|
297
|
+
{ "required": ["url"] },
|
|
298
|
+
{ "required": ["port"] },
|
|
299
|
+
{ "required": ["command"] },
|
|
300
|
+
{ "required": ["logMatches"] }
|
|
301
|
+
],
|
|
302
|
+
"additionalProperties": false
|
|
303
|
+
},
|
|
237
304
|
"inputs": {
|
|
238
305
|
"type": "array",
|
|
239
306
|
"items": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { TargetDependencyConfig } from '../config/workspace-json-project-json';
|
|
2
|
-
type LegacyValue = 'self' | 'dependencies';
|
|
3
|
-
type LegacyEntry = TargetDependencyConfig & {
|
|
4
|
-
projects: LegacyValue;
|
|
5
|
-
};
|
|
6
|
-
export interface LegacyDependsOnViolation {
|
|
7
|
-
index: number;
|
|
8
|
-
originalEntry: LegacyEntry;
|
|
9
|
-
}
|
|
10
|
-
export interface LegacyDependsOnLocation {
|
|
11
|
-
ownerTarget?: string;
|
|
12
|
-
index?: number;
|
|
13
|
-
legacyViolations?: LegacyDependsOnViolation[];
|
|
14
|
-
}
|
|
15
|
-
export declare function warnLegacyDependsOnMagicString(currentProject: string | undefined, dependencyConfig: TargetDependencyConfig, location: LegacyDependsOnLocation | undefined): void;
|
|
16
|
-
export declare function flushLegacyDependsOnViolations(project: string, ownerTarget: string, violations: LegacyDependsOnViolation[], projectRoot: string | undefined): void;
|
|
17
|
-
export declare function __resetForTests(): void;
|
|
18
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.warnLegacyDependsOnMagicString = warnLegacyDependsOnMagicString;
|
|
4
|
-
exports.flushLegacyDependsOnViolations = flushLegacyDependsOnViolations;
|
|
5
|
-
exports.__resetForTests = __resetForTests;
|
|
6
|
-
const nx_deps_cache_1 = require("../project-graph/nx-deps-cache");
|
|
7
|
-
const source_maps_1 = require("../project-graph/utils/project-configuration/source-maps");
|
|
8
|
-
const output_1 = require("../utils/output");
|
|
9
|
-
const warned = new Set();
|
|
10
|
-
const isInternal = (p) => !p || p.startsWith('nx/');
|
|
11
|
-
// Callers gate this on `dependencyConfig.projects` already being a legacy value;
|
|
12
|
-
// the inner cast snapshots that runtime guarantee into the type system.
|
|
13
|
-
function warnLegacyDependsOnMagicString(currentProject, dependencyConfig, location) {
|
|
14
|
-
const violation = {
|
|
15
|
-
index: location?.index ?? -1,
|
|
16
|
-
originalEntry: { ...dependencyConfig },
|
|
17
|
-
};
|
|
18
|
-
// Collector-aware caller (`getDependencyConfigs`) batches violations so the
|
|
19
|
-
// warning can group all offending entries for a single target. External
|
|
20
|
-
// callers fall through to an immediate per-entry warning.
|
|
21
|
-
if (location?.legacyViolations)
|
|
22
|
-
return void location.legacyViolations.push(violation);
|
|
23
|
-
flushLegacyDependsOnViolations(currentProject ?? '<unknown>', location?.ownerTarget ?? '<unknown>', [violation], undefined);
|
|
24
|
-
}
|
|
25
|
-
function flushLegacyDependsOnViolations(project, ownerTarget, violations, projectRoot) {
|
|
26
|
-
if (violations.length === 0)
|
|
27
|
-
return;
|
|
28
|
-
// Read source maps fresh each flush so daemon-cached maps don't go stale;
|
|
29
|
-
// only runs when violations exist, which is rare.
|
|
30
|
-
let sourceMaps = null;
|
|
31
|
-
try {
|
|
32
|
-
sourceMaps = (0, nx_deps_cache_1.readSourceMapsCache)();
|
|
33
|
-
}
|
|
34
|
-
catch { } // best-effort context
|
|
35
|
-
const map = projectRoot && sourceMaps ? sourceMaps[projectRoot] : undefined;
|
|
36
|
-
const arrayKey = `targets.${ownerTarget}.dependsOn`;
|
|
37
|
-
const items = violations.map((v) => {
|
|
38
|
-
const info = map
|
|
39
|
-
? (0, source_maps_1.readArrayItemSourceInfo)(map, arrayKey, v.index)
|
|
40
|
-
: undefined;
|
|
41
|
-
return {
|
|
42
|
-
...v,
|
|
43
|
-
value: v.originalEntry.projects,
|
|
44
|
-
plugin: info?.[1],
|
|
45
|
-
file: info?.[0] ?? undefined,
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
const shared = (key) => items.every((i) => i[key] === items[0][key]) ? items[0][key] : null;
|
|
49
|
-
const value = shared('value');
|
|
50
|
-
const plugin = shared('plugin');
|
|
51
|
-
const file = shared('file');
|
|
52
|
-
// External-plugin warnings are workspace-wide (the plugin's behavior, not a
|
|
53
|
-
// specific config): dedupe per (plugin, value) so the user sees one warning
|
|
54
|
-
// per offending plugin, not one per affected target.
|
|
55
|
-
const dedupeKey = plugin && !isInternal(plugin) && value
|
|
56
|
-
? `plugin::${plugin}::${value}`
|
|
57
|
-
: `target::${project}::${ownerTarget}`;
|
|
58
|
-
if (warned.has(dedupeKey))
|
|
59
|
-
return;
|
|
60
|
-
warned.add(dedupeKey);
|
|
61
|
-
const n = items.length;
|
|
62
|
-
const word = n === 1 ? 'entry' : 'entries';
|
|
63
|
-
const deprecation = 'This is deprecated and will be removed in Nx v24 —';
|
|
64
|
-
let phrase;
|
|
65
|
-
if (value) {
|
|
66
|
-
phrase = `projects: '${value}'`;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const self = items.filter((i) => i.value === 'self').length;
|
|
70
|
-
phrase = `legacy projects values (${self} 'self', ${n - self} 'dependencies')`;
|
|
71
|
-
}
|
|
72
|
-
let title;
|
|
73
|
-
let suppressBody = false;
|
|
74
|
-
if (plugin && !isInternal(plugin)) {
|
|
75
|
-
// Single external plugin: same plugin emits the same value across projects.
|
|
76
|
-
title = `The ${plugin} plugin infers dependsOn entries using ${phrase}. ${deprecation} please upgrade ${plugin} to a version that doesn't emit this.`;
|
|
77
|
-
suppressBody = true;
|
|
78
|
-
}
|
|
79
|
-
else if (plugin && isInternal(plugin) && file) {
|
|
80
|
-
// Single hand-authored config file — lead with the file path.
|
|
81
|
-
title = `${file} defines ${project}:${ownerTarget} with ${n} dependsOn ${word} using ${phrase}. ${deprecation} run 'nx repair' to fix this.`;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// Mixed sources or no source-map info — tailor advice to what's offending.
|
|
85
|
-
const offending = Array.from(new Set(items
|
|
86
|
-
.filter((i) => i.plugin && !isInternal(i.plugin))
|
|
87
|
-
.map((i) => i.plugin)));
|
|
88
|
-
const origin = plugin
|
|
89
|
-
? ` (set by ${plugin}${file ? ` in ${file}` : ''})`
|
|
90
|
-
: '';
|
|
91
|
-
const advice = offending.length
|
|
92
|
-
? `run 'nx repair' for hand-authored entries and upgrade ${offending.join(', ')} for plugin-inferred entries`
|
|
93
|
-
: `run 'nx repair' to fix`;
|
|
94
|
-
title = `${project}:${ownerTarget} has ${n} dependsOn ${word} using ${phrase}${origin}. ${deprecation} ${advice}.`;
|
|
95
|
-
}
|
|
96
|
-
const bodyLines = suppressBody
|
|
97
|
-
? []
|
|
98
|
-
: items.map((i) => {
|
|
99
|
-
const src = i.plugin && !plugin
|
|
100
|
-
? ` from ${i.plugin}${i.file ? ` in ${i.file}` : ''}`
|
|
101
|
-
: '';
|
|
102
|
-
return ` - ${JSON.stringify(i.originalEntry)} (${i.index}${src})`;
|
|
103
|
-
});
|
|
104
|
-
output_1.output.warn({ title, bodyLines });
|
|
105
|
-
}
|
|
106
|
-
// Test-only: clears the process-wide dedupe set.
|
|
107
|
-
function __resetForTests() {
|
|
108
|
-
warned.clear();
|
|
109
|
-
}
|