nx 21.3.0-canary.20250710-13551c9 → 21.3.0-canary.20250711-be6d35b

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/package.json +11 -11
  2. package/src/command-line/format/command-object.js +12 -6
  3. package/src/command-line/yargs-utils/shared-options.d.ts +1 -0
  4. package/src/command-line/yargs-utils/shared-options.js +5 -0
  5. package/src/core/graph/main.js +1 -1
  6. package/src/core/graph/styles.js +1 -1
  7. package/src/daemon/client/client.js +7 -15
  8. package/src/daemon/client/daemon-socket-messenger.js +2 -9
  9. package/src/daemon/server/file-watching/file-watcher-sockets.js +1 -1
  10. package/src/daemon/server/handle-context-file-data.js +1 -1
  11. package/src/daemon/server/handle-flush-sync-generator-changes-to-disk.js +1 -1
  12. package/src/daemon/server/handle-get-files-in-directory.js +1 -1
  13. package/src/daemon/server/handle-get-registered-sync-generators.js +1 -1
  14. package/src/daemon/server/handle-get-sync-generator-changes.js +1 -1
  15. package/src/daemon/server/handle-glob.js +2 -2
  16. package/src/daemon/server/handle-hash-tasks.d.ts +1 -1
  17. package/src/daemon/server/handle-hash-tasks.js +1 -1
  18. package/src/daemon/server/handle-nx-workspace-files.js +1 -1
  19. package/src/daemon/server/handle-outputs-tracking.js +1 -1
  20. package/src/daemon/server/handle-task-history.d.ts +2 -2
  21. package/src/daemon/server/handle-task-history.js +2 -2
  22. package/src/daemon/server/handle-tasks-execution-hooks.d.ts +1 -1
  23. package/src/daemon/server/handle-tasks-execution-hooks.js +1 -1
  24. package/src/daemon/server/server.d.ts +2 -2
  25. package/src/daemon/server/server.js +28 -49
  26. package/src/daemon/server/shutdown-utils.js +1 -2
  27. package/src/native/nx.wasm32-wasi.wasm +0 -0
  28. package/src/project-graph/plugins/isolation/messaging.js +1 -2
  29. package/src/project-graph/plugins/isolation/plugin-pool.js +5 -19
  30. package/src/project-graph/plugins/loaded-nx-plugin.js +0 -2
  31. package/src/tasks-runner/is-tui-enabled.js +8 -0
  32. package/src/tasks-runner/pseudo-ipc.js +4 -4
  33. package/src/utils/command-line-utils.d.ts +1 -0
  34. package/src/utils/consume-messages-from-socket.d.ts +0 -2
  35. package/src/utils/consume-messages-from-socket.js +3 -18
  36. package/src/utils/project-graph-utils.d.ts +6 -1
  37. package/src/utils/project-graph-utils.js +11 -6
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MESSAGE_END_SEQ = void 0;
4
3
  exports.consumeMessagesFromSocket = consumeMessagesFromSocket;
