nx 20.5.0-canary.20250212-7c5fcf3 → 20.5.0-canary.20250214-ef08108

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 (44) hide show
  1. package/package.json +11 -11
  2. package/src/adapter/compat.d.ts +1 -1
  3. package/src/adapter/compat.js +1 -0
  4. package/src/command-line/add/add.js +6 -16
  5. package/src/command-line/init/command-object.js +13 -6
  6. package/src/command-line/init/configure-plugins.d.ts +5 -6
  7. package/src/command-line/init/configure-plugins.js +13 -22
  8. package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
  9. package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
  10. package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
  11. package/src/command-line/init/implementation/deduce-default-base.js +53 -0
  12. package/src/command-line/init/implementation/utils.d.ts +3 -1
  13. package/src/command-line/init/implementation/utils.js +91 -42
  14. package/src/command-line/init/init-v2.js +34 -14
  15. package/src/config/nx-json.d.ts +3 -2
  16. package/src/core/graph/main.js +1 -1
  17. package/src/core/graph/runtime.js +1 -1
  18. package/src/core/graph/styles.css +2 -2
  19. package/src/core/graph/styles.js +1 -1
  20. package/src/daemon/client/client.d.ts +1 -1
  21. package/src/daemon/client/client.js +9 -60
  22. package/src/daemon/client/enabled.d.ts +2 -0
  23. package/src/daemon/client/enabled.js +64 -0
  24. package/src/daemon/message-types/hash-glob.d.ts +6 -0
  25. package/src/daemon/message-types/hash-glob.js +9 -1
  26. package/src/daemon/server/handle-hash-glob.d.ts +1 -0
  27. package/src/daemon/server/handle-hash-glob.js +8 -0
  28. package/src/daemon/server/server.js +3 -0
  29. package/src/devkit-exports.d.ts +1 -1
  30. package/src/devkit-exports.js +2 -2
  31. package/src/devkit-internals.d.ts +1 -1
  32. package/src/devkit-internals.js +2 -1
  33. package/src/native/index.d.ts +1 -0
  34. package/src/native/nx.wasi.cjs +7 -7
  35. package/src/native/nx.wasm32-wasi.wasm +0 -0
  36. package/src/project-graph/plugins/isolation/plugin-worker.js +4 -0
  37. package/src/project-graph/plugins/loaded-nx-plugin.d.ts +1 -1
  38. package/src/project-graph/plugins/loaded-nx-plugin.js +3 -2
  39. package/src/project-graph/plugins/tasks-execution-hooks.js +4 -3
  40. package/src/project-graph/plugins/utils.d.ts +2 -2
  41. package/src/project-graph/plugins/utils.js +2 -2
  42. package/src/project-graph/project-graph.js +1 -1
  43. package/src/utils/workspace-context.d.ts +1 -0
  44. package/src/utils/workspace-context.js +8 -0
@@ -5,8 +5,9 @@ exports.runPostTasksExecution = runPostTasksExecution;
5
5
  const get_plugins_1 = require("./get-plugins");
6
6
  const is_on_daemon_1 = require("../../daemon/is-on-daemon");
7
7
  const client_1 = require("../../daemon/client/client");
