nx 19.5.1 → 19.6.0-canary.20240719-83b88a1

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "19.5.1",
3
+ "version": "19.6.0-canary.20240719-83b88a1",
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": {
@@ -71,7 +71,7 @@
71
71
  "yargs-parser": "21.1.1",
72
72
  "node-machine-id": "1.1.12",
73
73
  "ora": "5.3.0",
74
- "@nrwl/tao": "19.5.1"
74
+ "@nrwl/tao": "19.6.0-canary.20240719-83b88a1"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@swc-node/register": "^1.8.0",
@@ -86,16 +86,16 @@
86
86
  }
87
87
  },
88
88
  "optionalDependencies": {
89
- "@nx/nx-darwin-x64": "19.5.1",
90
- "@nx/nx-darwin-arm64": "19.5.1",
91
- "@nx/nx-linux-x64-gnu": "19.5.1",
92
- "@nx/nx-linux-x64-musl": "19.5.1",
93
- "@nx/nx-win32-x64-msvc": "19.5.1",
94
- "@nx/nx-linux-arm64-gnu": "19.5.1",
95
- "@nx/nx-linux-arm64-musl": "19.5.1",
96
- "@nx/nx-linux-arm-gnueabihf": "19.5.1",
97
- "@nx/nx-win32-arm64-msvc": "19.5.1",
98
- "@nx/nx-freebsd-x64": "19.5.1"
89
+ "@nx/nx-darwin-x64": "19.6.0-canary.20240719-83b88a1",
90
+ "@nx/nx-darwin-arm64": "19.6.0-canary.20240719-83b88a1",
91
+ "@nx/nx-linux-x64-gnu": "19.6.0-canary.20240719-83b88a1",
92
+ "@nx/nx-linux-x64-musl": "19.6.0-canary.20240719-83b88a1",
93
+ "@nx/nx-win32-x64-msvc": "19.6.0-canary.20240719-83b88a1",
94
+ "@nx/nx-linux-arm64-gnu": "19.6.0-canary.20240719-83b88a1",
95
+ "@nx/nx-linux-arm64-musl": "19.6.0-canary.20240719-83b88a1",
96
+ "@nx/nx-linux-arm-gnueabihf": "19.6.0-canary.20240719-83b88a1",
97
+ "@nx/nx-win32-arm64-msvc": "19.6.0-canary.20240719-83b88a1",
98
+ "@nx/nx-freebsd-x64": "19.6.0-canary.20240719-83b88a1"
99
99
  },
100
100
  "nx-migrations": {
101
101
  "migrations": "./migrations.json",
@@ -799,13 +799,16 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
799
799
  import: (0, schema_utils_1.resolveImplementation)(executorConfig.implementation, (0, path_1.dirname)(executorsFilePath)),
800
800
  };
801
801
  }
802
- readExecutorsJson(nodeModule, builder) {
803
- const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, this.projects, this.root ? [this.root, __dirname] : [__dirname]);
802
+ readExecutorsJson(nodeModule, builder, extraRequirePaths = []) {
803
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, this.projects, this.root
804
+ ? [this.root, __dirname, ...extraRequirePaths]
805
+ : [__dirname, ...extraRequirePaths]);
804
806
  const executorsFile = packageJson.executors ?? packageJson.builders;
805
807
  if (!executorsFile) {
806
808
  throw new Error(`The "${nodeModule}" package does not support Nx executors or Angular Devkit Builders.`);
807
809
  }
808
- const executorsFilePath = require.resolve((0, path_1.join)((0, path_1.dirname)(packageJsonPath), executorsFile));
810
+ const basePath = (0, path_1.dirname)(packageJsonPath);
811
+ const executorsFilePath = require.resolve((0, path_1.join)(basePath, executorsFile));
809
812
  const executorsJson = (0, fileutils_1.readJsonFile)(executorsFilePath);
810
813
  const executorConfig = executorsJson.builders?.[builder] ?? executorsJson.executors?.[builder];
811
814
  if (!executorConfig) {
@@ -814,7 +817,7 @@ async function getWrappedWorkspaceNodeModulesArchitectHost(workspace, root, proj
814
817
  if (typeof executorConfig === 'string') {
815
818
  // Angular CLI can have a builder pointing to another package:builder
816
819
  const [packageName, executorName] = executorConfig.split(':');
817
- return this.readExecutorsJson(packageName, executorName);
820
+ return this.readExecutorsJson(packageName, executorName, [basePath]);
818
821
  }
819
822
  return { executorsFilePath, executorConfig, isNgCompat: true };
820
823
  }
@@ -53,15 +53,22 @@ function getExecutorInformation(nodeModule, executor, root, projects) {
53
53
  throw new Error(`Unable to resolve ${nodeModule}:${executor}.\n${e.message}`);
54
54
  }
55
55
  }
