nx
Advanced tools
Comparing version 19.4.0-canary.20240627-c2c6a13 to 19.4.0-canary.20240628-336d371
{ | ||
"name": "nx", | ||
"version": "19.4.0-canary.20240627-c2c6a13", | ||
"version": "19.4.0-canary.20240628-336d371", | ||
"private": false, | ||
@@ -73,3 +73,3 @@ "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.", | ||
"ora": "5.3.0", | ||
"@nrwl/tao": "19.4.0-canary.20240627-c2c6a13" | ||
"@nrwl/tao": "19.4.0-canary.20240628-336d371" | ||
}, | ||
@@ -89,12 +89,12 @@ "peerDependencies": { | ||
"optionalDependencies": { | ||
"@nx/nx-darwin-x64": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-darwin-arm64": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-linux-x64-gnu": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-linux-x64-musl": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-win32-x64-msvc": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-linux-arm64-gnu": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-linux-arm64-musl": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-linux-arm-gnueabihf": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-win32-arm64-msvc": "19.4.0-canary.20240627-c2c6a13", | ||
"@nx/nx-freebsd-x64": "19.4.0-canary.20240627-c2c6a13" | ||
"@nx/nx-darwin-x64": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-darwin-arm64": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-linux-x64-gnu": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-linux-x64-musl": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-win32-x64-msvc": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-linux-arm64-gnu": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-linux-arm64-musl": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-linux-arm-gnueabihf": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-win32-arm64-msvc": "19.4.0-canary.20240628-336d371", | ||
"@nx/nx-freebsd-x64": "19.4.0-canary.20240628-336d371" | ||
}, | ||
@@ -101,0 +101,0 @@ "nx-migrations": { |
@@ -5,2 +5,3 @@ "use strict"; | ||
const crypto_1 = require("crypto"); | ||
const node_child_process_1 = require("node:child_process"); | ||
const fs_1 = require("fs"); | ||
@@ -29,4 +30,4 @@ const fs_extra_1 = require("fs-extra"); | ||
const nx_deps_cache_1 = require("../../project-graph/nx-deps-cache"); | ||
const task_hasher_1 = require("../../hasher/task-hasher"); | ||
const create_task_hasher_1 = require("../../hasher/create-task-hasher"); | ||
const task_hasher_1 = require("../../hasher/task-hasher"); | ||
const error_types_1 = require("../../project-graph/error-types"); | ||
@@ -378,2 +379,16 @@ const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils"); | ||
} | ||
if (sanitizePath === 'help') { | ||
const project = parsedUrl.searchParams.get('project'); | ||
const target = parsedUrl.searchParams.get('target'); | ||
try { | ||
const text = getHelpTextFromTarget(project, target); | ||
res.writeHead(200, { 'Content-Type': 'application/javascript' }); | ||
res.end(JSON.stringify({ text, success: true })); | ||
} | ||
catch (err) { | ||
res.writeHead(200, { 'Content-Type': 'application/javascript' }); | ||
res.end(JSON.stringify({ text: err.message, success: false })); | ||
} | ||
return; | ||
} | ||
let pathname = (0, path_1.join)(__dirname, '../../core/graph/', sanitizePath); | ||
@@ -750,1 +765,19 @@ // if the file is not found or is a directory, return index.html | ||
} | ||
function getHelpTextFromTarget(projectName, targetName) { | ||
if (!projectName) | ||
throw new Error(`Missing project`); | ||
if (!targetName) | ||
throw new Error(`Missing target`); | ||
const project = currentProjectGraphClientResponse.projects?.find((p) => p.name === projectName); | ||
if (!project) | ||
throw new Error(`Cannot find project ${projectName}`); | ||
const target = project.data.targets[targetName]; | ||
if (!target) | ||
throw new Error(`Cannot find target ${targetName}`); | ||
const command = target.metadata?.help?.command; | ||
if (!command) | ||
throw new Error(`No help command found for ${projectName}:${targetName}`); | ||
return (0, node_child_process_1.execSync)(command, { | ||
cwd: (0, path_1.join)(workspace_root_1.workspaceRoot, project.data.root), | ||
}).toString(); | ||
} |
@@ -117,2 +117,9 @@ import type { NxJsonConfiguration, NxReleaseVersionConfiguration } from './nx-json'; | ||
nonAtomizedTarget?: string; | ||
help?: { | ||
command: string; | ||
example: { | ||
options?: Record<string, unknown>; | ||
args?: string[]; | ||
}; | ||
}; | ||
} | ||
@@ -119,0 +126,0 @@ export interface TargetDependencyConfig { |
@@ -7,3 +7,3 @@ import { ExecutorContext } from '../../config/misc-interfaces'; | ||
export interface RunCommandsOptions extends Json { | ||
command?: string; | ||
command?: string | string[]; | ||
commands?: ({ | ||
@@ -10,0 +10,0 @@ command: string; |
@@ -136,3 +136,9 @@ "use strict"; | ||
if (options.command) { | ||
options.commands = [{ command: options.command }]; | ||
options.commands = [ | ||
{ | ||
command: Array.isArray(options.command) | ||
? options.command.join(' ') | ||
: options.command, | ||
}, | ||
]; | ||
options.parallel = options.readyWhenStatus?.length > 0; | ||
@@ -139,0 +145,0 @@ } |
@@ -87,2 +87,16 @@ { | ||
"command": { | ||
"oneOf": [ | ||
{ | ||
"type": "array", | ||
"description": "Command to run in child process, but divided into parts.", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"x-priority": "important" | ||
}, | ||
{ | ||
"type": "string", | ||
"description": "Command to run in child process." | ||
} | ||
], | ||
"type": "string", | ||
@@ -89,0 +103,0 @@ "description": "Command to run in child process.", |
@@ -11,3 +11,3 @@ "use strict"; | ||
const version = await getNxCloudVersion(apiUrl); | ||
if (version && (0, semver_1.lt)(truncateToSemver(version), '2406.11.5')) { | ||
if (version && (0, semver_1.lt)(removeVersionModifier(version), '2406.11.5')) { | ||
return apiUrl; | ||
@@ -75,11 +75,11 @@ } | ||
try { | ||
const response = await require('axios').get(`${apiUrl}/vcs-integrations`); | ||
const response = await require('axios').get(`${apiUrl}/nx-cloud/system/features`); | ||
if (!response?.data || response.data.message) { | ||
throw new Error(response?.data?.message ?? 'Failed to shorten Nx Cloud URL'); | ||
} | ||
return !!response.data.github; | ||
return !!response.data.isGithubIntegrationEnabled; | ||
} | ||
catch (e) { | ||
if (process.env.NX_VERBOSE_LOGGING) { | ||
devkit_exports_1.logger.warn(`Failed to access vcs-integrations endpoint. | ||
devkit_exports_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled. | ||
${e}`); | ||
@@ -92,6 +92,4 @@ } | ||
try { | ||
const response = await require('axios').get(`${apiUrl}/version`, { | ||
responseType: 'document', | ||
}); | ||
const version = extractVersion(response.data); | ||
const response = await require('axios').get(`${apiUrl}/nx-cloud/system/version`); | ||
const version = removeVersionModifier(response.data.version); | ||
if (!version) { | ||
@@ -107,11 +105,5 @@ throw new Error('Failed to extract version from response.'); | ||
} | ||
function extractVersion(htmlString) { | ||
// The pattern assumes 'Version' is inside an h1 tag and the version number is the next span's content | ||
const regex = /<h1[^>]*>Version<\/h1>\s*<div[^>]*><div[^>]*><div[^>]*><span[^>]*>([^<]+)<\/span>/; | ||
const match = htmlString.match(regex); | ||
return match ? match[1].trim() : null; | ||
} | ||
function truncateToSemver(versionString) { | ||
function removeVersionModifier(versionString) { | ||
// version may be something like 2406.13.5.hotfix2 | ||
return versionString.split(/[\.-]/).slice(0, 3).join('.'); | ||
} |
@@ -38,2 +38,3 @@ "use strict"; | ||
maxBuffer: 1024 * 1024 * 10, | ||
windowsHide: true, | ||
}).toString(); | ||
@@ -68,2 +69,3 @@ const lockFileHash = getLockFileHash(lockFileContents); | ||
maxBuffer: 1024 * 1024 * 10, | ||
windowsHide: true, | ||
}).toString(); | ||
@@ -70,0 +72,0 @@ const lockFileHash = getLockFileHash(lockFileContents); |
@@ -22,3 +22,3 @@ "use strict"; | ||
const isLibrary = projectNode.type === 'lib'; | ||
const rootPackageJson = (0, fileutils_1.readJsonFile)(`${options.root || workspace_root_1.workspaceRoot}/package.json`); | ||
const rootPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(options.root ?? workspace_root_1.workspaceRoot, 'package.json')); | ||
const npmDeps = findProjectsNpmDependencies(projectNode, graph, options.target, rootPackageJson, { | ||
@@ -33,3 +33,3 @@ helperDependencies: options.helperDependencies, | ||
}; | ||
const projectPackageJsonPath = (0, path_1.join)(options.root || workspace_root_1.workspaceRoot, projectNode.data.root, 'package.json'); | ||
const projectPackageJsonPath = (0, path_1.join)(options.root ?? workspace_root_1.workspaceRoot, projectNode.data.root, 'package.json'); | ||
if ((0, fs_1.existsSync)(projectPackageJsonPath)) { | ||
@@ -36,0 +36,0 @@ try { |
@@ -10,3 +10,41 @@ "use strict"; | ||
let isTsEsmLoaderRegistered = false; | ||
/** | ||
* tsx is a utility to run TypeScript files in node which is growing in popularity: | ||
* https://tsx.is | ||
* | ||
* Behind the scenes it is invoking node with relevant --require and --import flags. | ||
* | ||
* If the user is invoking Nx via a script which is being invoked via tsx, then we | ||
* do not need to register any transpiler at all as the environment will have already | ||
* been configured by tsx. In fact, registering a transpiler such as ts-node or swc | ||
* in this case causes issues. | ||
* | ||
* Because node is being invoked by tsx, the tsx binary does not end up in the final | ||
* process.argv and so we need to check a few possible things to account for usage | ||
* via different package managers (e.g. pnpm does not set process._ to tsx, but rather | ||
* pnpm itself, modern yarn does not set process._ at all etc.). | ||
*/ | ||
const isInvokedByTsx = (() => { | ||
if (process.env._?.endsWith(`${path_1.sep}tsx`)) { | ||
return true; | ||
} | ||
const requireArgs = []; | ||
const importArgs = []; | ||
(process.execArgv ?? []).forEach((arg, i) => { | ||
if (arg === '-r' || arg === '--require') { | ||
requireArgs.push(process.execArgv[i + 1]); | ||
} | ||
if (arg === '--import') { | ||
importArgs.push(process.execArgv[i + 1]); | ||
} | ||
}); | ||
const isTsxPath = (p) => p.includes(`${path_1.sep}tsx${path_1.sep}`); | ||
return (requireArgs.some((a) => isTsxPath(a)) || | ||
importArgs.some((a) => isTsxPath(a))); | ||
})(); | ||
function registerTsProject(path, configFilename) { | ||
// See explanation alongside isInvokedByTsx declaration | ||
if (isInvokedByTsx) { | ||
return () => { }; | ||
} | ||
const tsConfigPath = configFilename ? (0, path_1.join)(path, configFilename) : path; | ||
@@ -13,0 +51,0 @@ const compilerOptions = readCompilerOptions(tsConfigPath); |
@@ -21,2 +21,9 @@ import { TargetConfiguration } from '../../config/workspace-json-project-json'; | ||
nonAtomizedTarget?: string; | ||
help?: { | ||
command: string; | ||
example: { | ||
options?: Record<string, unknown>; | ||
args?: string[]; | ||
}; | ||
}; | ||
}; | ||
@@ -37,2 +44,9 @@ executor?: undefined; | ||
nonAtomizedTarget?: string; | ||
help?: { | ||
command: string; | ||
example: { | ||
options?: Record<string, unknown>; | ||
args?: string[]; | ||
}; | ||
}; | ||
}; | ||
@@ -52,2 +66,9 @@ command?: undefined; | ||
nonAtomizedTarget?: string; | ||
help?: { | ||
command: string; | ||
example: { | ||
options?: Record<string, unknown>; | ||
args?: string[]; | ||
}; | ||
}; | ||
}; | ||
@@ -62,2 +83,9 @@ command?: undefined; | ||
nonAtomizedTarget?: string; | ||
help?: { | ||
command: string; | ||
example: { | ||
options?: Record<string, unknown>; | ||
args?: string[]; | ||
}; | ||
}; | ||
}; | ||
@@ -78,2 +106,9 @@ command?: undefined; | ||
nonAtomizedTarget?: string; | ||
help?: { | ||
command: string; | ||
example: { | ||
options?: Record<string, unknown>; | ||
args?: string[]; | ||
}; | ||
}; | ||
}; | ||
@@ -80,0 +115,0 @@ command?: undefined; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const path = require("path"); | ||
const net_1 = require("net"); | ||
// TODO (@AgentEnder): After scoped verbose logging is implemented, re-add verbose logs here. | ||
@@ -12,4 +13,4 @@ // import { logger } from '../../utils/logger'; | ||
const consume_messages_from_socket_1 = require("../../../utils/consume-messages-from-socket"); | ||
const exit_codes_1 = require("../../../utils/exit-codes"); | ||
const messaging_1 = require("./messaging"); | ||
const net_1 = require("net"); | ||
const cleanupFunctions = new Set(); | ||
@@ -186,4 +187,2 @@ const pluginNames = new Map(); | ||
const exitHandler = () => { | ||
if (cleanedUp) | ||
return; | ||
for (const fn of cleanupFunctions) { | ||
@@ -195,3 +194,6 @@ fn(); | ||
process.on('exit', exitHandler); | ||
process.on('SIGINT', exitHandler); | ||
process.on('SIGINT', () => { | ||
exitHandler(); | ||
process.exit((0, exit_codes_1.signalToCode)('SIGINT')); | ||
}); | ||
process.on('SIGTERM', exitHandler); | ||
@@ -235,13 +237,13 @@ function registerPendingPromise(tx, pending, callback) { | ||
const ipcPath = (0, socket_utils_1.getPluginOsSocketPath)([process.pid, global.nxPluginWorkerCount++].join('-')); | ||
const worker = (0, child_process_1.fork)(workerPath, [ipcPath], { | ||
const worker = (0, child_process_1.spawn)(process.execPath, [ | ||
...(isWorkerTypescript ? ['--require', 'ts-node/register'] : []), | ||
workerPath, | ||
ipcPath, | ||
], { | ||
stdio: process.stdout.isTTY ? 'inherit' : 'ignore', | ||
env, | ||
execArgv: [ | ||
...process.execArgv, | ||
// If the worker is typescript, we need to register ts-node | ||
...(isWorkerTypescript ? ['-r', 'ts-node/register'] : []), | ||
], | ||
detached: true, | ||
shell: false, | ||
windowsHide: true, | ||
}); | ||
worker.disconnect(); | ||
worker.unref(); | ||
@@ -248,0 +250,0 @@ let attempts = 0; |
@@ -12,8 +12,8 @@ import { ProjectConfiguration } from '../../config/workspace-json-project-json'; | ||
export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{ | ||
allWorkspaceFiles: import("../file-utils").FileData[]; | ||
allWorkspaceFiles: import("nx/src/devkit-exports").FileData[]; | ||
fileMap: { | ||
projectFileMap: ProjectFiles; | ||
nonProjectFiles: import("../../native").FileData[]; | ||
nonProjectFiles: import("nx/src/native").FileData[]; | ||
}; | ||
rustReferences: import("../../native").NxWorkspaceFilesExternals; | ||
rustReferences: import("nx/src/native").NxWorkspaceFilesExternals; | ||
}>; | ||
@@ -20,0 +20,0 @@ /** |
@@ -13,2 +13,3 @@ "use strict"; | ||
!!process.env['bamboo.buildKey'] || | ||
!!process.env['bamboo_buildKey'] || | ||
!!process.env.CODEBUILD_BUILD_ID || | ||
@@ -15,0 +16,0 @@ !!process.env.GITLAB_CI || |
Sorry, the diff of this file is too big to display
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
4258553
48768
378
+ Added@nrwl/tao@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-darwin-arm64@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-darwin-x64@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-freebsd-x64@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-linux-arm-gnueabihf@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-linux-arm64-gnu@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-linux-arm64-musl@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-linux-x64-gnu@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-linux-x64-musl@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-win32-arm64-msvc@19.4.0-canary.20240628-336d371(transitive)
+ Added@nx/nx-win32-x64-msvc@19.4.0-canary.20240628-336d371(transitive)
- Removed@nrwl/tao@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-darwin-arm64@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-darwin-x64@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-freebsd-x64@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-linux-arm-gnueabihf@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-linux-arm64-gnu@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-linux-arm64-musl@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-linux-x64-gnu@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-linux-x64-musl@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-win32-arm64-msvc@19.4.0-canary.20240627-c2c6a13(transitive)
- Removed@nx/nx-win32-x64-msvc@19.4.0-canary.20240627-c2c6a13(transitive)