nx 20.0.0-beta.7 → 20.0.0-beta.8

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 (51) hide show
  1. package/bin/init-local.js +0 -39
  2. package/bin/nx.js +3 -13
  3. package/migrations.json +5 -0
  4. package/package.json +11 -11
  5. package/src/adapter/compat.d.ts +1 -1
  6. package/src/adapter/compat.js +1 -1
  7. package/src/command-line/affected/affected.js +0 -2
  8. package/src/command-line/release/utils/git.js +2 -2
  9. package/src/command-line/run/run-one.js +0 -2
  10. package/src/command-line/run/run.js +0 -1
  11. package/src/command-line/run-many/run-many.js +1 -4
  12. package/src/config/misc-interfaces.d.ts +3 -15
  13. package/src/config/nx-json.d.ts +2 -2
  14. package/src/config/project-graph.d.ts +0 -2
  15. package/src/core/graph/main.js +1 -1
  16. package/src/daemon/client/client.js +1 -3
  17. package/src/devkit-exports.d.ts +3 -4
  18. package/src/devkit-exports.js +3 -6
  19. package/src/executors/utils/convert-nx-executor.js +0 -1
  20. package/src/generators/utils/nx-json.d.ts +1 -1
  21. package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
  22. package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
  23. package/src/native/nx.wasm32-wasi.wasm +0 -0
  24. package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -12
  25. package/src/project-graph/build-project-graph.js +3 -41
  26. package/src/project-graph/error-types.d.ts +4 -10
  27. package/src/project-graph/error-types.js +1 -12
  28. package/src/project-graph/file-utils.js +1 -1
  29. package/src/project-graph/nx-deps-cache.d.ts +0 -1
  30. package/src/project-graph/nx-deps-cache.js +0 -1
  31. package/src/project-graph/plugins/internal-api.d.ts +2 -5
  32. package/src/project-graph/plugins/internal-api.js +0 -1
  33. package/src/project-graph/plugins/isolation/messaging.d.ts +3 -23
  34. package/src/project-graph/plugins/isolation/plugin-pool.js +0 -23
  35. package/src/project-graph/plugins/isolation/plugin-worker.js +0 -19
  36. package/src/project-graph/plugins/loader.js +2 -3
  37. package/src/project-graph/plugins/public-api.d.ts +6 -7
  38. package/src/project-graph/plugins/utils.d.ts +1 -7
  39. package/src/project-graph/plugins/utils.js +0 -37
  40. package/src/project-graph/utils/project-configuration-utils.js +1 -1
  41. package/src/tasks-runner/batch/run-batch.js +0 -1
  42. package/src/tasks-runner/cache.js +2 -1
  43. package/src/tasks-runner/init-tasks-runner.js +0 -2
  44. package/src/utils/command-line-utils.js +24 -33
  45. package/src/utils/plugins/plugin-capabilities.js +2 -3
  46. package/src/utils/app-root.d.ts +0 -8
  47. package/src/utils/app-root.js +0 -12
  48. package/src/utils/nx-plugin.deprecated.d.ts +0 -31
  49. package/src/utils/nx-plugin.deprecated.js +0 -20
  50. package/src/utils/workspace-configuration-check.d.ts +0 -1
  51. package/src/utils/workspace-configuration-check.js +0 -36
package/bin/init-local.js CHANGED
@@ -5,7 +5,6 @@ exports.rewriteTargetsAndProjects = rewriteTargetsAndProjects;
5
5
  const perf_hooks_1 = require("perf_hooks");
6
6
  const nx_commands_1 = require("../src/command-line/nx-commands");
7
7
  const strip_indents_1 = require("../src/utils/strip-indents");