56
- function readExecutorJson(nodeModule, executor, root, projects) {
56
+ function readExecutorJson(nodeModule, executor, root, projects, extraRequirePaths = []) {
57
57
  const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(nodeModule, projects, root
58
- ? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
59
- : [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]);
58
+ ? [
59
+ root,
60
+ __dirname,
61
+ process.cwd(),
62
+ ...(0, installation_directory_1.getNxRequirePaths)(),
63
+ ...extraRequirePaths,
64
+ ]
65
+ : [__dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)(), ...extraRequirePaths]);
60
66
  const executorsFile = packageJson.executors ?? packageJson.builders;
61
67
  if (!executorsFile) {
62
68
  throw new Error(`The "${nodeModule}" package does not support Nx executors.`);
63
69
  }
64
- const executorsFilePath = require.resolve((0, path_1.join)((0, path_1.dirname)(packageJsonPath), executorsFile));
70
+ const basePath = (0, path_1.dirname)(packageJsonPath);
71
+ const executorsFilePath = require.resolve((0, path_1.join)(basePath, executorsFile));
65
72
  const executorsJson = (0, fileutils_1.readJsonFile)(executorsFilePath);
66
73
  const executorConfig = executorsJson.executors?.[executor] || executorsJson.builders?.[executor];
67
74
  if (!executorConfig) {
@@ -70,7 +77,9 @@ function readExecutorJson(nodeModule, executor, root, projects) {
70
77
  if (typeof executorConfig === 'string') {
71
78
  // Angular CLI can have a builder pointing to another package:builder
72
79
  const [packageName, executorName] = executorConfig.split(':');
73
- return readExecutorJson(packageName, executorName, root, projects);
80
+ return readExecutorJson(packageName, executorName, root, projects, [
81
+ basePath,
82
+ ]);
74
83
  }
75
84
  const isNgCompat = !executorsJson.executors?.[executor];
76
85
  return { executorsFilePath, executorConfig, isNgCompat };
Binary file
@@ -114,7 +114,7 @@ async function listPluginCapabilities(pluginName, projects) {
114
114
  if (hasBuilders) {
115
115
  bodyLines.push(chalk.bold(chalk.green('EXECUTORS/BUILDERS')));
116
116
  bodyLines.push('');
117
- bodyLines.push(...Object.keys(plugin.executors).map((name) => `${chalk.bold(name)} : ${resolveExecutorDescription(plugin.executors[name], projects)}`));
117
+ bodyLines.push(...Object.keys(plugin.executors).map((name) => `${chalk.bold(name)} : ${resolveExecutorDescription(pluginName, plugin.executors[name], projects)}`));
118
118
  }
119
119
  if (hasProjectGraphExtension) {
120
120
  bodyLines.push(`✔️ Project Graph Extension`);
@@ -127,13 +127,20 @@ async function listPluginCapabilities(pluginName, projects) {
127
127
  bodyLines,
128
128
  });
129
129
  }
130
- function resolveExecutorDescription(executorJsonEntry, projects) {
130
+ function resolveExecutorDescription(pluginName, executorJsonEntry, projects, requirePaths = (0, installation_directory_1.getNxRequirePaths)(workspace_root_1.workspaceRoot)) {
131
131
  try {
132
132
  if (typeof executorJsonEntry === 'string') {
133
133
  // it points to another executor, resolve it
134
134
  const [pkgName, executor] = executorJsonEntry.split(':');
135
- const collection = loadExecutorsCollection(workspace_root_1.workspaceRoot, pkgName, projects);
136
- return resolveExecutorDescription(collection[executor], projects);
135
+ // read the package.json of the parent plugin
136
+ const { path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, requirePaths);
137
+ // accumulate the require paths to resolve nested packages
138
+ const cummulativeRequirePaths = [
139
+ ...requirePaths,
140
+ (0, path_1.dirname)(packageJsonPath),
141
+ ];
142
+ const collection = loadExecutorsCollection(pkgName, projects, cummulativeRequirePaths);
143
+ return resolveExecutorDescription(pkgName, collection[executor], projects, cummulativeRequirePaths);
137
144
  }
138
145
  return executorJsonEntry.description;
139
146
  }
@@ -141,8 +148,8 @@ function resolveExecutorDescription(executorJsonEntry, projects) {
141
148
  return 'No description available';
142
149
  }
143
150
  }
144
- function loadExecutorsCollection(workspaceRoot, pluginName, projects) {
145
- const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
151
+ function loadExecutorsCollection(pluginName, projects, requirePaths) {
152
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, requirePaths);
146
153
  return {
147
154
  ...tryGetCollection(packageJsonPath, packageJson.builders, 'builders'),
148
155
  ...tryGetCollection(packageJsonPath, packageJson.executors, 'builders'),