nx 20.4.0-canary.20250114-6181592 → 20.4.0-canary.20250116-a127177
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/release/version.js +8 -0
- package/src/command-line/yargs-utils/shared-options.d.ts +1 -0
- package/src/command-line/yargs-utils/shared-options.js +7 -0
- package/src/daemon/server/server.js +2 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/error-types.d.ts +2 -0
- package/src/project-graph/error-types.js +66 -8
- package/src/project-graph/project-graph.js +0 -3
- package/src/project-graph/utils/project-configuration-utils.js +1 -17
- package/src/tasks-runner/cache.d.ts +1 -0
- package/src/tasks-runner/cache.js +20 -2
- package/src/tasks-runner/default-tasks-runner.d.ts +1 -0
- package/src/utils/command-line-utils.d.ts +1 -0
- package/src/utils/command-line-utils.js +8 -1
- package/src/utils/handle-errors.js +7 -11
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "nx",
|
3
|
-
"version": "20.4.0-canary.
|
3
|
+
"version": "20.4.0-canary.20250116-a127177",
|
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": {
|
@@ -82,16 +82,16 @@
|
|
82
82
|
}
|
83
83
|
},
|
84
84
|
"optionalDependencies": {
|
85
|
-
"@nx/nx-darwin-arm64": "20.4.0-canary.
|
86
|
-
"@nx/nx-darwin-x64": "20.4.0-canary.
|
87
|
-
"@nx/nx-freebsd-x64": "20.4.0-canary.
|
88
|
-
"@nx/nx-linux-arm-gnueabihf": "20.4.0-canary.
|
89
|
-
"@nx/nx-linux-arm64-gnu": "20.4.0-canary.
|
90
|
-
"@nx/nx-linux-arm64-musl": "20.4.0-canary.
|
91
|
-
"@nx/nx-linux-x64-gnu": "20.4.0-canary.
|
92
|
-
"@nx/nx-linux-x64-musl": "20.4.0-canary.
|
93
|
-
"@nx/nx-win32-arm64-msvc": "20.4.0-canary.
|
94
|
-
"@nx/nx-win32-x64-msvc": "20.4.0-canary.
|
85
|
+
"@nx/nx-darwin-arm64": "20.4.0-canary.20250116-a127177",
|
86
|
+
"@nx/nx-darwin-x64": "20.4.0-canary.20250116-a127177",
|
87
|
+
"@nx/nx-freebsd-x64": "20.4.0-canary.20250116-a127177",
|
88
|
+
"@nx/nx-linux-arm-gnueabihf": "20.4.0-canary.20250116-a127177",
|
89
|
+
"@nx/nx-linux-arm64-gnu": "20.4.0-canary.20250116-a127177",
|
90
|
+
"@nx/nx-linux-arm64-musl": "20.4.0-canary.20250116-a127177",
|
91
|
+
"@nx/nx-linux-x64-gnu": "20.4.0-canary.20250116-a127177",
|
92
|
+
"@nx/nx-linux-x64-musl": "20.4.0-canary.20250116-a127177",
|
93
|
+
"@nx/nx-win32-arm64-msvc": "20.4.0-canary.20250116-a127177",
|
94
|
+
"@nx/nx-win32-x64-msvc": "20.4.0-canary.20250116-a127177"
|
95
95
|
},
|
96
96
|
"nx-migrations": {
|
97
97
|
"migrations": "./migrations.json",
|
@@ -313,6 +313,14 @@ function createAPI(overrideReleaseConfig) {
|
|
313
313
|
});
|
314
314
|
}
|
315
315
|
}
|
316
|
+
if (args.gitPush ?? nxReleaseConfig.version.git.push) {
|
317
|
+
output_1.output.logSingleLine(`Pushing to git remote "${args.gitRemote}"`);
|
318
|
+
await (0, git_1.gitPush)({
|
319
|
+
gitRemote: args.gitRemote,
|
320
|
+
dryRun: args.dryRun,
|
321
|
+
verbose: args.verbose,
|
322
|
+
});
|
323
|
+
}
|
316
324
|
return {
|
317
325
|
workspaceVersion,
|
318
326
|
projectsVersionData: versionData,
|
@@ -75,6 +75,13 @@ function withRunOptions(yargs) {
|
|
75
75
|
describe: 'Rerun the tasks even when the results are available in the cache.',
|
76
76
|
type: 'boolean',
|
77
77
|
default: false,
|
78
|
+
alias: 'disableNxCache',
|
79
|
+
})
|
80
|
+
.options('skipRemoteCache', {
|
81
|
+
type: 'boolean',
|
82
|
+
describe: 'Disables the remote cache.',
|
83
|
+
default: false,
|
84
|
+
alias: 'disableRemoteCache',
|
78
85
|
})
|
79
86
|
.options('excludeTaskDependencies', {
|
80
87
|
describe: 'Skips running dependent tasks first.',
|
@@ -181,8 +181,8 @@ async function handleResult(socket, type, hrFn) {
|
|
181
181
|
logger_1.serverLogger.log(`Handled ${type}. Handling time: ${doneHandlingMark.getTime() - startMark.getTime()}. Response time: ${endMark.getTime() - doneHandlingMark.getTime()}.`);
|
182
182
|
}
|
183
183
|
function handleInactivityTimeout() {
|
184
|
-
if (
|
185
|
-
logger_1.serverLogger.log(`There are
|
184
|
+
if ((0, file_watcher_sockets_1.hasRegisteredFileWatcherSockets)()) {
|
185
|
+
logger_1.serverLogger.log(`There are open file watchers. Resetting inactivity timer.`);
|
186
186
|
(0, shutdown_utils_1.resetInactivityTimeout)(handleInactivityTimeout);
|
187
187
|
}
|
188
188
|
else {
|
Binary file
|
@@ -4,6 +4,7 @@ import { ProjectGraph } from '../config/project-graph';
|
|
4
4
|
import { CreateNodesFunctionV2 } from './plugins/public-api';
|
5
5
|
export declare class ProjectGraphError extends Error {
|
6
6
|
#private;
|
7
|
+
private readonly errors;
|
7
8
|
constructor(errors: Array<AggregateCreateNodesError | MergeNodesError | ProjectsWithNoNameError | MultipleProjectsWithSameNameError | ProcessDependenciesError | CreateMetadataError | WorkspaceValidityError>, partialProjectGraph: ProjectGraph, partialSourceMaps: ConfigurationSourceMaps);
|
8
9
|
/**
|
9
10
|
* The daemon cannot throw errors which contain methods as they are not serializable.
|
@@ -83,6 +84,7 @@ export declare class AggregateCreateNodesError extends Error {
|
|
83
84
|
*/
|
84
85
|
constructor(errors: Array<[file: string | null, error: Error]>, partialResults: Awaited<ReturnType<CreateNodesFunctionV2>>);
|
85
86
|
}
|
87
|
+
export declare function formatAggregateCreateNodesError(error: AggregateCreateNodesError, pluginName: string): void;
|
86
88
|
export declare class MergeNodesError extends Error {
|
87
89
|
file: string;
|
88
90
|
pluginName: string;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
var
|
2
|
+
var _ProjectGraphError_partialProjectGraph, _ProjectGraphError_partialSourceMaps;
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
4
|
exports.LoadPluginError = exports.DaemonProjectGraphError = exports.AggregateProjectGraphError = exports.WorkspaceValidityError = exports.ProcessDependenciesError = exports.CreateMetadataError = exports.MergeNodesError = exports.AggregateCreateNodesError = exports.ProjectConfigurationsError = exports.ProjectWithNoNameError = exports.ProjectsWithNoNameError = exports.ProjectWithExistingNameError = exports.MultipleProjectsWithSameNameError = exports.ProjectGraphError = void 0;
|
5
5
|
exports.isProjectWithExistingNameError = isProjectWithExistingNameError;
|
@@ -7,6 +7,7 @@ exports.isMultipleProjectsWithSameNameError = isMultipleProjectsWithSameNameErro
|
|
7
7
|
exports.isProjectsWithNoNameError = isProjectsWithNoNameError;
|
8
8
|
exports.isProjectWithNoNameError = isProjectWithNoNameError;
|
9
9
|
exports.isProjectConfigurationsError = isProjectConfigurationsError;
|
10
|
+
exports.formatAggregateCreateNodesError = formatAggregateCreateNodesError;
|
10
11
|
exports.isWorkspaceValidityError = isWorkspaceValidityError;
|
11
12
|
exports.isAggregateProjectGraphError = isAggregateProjectGraphError;
|
12
13
|
exports.isCreateMetadataError = isCreateMetadataError;
|
@@ -15,17 +16,45 @@ exports.isMergeNodesError = isMergeNodesError;
|
|
15
16
|
const tslib_1 = require("tslib");
|
16
17
|
class ProjectGraphError extends Error {
|
17
18
|
constructor(errors, partialProjectGraph, partialSourceMaps) {
|
18
|
-
|
19
|
-
|
19
|
+
const messageFragments = ['Failed to process project graph.'];
|
20
|
+
const mergeNodesErrors = [];
|
21
|
+
const unknownErrors = [];
|
22
|
+
for (const e of errors) {
|
23
|
+
if (
|
24
|
+
// Known errors that are self-explanatory
|
25
|
+
isAggregateCreateNodesError(e) ||
|
26
|
+
isCreateMetadataError(e) ||
|
27
|
+
isProcessDependenciesError(e) ||
|
28
|
+
isProjectsWithNoNameError(e) ||
|
29
|
+
isMultipleProjectsWithSameNameError(e) ||
|
30
|
+
isWorkspaceValidityError(e)) {
|
31
|
+
}
|
32
|
+
else if (
|
33
|
+
// Known error type, but unlikely to be caused by the user
|
34
|
+
isMergeNodesError(e)) {
|
35
|
+
mergeNodesErrors.push(e);
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
unknownErrors.push(e);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
if (mergeNodesErrors.length > 0) {
|
42
|
+
messageFragments.push(`This type of error most likely points to an issue within Nx. Please report it.`);
|
43
|
+
}
|
44
|
+
if (unknownErrors.length > 0) {
|
45
|
+
messageFragments.push(`If the error cause is not obvious from the below error messages, running "nx reset" may fix it. Please report the issue if you keep seeing it.`);
|
46
|
+
}
|
47
|
+
super(messageFragments.join(' '));
|
48
|
+
this.errors = errors;
|
20
49
|
_ProjectGraphError_partialProjectGraph.set(this, void 0);
|
21
50
|
_ProjectGraphError_partialSourceMaps.set(this, void 0);
|
22
51
|
this.name = this.constructor.name;
|
23
|
-
|
52
|
+
this.errors = errors;
|
24
53
|
tslib_1.__classPrivateFieldSet(this, _ProjectGraphError_partialProjectGraph, partialProjectGraph, "f");
|
25
54
|
tslib_1.__classPrivateFieldSet(this, _ProjectGraphError_partialSourceMaps, partialSourceMaps, "f");
|
26
|
-
this.stack =
|
55
|
+
this.stack = errors
|
27
56
|
.map((error) => indentString(formatErrorStackAndCause(error), 2))
|
28
|
-
.join('\n')
|
57
|
+
.join('\n');
|
29
58
|
}
|
30
59
|
/**
|
31
60
|
* The daemon cannot throw errors which contain methods as they are not serializable.
|
@@ -47,11 +76,11 @@ class ProjectGraphError extends Error {
|
|
47
76
|
return tslib_1.__classPrivateFieldGet(this, _ProjectGraphError_partialSourceMaps, "f");
|
48
77
|
}
|
49
78
|
getErrors() {
|
50
|
-
return
|
79
|
+
return this.errors;
|
51
80
|
}
|
52
81
|
}
|
53
82
|
exports.ProjectGraphError = ProjectGraphError;
|
54
|
-
|
83
|
+
_ProjectGraphError_partialProjectGraph = new WeakMap(), _ProjectGraphError_partialSourceMaps = new WeakMap();
|
55
84
|
class MultipleProjectsWithSameNameError extends Error {
|
56
85
|
constructor(conflicts, projects) {
|
57
86
|
super([
|
@@ -179,6 +208,29 @@ class AggregateCreateNodesError extends Error {
|
|
179
208
|
}
|
180
209
|
}
|
181
210
|
exports.AggregateCreateNodesError = AggregateCreateNodesError;
|
211
|
+
function formatAggregateCreateNodesError(error, pluginName) {
|
212
|
+
const errorBodyLines = [
|
213
|
+
`${error.errors.length > 1 ? `${error.errors.length} errors` : 'An error'} occurred while processing files for the ${pluginName} plugin.`,
|
214
|
+
];
|
215
|
+
const errorStackLines = [];
|
216
|
+
const innerErrors = error.errors;
|
217
|
+
for (const [file, e] of innerErrors) {
|
218
|
+
if (file) {
|
219
|
+
errorBodyLines.push(` - ${file}: ${e.message}`);
|
220
|
+
errorStackLines.push(` - ${file}: ${e.stack}`);
|
221
|
+
}
|
222
|
+
else {
|
223
|
+
errorBodyLines.push(` - ${e.message}`);
|
224
|
+
errorStackLines.push(` - ${e.stack}`);
|
225
|
+
}
|
226
|
+
if (e.stack && process.env.NX_VERBOSE_LOGGING === 'true') {
|
227
|
+
const innerStackTrace = ' ' + e.stack.split('\n')?.join('\n ');
|
228
|
+
errorStackLines.push(innerStackTrace);
|
229
|
+
}
|
230
|
+
}
|
231
|
+
error.stack = errorStackLines.join('\n');
|
232
|
+
error.message = errorBodyLines.join('\n');
|
233
|
+
}
|
182
234
|
class MergeNodesError extends Error {
|
183
235
|
constructor({ file, pluginName, error, }) {
|
184
236
|
const msg = `The nodes created from ${file} by the "${pluginName}" could not be merged into the project graph:`;
|
@@ -212,6 +264,12 @@ class ProcessDependenciesError extends Error {
|
|
212
264
|
}
|
213
265
|
}
|
214
266
|
exports.ProcessDependenciesError = ProcessDependenciesError;
|
267
|
+
function isProcessDependenciesError(e) {
|
268
|
+
return (e instanceof ProcessDependenciesError ||
|
269
|
+
(typeof e === 'object' &&
|
270
|
+
'name' in e &&
|
271
|
+
e?.name === ProcessDependenciesError.name));
|
272
|
+
}
|
215
273
|
class WorkspaceValidityError extends Error {
|
216
274
|
constructor(message) {
|
217
275
|
message = `Configuration Error\n${message}`;
|
@@ -135,9 +135,6 @@ function handleProjectGraphError(opts, e) {
|
|
135
135
|
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
136
136
|
if (e instanceof error_types_1.ProjectGraphError) {
|
137
137
|
let title = e.message;
|
138
|
-
if (isVerbose) {
|
139
|
-
title += ' See errors below.';
|
140
|
-
}
|
141
138
|
const bodyLines = isVerbose
|
142
139
|
? [e.stack]
|
143
140
|
: ['Pass --verbose to see the stacktraces.'];
|
@@ -260,28 +260,12 @@ plugins) {
|
|
260
260
|
workspaceRoot: root,
|
261
261
|
})
|
262
262
|
.catch((e) => {
|
263
|
-
const errorBodyLines = [
|
264
|
-
`An error occurred while processing files for the ${pluginName} plugin.`,
|
265
|
-
];
|
266
263
|
const error = (0, error_types_1.isAggregateCreateNodesError)(e)
|
267
264
|
? // This is an expected error if something goes wrong while processing files.
|
268
265
|
e
|
269
266
|
: // This represents a single plugin erroring out with a hard error.
|
270
267
|
new error_types_1.AggregateCreateNodesError([[null, e]], []);
|
271
|
-
|
272
|
-
for (const [file, e] of innerErrors) {
|
273
|
-
if (file) {
|
274
|
-
errorBodyLines.push(` - ${file}: ${e.message}`);
|
275
|
-
}
|
276
|
-
else {
|
277
|
-
errorBodyLines.push(` - ${e.message}`);
|
278
|
-
}
|
279
|
-
if (e.stack) {
|
280
|
-
const innerStackTrace = ' ' + e.stack.split('\n')?.join('\n ');
|
281
|
-
errorBodyLines.push(innerStackTrace);
|
282
|
-
}
|
283
|
-
}
|
284
|
-
error.stack = errorBodyLines.join('\n');
|
268
|
+
(0, error_types_1.formatAggregateCreateNodesError)(error, pluginName);
|
285
269
|
// This represents a single plugin erroring out with a hard error.
|
286
270
|
errors.push(error);
|
287
271
|
// The plugin didn't return partial results, so we return an empty array.
|
@@ -61,6 +61,7 @@ function getCache(options) {
|
|
61
61
|
? new DbCache({
|
62
62
|
// Remove this in Nx 21
|
63
63
|
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)(nxJson) ? options.remoteCache : null,
|
64
|
+
skipRemoteCache: options.skipRemoteCache,
|
64
65
|
})
|
65
66
|
: new Cache(options);
|
66
67
|
}
|
@@ -132,6 +133,15 @@ class DbCache {
|
|
132
133
|
return this.remoteCachePromise;
|
133
134
|
}
|
134
135
|
async _getRemoteCache() {
|
136
|
+
if (this.options.skipRemoteCache) {
|
137
|
+
output_1.output.warn({
|
138
|
+
title: 'Remote Cache Disabled',
|
139
|
+
bodyLines: [
|
140
|
+
'Nx will continue running, but nothing will be written or read from the remote cache.',
|
141
|
+
],
|
142
|
+
});
|
143
|
+
return null;
|
144
|
+
}
|
135
145
|
const nxJson = (0, nx_json_1.readNxJson)();
|
136
146
|
if ((0, nx_cloud_utils_1.isNxCloudUsed)(nxJson)) {
|
137
147
|
const options = (0, get_cloud_options_1.getCloudOptions)();
|
@@ -211,6 +221,14 @@ class Cache {
|
|
211
221
|
this.cachePath = this.createCacheDir();
|
212
222
|
this.terminalOutputsDir = this.createTerminalOutputsDir();
|
213
223
|
this._currentMachineId = null;
|
224
|
+
if (this.options.skipRemoteCache) {
|
225
|
+
output_1.output.warn({
|
226
|
+
title: 'Remote Cache Disabled',
|
227
|
+
bodyLines: [
|
228
|
+
'Nx will continue running, but nothing will be written or read from the remote cache.',
|
229
|
+
],
|
230
|
+
});
|
231
|
+
}
|
214
232
|
}
|
215
233
|
removeOldCacheRecords() {
|
216
234
|
/**
|
@@ -255,7 +273,7 @@ class Cache {
|
|
255
273
|
await this.assertLocalCacheValidity(task);
|
256
274
|
return { ...res, remote: false };
|
257
275
|
}
|
258
|
-
else if (this.options.remoteCache) {
|
276
|
+
else if (this.options.remoteCache && !this.options.skipRemoteCache) {
|
259
277
|
// didn't find it locally but we have a remote cache
|
260
278
|
// attempt remote cache
|
261
279
|
await this.options.remoteCache.retrieve(task.hash, this.cachePath);
|
@@ -295,7 +313,7 @@ class Cache {
|
|
295
313
|
await (0, promises_1.writeFile)((0, path_1.join)(td, 'code'), code.toString());
|
296
314
|
await (0, promises_1.writeFile)((0, path_1.join)(td, 'source'), await this.currentMachineId());
|
297
315
|
await (0, promises_1.writeFile)(tdCommit, 'true');
|
298
|
-
if (this.options.remoteCache) {
|
316
|
+
if (this.options.remoteCache && !this.options.skipRemoteCache) {
|
299
317
|
await this.options.remoteCache.store(task.hash, this.cachePath);
|
300
318
|
}
|
301
319
|
if (terminalOutput) {
|
@@ -20,6 +20,7 @@ export interface DefaultTasksRunnerOptions {
|
|
20
20
|
lifeCycle: LifeCycle;
|
21
21
|
captureStderr?: boolean;
|
22
22
|
skipNxCache?: boolean;
|
23
|
+
skipRemoteCache?: boolean;
|
23
24
|
batch?: boolean;
|
24
25
|
}
|
25
26
|
export declare const defaultTasksRunner: TasksRunner<DefaultTasksRunnerOptions>;
|
@@ -113,7 +113,14 @@ function splitArgsIntoNxArgsAndOverrides(args, mode, options = { printWarnings:
|
|
113
113
|
nxArgs.exclude = args.exclude.split(',');
|
114
114
|
}
|
115
115
|
if (!nxArgs.skipNxCache) {
|
116
|
-
nxArgs.skipNxCache =
|
116
|
+
nxArgs.skipNxCache =
|
117
|
+
process.env.NX_SKIP_NX_CACHE === 'true' ||
|
118
|
+
process.env.NX_DISABLE_NX_CACHE === 'true';
|
119
|
+
}
|
120
|
+
if (!nxArgs.skipRemoteCache) {
|
121
|
+
nxArgs.skipRemoteCache =
|
122
|
+
process.env.NX_DISABLE_REMOTE_CACHE === 'true' ||
|
123
|
+
process.env.NX_SKIP_REMOTE_CACHE === 'true';
|
117
124
|
}
|
118
125
|
normalizeNxArgsRunner(nxArgs, nxJson, options);
|
119
126
|
nxArgs['parallel'] = (0, shared_options_1.readParallelFromArgsAndEnv)(args);
|
@@ -24,22 +24,18 @@ async function handleErrors(isVerbose, fn) {
|
|
24
24
|
'message' in projectGraphError.cause) {
|
25
25
|
title += ' ' + projectGraphError.cause.message + '.';
|
26
26
|
}
|
27
|
-
if (isVerbose) {
|
28
|
-
title += ' See errors below.';
|
29
|
-
}
|
30
|
-
const bodyLines = isVerbose
|
31
|
-
? formatErrorStackAndCause(projectGraphError)
|
32
|
-
: ['Pass --verbose to see the stacktraces.'];
|
33
27
|
output_1.output.error({
|
34
28
|
title,
|
35
|
-
bodyLines:
|
29
|
+
bodyLines: isVerbose
|
30
|
+
? formatErrorStackAndCause(projectGraphError, isVerbose)
|
31
|
+
: projectGraphError.getErrors().map((e) => e.message),
|
36
32
|
});
|
37
33
|
}
|
38
34
|
else {
|
39
35
|
const lines = (err.message ? err.message : err.toString()).split('\n');
|
40
36
|
const bodyLines = lines.slice(1);
|
41
37
|
if (isVerbose) {
|
42
|
-
bodyLines.push(...formatErrorStackAndCause(err));
|
38
|
+
bodyLines.push(...formatErrorStackAndCause(err, isVerbose));
|
43
39
|
}
|
44
40
|
else if (err.stack) {
|
45
41
|
bodyLines.push('Pass --verbose to see the stacktrace.');
|
@@ -56,13 +52,13 @@ async function handleErrors(isVerbose, fn) {
|
|
56
52
|
return 1;
|
57
53
|
}
|
58
54
|
}
|
59
|
-
function formatErrorStackAndCause(error) {
|
55
|
+
function formatErrorStackAndCause(error, verbose) {
|
60
56
|
return [
|
61
|
-
error.stack || error.message,
|
57
|
+
verbose ? error.stack || error.message : error.message,
|
62
58
|
...(error.cause && typeof error.cause === 'object'
|
63
59
|
? [
|
64
60
|
'Caused by:',
|
65
|
-
'stack' in error.cause
|
61
|
+
verbose && 'stack' in error.cause
|
66
62
|
? error.cause.stack.toString()
|
67
63
|
: error.cause.toString(),
|
68
64
|
]
|