nx 22.1.0 → 22.1.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/package.json +11 -11
- package/release/changelog-renderer/index.d.ts +1 -0
- package/release/changelog-renderer/index.d.ts.map +1 -1
- package/release/changelog-renderer/index.js +12 -12
- package/src/ai/constants.d.ts +6 -1
- package/src/ai/constants.d.ts.map +1 -1
- package/src/ai/constants.js +14 -3
- package/src/ai/set-up-ai-agents/set-up-ai-agents.d.ts.map +1 -1
- package/src/ai/set-up-ai-agents/set-up-ai-agents.js +41 -7
- package/src/command-line/daemon/command-object.d.ts +3 -2
- package/src/command-line/daemon/command-object.d.ts.map +1 -1
- package/src/command-line/daemon/command-object.js +11 -4
- package/src/command-line/graph/graph.d.ts.map +1 -1
- package/src/command-line/graph/graph.js +25 -16
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +1 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts.map +1 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +3 -3
- package/src/command-line/release/utils/shared.d.ts +2 -1
- package/src/command-line/release/utils/shared.d.ts.map +1 -1
- package/src/command-line/release/utils/shared.js +27 -1
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +1 -1
- package/src/command-line/report/report.d.ts +4 -0
- package/src/command-line/report/report.d.ts.map +1 -1
- package/src/command-line/report/report.js +72 -1
- package/src/command-line/yargs-utils/arguments-of.d.ts +12 -0
- package/src/command-line/yargs-utils/arguments-of.d.ts.map +1 -0
- package/src/command-line/yargs-utils/arguments-of.js +9 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/cache.d.ts +2 -1
- package/src/daemon/cache.d.ts.map +1 -1
- package/src/daemon/cache.js +10 -26
- package/src/daemon/client/client.d.ts +2 -0
- package/src/daemon/client/client.d.ts.map +1 -1
- package/src/daemon/client/client.js +55 -26
- package/src/daemon/is-nx-version-mismatch.d.ts +3 -0
- package/src/daemon/is-nx-version-mismatch.d.ts.map +1 -0
- package/src/daemon/is-nx-version-mismatch.js +24 -0
- package/src/daemon/server/server.d.ts.map +1 -1
- package/src/daemon/server/server.js +7 -18
- package/src/daemon/tmp-dir.d.ts.map +1 -1
- package/src/daemon/tmp-dir.js +1 -0
- package/src/native/nx.wasi-browser.js +53 -45
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/error-types.d.ts +3 -2
- package/src/project-graph/error-types.d.ts.map +1 -1
- package/src/project-graph/error-types.js +9 -2
- package/src/project-graph/plugins/get-plugins.d.ts.map +1 -1
- package/src/project-graph/plugins/get-plugins.js +33 -35
- package/src/project-graph/plugins/in-process-loader.d.ts.map +1 -1
- package/src/project-graph/plugins/in-process-loader.js +2 -2
- package/src/project-graph/plugins/isolation/plugin-pool.js +3 -2
- package/src/project-graph/plugins/isolation/plugin-worker.js +3 -3
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +5 -0
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts.map +1 -1
- package/src/project-graph/plugins/loaded-nx-plugin.js +5 -0
- package/src/project-graph/project-graph.d.ts +1 -0
- package/src/project-graph/project-graph.d.ts.map +1 -1
- package/src/project-graph/project-graph.js +21 -0
- package/src/project-graph/utils/project-configuration-utils.d.ts +1 -1
- package/src/project-graph/utils/project-configuration-utils.d.ts.map +1 -1
- package/src/project-graph/utils/project-configuration-utils.js +46 -15
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.d.ts.map +1 -1
- package/src/tasks-runner/pseudo-terminal.js +1 -1
- package/src/tasks-runner/task-orchestrator.d.ts +1 -0
- package/src/tasks-runner/task-orchestrator.d.ts.map +1 -1
- package/src/tasks-runner/task-orchestrator.js +22 -5
- package/src/tasks-runner/utils.d.ts.map +1 -1
- package/src/tasks-runner/utils.js +3 -2
- package/src/utils/ab-testing.js +1 -1
- package/src/utils/assert-workspace-validity.d.ts.map +1 -1
- package/src/utils/assert-workspace-validity.js +5 -8
- package/src/utils/call-sites.d.ts +15 -0
- package/src/utils/call-sites.d.ts.map +1 -0
- package/src/utils/call-sites.js +28 -0
- package/src/utils/package-manager.d.ts +1 -0
- package/src/utils/package-manager.d.ts.map +1 -1
- package/src/utils/package-manager.js +4 -0
|
@@ -21,6 +21,8 @@ const installed_plugins_1 = require("../../utils/plugins/installed-plugins");
|
|
|
21
21
|
const installation_directory_1 = require("../../utils/installation-directory");
|
|
22
22
|
const nx_json_1 = require("../../config/nx-json");
|
|
23
23
|
const error_types_1 = require("../../project-graph/error-types");
|
|
24
|
+
const operators_1 = require("../../project-graph/operators");
|
|
25
|
+
const versions_1 = require("../../utils/versions");
|
|
24
26
|
const nx_key_1 = require("../../utils/nx-key");
|
|
25
27
|
const cache_1 = require("../../tasks-runner/cache");
|
|
26
28
|
const nxPackageJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(__dirname, '../../../package.json'));
|
|
@@ -47,7 +49,7 @@ const LINE_SEPARATOR = '---------------------------------------';
|
|
|
47
49
|
*
|
|
48
50
|
*/
|
|
49
51
|
async function reportHandler() {
|
|
50
|
-
const { pm, pmVersion, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, projectGraphError, nativeTarget, cache, } = await getReportData();
|
|
52
|
+
const { pm, pmVersion, nxKey, nxKeyError, localPlugins, powerpackPlugins, communityPlugins, registeredPlugins, packageVersionsWeCareAbout, outOfSyncPackageGroup, mismatchedNxVersions, projectGraphError, nativeTarget, cache, } = await getReportData();
|
|
51
53
|
const fields = [
|
|
52
54
|
['Node', process.versions.node],
|
|
53
55
|
['OS', `${process.platform}-${process.arch}`],
|
|
@@ -137,6 +139,26 @@ async function reportHandler() {
|
|
|
137
139
|
bodyLines.push('');
|
|
138
140
|
bodyLines.push(`To fix this, run \`nx migrate ${outOfSyncPackageGroup.migrateTarget}\``);
|
|
139
141
|
}
|
|
142
|
+
if (mismatchedNxVersions && mismatchedNxVersions.length > 0) {
|
|
143
|
+
bodyLines.push(LINE_SEPARATOR);
|
|
144
|
+
bodyLines.push(chalk.yellow('⚠️ Multiple Nx versions detected'));
|
|
145
|
+
bodyLines.push('');
|
|
146
|
+
bodyLines.push(`Your workspace uses nx@${versions_1.nxVersion}, but other packages depend on a different version:`);
|
|
147
|
+
for (const { version, chain } of mismatchedNxVersions) {
|
|
148
|
+
if (chain.length === 0) {
|
|
149
|
+
bodyLines.push(` - ${chalk.bold(`nx@${version}`)}`);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
bodyLines.push(` - ${chain.reverse().join(' → ')} → ${chalk.bold(`nx@${version}`)}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
bodyLines.push('');
|
|
156
|
+
bodyLines.push('These packages should not have nx as a dependency. Please report this issue to the package maintainers.');
|
|
157
|
+
const whyCommand = (0, package_manager_1.getPackageManagerCommand)(pm).why;
|
|
158
|
+
for (const { version } of mismatchedNxVersions) {
|
|
159
|
+
bodyLines.push(`Run \`${whyCommand} nx@${version}\` for more details.`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
140
162
|
if (projectGraphError) {
|
|
141
163
|
bodyLines.push(LINE_SEPARATOR);
|
|
142
164
|
bodyLines.push('⚠️ Unable to construct project graph.');
|
|
@@ -148,6 +170,53 @@ async function reportHandler() {
|
|
|
148
170
|
bodyLines,
|
|
149
171
|
});
|
|
150
172
|
}
|
|
173
|
+
function findDependencyChain(graph, targetNode) {
|
|
174
|
+
const reversedGraph = (0, operators_1.reverse)(graph);
|
|
175
|
+
// BFS to find shortest path to root dependency
|
|
176
|
+
const queue = [
|
|
177
|
+
{ node: targetNode, path: [] },
|
|
178
|
+
];
|
|
179
|
+
const visited = new Set();
|
|
180
|
+
while (queue.length > 0) {
|
|
181
|
+
const { node, path } = queue.shift();
|
|
182
|
+
if (visited.has(node))
|
|
183
|
+
continue;
|
|
184
|
+
visited.add(node);
|
|
185
|
+
const deps = reversedGraph.dependencies[node] || [];
|
|
186
|
+
// Check for unvisited dependents
|
|
187
|
+
const unvisitedDeps = deps.filter((dep) => !visited.has(dep.target));
|
|
188
|
+
// No unvisited dependents - this is our shortest path
|
|
189
|
+
if (unvisitedDeps.length === 0) {
|
|
190
|
+
return path;
|
|
191
|
+
}
|
|
192
|
+
for (const dep of unvisitedDeps) {
|
|
193
|
+
const depName = graph.externalNodes?.[dep.target]?.data?.packageName ?? dep.target;
|
|
194
|
+
queue.push({
|
|
195
|
+
node: dep.target,
|
|
196
|
+
path: [...path, depName],
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
function findMismatchedNxVersions(graph) {
|
|
203
|
+
if (!graph || !graph.externalNodes) {
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
const result = [];
|
|
207
|
+
// Find all nx package versions that don't match the workspace version
|
|
208
|
+
for (const nodeName of Object.keys(graph.externalNodes)) {
|
|
209
|
+
const node = graph.externalNodes[nodeName];
|
|
210
|
+
if (node.data?.packageName === 'nx') {
|
|
211
|
+
const version = node.data.version || 'unknown';
|
|
212
|
+
if (version !== versions_1.nxVersion) {
|
|
213
|
+
const chain = findDependencyChain(graph, nodeName);
|
|
214
|
+
result.push({ version, chain });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
151
220
|
async function getReportData() {
|
|
152
221
|
const pm = (0, package_manager_1.detectPackageManager)();
|
|
153
222
|
const pmVersion = (0, package_manager_1.getPackageManagerVersion)(pm);
|
|
@@ -169,6 +238,7 @@ async function getReportData() {
|
|
|
169
238
|
});
|
|
170
239
|
}
|
|
171
240
|
const outOfSyncPackageGroup = findMisalignedPackagesForPackage(nxPackageJson);
|
|
241
|
+
const mismatchedNxVersions = findMismatchedNxVersions(graph);
|
|
172
242
|
const native = isNativeAvailable();
|
|
173
243
|
let nxKey = null;
|
|
174
244
|
let nxKeyError = null;
|
|
@@ -197,6 +267,7 @@ async function getReportData() {
|
|
|
197
267
|
registeredPlugins,
|
|
198
268
|
packageVersionsWeCareAbout,
|
|
199
269
|
outOfSyncPackageGroup,
|
|
270
|
+
mismatchedNxVersions,
|
|
200
271
|
projectGraphError,
|
|
201
272
|
nativeTarget: native ? native.getBinaryTarget() : null,
|
|
202
273
|
cache,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Argv, CommandModule as YargsCommandModule } from 'yargs';
|
|
2
|
+
export type Builder<InitialArgs, FinalArgs> = (yargs: Argv<InitialArgs>) => Argv<FinalArgs>;
|
|
3
|
+
export type Handler<B extends Builder<any, any>> = (args: Awaited<ReturnType<B>['argv']>) => void | Promise<void>;
|
|
4
|
+
export interface CommandModule<T, U> extends Omit<YargsCommandModule<T, U>, 'handler'> {
|
|
5
|
+
builder: Builder<T, U>;
|
|
6
|
+
handler: Handler<Builder<T, U>>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to define a Yargs CommandModule with proper typing and not sacrifice inference.
|
|
10
|
+
*/
|
|
11
|
+
export declare function makeCommandModule<T, U>(module: CommandModule<T, U>): CommandModule<T, U>;
|
|
12
|
+
//# sourceMappingURL=arguments-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arguments-of.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/command-line/yargs-utils/arguments-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEvE,MAAM,MAAM,OAAO,CAAC,WAAW,EAAE,SAAS,IAAI,CAC5C,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,KACrB,IAAI,CAAC,SAAS,CAAC,CAAC;AAErB,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CACjD,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KACjC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC,CACjC,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC;IACjD,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EACpC,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1B,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAErB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCommandModule = makeCommandModule;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to define a Yargs CommandModule with proper typing and not sacrifice inference.
|
|
6
|
+
*/
|
|
7
|
+
function makeCommandModule(module) {
|
|
8
|
+
return module;
|
|
9
|
+
}
|