8
- const Mod = require("module");
9
8
  /**
10
9
  * Nx is being run inside a workspace.
11
10
  *
@@ -15,7 +14,6 @@ function initLocal(workspace) {
15
14
  process.env.NX_CLI_SET = 'true';
16
15
  try {
17
16
  perf_hooks_1.performance.mark('init-local');
18
- monkeyPatchRequire();
19
17
  if (workspace.type !== 'nx' && shouldDelegateToAngularCLI()) {
20
18
  console.warn((0, strip_indents_1.stripIndents) `Using Nx to run Angular CLI commands is deprecated and will be removed in a future version.
21
19
  To run Angular CLI commands, use \`ng\`.`);
@@ -144,40 +142,3 @@ To update the cache configuration, you can directly update the relevant options
144
142
  }
145
143
  }
146
144
  }
147
- // TODO(v17): Remove this once the @nrwl/* packages are not
148
- function monkeyPatchRequire() {
149
- const originalRequire = Mod.prototype.require;
150
- Mod.prototype.require = function (...args) {
151
- const modulePath = args[0];
152
- if (!modulePath.startsWith('@nrwl/')) {
153
- return originalRequire.apply(this, args);
154
- }
155
- else {
156
- try {
157
- // Try the original require
158
- return originalRequire.apply(this, args);
159
- }
160
- catch (e) {
161
- if (e.code !== 'MODULE_NOT_FOUND') {
162
- throw e;
163
- }
164
- try {
165
- // Retry the require with the @nx package
166
- return originalRequire.apply(this, args.map((value, i) => {
167
- if (i !== 0) {
168
- return value;
169
- }
170
- else {
171
- return value.replace('@nrwl/', '@nx/');
172
- }
173
- }));
174
- }
175
- catch {
176
- // Throw the original error
177
- throw e;
178
- }
179
- }
180
- }
181
- // do some side-effect of your own
182
- };
183
- }
package/bin/nx.js CHANGED
@@ -127,19 +127,9 @@ function resolveNx(workspace) {
127
127
  }
128
128
  catch { }
129
129
  // check for root install
130
- try {
131
- return require.resolve('nx/bin/nx.js', {
132
- paths: [workspace ? workspace.dir : globalsRoot],
133
- });
134
- }
135
- catch {
136
- // TODO(v17): Remove this
137
- // fallback for old CLI install setup
138
- // nx-ignore-next-line
139
- return require.resolve('@nrwl/cli/bin/nx.js', {
140
- paths: [workspace ? workspace.dir : globalsRoot],
141
- });
142
- }
130
+ return require.resolve('nx/bin/nx.js', {
131
+ paths: [workspace ? workspace.dir : globalsRoot],
132
+ });
143
133
  }
144
134
  function handleMissingLocalInstallation() {
145
135
  output_1.output.error({
package/migrations.json CHANGED
@@ -52,6 +52,11 @@
52
52
  "description": "Set project name in nx.json explicitly",
53
53
  "implementation": "./src/migrations/update-19-2-4/set-project-name",
54
54
  "x-repair-skip": true
55
+ },
56
+ "move-use-daemon-process": {
57
+ "version": "20.0.0-beta.7",
58
+ "description": "Migration for v20.0.0-beta.7",
59
+ "implementation": "./src/migrations/update-20-0-0/move-use-daemon-process"
55
60
  }
56
61
  }
57
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.0.0-beta.7",
3
+ "version": "20.0.0-beta.8",
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": {
@@ -80,16 +80,16 @@
80
80
  }
81
81
  },
82
82
  "optionalDependencies": {
83
- "@nx/nx-darwin-x64": "20.0.0-beta.7",
84
- "@nx/nx-darwin-arm64": "20.0.0-beta.7",
85
- "@nx/nx-linux-x64-gnu": "20.0.0-beta.7",
86
- "@nx/nx-linux-x64-musl": "20.0.0-beta.7",
87
- "@nx/nx-win32-x64-msvc": "20.0.0-beta.7",
88
- "@nx/nx-linux-arm64-gnu": "20.0.0-beta.7",
89
- "@nx/nx-linux-arm64-musl": "20.0.0-beta.7",
90
- "@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.7",
91
- "@nx/nx-win32-arm64-msvc": "20.0.0-beta.7",
92
- "@nx/nx-freebsd-x64": "20.0.0-beta.7"
83
+ "@nx/nx-darwin-x64": "20.0.0-beta.8",
84
+ "@nx/nx-darwin-arm64": "20.0.0-beta.8",
85
+ "@nx/nx-linux-x64-gnu": "20.0.0-beta.8",
86
+ "@nx/nx-linux-x64-musl": "20.0.0-beta.8",
87
+ "@nx/nx-win32-x64-msvc": "20.0.0-beta.8",
88
+ "@nx/nx-linux-arm64-gnu": "20.0.0-beta.8",
89
+ "@nx/nx-linux-arm64-musl": "20.0.0-beta.8",
90
+ "@nx/nx-linux-arm-gnueabihf": "20.0.0-beta.8",
91
+ "@nx/nx-win32-arm64-msvc": "20.0.0-beta.8",
92
+ "@nx/nx-freebsd-x64": "20.0.0-beta.8"
93
93
  },
94
94
  "nx-migrations": {
95
95
  "migrations": "./migrations.json",
@@ -1,2 +1,2 @@
1
1
  export declare const allowedProjectExtensions: readonly ["tags", "implicitDependencies", "configFilePath", "$schema", "generators", "namedInputs", "name", "files", "root", "sourceRoot", "projectType", "release", "includedScripts", "metadata"];
2
- export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "enableDbCache"];
2
+ export declare const allowedWorkspaceExtensions: readonly ["implicitDependencies", "affected", "defaultBase", "tasksRunnerOptions", "workspaceLayout", "plugins", "targetDefaults", "files", "generators", "namedInputs", "extends", "cli", "pluginsConfig", "defaultProject", "installation", "release", "nxCloudAccessToken", "nxCloudId", "nxCloudUrl", "nxCloudEncryptionKey", "parallel", "cacheDirectory", "useDaemonProcess", "useInferencePlugins", "neverConnectToCloud", "sync", "useLegacyCache"];
@@ -63,7 +63,7 @@ exports.allowedWorkspaceExtensions = [
63
63
  'useInferencePlugins',
64
64
  'neverConnectToCloud',
65
65
  'sync',
66
- 'enableDbCache',
66
+ 'useLegacyCache',
67
67
  ];
68
68
  if (!patched) {
69
69
  Module.prototype.require = function () {
@@ -12,7 +12,6 @@ const project_graph_1 = require("../../project-graph/project-graph");
12
12
  const project_graph_utils_1 = require("../../utils/project-graph-utils");
13
13
  const affected_project_graph_1 = require("../../project-graph/affected/affected-project-graph");
14
14
  const configuration_1 = require("../../config/configuration");
15
- const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
16
15
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
17
16
  const graph_1 = require("../graph/graph");
18
17
  const all_file_data_1 = require("../../utils/all-file-data");
@@ -22,7 +21,6 @@ async function affected(command, args, extraTargetDependencies = {}, extraOption
22
21
  }) {
23
22
  perf_hooks_1.performance.mark('code-loading:end');
24
23
  perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
25
- (0, workspace_configuration_check_1.workspaceConfigurationCheck)();
26
24
  const nxJson = (0, configuration_1.readNxJson)();
27
25
  const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'affected', {
28
26
  printWarnings: command !== 'print-affected' && !args.plain && args.graph !== 'stdout',
@@ -16,7 +16,7 @@ exports.getFirstGitCommit = getFirstGitCommit;
16
16
  * https://github.com/unjs/changelogen
17
17
  */
