nx 21.0.2 → 21.0.3

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.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{2259:()=>{}},s=>{var e;e=2259,s(s.s=e)}]);
1
+ "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{4941:()=>{}},s=>{var e;e=4941,s(s.s=e)}]);
@@ -5,7 +5,6 @@ const child_process_1 = require("child_process");
5
5
  const path = require("path");
6
6
  const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
7
7
  const package_manager_1 = require("../../utils/package-manager");
8
- const exit_codes_1 = require("../../utils/exit-codes");
9
8
  async function default_1(options, context) {
10
9
  const pm = (0, package_manager_1.getPackageManagerCommand)();
11
10
  try {
@@ -58,16 +57,3 @@ async function ptyProcess(command, cwd, env) {
58
57
  });
59
58
  });
60
59
  }
61
- // TODO: This only works because pseudo terminal registers signal handlers first but we need a service to handle this
62
- process.on('SIGHUP', () => {
63
- cp.kill('SIGHUP');
64
- process.exit((0, exit_codes_1.signalToCode)('SIGHUP'));
65
- });
66
- process.on('SIGTERM', () => {
67
- cp.kill('SIGTERM');
68
- process.exit((0, exit_codes_1.signalToCode)('SIGTERM'));
69
- });
70
- process.on('SIGINT', () => {
71
- cp.kill('SIGINT');
72
- process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
73
- });
Binary file
@@ -273,7 +273,7 @@ class TargetProjectLocator {
273
273
  return;
274
274
  }
275
275
  resolveImportWithRequire(normalizedImportExpr, filePath) {
276
- return node_path_1.posix.relative(workspace_root_1.workspaceRoot, require.resolve(normalizedImportExpr, {
276
+ return (0, node_path_1.relative)(workspace_root_1.workspaceRoot, require.resolve(normalizedImportExpr, {
277
277
  paths: [(0, node_path_1.dirname)(filePath)],
278
278
  }));
279
279
  }
@@ -12,7 +12,7 @@ export declare class PseudoTerminal {
12
12
  static isSupported(): boolean;
13
13
  constructor(rustPseudoTerminal: RustPseudoTerminal);
14
14
  init(): Promise<void>;
15
- shutdown(s?: NodeJS.Signals): void;
15
+ shutdown(code: number): void;
16
16
  runCommand(command: string, { cwd, execArgv, jsEnv, quiet, tty, }?: {
17
17
  cwd?: string;
18
18
  execArgv?: string[];
@@ -6,19 +6,11 @@ const os = require("os");
6
6
  const socket_utils_1 = require("../daemon/socket-utils");
7
7
  const native_1 = require("../native");
8
8
  const pseudo_ipc_1 = require("./pseudo-ipc");
9
+ const exit_codes_1 = require("../utils/exit-codes");
9
10
  // Register single event listeners for all pseudo-terminal instances
10
11
  const pseudoTerminalShutdownCallbacks = [];
11
- process.on('SIGINT', () => {
12
- pseudoTerminalShutdownCallbacks.forEach((cb) => cb('SIGINT'));
13
- });
14
- process.on('SIGTERM', () => {
15
- pseudoTerminalShutdownCallbacks.forEach((cb) => cb('SIGTERM'));
16
- });
17
- process.on('SIGHUP', () => {
18
- pseudoTerminalShutdownCallbacks.forEach((cb) => cb('SIGHUP'));
19
- });
20
- process.on('exit', () => {
21
- pseudoTerminalShutdownCallbacks.forEach((cb) => cb());
12
+ process.on('exit', (code) => {
13
+ pseudoTerminalShutdownCallbacks.forEach((cb) => cb(code));
22
14
  });
23
15
  function createPseudoTerminal(skipSupportCheck = false) {
24
16
  if (!skipSupportCheck && !PseudoTerminal.isSupported()) {
@@ -47,10 +39,10 @@ class PseudoTerminal {
47
39
  await this.pseudoIPC.init();
48
40
  this.initialized = true;
49
41
  }
50
- shutdown(s) {
42
+ shutdown(code) {
51
43
  for (const cp of this.childProcesses) {
52
44
  try {
53
- cp.kill(s);
45
+ cp.kill((0, exit_codes_1.codeToSignal)(code));
54
46
  }
55
47
  catch { }
56
48
  }
@@ -3,3 +3,7 @@
3
3
  * @param signal
4
4
  */
5
5
  export declare function signalToCode(signal: NodeJS.Signals): number;
6
+ /**
7
+ * Translates numeric exit codes to NodeJS signals
8
+ */
9
+ export declare function codeToSignal(code: number): NodeJS.Signals;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signalToCode = signalToCode;
4
+ exports.codeToSignal = codeToSignal;
4
5
  /**
5
6
  * Translates NodeJS signals to numeric exit code
6
7
  * @param signal
@@ -17,3 +18,18 @@ function signalToCode(signal) {
17
18
  return 128;
18
19
  }
19
20
  }
21
+ /**
22
+ * Translates numeric exit codes to NodeJS signals
23
+ */
24
+ function codeToSignal(code) {
25
+ switch (code) {
26
+ case 128 + 1:
27
+ return 'SIGHUP';
28
+ case 128 + 2:
29
+ return 'SIGINT';
30
+ case 128 + 15:
31
+ return 'SIGTERM';
32
+ default:
33
+ return 'SIGTERM';
34
+ }
35
+ }