{ | ||
"name": "nx", | ||
"version": "0.0.0-pr-31313-d972df3", | ||
"version": "0.0.0-pr-31369-292b003", | ||
"private": false, | ||
@@ -86,12 +86,12 @@ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", | ||
"optionalDependencies": { | ||
"@nx/nx-darwin-arm64": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-darwin-x64": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-freebsd-x64": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-linux-arm64-musl": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-linux-x64-gnu": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-linux-x64-musl": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-31313-d972df3", | ||
"@nx/nx-win32-x64-msvc": "0.0.0-pr-31313-d972df3" | ||
"@nx/nx-darwin-arm64": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-darwin-x64": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-freebsd-x64": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-linux-arm-gnueabihf": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-linux-arm64-gnu": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-linux-arm64-musl": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-linux-x64-gnu": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-linux-x64-musl": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-win32-arm64-msvc": "0.0.0-pr-31369-292b003", | ||
"@nx/nx-win32-x64-msvc": "0.0.0-pr-31369-292b003" | ||
}, | ||
@@ -98,0 +98,0 @@ "nx-migrations": { |
@@ -12,2 +12,3 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const net = require("net"); | ||
const perf_hooks_1 = require("perf_hooks"); | ||
@@ -291,3 +292,16 @@ const configuration_1 = require("../../config/configuration"); | ||
const environmentJs = buildEnvironmentJs(args.exclude || [], args.watch, !!args.file && args.file.endsWith('html') ? 'build' : 'serve'); | ||
const { app, url } = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude); | ||
let app; | ||
let url; | ||
try { | ||
const result = await startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude); | ||
app = result.app; | ||
url = result.url; | ||
} | ||
catch (err) { | ||
output_1.output.error({ | ||
title: 'Failed to start graph server', | ||
bodyLines: [err.message], | ||
}); | ||
process.exit(1); | ||
} | ||
url.pathname = args.view; | ||
@@ -323,2 +337,24 @@ if (args.focus) { | ||
} | ||
function findAvailablePort(startPort, host = '127.0.0.1') { | ||
return new Promise((resolve, reject) => { | ||
const server = net.createServer(); | ||
server.listen(startPort, host, () => { | ||
const port = server.address().port; | ||
server.close(() => { | ||
resolve(port); | ||
}); | ||
}); | ||
server.on('error', (err) => { | ||
if (err.code === 'EADDRINUSE') { | ||
// Port is in use, try the next one | ||
findAvailablePort(startPort + 1, host) | ||
.then(resolve) | ||
.catch(reject); | ||
} | ||
else { | ||
reject(err); | ||
} | ||
}); | ||
}); | ||
} | ||
async function startServer(html, environmentJs, host, port = 4211, watchForChanges = true, affected = [], focus = null, groupByFolder = false, exclude = []) { | ||
@@ -424,6 +460,16 @@ let unregisterFileWatcher; | ||
process.on('SIGTERM', () => handleTermination(128 + 15)); | ||
return new Promise((res) => { | ||
app.listen(port, host, () => { | ||
res({ app, url: new node_url_1.URL(`http://${host}:${port}`) }); | ||
// Find an available port starting from the requested port | ||
const availablePort = await findAvailablePort(port, host); | ||
return new Promise((res, rej) => { | ||
app.on('error', (err) => { | ||
rej(err); | ||
}); | ||
app.listen(availablePort, host, () => { | ||
if (availablePort !== port) { | ||
output_1.output.note({ | ||
title: `Port ${port} was already in use, using port ${availablePort} instead`, | ||
}); | ||
} | ||
res({ app, url: new node_url_1.URL(`http://${host}:${availablePort}`) }); | ||
}); | ||
}); | ||
@@ -430,0 +476,0 @@ } |
@@ -20,5 +20,6 @@ "use strict"; | ||
16: '~20.1.0', | ||
17: '~21.1.0', | ||
}; | ||
// min major angular version supported in latest Nx | ||
const minMajorAngularVersionSupported = 17; | ||
const minMajorAngularVersionSupported = Math.max(...Object.keys(nxAngularLegacyVersionMap).map(Number)) + 1; | ||
// version when the Nx CLI changed from @nrwl/tao & @nrwl/cli to nx | ||
@@ -25,0 +26,0 @@ const versionWithConsolidatedPackages = '13.9.0'; |
import { ExecutorContext } from '../../config/misc-interfaces'; | ||
import { NoopChildProcess } from '../../tasks-runner/running-tasks/noop-child-process'; | ||
import { ParallelRunningTasks, SeriallyRunningTasks } from './running-tasks'; | ||
@@ -57,3 +58,3 @@ export declare const LARGE_BUFFER: number; | ||
}>; | ||
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | ParallelRunningTasks | SeriallyRunningTasks>; | ||
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | NoopChildProcess | ParallelRunningTasks | SeriallyRunningTasks>; | ||
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string; |
@@ -10,2 +10,3 @@ "use strict"; | ||
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal"); | ||
const noop_child_process_1 = require("../../tasks-runner/running-tasks/noop-child-process"); | ||
const running_tasks_1 = require("./running-tasks"); | ||
@@ -49,2 +50,6 @@ exports.LARGE_BUFFER = 1024 * 1000000; | ||
} | ||
// Handle empty commands array - return immediately with success | ||
if (normalized.commands.length === 0) { | ||
return new noop_child_process_1.NoopChildProcess({ code: 0, terminalOutput: '' }); | ||
} | ||
const isSingleCommand = normalized.commands.length === 1; | ||
@@ -51,0 +56,0 @@ const usePseudoTerminal = (isSingleCommand || !options.parallel) && pseudo_terminal_1.PseudoTerminal.isSupported(); |
@@ -775,2 +775,13 @@ "use strict"; | ||
function getTasksRunnerPath(runner, nxJson) { | ||
// If running inside of Codex, there will be no internet access, so we cannot use the cloud runner, regardless of other config. | ||
// We can infer this scenario by checking for certain environment variables defined in their base image: https://github.com/openai/codex-universal | ||
if (process.env.CODEX_ENV_NODE_VERSION) { | ||
output_1.output.warn({ | ||
title: 'Codex environment detected, using default tasks runner', | ||
bodyLines: [ | ||
'Codex does not have internet access when it runs tasks, so Nx will use the default tasks runner and only leverage local caching.', | ||
], | ||
}); | ||
return defaultTasksRunnerPath; | ||
} | ||
const isCloudRunner = | ||
@@ -777,0 +788,0 @@ // No tasksRunnerOptions for given --runner |
@@ -14,3 +14,4 @@ import { RunningTask } from './running-task'; | ||
kill(): void; | ||
onExit(cb: (code: number) => void): void; | ||
onExit(cb: (code: number, terminalOutput: string) => void): void; | ||
onOutput(cb: (terminalOutput: string) => void): void; | ||
} |
@@ -16,5 +16,8 @@ "use strict"; | ||
onExit(cb) { | ||
cb(this.results.code); | ||
cb(this.results.code, this.results.terminalOutput); | ||
} | ||
onOutput(cb) { | ||
cb(this.results.terminalOutput); | ||
} | ||
} | ||
exports.NoopChildProcess = NoopChildProcess; |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
8528355
0.03%62308
0.11%412
0.24%45
2.27%