5
- exports.isJsonMessage = isJsonMessage;
6
- exports.MESSAGE_END_SEQ = 'NX_MSG_END' + String.fromCharCode(4);
7
4
  function consumeMessagesFromSocket(callback) {
8
5
  let message = '';
9
6
  return (data) => {
10
7
  const chunk = data.toString();
11
- if (chunk.endsWith(exports.MESSAGE_END_SEQ)) {
12
- message += chunk.substring(0, chunk.length - exports.MESSAGE_END_SEQ.length);
8
+ if (chunk.codePointAt(chunk.length - 1) === 4) {
9
+ message += chunk.substring(0, chunk.length - 1);
13
10
  // Server may send multiple messages in one chunk, so splitting by 0x4
14
- const messages = message.split(exports.MESSAGE_END_SEQ);
11
+ const messages = message.split('');
15
12
  for (const splitMessage of messages) {
16
13
  callback(splitMessage);
17
14
  }
@@ -22,15 +19,3 @@ function consumeMessagesFromSocket(callback) {
22
19
  }
23
20
  };
24
21
  }
25
- function isJsonMessage(message) {
26
- return (
27
- // json objects
28
- ['[', '{'].some((prefix) => message.startsWith(prefix)) ||
29
- // booleans
30
- message === 'true' ||
31
- message === 'false' ||
32
- // strings
33
- (message.startsWith('"') && message.endsWith('"')) ||
34
- // numbers
35
- /^[0-9]+(\.?[0-9]+)?$/.test(message));
36
- }
@@ -1,7 +1,11 @@
1
1
  import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
2
+ import type { ProjectConfiguration } from '../config/workspace-json-project-json';
2
3
  export declare function projectHasTarget(project: ProjectGraphProjectNode, target: string): boolean;
3
4
  export declare function projectHasTargetAndConfiguration(project: ProjectGraphProjectNode, target: string, configuration: string): any;
4
- export declare function getSourceDirOfDependentProjects(projectName: string, projectGraph?: ProjectGraph): [projectDirs: string[], warnings: string[]];
5
+ export declare function getSourceDirOfDependentProjects(projectName: string, projectGraph?: ProjectGraph): [
6
+ projectDirs: string[],
7
+ warnings: string[]
8
+ ];
5
9
  /**
6
10
  * Find all internal project dependencies.
7
11
  * All the external (npm) dependencies will be filtered out unless includeExternalDependencies is set to true
@@ -11,3 +15,4 @@ export declare function getSourceDirOfDependentProjects(projectName: string, pro
11
15
  * @returns {string[]}
12
16
  */
13
17
  export declare function findAllProjectNodeDependencies(parentNodeName: string, projectGraph?: ProjectGraph, includeExternalDependencies?: boolean): string[];
18
+ export declare function getProjectSourceRoot(project: ProjectConfiguration): string | undefined;
@@ -4,6 +4,9 @@ exports.projectHasTarget = projectHasTarget;
4
4
  exports.projectHasTargetAndConfiguration = projectHasTargetAndConfiguration;
5
5
  exports.getSourceDirOfDependentProjects = getSourceDirOfDependentProjects;
6
6
  exports.findAllProjectNodeDependencies = findAllProjectNodeDependencies;
7
+ exports.getProjectSourceRoot = getProjectSourceRoot;
8
+ const node_fs_1 = require("node:fs");
9
+ const node_path_1 = require("node:path");
7
10
  const project_graph_1 = require("../project-graph/project-graph");
8
11
  function projectHasTarget(project, target) {
9
12
  return !!(project.data &&
@@ -21,12 +24,8 @@ function getSourceDirOfDependentProjects(projectName, projectGraph = (0, project
21
24
  }
22
25
  const nodeNames = findAllProjectNodeDependencies(projectName, projectGraph);
23
26
  return nodeNames.reduce((result, nodeName) => {
24
- if (projectGraph.nodes[nodeName].data.sourceRoot) {
25
- result[0].push(projectGraph.nodes[nodeName].data.sourceRoot);
26
- }
27
- else {
28
- result[1].push(nodeName);
29
- }
27
+ const sourceRoot = getProjectSourceRoot(projectGraph.nodes[nodeName].data);
28
+ result[0].push(sourceRoot);
30
29
  return result;
31
30
  }, [[], []]);
32
31
  }
@@ -71,3 +70,9 @@ function collectDependentProjectNodesNames(nxDeps, dependencyNodeNames, parentNo
71
70
  collectDependentProjectNodesNames(nxDeps, dependencyNodeNames, dependencyName, includeExternalDependencies);
72
71
  }
73
72
  }
73
+ function getProjectSourceRoot(project) {
74
+ return (project.sourceRoot ??
75
+ ((0, node_fs_1.existsSync)(node_path_1.posix.join(project.root, 'src'))
76
+ ? node_path_1.posix.join(project.root, 'src')
77
+ : project.root));
78
+ }