nx 19.0.0-beta.0 → 19.0.0-beta.10
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/.eslintrc.json +1 -1
- package/migrations.json +2 -25
- package/package.json +12 -12
- package/src/command-line/add/add.js +17 -16
- package/src/command-line/affected/affected.js +1 -1
- package/src/command-line/graph/command-object.js +1 -1
- package/src/command-line/graph/graph.d.ts +11 -1
- package/src/command-line/graph/graph.js +97 -13
- package/src/command-line/init/implementation/react/index.js +1 -1
- package/src/command-line/release/changelog.js +1 -1
- package/src/command-line/release/command-object.js +2 -2
- package/src/command-line/release/publish.js +1 -1
- package/src/command-line/report/report.js +1 -1
- package/src/command-line/run/run-one.js +1 -1
- package/src/command-line/run-many/run-many.js +1 -1
- package/src/command-line/show/command-object.js +1 -5
- package/src/command-line/yargs-utils/shared-options.d.ts +3 -0
- package/src/command-line/yargs-utils/shared-options.js +16 -7
- package/src/config/nx-json.d.ts +2 -2
- package/src/config/to-project-name.d.ts +5 -0
- package/src/config/to-project-name.js +13 -0
- package/src/core/graph/index.html +1 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +2 -2
- package/src/daemon/client/client.js +21 -6
- package/src/daemon/server/project-graph-incremental-recomputation.js +8 -8
- package/src/daemon/server/server.js +1 -4
- package/src/daemon/server/shutdown-utils.js +7 -2
- package/src/daemon/socket-utils.js +2 -14
- package/src/daemon/tmp-dir.js +2 -2
- package/src/devkit-exports.d.ts +1 -5
- package/src/devkit-exports.js +1 -7
- package/src/devkit-internals.d.ts +2 -0
- package/src/devkit-internals.js +5 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -0
- package/src/executors/run-commands/run-commands.impl.js +69 -15
- package/src/executors/run-commands/schema.json +19 -2
- package/src/executors/utils/convert-nx-executor.js +2 -1
- package/src/generators/testing-utils/create-tree-with-empty-workspace.js +7 -0
- package/src/generators/utils/project-configuration.js +3 -8
- package/src/hasher/task-hasher.d.ts +4 -4
- package/src/native/index.d.ts +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.js +109 -67
- package/src/plugins/package-json-workspaces/create-nodes.d.ts +1 -0
- package/src/plugins/package-json-workspaces/create-nodes.js +25 -20
- package/src/plugins/project-json/build-nodes/project-json.js +2 -2
- package/src/project-graph/affected/locators/workspace-projects.js +3 -1
- package/src/project-graph/build-project-graph.d.ts +8 -18
- package/src/project-graph/build-project-graph.js +86 -57
- package/src/project-graph/error-types.d.ts +35 -3
- package/src/project-graph/error-types.js +84 -2
- package/src/project-graph/file-utils.d.ts +2 -3
- package/src/project-graph/file-utils.js +5 -9
- package/src/project-graph/plugins/internal-api.d.ts +3 -2
- package/src/project-graph/plugins/internal-api.js +3 -0
- package/src/project-graph/plugins/isolation/messaging.d.ts +34 -8
- package/src/project-graph/plugins/isolation/messaging.js +27 -10
- package/src/project-graph/plugins/isolation/plugin-pool.js +34 -15
- package/src/project-graph/plugins/isolation/plugin-worker.js +41 -4
- package/src/project-graph/plugins/loader.js +36 -24
- package/src/project-graph/plugins/public-api.d.ts +11 -1
- package/src/project-graph/plugins/utils.d.ts +2 -2
- package/src/project-graph/plugins/utils.js +19 -24
- package/src/project-graph/project-graph.d.ts +3 -0
- package/src/project-graph/project-graph.js +8 -7
- package/src/project-graph/utils/find-project-for-path.js +2 -3
- package/src/project-graph/utils/normalize-project-nodes.d.ts +1 -1
- package/src/project-graph/utils/normalize-project-nodes.js +8 -14
- package/src/project-graph/utils/project-configuration-utils.d.ts +23 -6
- package/src/project-graph/utils/project-configuration-utils.js +43 -20
- package/src/tasks-runner/create-task-graph.js +0 -1
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -1
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +4 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +2 -1
- package/src/tasks-runner/pseudo-terminal.js +8 -2
- package/src/tasks-runner/run-command.js +4 -4
- package/src/tasks-runner/utils.js +17 -0
- package/src/utils/assert-workspace-validity.js +2 -1
- package/src/utils/command-line-utils.d.ts +1 -1
- package/src/utils/nx-plugin.deprecated.d.ts +1 -1
- package/src/utils/nx-plugin.deprecated.js +1 -1
- package/src/utils/params.js +4 -0
- package/src/utils/perf-logging.js +3 -1
- package/src/utils/serializable-error.d.ts +4 -0
- package/src/utils/serializable-error.js +28 -0
- package/src/command-line/repair.d.ts +0 -4
- package/src/command-line/repair.js +0 -7
- package/src/command-line/run-many.d.ts +0 -4
- package/src/command-line/run-many.js +0 -7
- package/src/command-line/run-one.d.ts +0 -4
- package/src/command-line/run-one.js +0 -7
- package/src/command-line/run.d.ts +0 -4
- package/src/command-line/run.js +0 -7
- package/src/command-line/watch.d.ts +0 -4
- package/src/command-line/watch.js +0 -7
- package/src/config/workspaces.d.ts +0 -18
- package/src/config/workspaces.js +0 -35
- package/src/core/graph/3rdpartylicenses.txt +0 -785
- package/src/migrations/update-15-1-0/set-project-names.d.ts +0 -2
- package/src/migrations/update-15-1-0/set-project-names.js +0 -34
- package/src/migrations/update-15-8-2/update-nxw.d.ts +0 -2
- package/src/migrations/update-15-8-2/update-nxw.js +0 -7
- package/src/utils/typescript.d.ts +0 -1
- package/src/utils/typescript.js +0 -5
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.readTargetDefaultsForTarget = exports.resolveNxTokensInOptions = exports.isCompatibleTarget = exports.mergeTargetConfigurations = exports.readProjectConfigurationsFromRootMap = exports.createProjectConfigurations = exports.mergeProjectConfigurationIntoRootMap = void 0;
|
3
|
+
exports.normalizeTarget = exports.readTargetDefaultsForTarget = exports.resolveNxTokensInOptions = exports.isCompatibleTarget = exports.mergeTargetConfigurations = exports.readProjectConfigurationsFromRootMap = exports.createProjectConfigurations = exports.mergeMetadata = exports.mergeProjectConfigurationIntoRootMap = void 0;
|
4
4
|
const logger_1 = require("../../utils/logger");
|
5
5
|
const fileutils_1 = require("../../utils/fileutils");
|
6
6
|
const workspace_root_1 = require("../../utils/workspace-root");
|
@@ -12,17 +12,17 @@ const error_types_1 = require("../error-types");
|
|
12
12
|
function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
|
13
13
|
// This function is used when reading project configuration
|
14
14
|
// in generators, where we don't want to do this.
|
15
|
-
|
15
|
+
skipTargetNormalization) {
|
16
16
|
if (configurationSourceMaps && !configurationSourceMaps[project.root]) {
|
17
17
|
configurationSourceMaps[project.root] = {};
|
18
18
|
}
|
19
19
|
const sourceMap = configurationSourceMaps?.[project.root];
|
20
|
-
let matchingProject = projectRootMap
|
20
|
+
let matchingProject = projectRootMap[project.root];
|
21
21
|
if (!matchingProject) {
|
22
|
-
projectRootMap
|
22
|
+
projectRootMap[project.root] = {
|
23
23
|
root: project.root,
|
24
|
-
}
|
25
|
-
matchingProject = projectRootMap
|
24
|
+
};
|
25
|
+
matchingProject = projectRootMap[project.root];
|
26
26
|
if (sourceMap) {
|
27
27
|
sourceMap[`root`] = sourceInformation;
|
28
28
|
}
|
@@ -129,16 +129,18 @@ skipCommandNormalization) {
|
|
129
129
|
!matchingProject.targets?.[targetName]) {
|
130
130
|
continue;
|
131
131
|
}
|
132
|
-
const
|
132
|
+
const normalizedTarget = skipTargetNormalization
|
133
133
|
? target
|
134
|
-
:
|
134
|
+
: normalizeTarget(target, project);
|
135
|
+
const mergedTarget = mergeTargetConfigurations(normalizedTarget, matchingProject.targets?.[targetName], sourceMap, sourceInformation, `targets.${targetName}`);
|
135
136
|
// We don't want the symbol to live on past the merge process
|
136
137
|
if (mergedTarget?.[symbols_1.ONLY_MODIFIES_EXISTING_TARGET])
|
137
138
|
delete mergedTarget?.[symbols_1.ONLY_MODIFIES_EXISTING_TARGET];
|
138
139
|
updatedProjectConfiguration.targets[targetName] = mergedTarget;
|
139
140
|
}
|
140
141
|
}
|
141
|
-
projectRootMap
|
142
|
+
projectRootMap[updatedProjectConfiguration.root] =
|
143
|
+
updatedProjectConfiguration;
|
142
144
|
}
|
143
145
|
exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
|
144
146
|
function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata, matchingMetadata) {
|
@@ -210,6 +212,7 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
|
|
210
212
|
}
|
211
213
|
return result;
|
212
214
|
}
|
215
|
+
exports.mergeMetadata = mergeMetadata;
|
213
216
|
/**
|
214
217
|
* Transforms a list of project paths into a map of project configurations.
|
215
218
|
*
|
@@ -264,7 +267,7 @@ plugins) {
|
|
264
267
|
}
|
265
268
|
return Promise.all(results).then((results) => {
|
266
269
|
perf_hooks_1.performance.mark('createNodes:merge - start');
|
267
|
-
const projectRootMap =
|
270
|
+
const projectRootMap = {};
|
268
271
|
const externalNodes = {};
|
269
272
|
const configurationSourceMaps = {};
|
270
273
|
for (const result of results.flat()) {
|
@@ -291,14 +294,17 @@ plugins) {
|
|
291
294
|
}
|
292
295
|
Object.assign(externalNodes, pluginExternalNodes);
|
293
296
|
}
|
294
|
-
let projects;
|
295
297
|
try {
|
296
|
-
|
298
|
+
// We still call this just to assert that the root map
|
299
|
+
// only contains valid project names. This is a safety check.
|
300
|
+
//
|
301
|
+
// The signature itself can't be changed as we need it to return
|
302
|
+
// project configurations for use in devkit.
|
303
|
+
readProjectConfigurationsFromRootMap(projectRootMap);
|
297
304
|
}
|
298
305
|
catch (e) {
|
299
306
|
if ((0, error_types_1.isProjectsWithNoNameError)(e) ||
|
300
307
|
(0, error_types_1.isProjectsWithConflictingNamesError)(e)) {
|
301
|
-
projects = e.projects;
|
302
308
|
errors.push(e);
|
303
309
|
}
|
304
310
|
else {
|
@@ -312,18 +318,20 @@ plugins) {
|
|
312
318
|
perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
|
313
319
|
if (errors.length === 0) {
|
314
320
|
return {
|
315
|
-
projects,
|
321
|
+
projects: projectRootMap,
|
316
322
|
externalNodes,
|
317
323
|
projectRootMap: rootMap,
|
318
324
|
sourceMaps: configurationSourceMaps,
|
325
|
+
matchingProjectFiles: projectFiles,
|
319
326
|
};
|
320
327
|
}
|
321
328
|
else {
|
322
329
|
throw new error_types_1.ProjectConfigurationsError(errors, {
|
323
|
-
projects,
|
330
|
+
projects: projectRootMap,
|
324
331
|
externalNodes,
|
325
332
|
projectRootMap: rootMap,
|
326
333
|
sourceMaps: configurationSourceMaps,
|
334
|
+
matchingProjectFiles: projectFiles,
|
327
335
|
});
|
328
336
|
}
|
329
337
|
});
|
@@ -336,7 +344,8 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
|
|
336
344
|
// to provide better error messaging.
|
337
345
|
const conflicts = new Map();
|
338
346
|
const projectRootsWithNoName = [];
|
339
|
-
for (const
|
347
|
+
for (const root in projectRootMap) {
|
348
|
+
const configuration = projectRootMap[root];
|
340
349
|
// We're setting `// targets` as a comment `targets` is empty due to Project Crystal.
|
341
350
|
// Strip it before returning configuration for usage.
|
342
351
|
if (configuration['// targets'])
|
@@ -344,6 +353,9 @@ function readProjectConfigurationsFromRootMap(projectRootMap) {
|
|
344
353
|
if (!configuration.name) {
|
345
354
|
try {
|
346
355
|
const { name } = (0, fileutils_1.readJsonFile)((0, path_1.join)(root, 'package.json'));
|
356
|
+
if (!name) {
|
357
|
+
throw new Error("No name found for project at '" + root + "'.");
|
358
|
+
}
|
347
359
|
configuration.name = name;
|
348
360
|
}
|
349
361
|
catch {
|
@@ -388,7 +400,7 @@ function mergeTargetConfigurations(target, baseTarget, projectConfigSourceMap, s
|
|
388
400
|
const { configurations: defaultConfigurations, options: defaultOptions, ...baseTargetProperties } = baseTarget ?? {};
|
389
401
|
// Target is "compatible", e.g. executor is defined only once or is the same
|
390
402
|
// in both places. This means that it is likely safe to merge
|
391
|
-
const isCompatible = isCompatibleTarget(
|
403
|
+
const isCompatible = isCompatibleTarget(baseTarget ?? {}, target);
|
392
404
|
// If the targets are not compatible, we would normally overwrite the old target
|
393
405
|
// with the new one. However, we have a special case for targets that have the
|
394
406
|
// ONLY_MODIFIES_EXISTING_TARGET symbol set. This prevents the merged target
|
@@ -451,8 +463,8 @@ function isCompatibleTarget(a, b) {
|
|
451
463
|
return false;
|
452
464
|
const isRunCommands = a.executor === 'nx:run-commands';
|
453
465
|
if (isRunCommands) {
|
454
|
-
const aCommand = a.options?.command ?? a.options?.commands
|
455
|
-
const bCommand = b.options?.command ?? b.options?.commands
|
466
|
+
const aCommand = a.options?.command ?? a.options?.commands?.join(' && ');
|
467
|
+
const bCommand = b.options?.command ?? b.options?.commands?.join(' && ');
|
456
468
|
const oneHasNoCommand = !aCommand || !bCommand;
|
457
469
|
const hasSameCommand = aCommand === bCommand;
|
458
470
|
return oneHasNoCommand || hasSameCommand;
|
@@ -544,7 +556,8 @@ function readTargetDefaultsForTarget(targetName, targetDefaults, executor) {
|
|
544
556
|
exports.readTargetDefaultsForTarget = readTargetDefaultsForTarget;
|
545
557
|
function createRootMap(projectRootMap) {
|
546
558
|
const map = {};
|
547
|
-
for (const
|
559
|
+
for (const projectRoot in projectRootMap) {
|
560
|
+
const projectName = projectRootMap[projectRoot].name;
|
548
561
|
map[projectRoot] = projectName;
|
549
562
|
}
|
550
563
|
return map;
|
@@ -568,3 +581,13 @@ function resolveCommandSyntacticSugar(target, key) {
|
|
568
581
|
};
|
569
582
|
}
|
570
583
|
}
|
584
|
+
function normalizeTarget(target, project) {
|
585
|
+
target = resolveCommandSyntacticSugar(target, project.root);
|
586
|
+
target.options = resolveNxTokensInOptions(target.options, project, `${project.root}:${target}`);
|
587
|
+
target.configurations ??= {};
|
588
|
+
for (const configuration in target.configurations) {
|
589
|
+
target.configurations[configuration] = resolveNxTokensInOptions(target.configurations[configuration], project, `${project.root}:${target}:${configuration}`);
|
590
|
+
}
|
591
|
+
return target;
|
592
|
+
}
|
593
|
+
exports.normalizeTarget = normalizeTarget;
|
@@ -170,7 +170,6 @@ class ProcessTasks {
|
|
170
170
|
projectRoot: project.data.root,
|
171
171
|
overrides: interpolatedOverrides,
|
172
172
|
outputs: (0, utils_1.getOutputs)(this.projectGraph.nodes, qualifiedTarget, interpolatedOverrides),
|
173
|
-
// TODO(v19): Remove cast here after typing is moved back onto TargetConfiguration
|
174
173
|
cache: project.data.targets[target].cache,
|
175
174
|
};
|
176
175
|
}
|
@@ -24,6 +24,10 @@ const EXTENDED_LEFT_PAD = ` `;
|
|
24
24
|
*/
|
25
25
|
async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, overrides, }) {
|
26
26
|
cliCursor.hide();
|
27
|
+
// Show the cursor again after the process exits
|
28
|
+
process.on('exit', () => {
|
29
|
+
cliCursor.show();
|
30
|
+
});
|
27
31
|
let resolveRenderIsDonePromise;
|
28
32
|
const renderIsDone = new Promise((resolve) => (resolveRenderIsDonePromise = resolve)).then(() => {
|
29
33
|
clearRenderInterval();
|
@@ -261,7 +265,7 @@ async function createRunManyDynamicOutputRenderer({ projectNames, tasks, args, o
|
|
261
265
|
'',
|
262
266
|
`${failedTasksForPrinting
|
263
267
|
.map((t) => `${EXTENDED_LEFT_PAD}${output_1.output.colors.red('-')} ${output_1.output.formatCommand(t.toString())}`)
|
264
|
-
.join('\n
|
268
|
+
.join('\n')}`,
|
265
269
|
];
|
266
270
|
if (failedTasks.size > numFailedToPrint) {
|
267
271
|
failureSummaryRows.push(output_1.output.dim(`${EXTENDED_LEFT_PAD}...and ${failedTasks.size - numFailedToPrint} more...`));
|
@@ -24,6 +24,10 @@ const EXTENDED_LEFT_PAD = ` `;
|
|
24
24
|
*/
|
25
25
|
async function createRunOneDynamicOutputRenderer({ initiatingProject, tasks, args, overrides, }) {
|
26
26
|
cliCursor.hide();
|
27
|
+
// Show the cursor again after the process exits
|
28
|
+
process.on('exit', () => {
|
29
|
+
cliCursor.show();
|
30
|
+
});
|
27
31
|
let resolveRenderIsDonePromise;
|
28
32
|
const renderIsDone = new Promise((resolve) => (resolveRenderIsDonePromise = resolve)).then(() => {
|
29
33
|
clearRenderInterval();
|
@@ -11,10 +11,11 @@ export declare class PseudoTerminal {
|
|
11
11
|
static isSupported(): boolean;
|
12
12
|
constructor(rustPseudoTerminal: RustPseudoTerminal);
|
13
13
|
init(): Promise<void>;
|
14
|
-
runCommand(command: string, { cwd, jsEnv, quiet, }?: {
|
14
|
+
runCommand(command: string, { cwd, jsEnv, quiet, tty, }?: {
|
15
15
|
cwd?: string;
|
16
16
|
jsEnv?: Record<string, string>;
|
17
17
|
quiet?: boolean;
|
18
|
+
tty?: boolean;
|
18
19
|
}): PseudoTtyProcess;
|
19
20
|
fork(id: string, script: string, { cwd, jsEnv, quiet, }: {
|
20
21
|
cwd?: string;
|
@@ -32,8 +32,8 @@ class PseudoTerminal {
|
|
32
32
|
await this.pseudoIPC.init();
|
33
33
|
this.initialized = true;
|
34
34
|
}
|
35
|
-
runCommand(command, { cwd, jsEnv, quiet, } = {}) {
|
36
|
-
return new PseudoTtyProcess(this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, quiet));
|
35
|
+
runCommand(command, { cwd, jsEnv, quiet, tty, } = {}) {
|
36
|
+
return new PseudoTtyProcess(this.rustPseudoTerminal.runCommand(command, cwd, jsEnv, quiet, tty));
|
37
37
|
}
|
38
38
|
async fork(id, script, { cwd, jsEnv, quiet, }) {
|
39
39
|
if (!this.initialized) {
|
@@ -142,6 +142,12 @@ function supportedPtyPlatform() {
|
|
142
142
|
if (process.platform !== 'win32') {
|
143
143
|
return true;
|
144
144
|
}
|
145
|
+
// TODO: Re-enable Windows support when it's stable
|
146
|
+
// Currently, there's an issue with control chars.
|
147
|
+
// See: https://github.com/nrwl/nx/issues/22358
|
148
|
+
if (process.env.NX_WINDOWS_PTY_SUPPORT !== 'true') {
|
149
|
+
return false;
|
150
|
+
}
|
145
151
|
let windowsVersion = os.release().split('.');
|
146
152
|
let windowsBuild = windowsVersion[2];
|
147
153
|
if (!windowsBuild) {
|
@@ -140,7 +140,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
|
|
140
140
|
title: `TaskGraph is now required as an argument to hashTask`,
|
141
141
|
bodyLines: [
|
142
142
|
`The TaskGraph object can be retrieved from the context`,
|
143
|
-
'This will result in an error in Nx
|
143
|
+
'This will result in an error in Nx 20',
|
144
144
|
],
|
145
145
|
});
|
146
146
|
taskGraph_ = taskGraph;
|
@@ -150,7 +150,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
|
|
150
150
|
title: `The environment variables are now required as an argument to hashTask`,
|
151
151
|
bodyLines: [
|
152
152
|
`Please pass the environment variables used when running the task`,
|
153
|
-
'This will result in an error in Nx
|
153
|
+
'This will result in an error in Nx 20',
|
154
154
|
],
|
155
155
|
});
|
156
156
|
env = process.env;
|
@@ -163,7 +163,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
|
|
163
163
|
title: `TaskGraph is now required as an argument to hashTasks`,
|
164
164
|
bodyLines: [
|
165
165
|
`The TaskGraph object can be retrieved from the context`,
|
166
|
-
'This will result in an error in Nx
|
166
|
+
'This will result in an error in Nx 20',
|
167
167
|
],
|
168
168
|
});
|
169
169
|
taskGraph_ = taskGraph;
|
@@ -173,7 +173,7 @@ async function invokeTasksRunner({ tasks, projectGraph, taskGraph, lifeCycle, nx
|
|
173
173
|
title: `The environment variables are now required as an argument to hashTasks`,
|
174
174
|
bodyLines: [
|
175
175
|
`Please pass the environment variables used when running the tasks`,
|
176
|
-
'This will result in an error in Nx
|
176
|
+
'This will result in an error in Nx 20',
|
177
177
|
],
|
178
178
|
});
|
179
179
|
env = process.env;
|
@@ -78,7 +78,24 @@ class InvalidOutputsError extends Error {
|
|
78
78
|
return `The following outputs are invalid:${invalidOutputsList}\nPlease run "nx repair" to repair your configuration`;
|
79
79
|
}
|
80
80
|
}
|
81
|
+
function assertOutputsAreValidType(outputs) {
|
82
|
+
if (!Array.isArray(outputs)) {
|
83
|
+
throw new Error("The 'outputs' field must be an array");
|
84
|
+
}
|
85
|
+
const typesArray = [];
|
86
|
+
let hasInvalidType = false;
|
87
|
+
for (const output of outputs) {
|
88
|
+
if (typeof output !== 'string') {
|
89
|
+
hasInvalidType = true;
|
90
|
+
}
|
91
|
+
typesArray.push(typeof output);
|
92
|
+
}
|
93
|
+
if (hasInvalidType) {
|
94
|
+
throw new Error(`The 'outputs' field must contain only strings, but received types: [${typesArray.join(', ')}]`);
|
95
|
+
}
|
96
|
+
}
|
81
97
|
function validateOutputs(outputs) {
|
98
|
+
assertOutputsAreValidType(outputs);
|
82
99
|
const invalidOutputs = new Set();
|
83
100
|
for (const output of outputs) {
|
84
101
|
if (!/^!?{[\s\S]+}/.test(output)) {
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertWorkspaceValidity = void 0;
|
4
4
|
const find_matching_projects_1 = require("./find-matching-projects");
|
5
5
|
const output_1 = require("./output");
|
6
|
+
const devkit_internals_1 = require("../devkit-internals");
|
6
7
|
function assertWorkspaceValidity(projects, nxJson) {
|
7
8
|
const projectNames = Object.keys(projects);
|
8
9
|
const projectGraphNodes = projectNames.reduce((graph, project) => {
|
@@ -67,7 +68,7 @@ function assertWorkspaceValidity(projects, nxJson) {
|
|
67
68
|
})
|
68
69
|
.join('\n\n');
|
69
70
|
}
|
70
|
-
throw new
|
71
|
+
throw new devkit_internals_1.WorkspaceValidityError(message);
|
71
72
|
}
|
72
73
|
exports.assertWorkspaceValidity = assertWorkspaceValidity;
|
73
74
|
function detectAndSetInvalidProjectGlobValues(map, sourceName, desiredImplicitDeps, projectConfigurations, projects) {
|
@@ -30,7 +30,7 @@ export interface NxArgs {
|
|
30
30
|
type?: string;
|
31
31
|
batch?: boolean;
|
32
32
|
}
|
33
|
-
export declare function createOverrides(__overrides_unparsed__?: string[]): any
|
33
|
+
export declare function createOverrides(__overrides_unparsed__?: string[]): Record<string, any>;
|
34
34
|
export declare function splitArgsIntoNxArgsAndOverrides(args: {
|
35
35
|
[k: string]: any;
|
36
36
|
}, mode: 'run-one' | 'run-many' | 'affected' | 'print-affected', options: {
|
@@ -26,6 +26,6 @@ export type NxPluginV1 = {
|
|
26
26
|
projectFilePatterns?: string[];
|
27
27
|
};
|
28
28
|
/**
|
29
|
-
* @todo(@agentender)
|
29
|
+
* @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
|
30
30
|
*/
|
31
31
|
export declare function getDefaultPluginsSync(root: string): NxPluginV2[];
|
@@ -6,7 +6,7 @@ const project_json_1 = require("../plugins/project-json/build-nodes/project-json
|
|
6
6
|
const target_defaults_plugin_1 = require("../plugins/target-defaults/target-defaults-plugin");
|
7
7
|
const PackageJsonWorkspacesPlugin = require("../plugins/package-json-workspaces");
|
8
8
|
/**
|
9
|
-
* @todo(@agentender)
|
9
|
+
* @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
|
10
10
|
*/
|
11
11
|
function getDefaultPluginsSync(root) {
|
12
12
|
const plugins = [
|
package/src/utils/params.js
CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPromptsForSchema = exports.convertSmartDefaultsIntoNamedParams = exports.warnDeprecations = exports.combineOptionsForGenerator = exports.combineOptionsForExecutor = exports.applyVerbosity = exports.setDefaults = exports.validateObject = exports.validateOptsAgainstSchema = exports.SchemaError = exports.convertAliases = exports.coerceTypesInOptions = exports.convertToCamelCase = exports.handleErrors = void 0;
|
4
4
|
const logger_1 = require("./logger");
|
5
5
|
const output_1 = require("./output");
|
6
|
+
const client_1 = require("../daemon/client/client");
|
6
7
|
const LIST_CHOICE_DISPLAY_LIMIT = 10;
|
7
8
|
async function handleErrors(isVerbose, fn) {
|
8
9
|
try {
|
@@ -41,6 +42,9 @@ async function handleErrors(isVerbose, fn) {
|
|
41
42
|
logger_1.logger.info(err.stack);
|
42
43
|
}
|
43
44
|
}
|
45
|
+
if (client_1.daemonClient.enabled()) {
|
46
|
+
client_1.daemonClient.reset();
|
47
|
+
}
|
44
48
|
return 1;
|
45
49
|
}
|
46
50
|
}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const perf_hooks_1 = require("perf_hooks");
|
4
|
-
|
4
|
+
let initialized = false;
|
5
|
+
if (process.env.NX_PERF_LOGGING === 'true' && !initialized) {
|
6
|
+
initialized = true;
|
5
7
|
const obs = new perf_hooks_1.PerformanceObserver((list) => {
|
6
8
|
for (const entry of list.getEntries()) {
|
7
9
|
console.log(`Time for '${entry.name}'`, entry.duration);
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createSerializableError = void 0;
|
4
|
+
/**
|
5
|
+
* This function transforms an error into an object which can be properly serialized and deserialized to be sent between processes.
|
6
|
+
*/
|
7
|
+
function createSerializableError(error) {
|
8
|
+
const res = {};
|
9
|
+
Object.getOwnPropertyNames(error).forEach((k) => {
|
10
|
+
let value = error[k];
|
11
|
+
// If an error has an error as a property such as cause, it will be transformed into a serializable error
|
12
|
+
if (typeof value === 'object' && value instanceof Error) {
|
13
|
+
value = createSerializableError(value);
|
14
|
+
}
|
15
|
+
// If an error has an array of errors as a property, they will be transformed into serializable errors
|
16
|
+
if (Array.isArray(value)) {
|
17
|
+
value = value.map((v) => {
|
18
|
+
if (typeof v === 'object' && v instanceof Error) {
|
19
|
+
return createSerializableError(v);
|
20
|
+
}
|
21
|
+
return v;
|
22
|
+
});
|
23
|
+
}
|
24
|
+
res[k] = value;
|
25
|
+
});
|
26
|
+
return res;
|
27
|
+
}
|
28
|
+
exports.createSerializableError = createSerializableError;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const tslib_1 = require("tslib");
|
4
|
-
/**
|
5
|
-
* @deprecated(v17) This file has moved. The reexport will be removed in Nx 17.
|
6
|
-
*/
|
7
|
-
tslib_1.__exportStar(require("./run-many/run-many"), exports);
|
package/src/command-line/run.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import type { NxJsonConfiguration } from './nx-json';
|
2
|
-
import { ProjectsConfigurations } from './workspace-json-project-json';
|
3
|
-
/**
|
4
|
-
* @deprecated This will be removed in v19. Use {@link readProjectsConfigurationFromProjectGraph} instead.
|
5
|
-
*/
|
6
|
-
export declare class Workspaces {
|
7
|
-
private root;
|
8
|
-
constructor(root: string);
|
9
|
-
/**
|
10
|
-
* @deprecated Use {@link readProjectsConfigurationFromProjectGraph} instead.
|
11
|
-
*/
|
12
|
-
readWorkspaceConfiguration(): ProjectsConfigurations & NxJsonConfiguration;
|
13
|
-
}
|
14
|
-
/**
|
15
|
-
* Pulled from toFileName in names from @nx/devkit.
|
16
|
-
* Todo: Should refactor, not duplicate.
|
17
|
-
*/
|
18
|
-
export declare function toProjectName(fileName: string): string;
|
package/src/config/workspaces.js
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.toProjectName = exports.Workspaces = void 0;
|
4
|
-
const path_1 = require("path");
|
5
|
-
const project_graph_1 = require("../project-graph/project-graph");
|
6
|
-
const nx_json_1 = require("./nx-json");
|
7
|
-
// TODO(v19): remove this class
|
8
|
-
/**
|
9
|
-
* @deprecated This will be removed in v19. Use {@link readProjectsConfigurationFromProjectGraph} instead.
|
10
|
-
*/
|
11
|
-
class Workspaces {
|
12
|
-
constructor(root) {
|
13
|
-
this.root = root;
|
14
|
-
}
|
15
|
-
/**
|
16
|
-
* @deprecated Use {@link readProjectsConfigurationFromProjectGraph} instead.
|
17
|
-
*/
|
18
|
-
readWorkspaceConfiguration() {
|
19
|
-
const nxJson = (0, nx_json_1.readNxJson)(this.root);
|
20
|
-
return {
|
21
|
-
...(0, project_graph_1.readProjectsConfigurationFromProjectGraph)((0, project_graph_1.readCachedProjectGraph)()),
|
22
|
-
...nxJson,
|
23
|
-
};
|
24
|
-
}
|
25
|
-
}
|
26
|
-
exports.Workspaces = Workspaces;
|
27
|
-
/**
|
28
|
-
* Pulled from toFileName in names from @nx/devkit.
|
29
|
-
* Todo: Should refactor, not duplicate.
|
30
|
-
*/
|
31
|
-
function toProjectName(fileName) {
|
32
|
-
const parts = (0, path_1.dirname)(fileName).split(/[\/\\]/g);
|
33
|
-
return parts[parts.length - 1].toLowerCase();
|
34
|
-
}
|
35
|
-
exports.toProjectName = toProjectName;
|