nx 20.3.1 → 20.4.0-beta.0

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 (52) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +11 -11
  3. package/src/command-line/release/version.js +8 -0
  4. package/src/command-line/run/run-one.js +37 -13
  5. package/src/command-line/show/project.js +21 -3
  6. package/src/command-line/yargs-utils/shared-options.d.ts +1 -0
  7. package/src/command-line/yargs-utils/shared-options.js +7 -0
  8. package/src/core/graph/main.js +1 -1
  9. package/src/daemon/server/server.js +2 -2
  10. package/src/devkit-internals.d.ts +1 -1
  11. package/src/devkit-internals.js +2 -2
  12. package/src/native/nx.wasm32-wasi.wasm +0 -0
  13. package/src/nx-cloud/update-manager.js +13 -1
  14. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +4 -1
  15. package/src/plugins/js/utils/packages.js +16 -2
  16. package/src/project-graph/build-project-graph.d.ts +1 -1
  17. package/src/project-graph/error-types.d.ts +2 -0
  18. package/src/project-graph/error-types.js +66 -8
  19. package/src/project-graph/plugins/get-plugins.d.ts +3 -3
  20. package/src/project-graph/plugins/get-plugins.js +112 -12
  21. package/src/project-graph/plugins/in-process-loader.d.ts +10 -0
  22. package/src/project-graph/plugins/in-process-loader.js +60 -0
  23. package/src/project-graph/plugins/index.d.ts +2 -1
  24. package/src/project-graph/plugins/index.js +4 -3
  25. package/src/project-graph/plugins/isolation/index.d.ts +2 -2
  26. package/src/project-graph/plugins/isolation/messaging.d.ts +1 -1
  27. package/src/project-graph/plugins/isolation/plugin-pool.d.ts +1 -1
  28. package/src/project-graph/plugins/isolation/plugin-pool.js +2 -2
  29. package/src/project-graph/plugins/isolation/plugin-worker.js +1 -2
  30. package/src/project-graph/plugins/load-resolved-plugin.d.ts +1 -1
  31. package/src/project-graph/plugins/load-resolved-plugin.js +2 -2
  32. package/src/project-graph/plugins/{internal-api.d.ts → loaded-nx-plugin.d.ts} +4 -10
  33. package/src/project-graph/plugins/loaded-nx-plugin.js +57 -0
  34. package/src/project-graph/plugins/resolve-plugin.d.ts +15 -0
  35. package/src/project-graph/plugins/{loader.js → resolve-plugin.js} +60 -149
  36. package/src/project-graph/plugins/transpiler.d.ts +8 -0
  37. package/src/project-graph/plugins/transpiler.js +47 -0
  38. package/src/project-graph/project-graph.js +0 -3
  39. package/src/project-graph/utils/project-configuration-utils.d.ts +1 -1
  40. package/src/project-graph/utils/project-configuration-utils.js +1 -17
  41. package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
  42. package/src/tasks-runner/cache.d.ts +1 -0
  43. package/src/tasks-runner/cache.js +20 -2
  44. package/src/tasks-runner/default-tasks-runner.d.ts +1 -0
  45. package/src/utils/command-line-utils.d.ts +1 -0
  46. package/src/utils/command-line-utils.js +8 -1
  47. package/src/utils/find-matching-projects.js +11 -0
  48. package/src/utils/handle-errors.js +7 -11
  49. package/src/utils/package-json.d.ts +1 -0
  50. package/src/utils/plugins/plugin-capabilities.js +2 -2
  51. package/src/project-graph/plugins/internal-api.js +0 -135
  52. package/src/project-graph/plugins/loader.d.ts +0 -30
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2025 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.3.1",
3
+ "version": "20.4.0-beta.0",
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": {
@@ -82,16 +82,16 @@
82
82
  }
83
83
  },
