nx 21.2.0-canary.20250528-2572455 → 21.2.0-canary.20250530-b51676a
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/package.json +11 -11
- package/src/command-line/graph/graph.js +50 -4
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +2 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -1
- package/src/executors/run-commands/run-commands.impl.js +5 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/tasks-runner/run-command.js +11 -0
- package/src/tasks-runner/running-tasks/noop-child-process.d.ts +2 -1
- package/src/tasks-runner/running-tasks/noop-child-process.js +4 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "21.2.0-canary.
|
3
|
+
"version": "21.2.0-canary.20250530-b51676a",
|
4
4
|
"private": false,
|
5
5
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
6
6
|
"repository": {
|
@@ -83,16 +83,16 @@
|
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"optionalDependencies": {
|
86
|
-
"@nx/nx-darwin-arm64": "21.2.0-canary.
|
87
|
-
"@nx/nx-darwin-x64": "21.2.0-canary.
|
88
|
-
"@nx/nx-freebsd-x64": "21.2.0-canary.
|
89
|
-
"@nx/nx-linux-arm-gnueabihf": "21.2.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-gnu": "21.2.0-canary.
|
91
|
-
"@nx/nx-linux-arm64-musl": "21.2.0-canary.
|
92
|
-
"@nx/nx-linux-x64-gnu": "21.2.0-canary.
|
93
|
-
"@nx/nx-linux-x64-musl": "21.2.0-canary.
|
94
|
-
"@nx/nx-win32-arm64-msvc": "21.2.0-canary.
|
95
|
-
"@nx/nx-win32-x64-msvc": "21.2.0-canary.
|
86
|
+
"@nx/nx-darwin-arm64": "21.2.0-canary.20250530-b51676a",
|
87
|
+
"@nx/nx-darwin-x64": "21.2.0-canary.20250530-b51676a",
|
88
|
+
"@nx/nx-freebsd-x64": "21.2.0-canary.20250530-b51676a",
|
89
|
+
"@nx/nx-linux-arm-gnueabihf": "21.2.0-canary.20250530-b51676a",
|
90
|
+
"@nx/nx-linux-arm64-gnu": "21.2.0-canary.20250530-b51676a",
|
91
|
+
"@nx/nx-linux-arm64-musl": "21.2.0-canary.20250530-b51676a",
|
92
|
+
"@nx/nx-linux-x64-gnu": "21.2.0-canary.20250530-b51676a",
|
93
|
+
"@nx/nx-linux-x64-musl": "21.2.0-canary.20250530-b51676a",
|
94
|
+
"@nx/nx-win32-arm64-msvc": "21.2.0-canary.20250530-b51676a",
|
95
|
+
"@nx/nx-win32-x64-msvc": "21.2.0-canary.20250530-b51676a"
|
96
96
|
},
|
97
97
|
"nx-migrations": {
|
98
98
|
"migrations": "./migrations.json",
|
@@ -9,6 +9,7 @@ const minimatch_1 = require("minimatch");
|
|
9
9
|
const node_url_1 = require("node:url");
|
10
10
|
const open = require("open");
|
11
11
|
const path_1 = require("path");
|
12
|
+
const net = require("net");
|
12
13
|
const perf_hooks_1 = require("perf_hooks");
|
13
14
|
const configuration_1 = require("../../config/configuration");
|
14
15
|
const fileutils_1 = require("../../utils/fileutils");
|
@@ -287,7 +288,20 @@ async function generateGraph(args, affectedProjects) {
|
|
287
288
|
}
|
288
289
|
else {
|
289
290
|
const environmentJs = buildEnvironmentJs(args.exclude || [], args.watch, !!args.file && args.file.endsWith('html') ? 'build' : 'serve');
|
290
|
-
|
291
|
+
let app;
|
292
|
+
let url;
|
293
|
+
try {
|
294
|
+
const result = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude);
|
295
|
+
app = result.app;
|
296
|
+
url = result.url;
|
297
|
+
}
|
298
|
+
catch (err) {
|
299
|
+
output_1.output.error({
|
300
|
+
title: 'Failed to start graph server',
|
301
|
+
bodyLines: [err.message],
|
302
|
+
});
|
303
|
+
process.exit(1);
|
304
|
+
}
|
291
305
|
url.pathname = args.view;
|
292
306
|
if (args.focus) {
|
293
307
|
url.pathname += '/' + encodeURIComponent(args.focus);
|
@@ -318,6 +332,28 @@ async function generateGraph(args, affectedProjects) {
|
|
318
332
|
});
|
319
333
|
}
|
320
334
|
}
|
335
|
+
function findAvailablePort(startPort, host = '127.0.0.1') {
|
336
|
+
return new Promise((resolve, reject) => {
|
337
|
+
const server = net.createServer();
|
338
|
+
server.listen(startPort, host, () => {
|
339
|
+
const port = server.address().port;
|
340
|
+
server.close(() => {
|
341
|
+
resolve(port);
|
342
|
+
});
|
343
|
+
});
|
344
|
+
server.on('error', (err) => {
|
345
|
+
if (err.code === 'EADDRINUSE') {
|
346
|
+
// Port is in use, try the next one
|
347
|
+
findAvailablePort(startPort + 1, host)
|
348
|
+
.then(resolve)
|
349
|
+
.catch(reject);
|
350
|
+
}
|
351
|
+
else {
|
352
|
+
reject(err);
|
353
|
+
}
|
354
|
+
});
|
355
|
+
});
|
356
|
+
}
|
321
357
|
async function startServer(html, environmentJs, host, port = 4211, watchForChanges = true, affected = [], focus = null, groupByFolder = false, exclude = []) {
|
322
358
|
let unregisterFileWatcher;
|
323
359
|
if (watchForChanges && !client_1.daemonClient.enabled()) {
|
@@ -418,9 +454,19 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
418
454
|
};
|
419
455
|
process.on('SIGINT', () => handleTermination(128 + 2));
|
420
456
|
process.on('SIGTERM', () => handleTermination(128 + 15));
|
421
|
-
|
422
|
-
|
423
|
-
|
457
|
+
// Find an available port starting from the requested port
|
458
|
+
const availablePort = await findAvailablePort(port, host);
|
459
|
+
return new Promise((res, rej) => {
|
460
|
+
app.on('error', (err) => {
|
461
|
+
rej(err);
|
462
|
+
});
|
463
|
+
app.listen(availablePort, host, () => {
|
464
|
+
if (availablePort !== port) {
|
465
|
+
output_1.output.note({
|
466
|
+
title: `Port ${port} was already in use, using port ${availablePort} instead`,
|
467
|
+
});
|
468
|
+
}
|
469
|
+
res({ app, url: new node_url_1.URL(`http://${host}:${availablePort}`) });
|
424
470
|
});
|
425
471
|
});
|
426
472
|
}
|
@@ -17,9 +17,10 @@ const nxAngularLegacyVersionMap = {
|
|
17
17
|
14: '~17.0.0',
|
18
18
|
15: '~19.0.0',
|
19
19
|
16: '~20.1.0',
|
20
|
+
17: '~21.1.0',
|
20
21
|
};
|
21
22
|
// min major angular version supported in latest Nx
|
22
|
-
const minMajorAngularVersionSupported =
|
23
|
+
const minMajorAngularVersionSupported = Math.max(...Object.keys(nxAngularLegacyVersionMap).map(Number)) + 1;
|
23
24
|
// version when the Nx CLI changed from @nrwl/tao & @nrwl/cli to nx
|
24
25
|
const versionWithConsolidatedPackages = '13.9.0';
|
25
26
|
// version when packages were rescoped from @nrwl/* to @nx/*
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { ExecutorContext } from '../../config/misc-interfaces';
|
2
|
+
import { NoopChildProcess } from '../../tasks-runner/running-tasks/noop-child-process';
|
2
3
|
import { ParallelRunningTasks, SeriallyRunningTasks } from './running-tasks';
|
3
4
|
export declare const LARGE_BUFFER: number;
|
4
5
|
export type Json = {
|
@@ -54,5 +55,5 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
|
|
54
55
|
success: boolean;
|
55
56
|
terminalOutput: string;
|
56
57
|
}>;
|
57
|
-
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | ParallelRunningTasks | SeriallyRunningTasks>;
|
58
|
+
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | NoopChildProcess | ParallelRunningTasks | SeriallyRunningTasks>;
|
58
59
|
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
|
@@ -7,6 +7,7 @@ exports.interpolateArgsIntoCommand = interpolateArgsIntoCommand;
|
|
7
7
|
const yargsParser = require("yargs-parser");
|
8
8
|
const is_tui_enabled_1 = require("../../tasks-runner/is-tui-enabled");
|
9
9
|
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
10
|
+
const noop_child_process_1 = require("../../tasks-runner/running-tasks/noop-child-process");
|
10
11
|
const running_tasks_1 = require("./running-tasks");
|
11
12
|
exports.LARGE_BUFFER = 1024 * 1000000;
|
12
13
|
const propKeys = [
|
@@ -45,6 +46,10 @@ async function runCommands(options, context) {
|
|
45
46
|
!options.parallel) {
|
46
47
|
throw new Error('ERROR: Bad executor config for run-commands - "prefix", "prefixColor", "color" and "bgColor" can only be set when "parallel=true".');
|
47
48
|
}
|
49
|
+
// Handle empty commands array - return immediately with success
|
50
|
+
if (normalized.commands.length === 0) {
|
51
|
+
return new noop_child_process_1.NoopChildProcess({ code: 0, terminalOutput: '' });
|
52
|
+
}
|
48
53
|
const isSingleCommand = normalized.commands.length === 1;
|
49
54
|
const usePseudoTerminal = (isSingleCommand || !options.parallel) && pseudo_terminal_1.PseudoTerminal.isSupported();
|
50
55
|
const isSingleCommandAndCanUsePseudoTerminal = isSingleCommand &&
|
Binary file
|
@@ -772,6 +772,17 @@ function getRunner(nxArgs, nxJson) {
|
|
772
772
|
}
|
773
773
|
const defaultTasksRunnerPath = require.resolve('./default-tasks-runner');
|
774
774
|
function getTasksRunnerPath(runner, nxJson) {
|
775
|
+
// If running inside of Codex, there will be no internet access, so we cannot use the cloud runner, regardless of other config.
|
776
|
+
// We can infer this scenario by checking for certain environment variables defined in their base image: https://github.com/openai/codex-universal
|
777
|
+
if (process.env.CODEX_ENV_NODE_VERSION) {
|
778
|
+
output_1.output.warn({
|
779
|
+
title: 'Codex environment detected, using default tasks runner',
|
780
|
+
bodyLines: [
|
781
|
+
'Codex does not have internet access when it runs tasks, so Nx will use the default tasks runner and only leverage local caching.',
|
782
|
+
],
|
783
|
+
});
|
784
|
+
return defaultTasksRunnerPath;
|
785
|
+
}
|
775
786
|
const isCloudRunner =
|
776
787
|
// No tasksRunnerOptions for given --runner
|
777
788
|
nxJson.nxCloudAccessToken ||
|
@@ -11,5 +11,6 @@ export declare class NoopChildProcess implements RunningTask {
|
|
11
11
|
terminalOutput: string;
|
12
12
|
}>;
|
13
13
|
kill(): void;
|
14
|
-
onExit(cb: (code: number) => void): void;
|
14
|
+
onExit(cb: (code: number, terminalOutput: string) => void): void;
|
15
|
+
onOutput(cb: (terminalOutput: string) => void): void;
|
15
16
|
}
|
@@ -13,7 +13,10 @@ class NoopChildProcess {
|
|
13
13
|
return;
|
14
14
|
}
|
15
15
|
onExit(cb) {
|
16
|
-
cb(this.results.code);
|
16
|
+
cb(this.results.code, this.results.terminalOutput);
|
17
|
+
}
|
18
|
+
onOutput(cb) {
|
19
|
+
cb(this.results.terminalOutput);
|
17
20
|
}
|
18
21
|
}
|
19
22
|
exports.NoopChildProcess = NoopChildProcess;
|