nx 20.0.0-canary.20241003-84a5c7a → 20.0.0-canary.20241005-75c1da3
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/init-local.js +0 -39
- package/bin/nx.js +3 -13
- package/migrations.json +5 -0
- package/package.json +11 -11
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +1 -1
- package/src/command-line/affected/affected.js +0 -2
- package/src/command-line/release/utils/git.js +2 -2
- package/src/command-line/run/run-one.js +0 -2
- package/src/command-line/run/run.js +0 -1
- package/src/command-line/run-many/run-many.js +1 -4
- package/src/config/misc-interfaces.d.ts +3 -15
- package/src/config/nx-json.d.ts +2 -2
- package/src/config/project-graph.d.ts +0 -2
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.js +1 -3
- package/src/devkit-exports.d.ts +3 -4
- package/src/devkit-exports.js +3 -6
- package/src/executors/utils/convert-nx-executor.js +0 -1
- package/src/generators/utils/nx-json.d.ts +1 -1
- package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
- package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +54 -6
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
- package/src/project-graph/build-project-graph.js +3 -41
- package/src/project-graph/error-types.d.ts +4 -10
- package/src/project-graph/error-types.js +1 -12
- package/src/project-graph/file-utils.js +1 -1
- package/src/project-graph/nx-deps-cache.d.ts +0 -1
- package/src/project-graph/nx-deps-cache.js +0 -1
- package/src/project-graph/plugins/internal-api.d.ts +2 -5
- package/src/project-graph/plugins/internal-api.js +0 -1
- package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
- package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
- package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
- package/src/project-graph/plugins/loader.js +2 -3
- package/src/project-graph/plugins/public-api.d.ts +6 -7
- package/src/project-graph/plugins/utils.d.ts +1 -7
- package/src/project-graph/plugins/utils.js +0 -37
- package/src/project-graph/utils/project-configuration-utils.js +1 -1
- package/src/tasks-runner/batch/run-batch.js +0 -1
- package/src/tasks-runner/cache.js +2 -1
- package/src/tasks-runner/init-tasks-runner.js +0 -2
- package/src/utils/command-line-utils.js +24 -33
- package/src/utils/plugins/plugin-capabilities.js +2 -3
- package/src/utils/app-root.d.ts +0 -8
- package/src/utils/app-root.js +0 -12
- package/src/utils/nx-plugin.deprecated.d.ts +0 -31
- package/src/utils/nx-plugin.deprecated.js +0 -20
- package/src/utils/workspace-configuration-check.d.ts +0 -1
- package/src/utils/workspace-configuration-check.js +0 -36
@@ -1,8 +1,2 @@
|
|
1
|
-
import
|
2
|
-
import type { LoadedNxPlugin, NormalizedPlugin } from './internal-api';
|
3
|
-
import { CreateNodesContextV2, CreateNodesFunction, CreateNodesResult, type NxPlugin, type NxPluginV2 } from './public-api';
|
4
|
-
export declare function isNxPluginV2(plugin: NxPlugin): plugin is NxPluginV2;
|
5
|
-
export declare function isNxPluginV1(plugin: NxPlugin | LoadedNxPlugin): plugin is NxPluginV1;
|
6
|
-
export declare function normalizeNxPlugin(plugin: NxPlugin): NormalizedPlugin;
|
7
|
-
export type AsyncFn<T extends Function> = T extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> : never;
|
1
|
+
import { CreateNodesContextV2, CreateNodesFunction, CreateNodesResult } from './public-api';
|
8
2
|
export declare function createNodesFromFiles<T = unknown>(createNodes: CreateNodesFunction<T>, configFiles: readonly string[], options: T, context: CreateNodesContextV2): Promise<[file: string, value: CreateNodesResult][]>;
|
@@ -1,44 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isNxPluginV2 = isNxPluginV2;
|
4
|
-
exports.isNxPluginV1 = isNxPluginV1;
|
5
|
-
exports.normalizeNxPlugin = normalizeNxPlugin;
|
6
3
|
exports.createNodesFromFiles = createNodesFromFiles;
|
7
|
-
const node_path_1 = require("node:path");
|
8
|
-
const to_project_name_1 = require("../../config/to-project-name");
|
9
|
-
const globs_1 = require("../../utils/globs");
|
10
4
|
const error_types_1 = require("../error-types");
|
11
|
-
function isNxPluginV2(plugin) {
|
12
|
-
return 'createNodes' in plugin || 'createDependencies' in plugin;
|
13
|
-
}
|
14
|
-
function isNxPluginV1(plugin) {
|
15
|
-
return 'processProjectGraph' in plugin || 'projectFilePatterns' in plugin;
|
16
|
-
}
|
17
|
-
function normalizeNxPlugin(plugin) {
|
18
|
-
if (isNxPluginV2(plugin)) {
|
19
|
-
return plugin;
|
20
|
-
}
|
21
|
-
if (isNxPluginV1(plugin) && plugin.projectFilePatterns) {
|
22
|
-
return {
|
23
|
-
...plugin,
|
24
|
-
createNodes: [
|
25
|
-
`*/**/${(0, globs_1.combineGlobPatterns)(plugin.projectFilePatterns)}`,
|
26
|
-
(configFilePath) => {
|
27
|
-
const root = (0, node_path_1.dirname)(configFilePath);
|
28
|
-
return {
|
29
|
-
projects: {
|
30
|
-
[root]: {
|
31
|
-
name: (0, to_project_name_1.toProjectName)(configFilePath),
|
32
|
-
targets: plugin.registerProjectTargets?.(configFilePath),
|
33
|
-
},
|
34
|
-
},
|
35
|
-
};
|
36
|
-
},
|
37
|
-
],
|
38
|
-
};
|
39
|
-
}
|
40
|
-
return plugin;
|
41
|
-
}
|
42
5
|
async function createNodesFromFiles(createNodes, configFiles, options, context) {
|
43
6
|
const results = [];
|
44
7
|
const errors = [];
|
@@ -184,7 +184,7 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
|
|
184
184
|
}
|
185
185
|
}
|
186
186
|
else {
|
187
|
-
result[metadataKey] = value;
|
187
|
+
result[metadataKey][key] = value[key];
|
188
188
|
if (sourceMap) {
|
189
189
|
sourceMap[`${baseSourceMapPath}.${metadataKey}`] =
|
190
190
|
sourceInformation;
|
@@ -23,7 +23,6 @@ async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
|
23
23
|
cwd: process.cwd(),
|
24
24
|
projectsConfigurations,
|
25
25
|
nxJsonConfiguration,
|
26
|
-
workspace: { ...projectsConfigurations, ...nxJsonConfiguration },
|
27
26
|
isVerbose: false,
|
28
27
|
projectGraph,
|
29
28
|
taskGraph: fullTaskGraph,
|
@@ -22,7 +22,8 @@ const is_ci_1 = require("../utils/is-ci");
|
|
22
22
|
const output_1 = require("../utils/output");
|
23
23
|
function dbCacheEnabled(nxJson = (0, nx_json_1.readNxJson)()) {
|
24
24
|
return (process.env.NX_DISABLE_DB !== 'true' &&
|
25
|
-
|
25
|
+
nxJson.useLegacyCache !== true &&
|
26
|
+
process.env.NX_DB_CACHE !== 'false');
|
26
27
|
}
|
27
28
|
// Do not change the order of these arguments as this function is used by nx cloud
|
28
29
|
function getCache(options) {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.initTasksRunner = initTasksRunner;
|
4
|
-
const workspace_configuration_check_1 = require("../utils/workspace-configuration-check");
|
5
4
|
const configuration_1 = require("../config/configuration");
|
6
5
|
const project_graph_1 = require("../project-graph/project-graph");
|
7
6
|
const run_command_1 = require("./run-command");
|
@@ -12,7 +11,6 @@ const dotenv_1 = require("../utils/dotenv");
|
|
12
11
|
async function initTasksRunner(nxArgs) {
|
13
12
|
perf_hooks_1.performance.mark('init-local');
|
14
13
|
(0, dotenv_1.loadRootEnvFiles)();
|
15
|
-
(0, workspace_configuration_check_1.workspaceConfigurationCheck)();
|
16
14
|
const nxJson = (0, configuration_1.readNxJson)();
|
17
15
|
if (nxArgs.verbose) {
|
18
16
|
process.env.NX_VERBOSE_LOGGING = 'true';
|
@@ -139,41 +139,32 @@ function readParallelFromArgsAndEnv(args) {
|
|
139
139
|
}
|
140
140
|
function normalizeNxArgsRunner(nxArgs, nxJson, options) {
|
141
141
|
if (!nxArgs.runner) {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
if (options.printWarnings) {
|
148
|
-
if (runnerExists) {
|
149
|
-
output_1.output.note({
|
150
|
-
title: `No explicit --runner argument provided, but found environment variable ${envKey} so using its value: ${output_1.output.bold(`${runner}`)}`,
|
151
|
-
});
|
152
|
-
}
|
153
|
-
else if (nxArgs.verbose ||
|
154
|
-
process.env.NX_VERBOSE_LOGGING === 'true') {
|
155
|
-
output_1.output.warn({
|
156
|
-
title: `Could not find ${output_1.output.bold(`${runner}`)} within \`nx.json\` tasksRunnerOptions.`,
|
157
|
-
bodyLines: [
|
158
|
-
`${output_1.output.bold(`${runner}`)} was set by ${envKey}`,
|
159
|
-
``,
|
160
|
-
`To suppress this message, either:`,
|
161
|
-
` - provide a valid task runner with --runner`,
|
162
|
-
` - ensure NX_TASKS_RUNNER matches a task runner defined in nx.json`,
|
163
|
-
],
|
164
|
-
});
|
165
|
-
}
|
166
|
-
}
|
142
|
+
const envKey = 'NX_TASKS_RUNNER';
|
143
|
+
const runner = process.env[envKey];
|
144
|
+
if (runner) {
|
145
|
+
const runnerExists = nxJson.tasksRunnerOptions?.[runner];
|
146
|
+
if (options.printWarnings) {
|
167
147
|
if (runnerExists) {
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
title: 'NX_RUNNER is deprecated, please use NX_TASKS_RUNNER instead.',
|
172
|
-
});
|
173
|
-
}
|
174
|
-
nxArgs.runner = runner;
|
148
|
+
output_1.output.note({
|
149
|
+
title: `No explicit --runner argument provided, but found environment variable ${envKey} so using its value: ${output_1.output.bold(`${runner}`)}`,
|
150
|
+
});
|
175
151
|
}
|
176
|
-
|
152
|
+
else if (nxArgs.verbose ||
|
153
|
+
process.env.NX_VERBOSE_LOGGING === 'true') {
|
154
|
+
output_1.output.warn({
|
155
|
+
title: `Could not find ${output_1.output.bold(`${runner}`)} within \`nx.json\` tasksRunnerOptions.`,
|
156
|
+
bodyLines: [
|
157
|
+
`${output_1.output.bold(`${runner}`)} was set by ${envKey}`,
|
158
|
+
``,
|
159
|
+
`To suppress this message, either:`,
|
160
|
+
` - provide a valid task runner with --runner`,
|
161
|
+
` - ensure NX_TASKS_RUNNER matches a task runner defined in nx.json`,
|
162
|
+
],
|
163
|
+
});
|
164
|
+
}
|
165
|
+
}
|
166
|
+
if (runnerExists) {
|
167
|
+
nxArgs.runner = runner;
|
177
168
|
}
|
178
169
|
}
|
179
170
|
}
|
@@ -20,7 +20,7 @@ function tryGetCollection(packageJsonPath, collectionFile, propName) {
|
|
20
20
|
}
|
21
21
|
async function getPluginCapabilities(workspaceRoot, pluginName, projects, includeRuntimeCapabilities = false) {
|
22
22
|
try {
|
23
|
-
const { json: packageJson, path: packageJsonPath } =
|
23
|
+
const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
|
24
24
|
const pluginModule = includeRuntimeCapabilities
|
25
25
|
? await tryGetModule(packageJson, workspaceRoot)
|
26
26
|
: {};
|
@@ -62,8 +62,7 @@ async function tryGetModule(packageJson, workspaceRoot) {
|
|
62
62
|
packageJson['schematics'] ??
|
63
63
|
packageJson['builders']) {
|
64
64
|
const [pluginPromise] = (0, loader_1.loadNxPlugin)(packageJson.name, workspaceRoot);
|
65
|
-
|
66
|
-
return plugin;
|
65
|
+
return await pluginPromise;
|
67
66
|
}
|
68
67
|
else {
|
69
68
|
return {
|
package/src/utils/app-root.d.ts
DELETED
package/src/utils/app-root.js
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.workspaceRoot = exports.appRootPath = void 0;
|
4
|
-
// TODO(v16): Remove this file
|
5
|
-
const workspace_root_1 = require("./workspace-root");
|
6
|
-
Object.defineProperty(exports, "workspaceRoot", { enumerable: true, get: function () { return workspace_root_1.workspaceRoot; } });
|
7
|
-
/**
|
8
|
-
* The root of the workspace.
|
9
|
-
*
|
10
|
-
* @deprecated use workspaceRoot instead
|
11
|
-
*/
|
12
|
-
exports.appRootPath = workspace_root_1.workspaceRoot;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import { ProjectGraphProcessor } from '../config/project-graph';
|
2
|
-
import { TargetConfiguration } from '../config/workspace-json-project-json';
|
3
|
-
import { NxPluginV2 } from '../project-graph/plugins';
|
4
|
-
/**
|
5
|
-
* @deprecated Add targets to the projects in a {@link CreateNodes} function instead. This will be removed in Nx 20
|
6
|
-
*/
|
7
|
-
export type ProjectTargetConfigurator = (file: string) => Record<string, TargetConfiguration>;
|
8
|
-
/**
|
9
|
-
* @deprecated Use {@link NxPluginV2} instead. This will be removed in Nx 20
|
10
|
-
*/
|
11
|
-
export type NxPluginV1 = {
|
12
|
-
name: string;
|
13
|
-
/**
|
14
|
-
* @deprecated Use {@link CreateNodes} and {@link CreateDependencies} instead. This will be removed in Nx 20
|
15
|
-
*/
|
16
|
-
processProjectGraph?: ProjectGraphProcessor;
|
17
|
-
/**
|
18
|
-
* @deprecated Add targets to the projects inside of {@link CreateNodes} instead. This will be removed in Nx 20
|
19
|
-
*/
|
20
|
-
registerProjectTargets?: ProjectTargetConfigurator;
|
21
|
-
/**
|
22
|
-
* A glob pattern to search for non-standard project files.
|
23
|
-
* @example: ["*.csproj", "pom.xml"]
|
24
|
-
* @deprecated Use {@link CreateNodes} instead. This will be removed in Nx 20
|
25
|
-
*/
|
26
|
-
projectFilePatterns?: string[];
|
27
|
-
};
|
28
|
-
/**
|
29
|
-
* @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
|
30
|
-
*/
|
31
|
-
export declare function getDefaultPluginsSync(root: string): NxPluginV2[];
|
@@ -1,20 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getDefaultPluginsSync = getDefaultPluginsSync;
|
4
|
-
const angular_json_1 = require("../adapter/angular-json");
|
5
|
-
const project_json_1 = require("../plugins/project-json/build-nodes/project-json");
|
6
|
-
const PackageJsonWorkspacesPlugin = require("../plugins/package-json");
|
7
|
-
/**
|
8
|
-
* @todo(@agentender) v20: Remove this fn when we remove readWorkspaceConfig
|
9
|
-
*/
|
10
|
-
function getDefaultPluginsSync(root) {
|
11
|
-
const plugins = [
|
12
|
-
require('../plugins/js'),
|
13
|
-
...((0, angular_json_1.shouldMergeAngularProjects)(root, false)
|
14
|
-
? [require('../adapter/angular-json').NxAngularJsonPlugin]
|
15
|
-
: []),
|
16
|
-
PackageJsonWorkspacesPlugin,
|
17
|
-
project_json_1.default,
|
18
|
-
];
|
19
|
-
return plugins;
|
20
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function workspaceConfigurationCheck(): void;
|
@@ -1,36 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.workspaceConfigurationCheck = workspaceConfigurationCheck;
|
4
|
-
const workspace_root_1 = require("./workspace-root");
|
5
|
-
const fs_1 = require("fs");
|
6
|
-
const path_1 = require("path");
|
7
|
-
const output_1 = require("./output");
|
8
|
-
const fileutils_1 = require("../utils/fileutils");
|
9
|
-
//TODO: vsavkin remove after Nx 19
|
10
|
-
function workspaceConfigurationCheck() {
|
11
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'workspace.json'))) {
|
12
|
-
output_1.output.warn({
|
13
|
-
title: 'workspace.json is ignored',
|
14
|
-
bodyLines: [
|
15
|
-
'Nx no longer reads configuration from workspace.json.',
|
16
|
-
'Run "nx g @nx/workspace:fix-configuration" to split workspace.json into individual project.json files.',
|
17
|
-
],
|
18
|
-
});
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
if ((0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, 'angular.json'))) {
|
22
|
-
const angularJson = (0, fileutils_1.readJsonFile)((0, path_1.join)(workspace_root_1.workspaceRoot, 'angular.json'));
|
23
|
-
const v2Props = Object.values(angularJson.projects).find((p) => !!p.targets);
|
24
|
-
if (angularJson.version === 2 || v2Props) {
|
25
|
-
output_1.output.error({
|
26
|
-
title: 'angular.json format is incorrect',
|
27
|
-
bodyLines: [
|
28
|
-
'Nx no longer supports the v2 format of angular.json.',
|
29
|
-
'Run "nx g @nx/workspace:fix-configuration" to split angular.json into individual project.json files. (Recommended)',
|
30
|
-
'If you want to preserve angular.json, run "nx g @nx/workspace:fix-configuration --reformat"',
|
31
|
-
],
|
32
|
-
});
|
33
|
-
process.exit(1);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|