84
84
  "optionalDependencies": {
85
- "@nx/nx-darwin-arm64": "20.3.1",
86
- "@nx/nx-darwin-x64": "20.3.1",
87
- "@nx/nx-freebsd-x64": "20.3.1",
88
- "@nx/nx-linux-arm-gnueabihf": "20.3.1",
89
- "@nx/nx-linux-arm64-gnu": "20.3.1",
90
- "@nx/nx-linux-arm64-musl": "20.3.1",
91
- "@nx/nx-linux-x64-gnu": "20.3.1",
92
- "@nx/nx-linux-x64-musl": "20.3.1",
93
- "@nx/nx-win32-arm64-msvc": "20.3.1",
94
- "@nx/nx-win32-x64-msvc": "20.3.1"
85
+ "@nx/nx-darwin-arm64": "20.4.0-beta.0",
86
+ "@nx/nx-darwin-x64": "20.4.0-beta.0",
87
+ "@nx/nx-freebsd-x64": "20.4.0-beta.0",
88
+ "@nx/nx-linux-arm-gnueabihf": "20.4.0-beta.0",
89
+ "@nx/nx-linux-arm64-gnu": "20.4.0-beta.0",
90
+ "@nx/nx-linux-arm64-musl": "20.4.0-beta.0",
91
+ "@nx/nx-linux-x64-gnu": "20.4.0-beta.0",
92
+ "@nx/nx-linux-x64-musl": "20.4.0-beta.0",
93
+ "@nx/nx-win32-arm64-msvc": "20.4.0-beta.0",
94
+ "@nx/nx-win32-x64-msvc": "20.4.0-beta.0"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -313,6 +313,14 @@ function createAPI(overrideReleaseConfig) {
313
313
  });
314
314
  }
315
315
  }
316
+ if (args.gitPush ?? nxReleaseConfig.version.git.push) {
317
+ output_1.output.logSingleLine(`Pushing to git remote "${args.gitRemote}"`);
318
+ await (0, git_1.gitPush)({
319
+ gitRemote: args.gitRemote,
320
+ dryRun: args.dryRun,
321
+ verbose: args.verbose,
322
+ });
323
+ }
316
324
  return {
317
325
  workspaceVersion,
318
326
  projectsVersionData: versionData,
@@ -12,6 +12,7 @@ const output_1 = require("../../utils/output");
12
12
  const configuration_1 = require("../../config/configuration");
13
13
  const calculate_default_project_name_1 = require("../../config/calculate-default-project-name");
14
14
  const graph_1 = require("../graph/graph");
15
+ const find_matching_projects_1 = require("../../utils/find-matching-projects");
15
16
  async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
16
17
  excludeTaskDependencies: args.excludeTaskDependencies,
17
18
  loadDotEnvFiles: process.env.NX_LOAD_DOT_ENV_FILES !== 'false',
@@ -31,7 +32,7 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
31
32
  process.exit(0);
32
33
  }
33
34
  await (0, connect_to_nx_cloud_1.connectToNxCloudIfExplicitlyAsked)(nxArgs);
34
- const { projects } = getProjects(projectGraph, opts.project);
35
+ const { projects, projectName } = getProjects(projectGraph, opts.project);
35
36
  if (nxArgs.graph) {
36
37
  const projectNames = projects.map((t) => t.name);
37
38
  const file = (0, command_line_utils_1.readGraphFileFromGraphArg)(nxArgs);
@@ -45,22 +46,45 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
45
46
  }, projectNames);
46
47
  }
47
48
  else {
48
- const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, opts.project, extraTargetDependencies, extraOptions);
49
+ const status = await (0, run_command_1.runCommand)(projects, projectGraph, { nxJson }, nxArgs, overrides, projectName, extraTargetDependencies, extraOptions);
49
50
  process.exit(status);
50
51
  }
51
52
  }
