nx 20.5.0-canary.20250228-e8647df → 20.5.0-rc.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "20.5.0-canary.20250228-e8647df",
3
+ "version": "20.5.0-rc.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.5.0-canary.20250228-e8647df",
86
- "@nx/nx-darwin-x64": "20.5.0-canary.20250228-e8647df",
87
- "@nx/nx-freebsd-x64": "20.5.0-canary.20250228-e8647df",
88
- "@nx/nx-linux-arm-gnueabihf": "20.5.0-canary.20250228-e8647df",
89
- "@nx/nx-linux-arm64-gnu": "20.5.0-canary.20250228-e8647df",
90
- "@nx/nx-linux-arm64-musl": "20.5.0-canary.20250228-e8647df",
91
- "@nx/nx-linux-x64-gnu": "20.5.0-canary.20250228-e8647df",
92
- "@nx/nx-linux-x64-musl": "20.5.0-canary.20250228-e8647df",
93
- "@nx/nx-win32-arm64-msvc": "20.5.0-canary.20250228-e8647df",
94
- "@nx/nx-win32-x64-msvc": "20.5.0-canary.20250228-e8647df"
85
+ "@nx/nx-darwin-arm64": "20.5.0-rc.0",
86
+ "@nx/nx-darwin-x64": "20.5.0-rc.0",
87
+ "@nx/nx-freebsd-x64": "20.5.0-rc.0",
88
+ "@nx/nx-linux-arm-gnueabihf": "20.5.0-rc.0",
89
+ "@nx/nx-linux-arm64-gnu": "20.5.0-rc.0",
90
+ "@nx/nx-linux-arm64-musl": "20.5.0-rc.0",
91
+ "@nx/nx-linux-x64-gnu": "20.5.0-rc.0",
92
+ "@nx/nx-linux-x64-musl": "20.5.0-rc.0",
93
+ "@nx/nx-win32-arm64-msvc": "20.5.0-rc.0",
94
+ "@nx/nx-win32-x64-msvc": "20.5.0-rc.0"
95
95
  },
