nx 19.1.0-canary.20240517-312b271 → 19.1.0-canary.20240521-1255603

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.
@@ -198,7 +198,7 @@ const handleWorkspaceChanges = async (err, changeEvents) => {
198
198
  });
199
199
  return;
200
200
  }
201
- if (err || !changeEvents || !changeEvents.length) {
201
+ if (err) {
202
202
  let error = typeof err === 'string' ? new Error(err) : err;
203
203
  logger_1.serverLogger.watcherLog('Unexpected workspace watcher error', error.message);
204
204
  console.error(error);
@@ -175,7 +175,16 @@ function findTarget(sourcePath, keyMap, targetName, versionRange) {
175
175
  const searchPath = `${sourcePath}node_modules/${targetName}`;
176
176
  if (keyMap.has(searchPath)) {
177
177
  const child = keyMap.get(searchPath);
178
- if (child.data.version === versionRange ||
178
+ // if the version is alias to another package we need to parse the versions to compare
179
+ if (child.data.version.startsWith('npm:') &&
180
+ versionRange.startsWith('npm:')) {
181
+ const nodeVersion = child.data.version.slice(child.data.version.indexOf('@', 5) + 1);
182
+ const depVersion = versionRange.slice(versionRange.indexOf('@', 5) + 1);
183
+ if (nodeVersion === depVersion || (0, semver_1.satisfies)(nodeVersion, depVersion)) {
184
+ return child;
185
+ }
186
+ }
187
+ else if (child.data.version === versionRange ||
179
188
  (0, semver_1.satisfies)(child.data.version, versionRange)) {
180
189
  return child;
181
190
  }
@@ -16,7 +16,7 @@ function loadPnpmHoistedDepsDefinition() {
16
16
  const fullPath = `${workspace_root_1.workspaceRoot}/node_modules/.modules.yaml`;
17
17
  if ((0, fs_1.existsSync)(fullPath)) {
18
18
  const content = (0, fs_1.readFileSync)(fullPath, 'utf-8');
19
- const { load } = require('@zkochan/js-yaml');
19
+ const { load } = require('js-yaml');
20
20
  return load(content)?.hoistedDependencies ?? {};
21
21
  }
22
22
  else {
@@ -32,7 +32,7 @@ exports.loadPnpmHoistedDepsDefinition = loadPnpmHoistedDepsDefinition;
32
32
  * https://github.com/pnpm/pnpm/blob/af3e5559d377870d4c3d303429b3ed1a4e64fedc/lockfile/lockfile-file/src/read.ts#L91
33
33
  */
34
34
  function parseAndNormalizePnpmLockfile(content) {
35
- const { load } = require('@zkochan/js-yaml');
35
+ const { load } = require('js-yaml');
36
36
  const lockFileData = load(content);
37
37
  return revertFromInlineSpecifiersFormatIfNecessary(convertFromLockfileFileMutable(lockFileData));
38
38
  }
@@ -77,7 +77,7 @@ function stringifyToPnpmYaml(lockfile) {
77
77
  const adaptedLockfile = isLockfileV6
78
78
  ? convertToInlineSpecifiersFormat(lockfile)
79
79
  : lockfile;
80
- const { dump } = require('@zkochan/js-yaml');
80
+ const { dump } = require('js-yaml');
81
81
  return dump(sortLockfileKeys(normalizeLockfile(adaptedLockfile, isLockfileV6)), LOCKFILE_YAML_FORMAT);
82
82
  }
83
83
  exports.stringifyToPnpmYaml = stringifyToPnpmYaml;
@@ -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)} : ${plugin.executors[name].description}`));
117
+ bodyLines.push(...Object.keys(plugin.executors).map((name) => `${chalk.bold(name)} : ${resolveExecutorDescription(plugin.executors[name], projects)}`));
118
118
  }
119
119
  if (hasProjectGraphExtension) {
120
120
  bodyLines.push(`✔️ Project Graph Extension`);
@@ -128,3 +128,26 @@ async function listPluginCapabilities(pluginName, projects) {
128
128
  });
129
129
  }
130
130
  exports.listPluginCapabilities = listPluginCapabilities;
131
+ function resolveExecutorDescription(executorJsonEntry, projects) {
132
+ try {
133
+ if (typeof executorJsonEntry === 'string') {
134
+ // it points to another executor, resolve it
135
+ const [pkgName, executor] = executorJsonEntry.split(':');
136
+ const collection = loadExecutorsCollection(workspace_root_1.workspaceRoot, pkgName, projects);
137
+ return resolveExecutorDescription(collection[executor], projects);
138
+ }
139
+ return executorJsonEntry.description;
140
+ }
141
+ catch {
142
+ return 'No description available';
143
+ }
144
+ }
145
+ function loadExecutorsCollection(workspaceRoot, pluginName, projects) {
146
+ const { json: packageJson, path: packageJsonPath } = (0, plugins_1.readPluginPackageJson)(pluginName, projects, (0, installation_directory_1.getNxRequirePaths)(workspaceRoot));
147
+ return {
148
+ ...tryGetCollection(packageJsonPath, packageJson.builders, 'builders'),
149
+ ...tryGetCollection(packageJsonPath, packageJson.executors, 'builders'),
150
+ ...tryGetCollection(packageJsonPath, packageJson.builders, 'executors'),
151
+ ...tryGetCollection(packageJsonPath, packageJson.executors, 'executors'),
152
+ };
153
+ }