52
- function getProjects(projectGraph, project) {
53
- if (!projectGraph.nodes[project]) {
54
- output_1.output.error({
55
- title: `Cannot find project '${project}'`,
56
- });
57
- process.exit(1);
53
+ function getProjects(projectGraph, projectName) {
54
+ if (projectGraph.nodes[projectName]) {
55
+ return {
56
+ projectName: projectName,
57
+ projects: [projectGraph.nodes[projectName]],
58
+ projectsMap: {
59
+ [projectName]: projectGraph.nodes[projectName],
60
+ },
61
+ };
58
62
  }
59
- let projects = [projectGraph.nodes[project]];
60
- let projectsMap = {
61
- [project]: projectGraph.nodes[project],
62
- };
63
- return { projects, projectsMap };
63
+ else {
64
+ const projects = (0, find_matching_projects_1.findMatchingProjects)([projectName], projectGraph.nodes);
65
+ if (projects.length === 1) {
66
+ const projectName = projects[0];
67
+ const project = projectGraph.nodes[projectName];
68
+ return {
69
+ projectName,
70
+ projects: [project],
71
+ projectsMap: {
72
+ [project.data.name]: project,
73
+ },
74
+ };
75
+ }
76
+ else if (projects.length > 1) {
77
+ output_1.output.error({
78
+ title: `Multiple projects matched:`,
79
+ bodyLines: projects.length > 100 ? [...projects.slice(0, 100), '...'] : projects,
80
+ });
81
+ process.exit(1);
82
+ }
83
+ }
84
+ output_1.output.error({
85
+ title: `Cannot find project '${projectName}'`,
86
+ });
87
+ process.exit(1);
64
88
  }
65
89
  const targetAliases = {
66
90
  b: 'build',
@@ -4,14 +4,32 @@ exports.showProjectHandler = showProjectHandler;
4
4
  const output_1 = require("../../utils/output");
5
5
  const project_graph_1 = require("../../project-graph/project-graph");
6
6
  const graph_1 = require("../graph/graph");
7
+ const find_matching_projects_1 = require("../../utils/find-matching-projects");
7
8
  async function showProjectHandler(args) {
8
9
  performance.mark('code-loading:end');
9
10
  performance.measure('code-loading', 'init-local', 'code-loading:end');
10
11
  const graph = await (0, project_graph_1.createProjectGraphAsync)();
11
- const node = graph.nodes[args.projectName];
12
+ let node = graph.nodes[args.projectName];
12
13
  if (!node) {
13
- console.log(`Could not find project ${args.projectName}`);
14
- process.exit(1);
14
+ const projects = (0, find_matching_projects_1.findMatchingProjects)([args.projectName], graph.nodes);
15
+ if (projects.length === 1) {
16
+ const projectName = projects[0];
17
+ node = graph.nodes[projectName];
18
+ }
19
+ else if (projects.length > 1) {
20
+ output_1.output.error({
21
+ title: `Multiple projects matched:`,
22
+ bodyLines: projects.length > 100 ? [...projects.slice(0, 100), '...'] : projects,
23
+ });
24
+ console.log(`Multiple projects matched:\n ${(projects.length > 100
25
+ ? [...projects.slice(0, 100), '...']
26
+ : projects).join(' \n')}`);
27
+ process.exit(1);
28
+ }
29
+ else {
30
+ console.log(`Could not find project ${args.projectName}`);
31
+ process.exit(1);
32
+ }
15
33
  }
16
34
  if (args.json) {
17
35
  console.log(JSON.stringify(node.data));
@@ -15,6 +15,7 @@ export interface RunOptions {
15
15
  nxBail: boolean;
16
16
  nxIgnoreCycles: boolean;
17
17
  skipNxCache: boolean;
18
+ skipRemoteCache: boolean;
18
19
  cloud: boolean;
19
20
  dte: boolean;
20
21
  batch: boolean;
@@ -75,6 +75,13 @@ function withRunOptions(yargs) {
75
75
  describe: 'Rerun the tasks even when the results are available in the cache.',
76
76
  type: 'boolean',
77
77
  default: false,
78
+ alias: 'disableNxCache',
79
+ })
80
+ .options('skipRemoteCache', {
81
+ type: 'boolean',
82
+ describe: 'Disables the remote cache.',
83
+ default: false,
84
+ alias: 'disableRemoteCache',
78
85
  })
79
86
  .options('excludeTaskDependencies', {
80
87
  describe: 'Skips running dependent tasks first.',