nx 19.1.0-canary.20240511-f7dcf43 → 19.1.0-canary.20240514-cc9b7f3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.1.0-canary.20240511-f7dcf43",
3
+ "version": "19.1.0-canary.20240514-cc9b7f3",
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": {
@@ -66,7 +66,7 @@
66
66
  "yargs-parser": "21.1.1",
67
67
  "node-machine-id": "1.1.12",
68
68
  "ora": "5.3.0",
69
- "@nrwl/tao": "19.1.0-canary.20240511-f7dcf43"
69
+ "@nrwl/tao": "19.1.0-canary.20240514-cc9b7f3"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@swc-node/register": "^1.8.0",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "19.1.0-canary.20240511-f7dcf43",
85
- "@nx/nx-darwin-arm64": "19.1.0-canary.20240511-f7dcf43",
86
- "@nx/nx-linux-x64-gnu": "19.1.0-canary.20240511-f7dcf43",
87
- "@nx/nx-linux-x64-musl": "19.1.0-canary.20240511-f7dcf43",
88
- "@nx/nx-win32-x64-msvc": "19.1.0-canary.20240511-f7dcf43",
89
- "@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240511-f7dcf43",
90
- "@nx/nx-linux-arm64-musl": "19.1.0-canary.20240511-f7dcf43",
91
- "@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240511-f7dcf43",
92
- "@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240511-f7dcf43",
93
- "@nx/nx-freebsd-x64": "19.1.0-canary.20240511-f7dcf43"
84
+ "@nx/nx-darwin-x64": "19.1.0-canary.20240514-cc9b7f3",
85
+ "@nx/nx-darwin-arm64": "19.1.0-canary.20240514-cc9b7f3",
86
+ "@nx/nx-linux-x64-gnu": "19.1.0-canary.20240514-cc9b7f3",
87
+ "@nx/nx-linux-x64-musl": "19.1.0-canary.20240514-cc9b7f3",
88
+ "@nx/nx-win32-x64-msvc": "19.1.0-canary.20240514-cc9b7f3",
89
+ "@nx/nx-linux-arm64-gnu": "19.1.0-canary.20240514-cc9b7f3",
90
+ "@nx/nx-linux-arm64-musl": "19.1.0-canary.20240514-cc9b7f3",
91
+ "@nx/nx-linux-arm-gnueabihf": "19.1.0-canary.20240514-cc9b7f3",
92
+ "@nx/nx-win32-arm64-msvc": "19.1.0-canary.20240514-cc9b7f3",
93
+ "@nx/nx-freebsd-x64": "19.1.0-canary.20240514-cc9b7f3"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -0,0 +1,9 @@
1
+ import { CommandModule } from 'yargs';
2
+ /**
3
+ * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.'
4
+ */
5
+ export declare const yargsAffectedGraphCommand: CommandModule;
6
+ /**
7
+ * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.'
8
+ */
9
+ export declare const yargsPrintAffectedCommand: CommandModule;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.yargsPrintAffectedCommand = exports.yargsAffectedGraphCommand = void 0;
4
+ const params_1 = require("../../utils/params");
5
+ const shared_options_1 = require("../yargs-utils/shared-options");
6
+ const affectedGraphDeprecationMessage = 'Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command has been removed in Nx 19.';
7
+ const printAffectedDeprecationMessage = 'Use `nx show projects --affected`, `nx affected --graph -t build` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command has been removed in Nx 19.';
8
+ /**
9
+ * @deprecated 'Use `nx graph --affected`, or` nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.'
10
+ */
11
+ exports.yargsAffectedGraphCommand = {
12
+ command: 'affected:graph',
13
+ describe: false,
14
+ aliases: ['affected:dep-graph'],
15
+ builder: (yargs) => (0, shared_options_1.withAffectedOptions)((0, shared_options_1.withDepGraphOptions)(yargs)),
16
+ handler: (args) => (0, params_1.handleErrors)(false, () => {
17
+ throw new Error(affectedGraphDeprecationMessage);
18
+ }),
19
+ deprecated: affectedGraphDeprecationMessage,
20
+ };
21
+ /**
22
+ * @deprecated 'Use `nx show --affected`, `nx affected --graph` or `nx graph --affected` depending on which best suits your use case. The `print-affected` command will be removed in Nx 19.'
23
+ */
24
+ exports.yargsPrintAffectedCommand = {
25
+ command: 'print-affected',
26
+ describe: false,
27
+ builder: (yargs) => (0, shared_options_1.withAffectedOptions)((0, shared_options_1.withTargetAndConfigurationOption)(yargs, false))
28
+ .option('select', {
29
+ type: 'string',
30
+ describe: 'Select the subset of the returned json document (e.g., --select=projects)',
31
+ })
32
+ .option('type', {
33
+ type: 'string',
34
+ choices: ['app', 'lib'],
35
+ describe: 'Select the type of projects to be returned (e.g., --type=app)',
36
+ }),
37
+ handler: (args) => (0, params_1.handleErrors)(false, () => {
38
+ throw new Error(printAffectedDeprecationMessage);
39
+ }),
40
+ deprecated: printAffectedDeprecationMessage,
41
+ };
@@ -2,28 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.examples = void 0;
4
4
  exports.examples = {
5
- 'print-affected': [
6
- {
7
- command: 'print-affected',
8
- description: 'Print information about affected projects and the project graph',
9
- },
10
- {
11
- command: 'print-affected --base=main --head=HEAD',
12
- description: 'Print information about the projects affected by the changes between main and HEAD (e.g,. PR)',
13
- },
14
- {
15
- command: 'print-affected -t test',
16
- description: 'Prints information about the affected projects and a list of tasks to test them',
17
- },
18
- {
19
- command: 'print-affected -t build --select=projects',
20
- description: 'Prints the projects property from the print-affected output',
21
- },
22
- {
23
- command: 'print-affected -t build --select=tasks.target.project',
24
- description: 'Prints the tasks.target.project property from the print-affected output',
25
- },
26
- ],
27
5
  affected: [
28
6
  {
29
7
  command: 'affected -t custom-target',
@@ -166,32 +144,6 @@ exports.examples = {
166
144
  description: 'Watch for changes to project graph and update in-browser',
167
145
  },
168
146
  ],
169
- 'affected:graph': [
170
- {
171
- command: 'affected:graph --files=libs/mylib/src/index.ts',
172
- description: 'Open the project graph of the workspace in the browser, and highlight the projects affected by changing the index.ts file',
173
- },
174
- {
175
- command: 'affected:graph --base=main --head=HEAD',
176
- description: 'Open the project graph of the workspace in the browser, and highlight the projects affected by the changes between main and HEAD (e.g., PR)',
177
- },
178
- {
179
- command: 'affected:graph --base=main --head=HEAD --file=output.json',
180
- description: 'Save the project graph of the workspace in a json file, and highlight the projects affected by the changes between main and HEAD (e.g., PR)',
181
- },
182
- {
183
- command: 'affected:graph --base=main --head=HEAD --file=output.html',
184
- description: 'Generate a static website with project graph data in an html file, highlighting the projects affected by the changes between main and HEAD (e.g., PR)',
185
- },
186
- {
187
- command: 'affected:graph --base=main~1 --head=main',
188
- description: 'Open the project graph of the workspace in the browser, and highlight the projects affected by the last commit on main',
189
- },
190
- {
191
- command: 'affected:graph --exclude=project-one,project-two',
192
- description: 'Open the project graph of the workspace in the browser, highlight the projects affected, but exclude project-one and project-two',
193
- },
194
- ],
195
147
  list: [
196
148
  {
197
149
  command: 'list',
@@ -23,6 +23,7 @@ const command_object_17 = require("./watch/command-object");
23
23
  const command_object_18 = require("./reset/command-object");
24
24
  const command_object_19 = require("./release/command-object");
25
25
  const command_object_20 = require("./add/command-object");
26
+ const command_objects_1 = require("./deprecated/command-objects");
26
27
  // Ensure that the output takes up the available width of the terminal.
27
28
  yargs.wrap(yargs.terminalWidth());
28
29
  exports.parserConfiguration = {
@@ -45,6 +46,7 @@ exports.commandsObject = yargs
45
46
  .command(command_object_1.yargsAffectedE2ECommand)
46
47
  .command(command_object_1.yargsAffectedLintCommand)
47
48
  .command(command_object_1.yargsAffectedTestCommand)
49
+ .command(command_objects_1.yargsAffectedGraphCommand)
48
50
  .command(command_object_2.yargsConnectCommand)
49
51
  .command(command_object_3.yargsDaemonCommand)
50
52
  .command(command_object_4.yargsDepGraphCommand)
@@ -57,6 +59,7 @@ exports.commandsObject = yargs
57
59
  .command(command_object_9.yargsListCommand)
58
60
  .command(command_object_10.yargsMigrateCommand)
59
61
  .command(command_object_11.yargsNewCommand)
62
+ .command(command_objects_1.yargsPrintAffectedCommand)
60
63
  .command(command_object_19.yargsReleaseCommand)
61
64
  .command(command_object_12.yargsRepairCommand)
62
65
  .command(command_object_13.yargsReportCommand)
@@ -4,12 +4,13 @@
4
4
  * These may not be available in certain version of Nx, so be sure to check them first.
5
5
  */
6
6
  export { createTempNpmDirectory } from './utils/package-manager';
7
+ export { deepEquals } from './utils/json-diff';
7
8
  export { getExecutorInformation } from './command-line/run/executor-utils';
8
9
  export { readNxJson as readNxJsonFromDisk } from './config/nx-json';
9
10
  export { calculateDefaultProjectName } from './config/calculate-default-project-name';
10
11
  export { retrieveProjectConfigurationsWithAngularProjects } from './project-graph/utils/retrieve-workspace-files';
11
12
  export { mergeTargetConfigurations } from './project-graph/utils/project-configuration-utils';
12
- export { readProjectConfigurationsFromRootMap } from './project-graph/utils/project-configuration-utils';
13
+ export { readProjectConfigurationsFromRootMap, isCompatibleTarget, } from './project-graph/utils/project-configuration-utils';
13
14
  export { splitTarget } from './utils/split-target';
14
15
  export { combineOptionsForExecutor } from './utils/params';
15
16
  export { sortObjectByKeys } from './utils/object-sort';
@@ -20,6 +21,6 @@ export { hashObject } from './hasher/file-hasher';
20
21
  export { hashWithWorkspaceContext } from './utils/workspace-context';
21
22
  export { createProjectRootMappingsFromProjectConfigurations, findProjectForPath, } from './project-graph/utils/find-project-for-path';
22
23
  export { retrieveProjectConfigurations } from './project-graph/utils/retrieve-workspace-files';
23
- export { LoadedNxPlugin } from './project-graph/plugins/internal-api';
24
+ export { LoadedNxPlugin, loadNxPlugins, } from './project-graph/plugins/internal-api';
24
25
  export * from './project-graph/error-types';
25
26
  export { registerTsProject } from './plugins/js/utils/register';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.getExecutorInformation = exports.createTempNpmDirectory = void 0;
3
+ exports.registerTsProject = exports.loadNxPlugins = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.splitTarget = exports.isCompatibleTarget = exports.readProjectConfigurationsFromRootMap = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.getExecutorInformation = exports.deepEquals = exports.createTempNpmDirectory = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  /**
6
6
  * Note to developers: STOP! These exports are available via requireNx in @nx/devkit.
@@ -9,6 +9,8 @@ const tslib_1 = require("tslib");
9
9
  */
10
10
  var package_manager_1 = require("./utils/package-manager");
11
11
  Object.defineProperty(exports, "createTempNpmDirectory", { enumerable: true, get: function () { return package_manager_1.createTempNpmDirectory; } });
12
+ var json_diff_1 = require("./utils/json-diff");
13
+ Object.defineProperty(exports, "deepEquals", { enumerable: true, get: function () { return json_diff_1.deepEquals; } });
12
14
  var executor_utils_1 = require("./command-line/run/executor-utils");
13
15
  Object.defineProperty(exports, "getExecutorInformation", { enumerable: true, get: function () { return executor_utils_1.getExecutorInformation; } });
14
16
  var nx_json_1 = require("./config/nx-json");
@@ -21,6 +23,7 @@ var project_configuration_utils_1 = require("./project-graph/utils/project-confi
21
23
  Object.defineProperty(exports, "mergeTargetConfigurations", { enumerable: true, get: function () { return project_configuration_utils_1.mergeTargetConfigurations; } });
22
24
  var project_configuration_utils_2 = require("./project-graph/utils/project-configuration-utils");
23
25
  Object.defineProperty(exports, "readProjectConfigurationsFromRootMap", { enumerable: true, get: function () { return project_configuration_utils_2.readProjectConfigurationsFromRootMap; } });
26
+ Object.defineProperty(exports, "isCompatibleTarget", { enumerable: true, get: function () { return project_configuration_utils_2.isCompatibleTarget; } });
24
27
  var split_target_1 = require("./utils/split-target");
25
28
  Object.defineProperty(exports, "splitTarget", { enumerable: true, get: function () { return split_target_1.splitTarget; } });
26
29
  var params_1 = require("./utils/params");
@@ -44,6 +47,7 @@ var retrieve_workspace_files_2 = require("./project-graph/utils/retrieve-workspa
44
47
  Object.defineProperty(exports, "retrieveProjectConfigurations", { enumerable: true, get: function () { return retrieve_workspace_files_2.retrieveProjectConfigurations; } });
45
48
  var internal_api_1 = require("./project-graph/plugins/internal-api");
46
49
  Object.defineProperty(exports, "LoadedNxPlugin", { enumerable: true, get: function () { return internal_api_1.LoadedNxPlugin; } });
50
+ Object.defineProperty(exports, "loadNxPlugins", { enumerable: true, get: function () { return internal_api_1.loadNxPlugins; } });
47
51
  tslib_1.__exportStar(require("./project-graph/error-types"), exports);
48
52
  var register_1 = require("./plugins/js/utils/register");
49
53
  Object.defineProperty(exports, "registerTsProject", { enumerable: true, get: function () { return register_1.registerTsProject; } });
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const logger_1 = require("../../utils/logger");
3
4
  const project_configuration_1 = require("../../generators/utils/project-configuration");
4
5
  /**
5
6
  * This function escapes dollar sign in env variables
@@ -41,11 +42,17 @@ function parseEnvFile(tree, envFilePath) {
41
42
  return;
42
43
  }
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
+ }
44
51
  envFileContent = envFileContent
45
52
  .split('\n')
46
53
  .map((line) => {
47
54
  line = line.trim();
48
- if (!line.includes('$')) {
55
+ if (!line || !line.includes('$')) {
49
56
  return line;
50
57
  }
51
58
  const declarations = line.split('=');
@@ -25,5 +25,5 @@ export declare const nxPluginCache: Map<unknown, [
25
25
  Promise<LoadedNxPlugin>,
26
26
  () => void
27
27
  ]>;
28
- export declare function loadNxPlugins(plugins: PluginConfiguration[], root?: string): Promise<[LoadedNxPlugin[], () => void]>;
28
+ export declare function loadNxPlugins(plugins: PluginConfiguration[], root?: string, skipDefaultPlugins?: boolean): Promise<[LoadedNxPlugin[], () => void]>;
29
29
  export declare function getDefaultPlugins(root: string): Promise<string[]>;
@@ -38,12 +38,14 @@ exports.LoadedNxPlugin = LoadedNxPlugin;
38
38
  // Allows loaded plugins to not be reloaded when
39
39
  // referenced multiple times.
40
40
  exports.nxPluginCache = new Map();
41
- async function loadNxPlugins(plugins, root = workspace_root_1.workspaceRoot) {
41
+ async function loadNxPlugins(plugins, root = workspace_root_1.workspaceRoot, skipDefaultPlugins = false) {
42
42
  const result = [];
43
43
  const loadingMethod = process.env.NX_ISOLATE_PLUGINS === 'true'
44
44
  ? isolation_1.loadNxPluginInIsolation
45
45
  : loader_1.loadNxPlugin;
46
- plugins = await normalizePlugins(plugins, root);
46
+ plugins = skipDefaultPlugins
47
+ ? plugins ?? []
48
+ : await normalizePlugins(plugins, root);
47
49
  const cleanupFunctions = [];
48
50
  for (const plugin of plugins) {
49
51
  const [loadedPluginPromise, cleanup] = loadingMethod(plugin, root);
@@ -9,12 +9,12 @@ import { LoadedNxPlugin } from '../plugins/internal-api';
9
9
  * @param nxJson
10
10
  */
11
11
  export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRootMap: Record<string, string>): Promise<{
12
- allWorkspaceFiles: import("nx/src/devkit-exports").FileData[];
12
+ allWorkspaceFiles: import("../file-utils").FileData[];
13
13
  fileMap: {
14
14
  projectFileMap: ProjectFiles;
15
- nonProjectFiles: import("nx/src/native").FileData[];
15
+ nonProjectFiles: import("../../native").FileData[];
16
16
  };
17
- rustReferences: import("nx/src/native").NxWorkspaceFilesExternals;
17
+ rustReferences: import("../../native").NxWorkspaceFilesExternals;
18
18
  }>;
19
19
  /**
20
20
  * Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
@@ -331,7 +331,7 @@ function writeCompletedTaskResultLine(line) {
331
331
  function writeCommandOutputBlock(commandOutput) {
332
332
  commandOutput = commandOutput || '';
333
333
  commandOutput = commandOutput.trimStart();
334
- const lines = commandOutput.split(os_1.EOL);
334
+ const lines = commandOutput.split(/\r?\n/);
335
335
  let totalTrailingEmptyLines = 0;
336
336
  for (let i = lines.length - 1; i >= 0; i--) {
337
337
  if (lines[i] !== '') {
@@ -22,6 +22,15 @@ function findMatchingProjects(patterns = [], projects) {
22
22
  }
23
23
  const projectNames = Object.keys(projects);
24
24
  const matchedProjects = new Set();
25
+ // If the first pattern is an exclude pattern,
26
+ // we add a wildcard pattern at the first to select
27
+ // all projects, except the ones that match the exclude pattern.
28
+ // e.g. ['!tag:someTag', 'project2'] will match all projects except
29
+ // the ones with the tag 'someTag', and also match the project 'project2',
30
+ // regardless of its tags.
31
+ if (isExcludePattern(patterns[0])) {
32
+ patterns.unshift('*');
33
+ }
25
34
  for (const stringPattern of patterns) {
26
35
  if (!stringPattern.length) {
27
36
  continue;
@@ -139,8 +148,11 @@ function addMatchingProjectsByTag(projectNames, projects, pattern, matchedProjec
139
148
  }
140
149
  }
141
150
  }
151
+ function isExcludePattern(pattern) {
152
+ return pattern.startsWith('!');
153
+ }
142
154
  function parseStringPattern(pattern, projects) {
143
- const isExclude = pattern.startsWith('!');
155
+ const isExclude = isExcludePattern(pattern);
144
156
  // Support for things like: `!{type}:value`
145
157
  if (isExclude) {
146
158
  pattern = pattern.substring(1);