nx 20.0.0-canary.20241002-1d10a19 → 20.0.0-canary.20241005-75c1da3

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.
Files changed (91) hide show
  1. package/.eslintrc.json +12 -2
  2. package/bin/init-local.js +0 -39
  3. package/bin/nx.js +3 -13
  4. package/migrations.json +5 -37
  5. package/package.json +11 -11
  6. package/release/changelog-renderer/index.d.ts +60 -38
  7. package/release/changelog-renderer/index.js +260 -236
  8. package/src/adapter/compat.d.ts +1 -1
  9. package/src/adapter/compat.js +1 -1
  10. package/src/command-line/add/add.js +2 -2
  11. package/src/command-line/affected/affected.js +0 -2
  12. package/src/command-line/nx-commands.js +31 -10
  13. package/src/command-line/release/changelog.d.ts +2 -2
  14. package/src/command-line/release/changelog.js +28 -29
  15. package/src/command-line/release/index.d.ts +5 -2
  16. package/src/command-line/release/publish.d.ts +6 -1
  17. package/src/command-line/release/publish.js +31 -25
  18. package/src/command-line/release/utils/git.js +2 -2
  19. package/src/command-line/release/utils/print-changes.js +6 -4
  20. package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
  21. package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
  22. package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
  23. package/src/command-line/release/version.d.ts +3 -3
  24. package/src/command-line/run/run-one.js +0 -2
  25. package/src/command-line/run/run.js +0 -1
  26. package/src/command-line/run-many/run-many.js +1 -4
  27. package/src/command-line/yargs-utils/shared-options.js +2 -2
  28. package/src/config/misc-interfaces.d.ts +3 -15
  29. package/src/config/nx-json.d.ts +4 -3
  30. package/src/config/project-graph.d.ts +0 -2
  31. package/src/core/graph/main.js +1 -1
  32. package/src/daemon/client/client.js +1 -3
  33. package/src/devkit-exports.d.ts +3 -4
  34. package/src/devkit-exports.js +3 -6
  35. package/src/executors/utils/convert-nx-executor.js +0 -1
  36. package/src/generators/utils/nx-json.d.ts +1 -1
  37. package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
  38. package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
  39. package/src/native/nx.wasm32-wasi.wasm +0 -0
  40. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +54 -6
  41. package/src/nx-cloud/utilities/axios.js +1 -2
  42. package/src/nx-cloud/utilities/onboarding.js +2 -2
  43. package/src/nx-cloud/utilities/url-shorten.js +5 -5
  44. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
  45. package/src/project-graph/build-project-graph.js +3 -41
  46. package/src/project-graph/error-types.d.ts +4 -10
  47. package/src/project-graph/error-types.js +1 -12
  48. package/src/project-graph/file-utils.d.ts +2 -2
  49. package/src/project-graph/file-utils.js +3 -3
  50. package/src/project-graph/nx-deps-cache.d.ts +0 -1
  51. package/src/project-graph/nx-deps-cache.js +0 -1
  52. package/src/project-graph/plugins/internal-api.d.ts +2 -5
  53. package/src/project-graph/plugins/internal-api.js +0 -1
  54. package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
  55. package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
  56. package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
  57. package/src/project-graph/plugins/loader.js +2 -3
  58. package/src/project-graph/plugins/public-api.d.ts +6 -7
  59. package/src/project-graph/plugins/utils.d.ts +1 -7
  60. package/src/project-graph/plugins/utils.js +0 -37
  61. package/src/project-graph/utils/project-configuration-utils.js +1 -1
  62. package/src/tasks-runner/batch/run-batch.js +0 -1
  63. package/src/tasks-runner/cache.d.ts +2 -1
  64. package/src/tasks-runner/cache.js +11 -6
  65. package/src/tasks-runner/create-task-graph.d.ts +2 -0
  66. package/src/tasks-runner/create-task-graph.js +39 -5
  67. package/src/tasks-runner/init-tasks-runner.js +0 -2
  68. package/src/tasks-runner/run-command.js +15 -2
  69. package/src/tasks-runner/task-orchestrator.js +1 -1
  70. package/src/utils/command-line-utils.d.ts +3 -0
  71. package/src/utils/command-line-utils.js +24 -33
  72. package/src/utils/git-utils.js +2 -2
  73. package/src/utils/plugins/plugin-capabilities.js +2 -3
  74. package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
  75. package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
  76. package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
  77. package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
  78. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
  79. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
  80. package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
  81. package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
  82. package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
  83. package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
  84. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
  85. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
  86. package/src/utils/app-root.d.ts +0 -8
  87. package/src/utils/app-root.js +0 -12
  88. package/src/utils/nx-plugin.deprecated.d.ts +0 -31
  89. package/src/utils/nx-plugin.deprecated.js +0 -20
  90. package/src/utils/workspace-configuration-check.d.ts +0 -1
  91. package/src/utils/workspace-configuration-check.js +0 -36
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const project_configuration_1 = require("../../generators/utils/project-configuration");
5
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
6
- async function default_1(tree) {
7
- updateDependsOnAndInputsInsideNxJson(tree);
8
- const projectsConfigurations = (0, project_configuration_1.getProjects)(tree);
9
- for (const [projectName, projectConfiguration] of projectsConfigurations) {
10
- let projectChanged = false;
11
- for (const [targetName, targetConfiguration] of Object.entries(projectConfiguration.targets ?? {})) {
12
- for (const dependency of targetConfiguration.dependsOn ?? []) {
13
- if (typeof dependency !== 'string') {
14
- if (dependency.projects === 'self' ||
15
- dependency.projects === '{self}') {
16
- delete dependency.projects;
17
- projectChanged = true;
18
- }
19
- else if (dependency.projects === 'dependencies' ||
20
- dependency.projects === '{dependencies}') {
21
- delete dependency.projects;
22
- dependency.dependencies = true;
23
- projectChanged = true;
24
- }
25
- }
26
- }
27
- for (let i = 0; i < targetConfiguration.inputs?.length ?? 0; i++) {
28
- const input = targetConfiguration.inputs[i];
29
- if (typeof input !== 'string') {
30
- if ('projects' in input &&
31
- (input.projects === 'self' || input.projects === '{self}')) {
32
- delete input.projects;
33
- projectChanged = true;
34
- }
35
- else if ('projects' in input &&
36
- (input.projects === 'dependencies' ||
37
- input.projects === '{dependencies}')) {
38
- delete input.projects;
39
- targetConfiguration.inputs[i] = {
40
- ...input,
41
- dependencies: true,
42
- };
43
- projectChanged = true;
44
- }
45
- }
46
- }
47
- }
48
- if (projectChanged) {
49
- (0, project_configuration_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
50
- }
51
- }
52
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
53
- }
54
- function updateDependsOnAndInputsInsideNxJson(tree) {
55
- const nxJson = (0, project_configuration_1.readNxJson)(tree);
56
- let nxJsonChanged = false;
57
- for (const [target, defaults] of Object.entries(nxJson?.targetDefaults ?? {})) {
58
- for (const dependency of defaults.dependsOn ?? []) {
59
- if (typeof dependency !== 'string') {
60
- if (dependency.projects === 'self' ||
61
- dependency.projects === '{self}') {
62
- delete dependency.projects;
63
- nxJsonChanged = true;
64
- }
65
- else if (dependency.projects === 'dependencies' ||
66
- dependency.projects === '{dependencies}') {
67
- delete dependency.projects;
68
- dependency.dependencies = true;
69
- nxJsonChanged = true;
70
- }
71
- }
72
- }
73
- for (let i = 0; i < defaults.inputs?.length ?? 0; i++) {
74
- const input = defaults.inputs[i];
75
- if (typeof input !== 'string') {
76
- if ('projects' in input &&
77
- (input.projects === 'self' || input.projects === '{self}')) {
78
- delete input.projects;
79
- nxJsonChanged = true;
80
- }
81
- else if ('projects' in input &&
82
- (input.projects === 'dependencies' ||
83
- input.projects === '{dependencies}')) {
84
- delete input.projects;
85
- defaults.inputs[i] = {
86
- ...input,
87
- dependencies: true,
88
- };
89
- nxJsonChanged = true;
90
- }
91
- }
92
- }
93
- }
94
- if (nxJsonChanged) {
95
- (0, project_configuration_1.updateNxJson)(tree, nxJson);
96
- }
97
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const project_configuration_1 = require("../../generators/utils/project-configuration");
5
- const json_1 = require("../../generators/utils/json");
6
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
7
- async function default_1(tree) {
8
- (0, json_1.updateJson)(tree, 'package.json', (json) => {
9
- if (json.dependencies && json.dependencies['@nrwl/nx-cloud']) {
10
- json.dependencies['nx-cloud'] = json.dependencies['@nrwl/nx-cloud'];
11
- delete json.dependencies['@nrwl/nx-cloud'];
12
- }
13
- if (json.devDependencies && json.devDependencies['@nrwl/nx-cloud']) {
14
- json.devDependencies['nx-cloud'] = json.devDependencies['@nrwl/nx-cloud'];
15
- delete json.devDependencies['@nrwl/nx-cloud'];
16
- }
17
- return json;
18
- });
19
- const nxJson = (0, project_configuration_1.readNxJson)(tree);
20
- if (!nxJson)
21
- return;
22
- for (let opts of Object.values(nxJson.tasksRunnerOptions ?? {})) {
23
- if (opts.runner === '@nrwl/nx-cloud') {
24
- opts.runner = 'nx-cloud';
25
- }
26
- }
27
- (0, project_configuration_1.updateNxJson)(tree, nxJson);
28
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
29
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- export default function removeRunCommandsOutputPath(tree: Tree): Promise<void>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removeRunCommandsOutputPath;
4
- const path_1 = require("../../utils/path");
5
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
6
- const json_1 = require("../../generators/utils/json");
7
- const project_configuration_1 = require("../../generators/utils/project-configuration");
8
- async function removeRunCommandsOutputPath(tree) {
9
- for (const [project, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
10
- const targets = configuration.targets ?? {};
11
- let changed = false;
12
- for (const [, target] of Object.entries(targets)) {
13
- changed ||= updateTargetBlock(target);
14
- }
15
- if (changed) {
16
- (0, project_configuration_1.updateProjectConfiguration)(tree, project, configuration);
17
- }
18
- }
19
- if (tree.exists('nx.json')) {
20
- (0, json_1.updateJson)(tree, 'nx.json', (json) => {
21
- for (const [, target] of Object.entries(json.targetDefaults ?? {})) {
22
- updateTargetBlock(target);
23
- }
24
- return json;
25
- });
26
- }
27
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
28
- }
29
- function updateTargetBlock(target) {
30
- let changed = false;
31
- if (target.executor === 'nx:run-commands' && target.options?.outputPath) {
32
- changed = true;
33
- const outputs = new Set(target.outputs ?? []);
34
- outputs.delete('{options.outputPath}');
35
- const newOutputs = Array.isArray(target.options.outputPath)
36
- ? target.options.outputPath.map((p) => (0, path_1.joinPathFragments)('{workspaceRoot}', p))
37
- : [(0, path_1.joinPathFragments)('{workspaceRoot}', target.options.outputPath)];
38
- for (const outputPath of newOutputs) {
39
- outputs.add(outputPath);
40
- }
41
- delete target.options.outputPath;
42
- target.outputs = Array.from(outputs);
43
- }
44
- return changed;
45
- }
@@ -1,12 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- /**
3
- * This function escapes dollar sign in env variables
4
- * It will go through:
5
- * - '.env', '.local.env', '.env.local'
6
- * - .env.[target-name], .[target-name].env
7
- * - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
8
- * - .env.[configuration-name], .[configuration-name].env
9
- * at each project root and workspace root
10
- * @param tree
11
- */
12
- export default function escapeDollarSignEnvVariables(tree: Tree): void;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = escapeDollarSignEnvVariables;
4
- const logger_1 = require("../../utils/logger");
5
- const project_configuration_1 = require("../../generators/utils/project-configuration");
6
- /**
7
- * This function escapes dollar sign in env variables
8
- * It will go through:
9
- * - '.env', '.local.env', '.env.local'
10
- * - .env.[target-name], .[target-name].env
11
- * - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
12
- * - .env.[configuration-name], .[configuration-name].env
13
- * at each project root and workspace root
14
- * @param tree
15
- */
16
- function escapeDollarSignEnvVariables(tree) {
17
- const envFiles = ['.env', '.local.env', '.env.local'];
18
- for (const [_, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
19
- envFiles.push(`${configuration.root}/.env`, `${configuration.root}/.local.env`, `${configuration.root}/.env.local`);
20
- for (const targetName in configuration.targets) {
21
- const task = configuration.targets[targetName];
22
- envFiles.push(`.env.${targetName}`, `.${targetName}.env`, `${configuration.root}/.env.${targetName}`, `${configuration.root}/.${targetName}.env`);
23
- if (task.configurations) {
24
- for (const configurationName in task.configurations) {
25
- envFiles.push(`.env.${targetName}.${configurationName}`, `.${targetName}.${configurationName}.env`, `.env.${configurationName}`, `.${configurationName}.env`, `${configuration.root}/.env.${targetName}.${configurationName}`, `${configuration.root}/.${targetName}.${configurationName}.env`, `${configuration.root}/.env.${configurationName}`, `${configuration.root}/.${configurationName}.env`);
26
- }
27
- }
28
- }
29
- }
30
- for (const envFile of new Set(envFiles)) {
31
- parseEnvFile(tree, envFile);
32
- }
33
- }
34
- /**
35
- * This function parse the env file and escape dollar sign
36
- * @param tree
37
- * @param envFilePath
38
- * @returns
39
- */
40
- function parseEnvFile(tree, envFilePath) {
41
- if (!tree.exists(envFilePath)) {
42
- return;
43
- }
44
- let envFileContent = tree.read(envFilePath, 'utf-8');
45
- if (!envFileContent) {
46
- // envFileContent is null if we fail to read the file for any reason
47
- // e.g. the file is not utf-8 encoded
48
- logger_1.logger.info(`Unable to update ${envFilePath}. Nx interpolates environment variables in the form of $VAR_NAME. To escape the dollar sign, use \\$VAR_NAME.`);
49
- return;
50
- }
51
- envFileContent = envFileContent
52
- .split('\n')
53
- .map((line) => {
54
- line = line.trim();
55
- if (!line || !line.includes('$')) {
56
- return line;
57
- }
58
- const declarations = line.split('=');
59
- if (declarations[1].includes('$') && !declarations[1].includes(`\\$`)) {
60
- declarations[1] = declarations[1].replace('$', `\\$`);
61
- line = declarations.join('=');
62
- }
63
- return line;
64
- })
65
- .join('\n');
66
- tree.write(envFilePath, envFileContent);
67
- }
@@ -1,8 +0,0 @@
1
- import { workspaceRoot } from './workspace-root';
2
- /**
3
- * The root of the workspace.
4
- *
5
- * @deprecated use workspaceRoot instead
6
- */
7
- export declare const appRootPath: string;
8
- export { workspaceRoot };
@@ -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
- }