nx 23.2.0-beta.1 → 23.2.0-beta.2

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 (37) hide show
  1. package/dist/src/analytics/analytics.d.ts +6 -0
  2. package/dist/src/analytics/analytics.js +7 -1
  3. package/dist/src/analytics/index.d.ts +1 -1
  4. package/dist/src/analytics/index.js +2 -1
  5. package/dist/src/command-line/init/implementation/angular/integrated-workspace.js +2 -5
  6. package/dist/src/command-line/init/implementation/angular/legacy-angular-versions.js +3 -0
  7. package/dist/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +4 -1
  8. package/dist/src/command-line/migrate/migrate.js +4 -0
  9. package/dist/src/command-line/nx-cloud/connect/view-logs.js +2 -0
  10. package/dist/src/command-line/show/show-target/inputs.js +50 -153
  11. package/dist/src/command-line/show/show-target/outputs.js +48 -173
  12. package/dist/src/command-line/show/show-target/utils.d.ts +28 -0
  13. package/dist/src/command-line/show/show-target/utils.js +83 -3
  14. package/dist/src/command-line/yargs-utils/shared-options.d.ts +1 -1
  15. package/dist/src/core/graph/main.js +1 -1
  16. package/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
  17. package/dist/src/daemon/server/server.js +7 -4
  18. package/dist/src/devkit-internals.d.ts +1 -0
  19. package/dist/src/devkit-internals.js +5 -2
  20. package/dist/src/hasher/check-task-files.d.ts +86 -0
  21. package/dist/src/hasher/check-task-files.js +378 -0
  22. package/dist/src/native/index.d.ts +25 -2
  23. package/dist/src/native/native-bindings.js +2 -0
  24. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  25. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  26. package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -0
  27. package/dist/src/project-graph/build-project-graph.js +7 -1
  28. package/dist/src/project-graph/plugins/loaded-nx-plugin.js +1 -0
  29. package/dist/src/project-graph/project-graph.js +3 -0
  30. package/dist/src/tasks-runner/life-cycle.d.ts +2 -2
  31. package/dist/src/tasks-runner/life-cycle.js +2 -2
  32. package/dist/src/tasks-runner/pseudo-terminal.d.ts +1 -1
  33. package/dist/src/tasks-runner/pseudo-terminal.js +2 -2
  34. package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -1
  35. package/dist/src/tasks-runner/task-orchestrator.js +23 -6
  36. package/dist/src/utils/acknowledge-build-scripts.js +7 -5
  37. package/package.json +11 -11
@@ -6,6 +6,10 @@ exports.normalizePath = normalizePath;
6
6
  exports.deduplicateFolderEntries = deduplicateFolderEntries;
7
7
  exports.pc = pc;
8
8
  exports.printList = printList;
9
+ exports.printJson = printJson;
10
+ exports.pathsUnder = pathsUnder;
11
+ exports.renderCheckResults = renderCheckResults;
12
+ exports.setCheckExitCode = setCheckExitCode;
9
13
  const path_1 = require("path");
10
14
  const calculate_default_project_name_1 = require("../../../config/calculate-default-project-name");
11
15
  const configuration_1 = require("../../../config/configuration");
@@ -29,18 +33,22 @@ async function resolveTarget(args, opts) {
29
33
  }
30
34
  const nxJson = (0, configuration_1.readNxJson)();
31
35
  const { projectName, targetName, configurationName } = resolveTargetIdentifier(args, graph, nxJson);
36
+ // `resolveProjectNode` accepts a pattern specifier (`my-*`), so the concrete
37
+ // name it resolved to is the one everything downstream has to use — it is a
38
+ // lookup key for the task id, not just a label.
32
39
  const node = resolveProjectNode(projectName, graph);
40
+ const resolvedProjectName = node.name;
33
41
  if (!node.data.targets?.[targetName]) {
34
- reportTargetNotFound(projectName, targetName, node);
42
+ reportTargetNotFound(resolvedProjectName, targetName, node);
35
43
  }
36
44
  const configuration = configurationName ?? args.configuration;
37
45
  if (configuration) {
38
- validateConfiguration(projectName, targetName, configuration, node.data.targets[targetName]);
46
+ validateConfiguration(resolvedProjectName, targetName, configuration, node.data.targets[targetName]);
39
47
  }