18
18
  const utils_1 = require("../../../tasks-runner/utils");
19
- const app_root_1 = require("../../../utils/app-root");
19
+ const workspace_root_1 = require("../../../utils/workspace-root");
20
20
  const exec_command_1 = require("./exec-command");
21
21
  function escapeRegExp(string) {
22
22
  return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
@@ -118,7 +118,7 @@ async function getChangedTrackedFiles(cwd) {
118
118
  async function gitAdd({ changedFiles, deletedFiles, dryRun, verbose, logFn, cwd, }) {
119
119
  logFn = logFn || console.log;
120
120
  // Default to running git add related commands from the workspace root
121
- cwd = cwd || app_root_1.workspaceRoot;
121
+ cwd = cwd || workspace_root_1.workspaceRoot;
122
122
  let ignoredFiles = [];
123
123
  let filesToAdd = [];
124
124
  for (const f of changedFiles ?? []) {
@@ -11,7 +11,6 @@ const split_target_1 = require("../../utils/split-target");
11
11
  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
- const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
15
14
  const graph_1 = require("../graph/graph");
16
15
  async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
17
16
  excludeTaskDependencies: args.excludeTaskDependencies,
@@ -19,7 +18,6 @@ async function runOne(cwd, args, extraTargetDependencies = {}, extraOptions = {
19
18
  }) {
20
19
  perf_hooks_1.performance.mark('code-loading:end');
21
20
  perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
22
- (0, workspace_configuration_check_1.workspaceConfigurationCheck)();
23
21
  const nxJson = (0, configuration_1.readNxJson)();
24
22
  const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
25
23
  const opts = parseRunOneOptions(cwd, args, projectGraph, nxJson);
@@ -100,7 +100,6 @@ async function runExecutorInternal({ project, target, configuration }, overrides
100
100
  target: targetConfig,
101
101
  projectsConfigurations,
102
102
  nxJsonConfiguration,
103
- workspace: { ...projectsConfigurations, ...nxJsonConfiguration },
104
103
  projectName: project,
105
104
  targetName: target,
106
105
  configurationName: configuration,
@@ -4,7 +4,6 @@ exports.runMany = runMany;
4
4
  exports.projectsToRun = projectsToRun;
5
5
  const run_command_1 = require("../../tasks-runner/run-command");
6
6
  const command_line_utils_1 = require("../../utils/command-line-utils");
7
- const command_line_utils_2 = require("../../utils/command-line-utils");
8
7
  const project_graph_utils_1 = require("../../utils/project-graph-utils");
9
8
  const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
10
9
  const perf_hooks_1 = require("perf_hooks");
@@ -12,7 +11,6 @@ const project_graph_1 = require("../../project-graph/project-graph");
12
11
  const configuration_1 = require("../../config/configuration");
13
12
  const output_1 = require("../../utils/output");
14
13
  const find_matching_projects_1 = require("../../utils/find-matching-projects");
15
- const workspace_configuration_check_1 = require("../../utils/workspace-configuration-check");
16
14
  const graph_1 = require("../graph/graph");
17
15
  async function runMany(args, extraTargetDependencies = {}, extraOptions = {
18
16
  excludeTaskDependencies: args.excludeTaskDependencies,
@@ -20,9 +18,8 @@ async function runMany(args, extraTargetDependencies = {}, extraOptions = {
20
18
  }) {
21
19
  perf_hooks_1.performance.mark('code-loading:end');
22
20
  perf_hooks_1.performance.measure('code-loading', 'init-local', 'code-loading:end');
23
- (0, workspace_configuration_check_1.workspaceConfigurationCheck)();
24
21
  const nxJson = (0, configuration_1.readNxJson)();
25
- const { nxArgs, overrides } = (0, command_line_utils_2.splitArgsIntoNxArgsAndOverrides)(args, 'run-many', { printWarnings: args.graph !== 'stdout' }, nxJson);
22
+ const { nxArgs, overrides } = (0, command_line_utils_1.splitArgsIntoNxArgsAndOverrides)(args, 'run-many', { printWarnings: args.graph !== 'stdout' }, nxJson);
26
23
  if (nxArgs.verbose) {
27
24
  process.env.NX_VERBOSE_LOGGING = 'true';
28
25
  }
@@ -173,16 +173,12 @@ export interface ExecutorContext {
173
173
  target?: TargetConfiguration;
174
174
  /**
175
175
  * Projects config
176
- *
177
- * @todo(vsavkin): mark this as required for v17
178
176
  */
179
- projectsConfigurations?: ProjectsConfigurations;
177
+ projectsConfigurations: ProjectsConfigurations;
180
178
  /**
181
179
  * The contents of nx.json.
182
- *
183
- * @todo(vsavkin): mark this as required for v17
184
180
  */
185
- nxJsonConfiguration?: NxJsonConfiguration;
181
+ nxJsonConfiguration: NxJsonConfiguration;
186
182
  /**
187
183
  * The current working directory
188
184
  */
@@ -194,19 +190,11 @@ export interface ExecutorContext {
194
190
  /**
195
191
  * A snapshot of the project graph as
196
192
  * it existed when the Nx command was kicked off
197
- *
198
- * @todo(vsavkin) mark this required for v17
199
193
  */
200
- projectGraph?: ProjectGraph;
194
+ projectGraph: ProjectGraph;
201
195
  /**
202
196
  * A snapshot of the task graph as
203
197
  * it existed when the Nx command was kicked off
204
198
  */
205
199
  taskGraph?: TaskGraph;
206
- /**
207
- * Deprecated. Use projectsConfigurations or nxJsonConfiguration
208
- * The full workspace configuration
209
- * @todo(vsavkin): remove after v17
210
- */
211
- workspace?: ProjectsConfigurations & NxJsonConfiguration;
212
200
  }
@@ -464,9 +464,9 @@ export interface NxJsonConfiguration<T = '*' | string[]> {
464
464
  */
465
465
  sync?: NxSyncConfiguration;
466
466
  /**
467
- * Enable the new experimental db based cache
467
+ * Use the legacy file system cache instead of the db cache
468
468
  */
469
- enableDbCache?: boolean;
469
+ useLegacyCache?: boolean;
470
470
  }
471
471
  export type PluginConfiguration = string | ExpandedPluginConfiguration;
472
472
  export type ExpandedPluginConfiguration<T = unknown> = {
@@ -61,8 +61,6 @@ export declare enum DependencyType {
61
61
  */
62
62
  implicit = "implicit"
63
63
  }
64
- /** @deprecated this type will be removed in v16. Use {@link ProjectGraphProjectNode} or {@link ProjectGraphExternalNode} instead */
65
- export type ProjectGraphNode = ProjectGraphProjectNode | ProjectGraphExternalNode;
66
64
  /**
67
65
  * A node describing a project in a workspace
68
66
  */