8
+ const enabled_1 = require("../../daemon/client/enabled");
8
9
  async function runPreTasksExecution(pluginContext) {
9
- if ((0, is_on_daemon_1.isOnDaemon)() || !(0, client_1.isDaemonEnabled)()) {
10
+ if ((0, is_on_daemon_1.isOnDaemon)() || !(0, enabled_1.isDaemonEnabled)(pluginContext.nxJsonConfiguration)) {
10
11
  performance.mark(`preTasksExecution:start`);
11
12
  const plugins = await (0, get_plugins_1.getPlugins)(pluginContext.workspaceRoot);
12
13
  const envs = await Promise.all(plugins
@@ -21,7 +22,7 @@ async function runPreTasksExecution(pluginContext) {
21
22
  performance.measure(`${plugin.name}:preTasksExecution`, `${plugin.name}:preTasksExecution:start`, `${plugin.name}:preTasksExecution:end`);
22
23
  }
23
24
  }));
24
- if (!(0, client_1.isDaemonEnabled)()) {
25
+ if (!(0, enabled_1.isDaemonEnabled)(pluginContext.nxJsonConfiguration)) {
25
26
  applyProcessEnvs(envs);
26
27
  }
27
28
  performance.mark(`preTasksExecution:end`);
@@ -41,7 +42,7 @@ function applyProcessEnvs(envs) {
41
42
  }
42
43
  }
43
44
  async function runPostTasksExecution(context) {
44
- if ((0, is_on_daemon_1.isOnDaemon)() || !(0, client_1.isDaemonEnabled)()) {
45
+ if ((0, is_on_daemon_1.isOnDaemon)() || !(0, enabled_1.isDaemonEnabled)(context.nxJsonConfiguration)) {
45
46
  performance.mark(`postTasksExecution:start`);
46
47
  const plugins = await (0, get_plugins_1.getPlugins)();
47
48
  await Promise.all(plugins
@@ -1,2 +1,2 @@
1
- import { CreateNodesContextV2, CreateNodesFunction, CreateNodesResult } from './public-api';
2
- export declare function createNodesFromFiles<T = unknown>(createNodes: CreateNodesFunction<T>, configFiles: readonly string[], options: T, context: CreateNodesContextV2): Promise<[file: string, value: CreateNodesResult][]>;
1
+ import { CreateNodesContext, CreateNodesContextV2, CreateNodesResult } from './public-api';
2
+ export declare function createNodesFromFiles<T = unknown>(createNodes: (projectConfigurationFile: string, options: T | undefined, context: CreateNodesContext, idx: number) => CreateNodesResult | Promise<CreateNodesResult>, configFiles: readonly string[], options: T, context: CreateNodesContextV2): Promise<[file: string, value: CreateNodesResult][]>;
@@ -5,12 +5,12 @@ const error_types_1 = require("../error-types");
5
5
  async function createNodesFromFiles(createNodes, configFiles, options, context) {
6
6
  const results = [];
7
7
  const errors = [];
8
- await Promise.all(configFiles.map(async (file) => {
8
+ await Promise.all(configFiles.map(async (file, idx) => {
9
9
  try {
10
10
  const value = await createNodes(file, options, {
11
11
  ...context,
12
12
  configFiles,
13
- });
13
+ }, idx);
14
14
  if (value) {
15
15
  results.push([file, value]);
16
16
  }
@@ -280,7 +280,7 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
280
280
  handleProjectGraphError(opts, e);
281
281
  }
282
282
  finally {
283
- lock.unlock();
283
+ lock?.unlock();
284
284
  }
285
285
  }
286
286
  else {
@@ -12,6 +12,7 @@ export declare function globWithWorkspaceContextSync(workspaceRoot: string, glob
12
12
  export declare function globWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string[]>;
13
13
  export declare function multiGlobWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string[][]>;
14
14
  export declare function hashWithWorkspaceContext(workspaceRoot: string, globs: string[], exclude?: string[]): Promise<string>;
15
+ export declare function hashMultiGlobWithWorkspaceContext(workspaceRoot: string, globGroups: string[][]): Promise<string[]>;
15
16
  export declare function updateContextWithChangedFiles(workspaceRoot: string, createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
16
17
  export declare function updateFilesInContext(workspaceRoot: string, updatedFiles: string[], deletedFiles: string[]): Record<string, string>;
17
18
  export declare function getAllFileDataInContext(workspaceRoot: string): Promise<import("../native").FileData[]>;
@@ -6,6 +6,7 @@ exports.globWithWorkspaceContextSync = globWithWorkspaceContextSync;
6
6
  exports.globWithWorkspaceContext = globWithWorkspaceContext;
7
7
  exports.multiGlobWithWorkspaceContext = multiGlobWithWorkspaceContext;
8
8
  exports.hashWithWorkspaceContext = hashWithWorkspaceContext;
9
+ exports.hashMultiGlobWithWorkspaceContext = hashMultiGlobWithWorkspaceContext;
9
10
  exports.updateContextWithChangedFiles = updateContextWithChangedFiles;
10
11
  exports.updateFilesInContext = updateFilesInContext;
11
12
  exports.getAllFileDataInContext = getAllFileDataInContext;
@@ -65,6 +66,13 @@ async function hashWithWorkspaceContext(workspaceRoot, globs, exclude) {
65
66
  }
66
67
  return client_1.daemonClient.hashGlob(globs, exclude);
67
68
  }
69
+ async function hashMultiGlobWithWorkspaceContext(workspaceRoot, globGroups) {
70
+ if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
71
+ ensureContextAvailable(workspaceRoot);
72
+ return workspaceContext.hashFilesMatchingGlobs(globGroups);
73
+ }
74
+ return client_1.daemonClient.hashMultiGlob(globGroups);
75
+ }
68
76
  async function updateContextWithChangedFiles(workspaceRoot, createdFiles, updatedFiles, deletedFiles) {
69
77
  if (!client_1.daemonClient.enabled()) {
70
78
  updateFilesInContext(workspaceRoot, [...createdFiles, ...updatedFiles], deletedFiles);