nx 21.1.0-beta.0 → 21.1.0-canary.20250507-30a7709
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/bin/nx.js +20 -1
- package/package.json +11 -11
- package/src/command-line/affected/command-object.js +1 -1
- package/src/command-line/init/init-v1.js +1 -1
- package/src/command-line/yargs-utils/shared-options.js +4 -13
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/executors/run-commands/running-tasks.js +1 -1
- package/src/executors/run-script/run-script.impl.js +1 -2
- package/src/native/index.d.ts +1 -5
- package/src/native/native-bindings.js +0 -2
- package/src/native/nx.wasi-browser.js +37 -41
- package/src/native/nx.wasi.cjs +37 -41
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +1 -1
- package/src/tasks-runner/forked-process-task-runner.d.ts +0 -1
- package/src/tasks-runner/forked-process-task-runner.js +12 -15
- package/src/tasks-runner/life-cycle.d.ts +2 -2
- package/src/tasks-runner/life-cycle.js +2 -2
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +9 -23
- package/src/tasks-runner/pseudo-terminal.d.ts +1 -1
- package/src/tasks-runner/pseudo-terminal.js +13 -5
- package/src/tasks-runner/run-command.js +4 -15
- package/src/tasks-runner/task-orchestrator.js +2 -9
- package/src/utils/exit-codes.d.ts +0 -4
- package/src/utils/exit-codes.js +0 -16
- package/src/utils/find-matching-projects.js +1 -1
package/src/core/graph/styles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{
|
1
|
+
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{2259:()=>{}},s=>{var e;e=2259,s(s.s=e)}]);
|
@@ -231,7 +231,7 @@ class RunningNodeProcess {
|
|
231
231
|
}
|
232
232
|
kill(signal) {
|
233
233
|
return new Promise((res, rej) => {
|
234
|
-
if (process.platform === 'win32') {
|
234
|
+
if (process.platform === 'win32' || process.platform === 'darwin') {
|
235
235
|
if (this.childProcess.kill(signal)) {
|
236
236
|
res();
|
237
237
|
}
|
@@ -38,12 +38,11 @@ function nodeProcess(command, cwd, env) {
|
|
38
38
|
windowsHide: false,
|
39
39
|
});
|
40
40
|
}
|
41
|
-
let cp;
|
42
41
|
async function ptyProcess(command, cwd, env) {
|
43
42
|
const terminal = (0, pseudo_terminal_1.createPseudoTerminal)();
|
44
43
|
await terminal.init();
|
45
44
|
return new Promise((res, rej) => {
|
46
|
-
cp = terminal.runCommand(command, { cwd, jsEnv: env });
|
45
|
+
const cp = terminal.runCommand(command, { cwd, jsEnv: env });
|
47
46
|
cp.onExit((code) => {
|
48
47
|
if (code === 0) {
|
49
48
|
res();
|
package/src/native/index.d.ts
CHANGED
@@ -18,7 +18,7 @@ export declare class AppLifeCycle {
|
|
18
18
|
__init(doneCallback: () => any): void
|
19
19
|
registerRunningTask(taskId: string, parserAndWriter: ExternalObject<[ParserArc, WriterArc]>): void
|
20
20
|
registerRunningTaskWithEmptyParser(taskId: string): void
|
21
|
-
appendTaskOutput(taskId: string, output: string
|
21
|
+
appendTaskOutput(taskId: string, output: string): void
|
22
22
|
setTaskStatus(taskId: string, status: TaskStatus): void
|
23
23
|
registerForcedShutdownCallback(forcedShutdownCallback: () => any): void
|
24
24
|
__setCloudMessage(message: string): Promise<void>
|
@@ -237,10 +237,6 @@ export interface InputsInput {
|
|
237
237
|
|
238
238
|
export const IS_WASM: boolean
|
239
239
|
|
240
|
-
export declare export declare function logError(message: string): void
|
241
|
-
|
242
|
-
export declare export declare function logInfo(message: string): void
|
243
|
-
|
244
240
|
/** Stripped version of the NxJson interface for use in rust */
|
245
241
|
export interface NxJson {
|
246
242
|
namedInputs?: Record<string, Array<JsInputs>>
|
@@ -388,8 +388,6 @@ module.exports.getTransformableOutputs = nativeBinding.getTransformableOutputs
|
|
388
388
|
module.exports.hashArray = nativeBinding.hashArray
|
389
389
|
module.exports.hashFile = nativeBinding.hashFile
|
390
390
|
module.exports.IS_WASM = nativeBinding.IS_WASM
|
391
|
-
module.exports.logError = nativeBinding.logError
|
392
|
-
module.exports.logInfo = nativeBinding.logInfo
|
393
391
|
module.exports.parseTaskStatus = nativeBinding.parseTaskStatus
|
394
392
|
module.exports.remove = nativeBinding.remove
|
395
393
|
module.exports.restoreTerminal = nativeBinding.restoreTerminal
|
@@ -59,45 +59,43 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
59
59
|
__napiInstance.exports['__napi_register__get_transformable_outputs_5']?.()
|
60
60
|
__napiInstance.exports['__napi_register__hash_array_6']?.()
|
61
61
|
__napiInstance.exports['__napi_register__hash_file_7']?.()
|
62
|
-
__napiInstance.exports['
|
63
|
-
__napiInstance.exports['
|
64
|
-
__napiInstance.exports['
|
65
|
-
__napiInstance.exports['
|
66
|
-
__napiInstance.exports['
|
67
|
-
__napiInstance.exports['
|
68
|
-
__napiInstance.exports['
|
69
|
-
__napiInstance.exports['
|
70
|
-
__napiInstance.exports['
|
71
|
-
__napiInstance.exports['
|
72
|
-
__napiInstance.exports['
|
73
|
-
__napiInstance.exports['
|
74
|
-
__napiInstance.exports['
|
75
|
-
__napiInstance.exports['
|
76
|
-
__napiInstance.exports['
|
77
|
-
__napiInstance.exports['
|
78
|
-
__napiInstance.exports['
|
79
|
-
__napiInstance.exports['
|
80
|
-
__napiInstance.exports['
|
81
|
-
__napiInstance.exports['
|
82
|
-
__napiInstance.exports['
|
83
|
-
__napiInstance.exports['
|
84
|
-
__napiInstance.exports['
|
85
|
-
__napiInstance.exports['
|
86
|
-
__napiInstance.exports['
|
87
|
-
__napiInstance.exports['
|
88
|
-
__napiInstance.exports['
|
89
|
-
__napiInstance.exports['
|
90
|
-
__napiInstance.exports['
|
91
|
-
__napiInstance.exports['
|
92
|
-
__napiInstance.exports['
|
93
|
-
__napiInstance.exports['
|
94
|
-
__napiInstance.exports['
|
95
|
-
__napiInstance.exports['
|
96
|
-
__napiInstance.exports['
|
97
|
-
__napiInstance.exports['
|
98
|
-
__napiInstance.exports['
|
99
|
-
__napiInstance.exports['__napi_register__FileMap_struct_61']?.()
|
100
|
-
__napiInstance.exports['__napi_register____test_only_transfer_file_map_62']?.()
|
62
|
+
__napiInstance.exports['__napi_register__IS_WASM_8']?.()
|
63
|
+
__napiInstance.exports['__napi_register__get_binary_target_9']?.()
|
64
|
+
__napiInstance.exports['__napi_register__ImportResult_struct_10']?.()
|
65
|
+
__napiInstance.exports['__napi_register__find_imports_11']?.()
|
66
|
+
__napiInstance.exports['__napi_register__transfer_project_graph_12']?.()
|
67
|
+
__napiInstance.exports['__napi_register__ExternalNode_struct_13']?.()
|
68
|
+
__napiInstance.exports['__napi_register__Target_struct_14']?.()
|
69
|
+
__napiInstance.exports['__napi_register__Project_struct_15']?.()
|
70
|
+
__napiInstance.exports['__napi_register__ProjectGraph_struct_16']?.()
|
71
|
+
__napiInstance.exports['__napi_register__HashPlanner_struct_17']?.()
|
72
|
+
__napiInstance.exports['__napi_register__HashPlanner_impl_21']?.()
|
73
|
+
__napiInstance.exports['__napi_register__HashDetails_struct_22']?.()
|
74
|
+
__napiInstance.exports['__napi_register__HasherOptions_struct_23']?.()
|
75
|
+
__napiInstance.exports['__napi_register__TaskHasher_struct_24']?.()
|
76
|
+
__napiInstance.exports['__napi_register__TaskHasher_impl_27']?.()
|
77
|
+
__napiInstance.exports['__napi_register__Task_struct_28']?.()
|
78
|
+
__napiInstance.exports['__napi_register__TaskTarget_struct_29']?.()
|
79
|
+
__napiInstance.exports['__napi_register__TaskResult_struct_30']?.()
|
80
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_31']?.()
|
81
|
+
__napiInstance.exports['__napi_register__FileData_struct_32']?.()
|
82
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_33']?.()
|
83
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_34']?.()
|
84
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_35']?.()
|
85
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_36']?.()
|
86
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_37']?.()
|
87
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_38']?.()
|
88
|
+
__napiInstance.exports['__napi_register__NxJson_struct_39']?.()
|
89
|
+
__napiInstance.exports['__napi_register__FileLock_struct_40']?.()
|
90
|
+
__napiInstance.exports['__napi_register__FileLock_impl_42']?.()
|
91
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_43']?.()
|
92
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_54']?.()
|
93
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_55']?.()
|
94
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_56']?.()
|
95
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_57']?.()
|
96
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_58']?.()
|
97
|
+
__napiInstance.exports['__napi_register__FileMap_struct_59']?.()
|
98
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_60']?.()
|
101
99
|
}
|
102
100
|
export const FileLock = __napiModule.exports.FileLock
|
103
101
|
export const HashPlanner = __napiModule.exports.HashPlanner
|
@@ -113,8 +111,6 @@ export const getTransformableOutputs = __napiModule.exports.getTransformableOutp
|
|
113
111
|
export const hashArray = __napiModule.exports.hashArray
|
114
112
|
export const hashFile = __napiModule.exports.hashFile
|
115
113
|
export const IS_WASM = __napiModule.exports.IS_WASM
|
116
|
-
export const logError = __napiModule.exports.logError
|
117
|
-
export const logInfo = __napiModule.exports.logInfo
|
118
114
|
export const remove = __napiModule.exports.remove
|
119
115
|
export const testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
|
120
116
|
export const transferProjectGraph = __napiModule.exports.transferProjectGraph
|
package/src/native/nx.wasi.cjs
CHANGED
@@ -90,45 +90,43 @@ function __napi_rs_initialize_modules(__napiInstance) {
|
|
90
90
|
__napiInstance.exports['__napi_register__get_transformable_outputs_5']?.()
|
91
91
|
__napiInstance.exports['__napi_register__hash_array_6']?.()
|
92
92
|
__napiInstance.exports['__napi_register__hash_file_7']?.()
|
93
|
-
__napiInstance.exports['
|
94
|
-
__napiInstance.exports['
|
95
|
-
__napiInstance.exports['
|
96
|
-
__napiInstance.exports['
|
97
|
-
__napiInstance.exports['
|
98
|
-
__napiInstance.exports['
|
99
|
-
__napiInstance.exports['
|
100
|
-
__napiInstance.exports['
|
101
|
-
__napiInstance.exports['
|
102
|
-
__napiInstance.exports['
|
103
|
-
__napiInstance.exports['
|
104
|
-
__napiInstance.exports['
|
105
|
-
__napiInstance.exports['
|
106
|
-
__napiInstance.exports['
|
107
|
-
__napiInstance.exports['
|
108
|
-
__napiInstance.exports['
|
109
|
-
__napiInstance.exports['
|
110
|
-
__napiInstance.exports['
|
111
|
-
__napiInstance.exports['
|
112
|
-
__napiInstance.exports['
|
113
|
-
__napiInstance.exports['
|
114
|
-
__napiInstance.exports['
|
115
|
-
__napiInstance.exports['
|
116
|
-
__napiInstance.exports['
|
117
|
-
__napiInstance.exports['
|
118
|
-
__napiInstance.exports['
|
119
|
-
__napiInstance.exports['
|
120
|
-
__napiInstance.exports['
|
121
|
-
__napiInstance.exports['
|
122
|
-
__napiInstance.exports['
|
123
|
-
__napiInstance.exports['
|
124
|
-
__napiInstance.exports['
|
125
|
-
__napiInstance.exports['
|
126
|
-
__napiInstance.exports['
|
127
|
-
__napiInstance.exports['
|
128
|
-
__napiInstance.exports['
|
129
|
-
__napiInstance.exports['
|
130
|
-
__napiInstance.exports['__napi_register__FileMap_struct_61']?.()
|
131
|
-
__napiInstance.exports['__napi_register____test_only_transfer_file_map_62']?.()
|
93
|
+
__napiInstance.exports['__napi_register__IS_WASM_8']?.()
|
94
|
+
__napiInstance.exports['__napi_register__get_binary_target_9']?.()
|
95
|
+
__napiInstance.exports['__napi_register__ImportResult_struct_10']?.()
|
96
|
+
__napiInstance.exports['__napi_register__find_imports_11']?.()
|
97
|
+
__napiInstance.exports['__napi_register__transfer_project_graph_12']?.()
|
98
|
+
__napiInstance.exports['__napi_register__ExternalNode_struct_13']?.()
|
99
|
+
__napiInstance.exports['__napi_register__Target_struct_14']?.()
|
100
|
+
__napiInstance.exports['__napi_register__Project_struct_15']?.()
|
101
|
+
__napiInstance.exports['__napi_register__ProjectGraph_struct_16']?.()
|
102
|
+
__napiInstance.exports['__napi_register__HashPlanner_struct_17']?.()
|
103
|
+
__napiInstance.exports['__napi_register__HashPlanner_impl_21']?.()
|
104
|
+
__napiInstance.exports['__napi_register__HashDetails_struct_22']?.()
|
105
|
+
__napiInstance.exports['__napi_register__HasherOptions_struct_23']?.()
|
106
|
+
__napiInstance.exports['__napi_register__TaskHasher_struct_24']?.()
|
107
|
+
__napiInstance.exports['__napi_register__TaskHasher_impl_27']?.()
|
108
|
+
__napiInstance.exports['__napi_register__Task_struct_28']?.()
|
109
|
+
__napiInstance.exports['__napi_register__TaskTarget_struct_29']?.()
|
110
|
+
__napiInstance.exports['__napi_register__TaskResult_struct_30']?.()
|
111
|
+
__napiInstance.exports['__napi_register__TaskGraph_struct_31']?.()
|
112
|
+
__napiInstance.exports['__napi_register__FileData_struct_32']?.()
|
113
|
+
__napiInstance.exports['__napi_register__InputsInput_struct_33']?.()
|
114
|
+
__napiInstance.exports['__napi_register__FileSetInput_struct_34']?.()
|
115
|
+
__napiInstance.exports['__napi_register__RuntimeInput_struct_35']?.()
|
116
|
+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_36']?.()
|
117
|
+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_37']?.()
|
118
|
+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_38']?.()
|
119
|
+
__napiInstance.exports['__napi_register__NxJson_struct_39']?.()
|
120
|
+
__napiInstance.exports['__napi_register__FileLock_struct_40']?.()
|
121
|
+
__napiInstance.exports['__napi_register__FileLock_impl_42']?.()
|
122
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_43']?.()
|
123
|
+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_54']?.()
|
124
|
+
__napiInstance.exports['__napi_register__WorkspaceErrors_55']?.()
|
125
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_56']?.()
|
126
|
+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_57']?.()
|
127
|
+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_58']?.()
|
128
|
+
__napiInstance.exports['__napi_register__FileMap_struct_59']?.()
|
129
|
+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_60']?.()
|
132
130
|
}
|
133
131
|
module.exports.FileLock = __napiModule.exports.FileLock
|
134
132
|
module.exports.HashPlanner = __napiModule.exports.HashPlanner
|
@@ -144,8 +142,6 @@ module.exports.getTransformableOutputs = __napiModule.exports.getTransformableOu
|
|
144
142
|
module.exports.hashArray = __napiModule.exports.hashArray
|
145
143
|
module.exports.hashFile = __napiModule.exports.hashFile
|
146
144
|
module.exports.IS_WASM = __napiModule.exports.IS_WASM
|
147
|
-
module.exports.logError = __napiModule.exports.logError
|
148
|
-
module.exports.logInfo = __napiModule.exports.logInfo
|
149
145
|
module.exports.remove = __napiModule.exports.remove
|
150
146
|
module.exports.testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
|
151
147
|
module.exports.transferProjectGraph = __napiModule.exports.transferProjectGraph
|
Binary file
|
@@ -273,7 +273,7 @@ class TargetProjectLocator {
|
|
273
273
|
return;
|
274
274
|
}
|
275
275
|
resolveImportWithRequire(normalizedImportExpr, filePath) {
|
276
|
-
return
|
276
|
+
return node_path_1.posix.relative(workspace_root_1.workspaceRoot, require.resolve(normalizedImportExpr, {
|
277
277
|
paths: [(0, node_path_1.dirname)(filePath)],
|
278
278
|
}));
|
279
279
|
}
|
@@ -136,7 +136,7 @@ class ForkedProcessTaskRunner {
|
|
136
136
|
terminalOutput += msg;
|
137
137
|
});
|
138
138
|
p.onExit((code) => {
|
139
|
-
if (
|
139
|
+
if (code > 128) {
|
140
140
|
process.exit(code);
|
141
141
|
}
|
142
142
|
this.pseudoTerminals.delete(pseudoTerminal);
|
@@ -233,12 +233,6 @@ class ForkedProcessTaskRunner {
|
|
233
233
|
writeTerminalOutput(outputPath, content) {
|
234
234
|
(0, fs_1.writeFileSync)(outputPath, content);
|
235
235
|
}
|
236
|
-
cleanup(signal) {
|
237
|
-
this.processes.forEach((p) => {
|
238
|
-
p.kill(signal);
|
239
|
-
});
|
240
|
-
this.cleanUpBatchProcesses();
|
241
|
-
}
|
242
236
|
setupProcessEventListeners() {
|
243
237
|
const messageHandler = (message) => {
|
244
238
|
this.pseudoTerminals.forEach((p) => {
|
@@ -252,26 +246,29 @@ class ForkedProcessTaskRunner {
|
|
252
246
|
};
|
253
247
|
// When the nx process gets a message, it will be sent into the task's process
|
254
248
|
process.on('message', messageHandler);
|
249
|
+
const cleanUp = (signal) => {
|
250
|
+
this.processes.forEach((p) => {
|
251
|
+
p.kill(signal);
|
252
|
+
});
|
253
|
+
process.off('message', messageHandler);
|
254
|
+
this.cleanUpBatchProcesses();
|
255
|
+
};
|
255
256
|
// Terminate any task processes on exit
|
256
257
|
process.once('exit', () => {
|
257
|
-
|
258
|
-
process.off('message', messageHandler);
|
258
|
+
cleanUp();
|
259
259
|
});
|
260
260
|
process.once('SIGINT', () => {
|
261
|
-
|
262
|
-
process.off('message', messageHandler);
|
261
|
+
cleanUp('SIGTERM');
|
263
262
|
// we exit here because we don't need to write anything to cache.
|
264
263
|
process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
|
265
264
|
});
|
266
265
|
process.once('SIGTERM', () => {
|
267
|
-
|
268
|
-
process.off('message', messageHandler);
|
266
|
+
cleanUp('SIGTERM');
|
269
267
|
// no exit here because we expect child processes to terminate which
|
270
268
|
// will store results to the cache and will terminate this process
|
271
269
|
});
|
272
270
|
process.once('SIGHUP', () => {
|
273
|
-
|
274
|
-
process.off('message', messageHandler);
|
271
|
+
cleanUp('SIGTERM');
|
275
272
|
// no exit here because we expect child processes to terminate which
|
276
273
|
// will store results to the cache and will terminate this process
|
277
274
|
});
|
@@ -38,7 +38,7 @@ export interface LifeCycle {
|
|
38
38
|
printTaskTerminalOutput?(task: Task, status: TaskStatus, output: string): void;
|
39
39
|
registerRunningTask?(taskId: string, parserAndWriter: ExternalObject<[any, any]>): void;
|
40
40
|
registerRunningTaskWithEmptyParser?(taskId: string): void;
|
41
|
-
appendTaskOutput?(taskId: string, output: string
|
41
|
+
appendTaskOutput?(taskId: string, output: string): void;
|
42
42
|
setTaskStatus?(taskId: string, status: NativeTaskStatus): void;
|
43
43
|
registerForcedShutdownCallback?(callback: () => void): void;
|
44
44
|
}
|
@@ -55,7 +55,7 @@ export declare class CompositeLifeCycle implements LifeCycle {
|
|
55
55
|
printTaskTerminalOutput(task: Task, status: TaskStatus, output: string): void;
|
56
56
|
registerRunningTask(taskId: string, parserAndWriter: ExternalObject<[any, any]>): void;
|
57
57
|
registerRunningTaskWithEmptyParser(taskId: string): void;
|
58
|
-
appendTaskOutput(taskId: string, output: string
|
58
|
+
appendTaskOutput(taskId: string, output: string): void;
|
59
59
|
setTaskStatus(taskId: string, status: NativeTaskStatus): void;
|
60
60
|
registerForcedShutdownCallback(callback: () => void): void;
|
61
61
|
}
|
@@ -81,10 +81,10 @@ class CompositeLifeCycle {
|
|
81
81
|
}
|
82
82
|
}
|
83
83
|
}
|
84
|
-
appendTaskOutput(taskId, output
|
84
|
+
appendTaskOutput(taskId, output) {
|
85
85
|
for (let l of this.lifeCycles) {
|
86
86
|
if (l.appendTaskOutput) {
|
87
|
-
l.appendTaskOutput(taskId, output
|
87
|
+
l.appendTaskOutput(taskId, output);
|
88
88
|
}
|
89
89
|
}
|
90
90
|
}
|
@@ -26,21 +26,15 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
26
26
|
const inProgressTasks = new Set();
|
27
27
|
const stoppedTasks = new Set();
|
28
28
|
const tasksToTerminalOutputs = {};
|
29
|
-
const
|
30
|
-
const taskIdsInTheOrderTheyStart = [];
|
29
|
+
const taskIdsInOrderOfCompletion = [];
|
31
30
|
lifeCycle.startTasks = (tasks) => {
|
32
31
|
for (let t of tasks) {
|
33
|
-
tasksToTerminalOutputs[t.id] ??= '';
|
34
|
-
taskIdsInTheOrderTheyStart.push(t.id);
|
35
32
|
inProgressTasks.add(t.id);
|
36
33
|
}
|
37
34
|
};
|
38
|
-
lifeCycle.
|
39
|
-
|
40
|
-
|
41
|
-
// TODO(@AgentEnder): The following 2 methods should be one but will need more refactoring
|
42
|
-
lifeCycle.printTaskTerminalOutput = (task, taskStatus) => {
|
43
|
-
tasksToTaskStatus[task.id] = taskStatus;
|
35
|
+
lifeCycle.printTaskTerminalOutput = (task, taskStatus, terminalOutput) => {
|
36
|
+
taskIdsInOrderOfCompletion.push(task.id);
|
37
|
+
tasksToTerminalOutputs[task.id] = { terminalOutput, taskStatus };
|
44
38
|
};
|
45
39
|
lifeCycle.setTaskStatus = (taskId, taskStatus) => {
|
46
40
|
if (taskStatus === 9 /* NativeTaskStatus.Stopped */) {
|
@@ -109,9 +103,8 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
109
103
|
let lines = [];
|
110
104
|
// Prints task outputs in the order they were completed
|
111
105
|
// above the summary, since run-one should print all task results.
|
112
|
-
for (const taskId of
|
113
|
-
const taskStatus =
|
114
|
-
const terminalOutput = tasksToTerminalOutputs[taskId];
|
106
|
+
for (const taskId of taskIdsInOrderOfCompletion) {
|
107
|
+
const { terminalOutput, taskStatus } = tasksToTerminalOutputs[taskId];
|
115
108
|
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
116
109
|
}
|
117
110
|
lines.push(...output_1.output.getVerticalSeparatorLines(failure ? 'red' : 'green'));
|
@@ -164,16 +157,9 @@ function getTuiTerminalSummaryLifeCycle({ projectNames, tasks, taskGraph, args,
|
|
164
157
|
const printRunManySummary = ({ failure, cancelled, }) => {
|
165
158
|
console.log('');
|
166
159
|
const lines = [''];
|
167
|
-
for (const taskId of
|
168
|
-
const taskStatus =
|
169
|
-
|
170
|
-
// Task Status is null?
|
171
|
-
if (!taskStatus) {
|
172
|
-
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
173
|
-
output_1.output.addNewline();
|
174
|
-
lines.push(`${LEFT_PAD}${output_1.output.colors.cyan(figures.squareSmallFilled)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
175
|
-
}
|
176
|
-
else if (taskStatus === 'failure') {
|
160
|
+
for (const taskId of taskIdsInOrderOfCompletion) {
|
161
|
+
const { terminalOutput, taskStatus } = tasksToTerminalOutputs[taskId];
|
162
|
+
if (taskStatus === 'failure') {
|
177
163
|
output_1.output.logCommandOutput(taskId, taskStatus, terminalOutput);
|
178
164
|
output_1.output.addNewline();
|
179
165
|
lines.push(`${LEFT_PAD}${output_1.output.colors.red(figures.cross)}${SPACER}${output_1.output.colors.gray('nx run ')}${taskId}`);
|
@@ -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(
|
15
|
+
shutdown(s?: NodeJS.Signals): void;
|
16
16
|
runCommand(command: string, { cwd, execArgv, jsEnv, quiet, tty, }?: {
|
17
17
|
cwd?: string;
|
18
18
|
execArgv?: string[];
|
@@ -6,11 +6,19 @@ 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");
|
10
9
|
// Register single event listeners for all pseudo-terminal instances
|
11
10
|
const pseudoTerminalShutdownCallbacks = [];
|
12
|
-
process.on('
|
13
|
-
pseudoTerminalShutdownCallbacks.forEach((cb) => cb(
|
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());
|
14
22
|
});
|
15
23
|
function createPseudoTerminal(skipSupportCheck = false) {
|
16
24
|
if (!skipSupportCheck && !PseudoTerminal.isSupported()) {
|
@@ -39,10 +47,10 @@ class PseudoTerminal {
|
|
39
47
|
await this.pseudoIPC.init();
|
40
48
|
this.initialized = true;
|
41
49
|
}
|
42
|
-
shutdown(
|
50
|
+
shutdown(s) {
|
43
51
|
for (const cp of this.childProcesses) {
|
44
52
|
try {
|
45
|
-
cp.kill(
|
53
|
+
cp.kill(s);
|
46
54
|
}
|
47
55
|
catch { }
|
48
56
|
}
|
@@ -15,7 +15,6 @@ const nx_json_1 = require("../config/nx-json");
|
|
15
15
|
const client_1 = require("../daemon/client/client");
|
16
16
|
const create_task_hasher_1 = require("../hasher/create-task-hasher");
|
17
17
|
const hash_task_1 = require("../hasher/hash-task");
|
18
|
-
const native_1 = require("../native");
|
19
18
|
const tasks_execution_hooks_1 = require("../project-graph/plugins/tasks-execution-hooks");
|
20
19
|
const project_graph_1 = require("../project-graph/project-graph");
|
21
20
|
const handle_errors_1 = require("../utils/handle-errors");
|
@@ -40,8 +39,8 @@ const task_timings_life_cycle_1 = require("./life-cycles/task-timings-life-cycle
|
|
40
39
|
const tui_summary_life_cycle_1 = require("./life-cycles/tui-summary-life-cycle");
|
41
40
|
const task_graph_utils_1 = require("./task-graph-utils");
|
42
41
|
const utils_1 = require("./utils");
|
43
|
-
const exit_codes_1 = require("../utils/exit-codes");
|
44
42
|
const chalk = require("chalk");
|
43
|
+
const exit_codes_1 = require("../utils/exit-codes");
|
45
44
|
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
46
45
|
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
47
46
|
const originalConsoleLog = console.log.bind(console);
|
@@ -133,19 +132,9 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
|
|
133
132
|
/**
|
134
133
|
* Patch stdout.write and stderr.write methods to pass Nx Cloud client logs to the TUI via the lifecycle
|
135
134
|
*/
|
136
|
-
const createPatchedLogWrite = (originalWrite
|
135
|
+
const createPatchedLogWrite = (originalWrite) => {
|
137
136
|
// @ts-ignore
|
138
137
|
return (chunk, encoding, callback) => {
|
139
|
-
if (isError) {
|
140
|
-
(0, native_1.logError)(Buffer.isBuffer(chunk)
|
141
|
-
? chunk.toString(encoding)
|
142
|
-
: chunk.toString());
|
143
|
-
}
|
144
|
-
else {
|
145
|
-
(0, native_1.logInfo)(Buffer.isBuffer(chunk)
|
146
|
-
? chunk.toString(encoding)
|
147
|
-
: chunk.toString());
|
148
|
-
}
|
149
138
|
// Check if the log came from the Nx Cloud client, otherwise invoke the original write method
|
150
139
|
const stackTrace = new Error().stack;
|
151
140
|
const isNxCloudLog = stackTrace.includes((0, node_path_1.join)(workspace_root_1.workspaceRoot, '.nx', 'cache', 'cloud'));
|
@@ -176,8 +165,8 @@ async function getTerminalOutputLifeCycle(initiatingProject, initiatingTasks, pr
|
|
176
165
|
// No-op the Nx Cloud client logs
|
177
166
|
};
|
178
167
|
};
|
179
|
-
process.stdout.write = createPatchedLogWrite(originalStdoutWrite
|
180
|
-
process.stderr.write = createPatchedLogWrite(originalStderrWrite
|
168
|
+
process.stdout.write = createPatchedLogWrite(originalStdoutWrite);
|
169
|
+
process.stderr.write = createPatchedLogWrite(originalStderrWrite);
|
181
170
|
// The cloud client calls console.log when NX_VERBOSE_LOGGING is set to true
|
182
171
|
console.log = createPatchedConsoleMethod(originalConsoleLog);
|
183
172
|
console.error = createPatchedConsoleMethod(originalConsoleError);
|
@@ -333,14 +333,11 @@ class TaskOrchestrator {
|
|
333
333
|
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
334
334
|
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
335
335
|
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
336
|
-
runningTask.onOutput((output) => {
|
337
|
-
this.options.lifeCycle.appendTaskOutput(task.id, output, true);
|
338
|
-
});
|
339
336
|
}
|
340
337
|
else {
|
341
338
|
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
342
339
|
runningTask.onOutput((output) => {
|
343
|
-
this.options.lifeCycle.appendTaskOutput(task.id, output
|
340
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output);
|
344
341
|
});
|
345
342
|
}
|
346
343
|
}
|
@@ -394,14 +391,11 @@ class TaskOrchestrator {
|
|
394
391
|
if (runningTask instanceof pseudo_terminal_1.PseudoTtyProcess) {
|
395
392
|
// This is an external of a the pseudo terminal where a task is running and can be passed to the TUI
|
396
393
|
this.options.lifeCycle.registerRunningTask(task.id, runningTask.getParserAndWriter());
|
397
|
-
runningTask.onOutput((output) => {
|
398
|
-
this.options.lifeCycle.appendTaskOutput(task.id, output, true);
|
399
|
-
});
|
400
394
|
}
|
401
395
|
else if ('onOutput' in runningTask) {
|
402
396
|
this.options.lifeCycle.registerRunningTaskWithEmptyParser(task.id);
|
403
397
|
runningTask.onOutput((output) => {
|
404
|
-
this.options.lifeCycle.appendTaskOutput(task.id, output
|
398
|
+
this.options.lifeCycle.appendTaskOutput(task.id, output);
|
405
399
|
});
|
406
400
|
}
|
407
401
|
}
|
@@ -651,7 +645,6 @@ class TaskOrchestrator {
|
|
651
645
|
}
|
652
646
|
// endregion utils
|
653
647
|
async cleanup() {
|
654
|
-
this.forkedProcessTaskRunner.cleanup();
|
655
648
|
await Promise.all([
|
656
649
|
...Array.from(this.runningContinuousTasks).map(async ([taskId, t]) => {
|
657
650
|
try {
|
package/src/utils/exit-codes.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.signalToCode = signalToCode;
|
4
|
-
exports.codeToSignal = codeToSignal;
|
5
4
|
/**
|
6
5
|
* Translates NodeJS signals to numeric exit code
|
7
6
|
* @param signal
|
@@ -18,18 +17,3 @@ function signalToCode(signal) {
|
|
18
17
|
return 128;
|
19
18
|
}
|
20
19
|
}
|
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
|
-
}
|
@@ -113,7 +113,7 @@ function addMatchingProjectsByName(projectNames, projects, pattern, matchedProje
|
|
113
113
|
}
|
114
114
|
if (!(0, globs_1.isGlobPattern)(pattern.value)) {
|
115
115
|
// Custom regex that is basically \b but includes hyphens (-) and excludes underscores (_), so "foo" pattern matches "foo_bar" but not "foo-e2e".
|
116
|
-
const regex = new RegExp(`(?<![
|
116
|
+
const regex = new RegExp(`(?<![a-zA-Z0-9-])${pattern.value}(?![a-zA-Z0-9-])`, 'i');
|
117
117
|
const matchingProjects = Object.keys(projects).filter((name) => regex.test(name));
|
118
118
|
for (const projectName of matchingProjects) {
|
119
119
|
if (pattern.exclude) {
|