40
48
  return {
41
49
  graph,
42
50
  nxJson,
43
- projectName,
51
+ projectName: resolvedProjectName,
44
52
  targetName,
45
53
  configuration,
46
54
  node,
@@ -183,3 +191,75 @@ function printList(header, items, prefix = '\n') {
183
191
  for (const item of items)
184
192
  console.log(` ${item}`);
185
193
  }
194
+ function printJson(data) {
195
+ const result = {};
196
+ for (const [key, value] of Object.entries(data)) {
197
+ if (Array.isArray(value) && value.length === 0)
198
+ continue;
199
+ result[key] = value;
200
+ }
201
+ console.log(JSON.stringify(result, null, 2));
202
+ }
203
+ /** The paths that live under `dir`. An empty `dir` is the workspace root. */
204
+ function pathsUnder(dir, paths) {
205
+ if (dir === '')
206
+ return [...paths];
207
+ const prefix = dir.endsWith('/') ? dir : dir + '/';
208
+ return paths.filter((p) => p.startsWith(prefix));
209
+ }
210
+ const NOUNS = {
211
+ input: { preposition: 'for', contained: 'input file' },
212
+ output: { preposition: 'of', contained: 'output path' },
213
+ };
214
+ function renderCheckResults(results, project, target, noun) {
215
+ if (results.length >= 2) {
216
+ renderBatchCheckResults(results, project, target, noun);
217
+ return;
218
+ }
219
+ for (const result of results) {
220
+ renderCheckResult(result, project, target, noun);
221
+ }
222
+ }
223
+ function setCheckExitCode(results) {
224
+ for (const result of results) {
225
+ process.exitCode ||= result.matched || result.contained.length ? 0 : 1;
226
+ }
227
+ }
228
+ function renderCheckResult(result, project, target, noun) {
229
+ const c = pc();
230
+ const { preposition, contained } = NOUNS[noun];
231
+ const label = `${c.cyan(project)}:${c.green(target)}`;
232
+ if (result.matched) {
233
+ const category = result.category ? ` (${result.category})` : '';
234
+ console.log(`${c.green('✓')} ${c.bold(result.value)} is an ${noun} ${preposition} ${label}${category}`);
235
+ }
236
+ else if (result.contained.length > 0) {
237
+ console.log(`${c.yellow('~')} ${c.bold(result.file)} is a directory containing ${c.bold(String(result.contained.length))} ${contained}(s) ${preposition} ${label}`);
238
+ for (const item of [...result.contained].sort())
239
+ console.log(` ${item}`);
240
+ }
241
+ else {
242
+ console.log(`${c.red('✗')} ${c.bold(result.value)} is ${c.red('not')} an ${noun} ${preposition} ${label}`);
243
+ }
244
+ }
245
+ function renderBatchCheckResults(results, project, target, noun) {
246
+ const c = pc();
247
+ const { preposition, contained } = NOUNS[noun];
248
+ const label = `${c.cyan(project)}:${c.green(target)}`;
249
+ const matched = results.filter((r) => r.matched);
250
+ const directories = results.filter((r) => !r.matched && r.contained.length);
251
+ const unmatched = results.filter((r) => !r.matched && !r.contained.length);
252
+ if (matched.length > 0 || directories.length > 0) {
253
+ console.log(`\n${c.green('✓')} These arguments were ${noun}s ${preposition} ${label}:`);
254
+ for (const r of matched)
255
+ console.log(` ${r.value}`);
256
+ for (const r of directories) {
257
+ console.log(` ${r.file} (directory containing ${r.contained.length} ${contained}s)`);
258
+ }
259
+ }
260
+ if (unmatched.length > 0) {
261
+ console.log(`\n${c.red('✗')} These arguments were ${c.red('not')} ${noun}s ${preposition} ${label}:`);
262
+ for (const r of unmatched)
263
+ console.log(` ${r.value}`);
264
+ }
265
+ }
@@ -1,4 +1,4 @@
1
- import { Argv, ParserConfigurationOptions } from 'yargs';
1
+ import type { Argv, ParserConfigurationOptions } from 'yargs';
2
2
  interface ExcludeOptions {
3
3
  exclude: string[];
4
4
  }