nx 23.0.0-beta.1 → 23.0.0-beta.2
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/dist/bin/nx.js +2 -2
- package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +15 -23
- package/dist/src/command-line/graph/graph.js +0 -1
- package/dist/src/command-line/release/utils/shared.js +22 -12
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/daemon/client/client.js +11 -3
- package/dist/src/daemon/client/daemon-environment.d.ts +8 -0
- package/dist/src/daemon/client/daemon-environment.js +29 -0
- package/dist/src/daemon/is-nx-version-mismatch.d.ts +0 -1
- package/dist/src/daemon/is-nx-version-mismatch.js +2 -18
- package/dist/src/daemon/server/file-watching/changed-projects.js +15 -6
- package/dist/src/daemon/server/handle-update-workspace-context.js +1 -1
- package/dist/src/daemon/server/latest-nx.js +2 -0
- package/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts +1 -1
- package/dist/src/daemon/server/project-graph-incremental-recomputation.js +182 -138
- package/dist/src/daemon/server/server.js +7 -12
- package/dist/src/daemon/server/watcher.d.ts +7 -0
- package/dist/src/daemon/server/watcher.js +39 -11
- package/dist/src/native/index.d.ts +10 -3
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/project-graph/plugins/get-plugins.js +7 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +2 -3
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +22 -4
- package/dist/src/tasks-runner/task-orchestrator.js +6 -1
- package/dist/src/tasks-runner/utils.d.ts +11 -0
- package/dist/src/tasks-runner/utils.js +37 -0
- package/dist/src/utils/ab-testing.js +12 -0
- package/dist/src/utils/installed-nx-version.d.ts +8 -0
- package/dist/src/utils/installed-nx-version.js +67 -0
- package/dist/src/utils/workspace-context.js +2 -2
- package/package.json +11 -11
package/dist/bin/nx.js
CHANGED
|
@@ -109,10 +109,10 @@ async function main() {
|
|
|
109
109
|
warnIfUsingOutdatedGlobalInstall(GLOBAL_NX_VERSION, LOCAL_NX_VERSION);
|
|
110
110
|
if (localNx.includes('.nx')) {
|
|
111
111
|
const nxWrapperPath = localNx.replace(/\.nx.*/, '.nx/') + 'nxw.js';
|
|
112
|
-
|
|
112
|
+
require(nxWrapperPath);
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
|
|
115
|
+
require(localNx);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -15,38 +15,30 @@ const package_json_1 = require("../../utils/package-json");
|
|
|
15
15
|
const ignore_1 = require("../../utils/ignore");
|
|
16
16
|
const provenance_1 = require("../../utils/provenance");
|
|
17
17
|
const workspace_root_1 = require("../../utils/workspace-root");
|
|
18
|
+
const installed_nx_version_1 = require("../../utils/installed-nx-version");
|
|
18
19
|
const constants_1 = require("../constants");
|
|
19
20
|
const clone_ai_config_repo_1 = require("../clone-ai-config-repo");
|
|
20
21
|
const utils_1 = require("../utils");
|
|
21
22
|
const handle_import_1 = require("../../utils/handle-import");
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* Best-effort fallback when `getInstalledNxVersion()` can't find an
|
|
25
|
+
* installed nx — read the version declared in the workspace's
|
|
26
|
+
* `package.json` (devDependencies/dependencies), stripping any semver
|
|
27
|
+
* range prefix, and finally a sane default.
|
|
24
28
|
*/
|
|
25
|
-
function
|
|
29
|
+
function getDeclaredNxVersionOrDefault() {
|
|
26
30
|
try {
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
31
|
+
const workspacePackageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'package.json'), 'utf-8'));
|
|
32
|
+
const declared = workspacePackageJson.devDependencies?.nx ||
|
|
33
|
+
workspacePackageJson.dependencies?.nx;
|
|
34
|
+
if (declared) {
|
|
35
|
+
return declared.replace(/^[\^~>=<]+/, '');
|
|
36
|
+
}
|
|
30
37
|
}
|
|
31
38
|
catch {
|
|
32
|
-
|
|
33
|
-
// Fallback: try to read from workspace package.json
|
|
34
|
-
const workspacePackageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'package.json'), 'utf-8'));
|
|
35
|
-
// Check devDependencies first, then dependencies
|
|
36
|
-
const nxVersion = workspacePackageJson.devDependencies?.nx ||
|
|
37
|
-
workspacePackageJson.dependencies?.nx;
|
|
38
|
-
if (nxVersion) {
|
|
39
|
-
// Remove any semver range characters (^, ~, >=, etc.)
|
|
40
|
-
return nxVersion.replace(/^[\^~>=<]+/, '');
|
|
41
|
-
}
|
|
42
|
-
throw new Error('Nx not found in package.json');
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
// If we can't determine the version, default to the newer format
|
|
46
|
-
// This handles cases where nx might not be installed or is globally installed
|
|
47
|
-
return '22.0.0';
|
|
48
|
-
}
|
|
39
|
+
// fall through to default
|
|
49
40
|
}
|
|
41
|
+
return '22.0.0';
|
|
50
42
|
}
|
|
51
43
|
async function setupAiAgentsGenerator(tree, options, inner = false) {
|
|
52
44
|
const normalizedOptions = normalizeOptions(options);
|
|
@@ -77,7 +69,7 @@ function normalizeOptions(options) {
|
|
|
77
69
|
}
|
|
78
70
|
async function setupAiAgentsGeneratorImpl(tree, options) {
|
|
79
71
|
const hasAgent = (agent) => options.agents.includes(agent);
|
|
80
|
-
const nxVersion =
|
|
72
|
+
const nxVersion = (0, installed_nx_version_1.getInstalledNxVersion)() ?? getDeclaredNxVersionOrDefault();
|
|
81
73
|
const agentsMd = (0, constants_1.agentsMdPath)(options.directory);
|
|
82
74
|
// write AGENTS.md for most agents
|
|
83
75
|
if (hasAgent('cursor') ||
|
|
@@ -402,7 +402,6 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
|
402
402
|
// Avoid https://en.wikipedia.org/wiki/Directory_traversal_attack
|
|
403
403
|
// e.g curl --path-as-is http://localhost:9000/../fileInDanger.txt
|
|
404
404
|
// by limiting the path to current directory only
|
|
405
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
406
405
|
const sanitizePath = (0, node_path_1.basename)(parsedUrl.pathname);
|
|
407
406
|
if (sanitizePath === 'project-graph.json') {
|
|
408
407
|
const requestFull = parsedUrl.searchParams.get('full') === 'true';
|
|
@@ -15,6 +15,7 @@ const semver_1 = require("semver");
|
|
|
15
15
|
const utils_1 = require("../../../tasks-runner/utils");
|
|
16
16
|
const output_1 = require("../../../utils/output");
|
|
17
17
|
const git_1 = require("./git");
|
|
18
|
+
const find_matching_projects_1 = require("../../../utils/find-matching-projects");
|
|
18
19
|
exports.noDiffInChangelogMessage = pc.yellow(`NOTE: There was no diff detected for the changelog entry. Maybe you intended to pass alternative git references via --from and --to?`);
|
|
19
20
|
function isPrerelease(version) {
|
|
20
21
|
// prerelease returns an array of matching prerelease "components", or null if the version is not a prerelease
|
|
@@ -329,23 +330,32 @@ async function getCommitsRelevantToProjects(projectGraph, commits, projects, nxR
|
|
|
329
330
|
// Try to get the graph associated with the commit shortHash
|
|
330
331
|
// if not available, calculate it and store it in the cache
|
|
331
332
|
let affectedGraph = await releaseGraph.resolveAffectedFilesPerCommitInProjectGraph(commit, projectGraph);
|
|
333
|
+
// Resolve commit scopes using Nx matcher
|
|
334
|
+
const scopePatterns = commit.scope
|
|
335
|
+
? commit.scope.split(',').map((s) => s.trim())
|
|
336
|
+
: [];
|
|
337
|
+
let scopedProjects = null;
|
|
338
|
+
if (scopePatterns.length > 0) {
|
|
339
|
+
const matches = (0, find_matching_projects_1.findMatchingProjects)(scopePatterns, projectGraph.nodes);
|
|
340
|
+
// detect ambiguity
|
|
341
|
+
for (const pattern of scopePatterns) {
|
|
342
|
+
const perPatternMatches = (0, find_matching_projects_1.findMatchingProjects)([pattern], projectGraph.nodes);
|
|
343
|
+
if (perPatternMatches.length > 1) {
|
|
344
|
+
throw new Error(`Ambiguous scope "${pattern}" in commit "${commit.message}". ` +
|
|
345
|
+
`Matches: ${perPatternMatches.join(', ')}`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
scopedProjects = new Set(matches);
|
|
349
|
+
}
|
|
332
350
|
for (const projectName of Object.keys(affectedGraph.nodes)) {
|
|
333
351
|
if (projectSet.has(projectName)) {
|
|
334
352
|
if (!relevantCommits.has(projectName)) {
|
|
335
353
|
relevantCommits.set(projectName, []);
|
|
336
354
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
.get(projectName)
|
|
342
|
-
?.push({ commit, isProjectScopedCommit: true });
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
relevantCommits
|
|
346
|
-
.get(projectName)
|
|
347
|
-
?.push({ commit, isProjectScopedCommit: false });
|
|
348
|
-
}
|
|
355
|
+
const isProjectScopedCommit = scopedProjects === null || scopedProjects.has(projectName);
|
|
356
|
+
relevantCommits
|
|
357
|
+
.get(projectName)
|
|
358
|
+
?.push({ commit, isProjectScopedCommit });
|
|
349
359
|
}
|
|
350
360
|
}
|
|
351
361
|
}
|