96
96
  "nx-migrations": {
97
97
  "migrations": "./migrations.json",
@@ -74,3 +74,4 @@ export declare class DaemonClient {
74
74
  stop(): Promise<void>;
75
75
  }
76
76
  export declare const daemonClient: DaemonClient;
77
+ export declare function isDaemonEnabled(): boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.daemonClient = exports.DaemonClient = void 0;
4
+ exports.isDaemonEnabled = isDaemonEnabled;
4
5
  const workspace_root_1 = require("../../utils/workspace-root");
5
6
  const child_process_1 = require("child_process");
6
7
  const node_fs_1 = require("node:fs");
@@ -11,11 +12,14 @@ const perf_hooks_1 = require("perf_hooks");
11
12
  const output_1 = require("../../utils/output");
12
13
  const socket_utils_1 = require("../socket-utils");
13
14
  const tmp_dir_1 = require("../tmp-dir");
15
+ const is_ci_1 = require("../../utils/is-ci");
16
+ const nx_json_1 = require("../../config/nx-json");
14
17
  const configuration_1 = require("../../config/configuration");
15
18
  const promised_based_queue_1 = require("../../utils/promised-based-queue");
16
19
  const daemon_socket_messenger_1 = require("./daemon-socket-messenger");
17
20
  const cache_1 = require("../cache");
18
21
  const error_types_1 = require("../../project-graph/error-types");
22
+ const native_1 = require("../../native");
19
23
  const get_nx_workspace_files_1 = require("../message-types/get-nx-workspace-files");
20
24
  const get_context_file_data_1 = require("../message-types/get-context-file-data");
21
25
  const get_files_in_directory_1 = require("../message-types/get-files-in-directory");
@@ -28,7 +32,6 @@ const update_workspace_context_1 = require("../message-types/update-workspace-co
28
32
  const flush_sync_generator_changes_to_disk_1 = require("../message-types/flush-sync-generator-changes-to-disk");
29
33
  const delayed_spinner_1 = require("../../utils/delayed-spinner");
30
34
  const run_tasks_execution_hooks_1 = require("../message-types/run-tasks-execution-hooks");
31
- const enabled_1 = require("./enabled");
32
35
  const DAEMON_ENV_SETTINGS = {
33
36
  NX_PROJECT_GLOB_CACHE: 'false',
34
37
  NX_CACHE_PROJECTS_CONFIG: 'false',
@@ -55,7 +58,43 @@ class DaemonClient {
55
58
  this.reset();
56
59
  }
57
60
  enabled() {
58
- return (0, enabled_1.isDaemonEnabled)(this.nxJson);
61
+ if (this._enabled === undefined) {
62
+ const useDaemonProcessOption = this.nxJson?.useDaemonProcess;
63
+ const env = process.env.NX_DAEMON;
64
+ // env takes precedence
65
+ // option=true,env=false => no daemon
66
+ // option=false,env=undefined => no daemon
67
+ // option=false,env=false => no daemon
68
+ // option=undefined,env=undefined => daemon
69
+ // option=true,env=true => daemon
70
+ // option=false,env=true => daemon
71
+ // CI=true,env=undefined => no daemon
72
+ // CI=true,env=false => no daemon
73
+ // CI=true,env=true => daemon
74
+ // docker=true,env=undefined => no daemon
75
+ // docker=true,env=false => no daemon
76
+ // docker=true,env=true => daemon
77
+ // WASM => no daemon because file watching does not work
78
+ if ((((0, is_ci_1.isCI)() || isDocker()) && env !== 'true') ||
79
+ (0, tmp_dir_1.isDaemonDisabled)() ||
80
+ nxJsonIsNotPresent() ||
81
+ (useDaemonProcessOption === undefined && env === 'false') ||
82
+ (useDaemonProcessOption === true && env === 'false') ||
83
+ (useDaemonProcessOption === false && env === undefined) ||
84
+ (useDaemonProcessOption === false && env === 'false')) {
85
+ this._enabled = false;
86
+ }
87
+ else if (native_1.IS_WASM) {
88
+ output_1.output.warn({
89
+ title: 'The Nx Daemon is unsupported in WebAssembly environments. Some things may be slower than or not function as expected.',
90
+ });
91
+ this._enabled = false;
92
+ }
93
+ else {
94
+ this._enabled = true;
95
+ }
96
+ }
97
+ return this._enabled;
59
98
  }
60
99
  reset() {
61
100
  this.socketMessenger?.close();
@@ -462,6 +501,25 @@ class DaemonClient {
462
501
  }
463
502
  exports.DaemonClient = DaemonClient;
464
503
  exports.daemonClient = new DaemonClient();
504
+ function isDaemonEnabled() {
505
+ return exports.daemonClient.enabled();
506
+ }
507
+ function isDocker() {
508
+ try {
509
+ (0, node_fs_1.statSync)('/.dockerenv');
510
+ return true;
511
+ }
512
+ catch {
513
+ try {
514
+ return (0, node_fs_1.readFileSync)('/proc/self/cgroup', 'utf8')?.includes('docker');
515
+ }
516
+ catch { }
517
+ return false;
518
+ }
519
+ }
520
+ function nxJsonIsNotPresent() {
521
+ return !(0, nx_json_1.hasNxJson)(workspace_root_1.workspaceRoot);
522
+ }
465
523
  function daemonProcessException(message) {
466
524
  try {
467
525
  let log = (0, node_fs_1.readFileSync)(tmp_dir_1.DAEMON_OUTPUT_LOG_FILE).toString().split('\n');
@@ -136,4 +136,4 @@ export { cacheDir } from './utils/cache-directory';
136
136
  * @category Utils
137
137
  */
138
138
  export { createProjectFileMapUsingProjectGraph } from './project-graph/file-map-utils';
139
- export { isDaemonEnabled } from './daemon/client/enabled';
139
+ export { isDaemonEnabled } from './daemon/client/client';
@@ -136,5 +136,5 @@ Object.defineProperty(exports, "cacheDir", { enumerable: true, get: function ()
136
136
  */
137
137
  var file_map_utils_1 = require("./project-graph/file-map-utils");
138
138
  Object.defineProperty(exports, "createProjectFileMapUsingProjectGraph", { enumerable: true, get: function () { return file_map_utils_1.createProjectFileMapUsingProjectGraph; } });
139
- var enabled_1 = require("./daemon/client/enabled");
140
- Object.defineProperty(exports, "isDaemonEnabled", { enumerable: true, get: function () { return enabled_1.isDaemonEnabled; } });
139
+ var client_1 = require("./daemon/client/client");
140
+ Object.defineProperty(exports, "isDaemonEnabled", { enumerable: true, get: function () { return client_1.isDaemonEnabled; } });
Binary file
@@ -4,7 +4,7 @@ exports.LoadedNxPlugin = void 0;
4
4
  const error_types_1 = require("../error-types");
5
5
  const utils_1 = require("./utils");
6
6
  const enabled_1 = require("./isolation/enabled");
7
- const enabled_2 = require("../../daemon/client/enabled");
7
+ const client_1 = require("../../daemon/client/client");
8
8
  class LoadedNxPlugin {
9
9
  constructor(plugin, pluginDefinition) {
10
10
  this.name = plugin.name;
@@ -58,8 +58,7 @@ class LoadedNxPlugin {
58
58
  this.preTasksExecution = async (context) => {
59
59
  const updates = {};
60
60
  let originalEnv = process.env;
61
- if ((0, enabled_1.isIsolationEnabled)() ||
62
- (0, enabled_2.isDaemonEnabled)(context.nxJsonConfiguration)) {
61
+ if ((0, enabled_1.isIsolationEnabled)() || (0, client_1.isDaemonEnabled)()) {
63
62
  process.env = new Proxy(originalEnv, {
64
63
  set: (target, key, value) => {
65
64
  target[key] = value;
@@ -5,9 +5,8 @@ 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");
9
8
  async function runPreTasksExecution(pluginContext) {
10
- if ((0, is_on_daemon_1.isOnDaemon)() || !(0, enabled_1.isDaemonEnabled)(pluginContext.nxJsonConfiguration)) {
9
+ if ((0, is_on_daemon_1.isOnDaemon)() || !(0, client_1.isDaemonEnabled)()) {
11
10
  performance.mark(`preTasksExecution:start`);
12
11
  const plugins = await (0, get_plugins_1.getPlugins)(pluginContext.workspaceRoot);
13
12
  const envs = await Promise.all(plugins
@@ -22,7 +21,7 @@ async function runPreTasksExecution(pluginContext) {
22
21
  performance.measure(`${plugin.name}:preTasksExecution`, `${plugin.name}:preTasksExecution:start`, `${plugin.name}:preTasksExecution:end`);
23
22
  }
24
23
  }));
25
- if (!(0, enabled_1.isDaemonEnabled)(pluginContext.nxJsonConfiguration)) {
24
+ if (!(0, client_1.isDaemonEnabled)()) {
26
25
  applyProcessEnvs(envs);
27
26
  }
28
27
  performance.mark(`preTasksExecution:end`);
@@ -42,7 +41,7 @@ function applyProcessEnvs(envs) {
42
41
  }
43
42
  }
44
43
  async function runPostTasksExecution(context) {
45
- if ((0, is_on_daemon_1.isOnDaemon)() || !(0, enabled_1.isDaemonEnabled)(context.nxJsonConfiguration)) {
44
+ if ((0, is_on_daemon_1.isOnDaemon)() || !(0, client_1.isDaemonEnabled)()) {
46
45
  performance.mark(`postTasksExecution:start`);
47
46
  const plugins = await (0, get_plugins_1.getPlugins)();
48
47
  await Promise.all(plugins
@@ -1,2 +0,0 @@
1
- import { type NxJsonConfiguration } from '../../config/nx-json';
2
- export declare function isDaemonEnabled(nxJson?: NxJsonConfiguration): boolean;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDaemonEnabled = isDaemonEnabled;
4
- const nx_json_1 = require("../../config/nx-json");
5
- const node_fs_1 = require("node:fs");
6
- const is_ci_1 = require("../../utils/is-ci");
7
- const workspace_root_1 = require("../../utils/workspace-root");
8
- const tmp_dir_1 = require("../tmp-dir");
9
- let _enabled;
10
- function isDaemonEnabled(nxJson = (0, nx_json_1.readNxJson)()) {
11
- if (_enabled === undefined) {
12
- const useDaemonProcessOption = nxJson?.useDaemonProcess;
13
- const env = process.env.NX_DAEMON;
14
- // env takes precedence
15
- // option=true,env=false => no daemon
16
- // option=false,env=undefined => no daemon
17
- // option=false,env=false => no daemon
18
- // option=undefined,env=undefined => daemon
19
- // option=true,env=true => daemon
20
- // option=false,env=true => daemon
21
- // CI=true,env=undefined => no daemon
22
- // CI=true,env=false => no daemon
23
- // CI=true,env=true => daemon
24
- // docker=true,env=undefined => no daemon
25
- // docker=true,env=false => no daemon
26
- // docker=true,env=true => daemon
27
- // WASM => no daemon because file watching does not work
28
- if ((((0, is_ci_1.isCI)() || isDocker()) && env !== 'true') ||
29
- (0, tmp_dir_1.isDaemonDisabled)() ||
30
- nxJsonIsNotPresent() ||
31
- (useDaemonProcessOption === undefined && env === 'false') ||
32
- (useDaemonProcessOption === true && env === 'false') ||
33
- (useDaemonProcessOption === false && env === undefined) ||
34
- (useDaemonProcessOption === false && env === 'false')) {
35
- _enabled = false;
36
- }
37
- else if (require('../../native').IS_WASM) {
38
- require('../../utils/output').output.warn({
39
- title: 'The Nx Daemon is unsupported in WebAssembly environments. Some things may be slower than or not function as expected.',
40
- });
41
- _enabled = false;
42
- }
43
- else {
44
- _enabled = true;
45
- }
46
- }
47
- return _enabled;
48
- }
49
- function isDocker() {
50
- try {
51
- (0, node_fs_1.statSync)('/.dockerenv');
52
- return true;
53
- }
54
- catch {
55
- try {
56
- return (0, node_fs_1.readFileSync)('/proc/self/cgroup', 'utf8')?.includes('docker');
57
- }
58
- catch { }
59
- return false;
60
- }
61
- }
62
- function nxJsonIsNotPresent() {
63
- return !(0, nx_json_1.hasNxJson)(workspace_root_1.workspaceRoot);
64
- }