nx 18.1.0-canary.20240312-9520aa2 → 18.1.0-canary.20240313-81df848
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 +12 -12
- package/src/core/graph/3rdpartylicenses.txt +51 -0
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/polyfills.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.js +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +3 -0
- package/src/executors/run-commands/run-commands.impl.js +77 -38
- package/src/hasher/hash-task.js +2 -2
- package/src/tasks-runner/task-orchestrator.js +45 -8
- package/src/tasks-runner/tasks-schedule.js +3 -3
- package/src/tasks-runner/utils.d.ts +7 -6
- package/src/tasks-runner/utils.js +11 -7
- package/src/utils/output.js +1 -1
@@ -1 +1 @@
|
|
1
|
-
(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={id:e,loaded:!1,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(f=0;f<e.length;f++){for(var[t,n,i]=e[f],a=!0,u=0;u<t.length;u++)(!1&i||l>=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i<l&&(l=i));if(a){e.splice(f--,1);var d=n();void 0!==d&&(r=d)}}return r}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={
|
1
|
+
(()=>{"use strict";var e,r={},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={id:e,loaded:!1,exports:{}};return r[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var l=1/0;for(f=0;f<e.length;f++){for(var[t,n,i]=e[f],a=!0,u=0;u<t.length;u++)(!1&i||l>=i)&&Object.keys(o.O).every((e=>o.O[e](t[u])))?t.splice(u--,1):(a=!1,i<l&&(l=i));if(a){e.splice(f--,1);var d=n();void 0!==d&&(r=d)}}return r}i=i||0;for(var f=e.length;f>0&&e[f-1][2]>i;f--)e[f]=e[f-1];e[f]=[t,n,i]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e={2:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[l,a,u]=t,d=0;if(l.some((r=>0!==e[r]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(u)var f=u(o)}for(r&&r(t);d<l.length;d++)i=l[d],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(f)},t=self.webpackChunk=self.webpackChunk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();
|
package/src/core/graph/styles.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[
|
1
|
+
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3],{22232:(s,e,k)=>{k.r(e)}},s=>{var e;e=22232,s(s.s=e)}]);
|
@@ -25,6 +25,8 @@ export interface RunCommandsOptions extends Json {
|
|
25
25
|
args?: string | string[];
|
26
26
|
envFile?: string;
|
27
27
|
__unparsed__: string[];
|
28
|
+
usePty?: boolean;
|
29
|
+
streamOutput?: boolean;
|
28
30
|
}
|
29
31
|
export interface NormalizedRunCommandsOptions extends RunCommandsOptions {
|
30
32
|
commands: {
|
@@ -41,5 +43,6 @@ export interface NormalizedRunCommandsOptions extends RunCommandsOptions {
|
|
41
43
|
}
|
42
44
|
export default function (options: RunCommandsOptions, context: ExecutorContext): Promise<{
|
43
45
|
success: boolean;
|
46
|
+
terminalOutput: string;
|
44
47
|
}>;
|
45
48
|
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions'>, forwardAllArgs: boolean): string;
|
@@ -34,7 +34,8 @@ const propKeys = [
|
|
34
34
|
'envFile',
|
35
35
|
'__unparsed__',
|
36
36
|
'env',
|
37
|
-
'
|
37
|
+
'usePty',
|
38
|
+
'streamOutput',
|
38
39
|
'verbose',
|
39
40
|
];
|
40
41
|
async function default_1(options, context) {
|
@@ -48,10 +49,10 @@ async function default_1(options, context) {
|
|
48
49
|
throw new Error('ERROR: Bad executor config for run-commands - "prefix", "color" and "bgColor" can only be set when "parallel=true".');
|
49
50
|
}
|
50
51
|
try {
|
51
|
-
const
|
52
|
+
const result = options.parallel
|
52
53
|
? await runInParallel(normalized, context)
|
53
54
|
: await runSerially(normalized, context);
|
54
|
-
return
|
55
|
+
return result;
|
55
56
|
}
|
56
57
|
catch (e) {
|
57
58
|
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
@@ -62,31 +63,48 @@ async function default_1(options, context) {
|
|
62
63
|
}
|
63
64
|
exports.default = default_1;
|
64
65
|
async function runInParallel(options, context) {
|
65
|
-
const procs = options.commands.map((c) => createProcess(c, options.readyWhen, options.color, calculateCwd(options.cwd, context), options.env ?? {}, true).then((result) => ({
|
66
|
+
const procs = options.commands.map((c) => createProcess(c, options.readyWhen, options.color, calculateCwd(options.cwd, context), options.env ?? {}, true, options.usePty, options.streamOutput).then((result) => ({
|
66
67
|
result,
|
67
68
|
command: c.command,
|
68
69
|
})));
|
70
|
+
let terminalOutput = '';
|
69
71
|
if (options.readyWhen) {
|
70
72
|
const r = await Promise.race(procs);
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
terminalOutput += r.result.terminalOutput;
|
74
|
+
if (!r.result.success) {
|
75
|
+
const output = `Warning: command "${r.command}" exited with non-zero status code`;
|
76
|
+
terminalOutput += output;
|
77
|
+
if (options.streamOutput) {
|
78
|
+
process.stderr.write(output);
|
79
|
+
}
|
80
|
+
return { success: false, terminalOutput };
|
74
81
|
}
|
75
82
|
else {
|
76
|
-
return true;
|
83
|
+
return { success: true, terminalOutput };
|
77
84
|
}
|
78
85
|
}
|
79
86
|
else {
|
80
87
|
const r = await Promise.all(procs);
|
81
|
-
|
88
|
+
terminalOutput += r.map((f) => f.result.terminalOutput).join('');
|
89
|
+
const failed = r.filter((v) => !v.result.success);
|
82
90
|
if (failed.length > 0) {
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
91
|
+
const output = failed
|
92
|
+
.map((f) => `Warning: command "${f.command}" exited with non-zero status code`)
|
93
|
+
.join('\r\n');
|
94
|
+
terminalOutput += output;
|
95
|
+
if (options.streamOutput) {
|
96
|
+
process.stderr.write(output);
|
97
|
+
}
|
98
|
+
return {
|
99
|
+
success: false,
|
100
|
+
terminalOutput,
|
101
|
+
};
|
87
102
|
}
|
88
103
|
else {
|
89
|
-
return
|
104
|
+
return {
|
105
|
+
success: true,
|
106
|
+
terminalOutput,
|
107
|
+
};
|
90
108
|
}
|
91
109
|
}
|
92
110
|
}
|
@@ -118,46 +136,53 @@ function normalizeOptions(options) {
|
|
118
136
|
return options;
|
119
137
|
}
|
120
138
|
async function runSerially(options, context) {
|
139
|
+
let terminalOutput = '';
|
121
140
|
for (const c of options.commands) {
|
122
|
-
const
|
123
|
-
|
124
|
-
|
125
|
-
|
141
|
+
const result = await createProcess(c, undefined, options.color, calculateCwd(options.cwd, context), options.env ?? {}, false, options.usePty, options.streamOutput);
|
142
|
+
terminalOutput += result.terminalOutput;
|
143
|
+
if (!result.success) {
|
144
|
+
const output = `Warning: command "${c.command}" exited with non-zero status code`;
|
145
|
+
result.terminalOutput += output;
|
146
|
+
if (options.streamOutput) {
|
147
|
+
process.stderr.write(output);
|
148
|
+
}
|
149
|
+
return { success: false, terminalOutput };
|
126
150
|
}
|
127
151
|
}
|
128
|
-
return true;
|
152
|
+
return { success: true, terminalOutput };
|
129
153
|
}
|
130
|
-
async function createProcess(commandConfig, readyWhen, color, cwd, env, isParallel) {
|
154
|
+
async function createProcess(commandConfig, readyWhen, color, cwd, env, isParallel, usePty = true, streamOutput = true) {
|
131
155
|
env = processEnv(color, cwd, env);
|
132
156
|
// The rust runCommand is always a tty, so it will not look nice in parallel and if we need prefixes
|
133
157
|
// currently does not work properly in windows
|
134
158
|
if (process.env.NX_NATIVE_COMMAND_RUNNER !== 'false' &&
|
135
159
|
process.stdout.isTTY &&
|
136
160
|
!commandConfig.prefix &&
|
137
|
-
!isParallel
|
138
|
-
|
161
|
+
!isParallel &&
|
162
|
+
usePty) {
|
163
|
+
const cp = new child_process_2.PseudoTtyProcess((0, native_1.runCommand)(commandConfig.command, cwd, env, !streamOutput));
|
164
|
+
let terminalOutput = '';
|
139
165
|
return new Promise((res) => {
|
140
166
|
cp.onOutput((output) => {
|
167
|
+
terminalOutput += output;
|
141
168
|
if (readyWhen && output.indexOf(readyWhen) > -1) {
|
142
|
-
res(true);
|
169
|
+
res({ success: true, terminalOutput });
|
143
170
|
}
|
144
171
|
});
|
145
172
|
cp.onExit((code) => {
|
146
|
-
if (code
|
147
|
-
res(true);
|
148
|
-
}
|
149
|
-
else if (code >= 128) {
|
173
|
+
if (code >= 128) {
|
150
174
|
process.exit(code);
|
151
175
|
}
|
152
176
|
else {
|
153
|
-
res(
|
177
|
+
res({ success: code === 0, terminalOutput });
|
154
178
|
}
|
155
179
|
});
|
156
180
|
});
|
157
181
|
}
|
158
|
-
return nodeProcess(commandConfig,
|
182
|
+
return nodeProcess(commandConfig, cwd, env, readyWhen, streamOutput);
|
159
183
|
}
|
160
|
-
function nodeProcess(commandConfig,
|
184
|
+
function nodeProcess(commandConfig, cwd, env, readyWhen, streamOutput = true) {
|
185
|
+
let terminalOutput = '';
|
161
186
|
return new Promise((res) => {
|
162
187
|
const childProcess = (0, child_process_1.exec)(commandConfig.command, {
|
163
188
|
maxBuffer: exports.LARGE_BUFFER,
|
@@ -173,24 +198,36 @@ function nodeProcess(commandConfig, color, cwd, env, readyWhen) {
|
|
173
198
|
process.on('SIGINT', processExitListener);
|
174
199
|
process.on('SIGQUIT', processExitListener);
|
175
200
|
childProcess.stdout.on('data', (data) => {
|
176
|
-
|
201
|
+
const output = addColorAndPrefix(data, commandConfig);
|
202
|
+
terminalOutput += output;
|
203
|
+
if (streamOutput) {
|
204
|
+
process.stdout.write(output);
|
205
|
+
}
|
177
206
|
if (readyWhen && data.toString().indexOf(readyWhen) > -1) {
|
178
|
-
res(true);
|
207
|
+
res({ success: true, terminalOutput });
|
179
208
|
}
|
180
209
|
});
|
181
210
|
childProcess.stderr.on('data', (err) => {
|
182
|
-
|
211
|
+
const output = addColorAndPrefix(err, commandConfig);
|
212
|
+
terminalOutput += output;
|
213
|
+
if (streamOutput) {
|
214
|
+
process.stderr.write(output);
|
215
|
+
}
|
183
216
|
if (readyWhen && err.toString().indexOf(readyWhen) > -1) {
|
184
|
-
res(true);
|
217
|
+
res({ success: true, terminalOutput });
|
185
218
|
}
|
186
219
|
});
|
187
220
|
childProcess.on('error', (err) => {
|
188
|
-
|
189
|
-
|
221
|
+
const ouptput = addColorAndPrefix(err.toString(), commandConfig);
|
222
|
+
terminalOutput += ouptput;
|
223
|
+
if (streamOutput) {
|
224
|
+
process.stderr.write(ouptput);
|
225
|
+
}
|
226
|
+
res({ success: false, terminalOutput });
|
190
227
|
});
|
191
228
|
childProcess.on('exit', (code) => {
|
192
229
|
if (!readyWhen) {
|
193
|
-
res(code === 0);
|
230
|
+
res({ success: code === 0, terminalOutput });
|
194
231
|
}
|
195
232
|
});
|
196
233
|
});
|
@@ -218,11 +255,13 @@ function calculateCwd(cwd, context) {
|
|
218
255
|
return path.join(context.root, cwd);
|
219
256
|
}
|
220
257
|
function processEnv(color, cwd, env) {
|
258
|
+
const localEnv = (0, npm_run_path_1.env)({ cwd: cwd ?? process.cwd() });
|
221
259
|
const res = {
|
222
260
|
...process.env,
|
223
|
-
...
|
261
|
+
...localEnv,
|
224
262
|
...env,
|
225
263
|
};
|
264
|
+
res.PATH = localEnv.PATH; // need to override PATH to make sure we are using the local node_modules
|
226
265
|
if (color) {
|
227
266
|
res.FORCE_COLOR = `${color}`;
|
228
267
|
}
|
package/src/hasher/hash-task.js
CHANGED
@@ -9,7 +9,7 @@ async function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher, projectGrap
|
|
9
9
|
performance.mark('hashMultipleTasks:start');
|
10
10
|
const tasks = Object.values(taskGraph.tasks);
|
11
11
|
const tasksWithHashers = await Promise.all(tasks.map(async (task) => {
|
12
|
-
const customHasher =
|
12
|
+
const customHasher = (0, utils_1.getCustomHasher)(task, projectGraph);
|
13
13
|
return { task, customHasher };
|
14
14
|
}));
|
15
15
|
const tasksToHash = tasksWithHashers
|
@@ -33,7 +33,7 @@ async function hashTasksThatDoNotDependOnOutputsOfOtherTasks(hasher, projectGrap
|
|
33
33
|
exports.hashTasksThatDoNotDependOnOutputsOfOtherTasks = hashTasksThatDoNotDependOnOutputsOfOtherTasks;
|
34
34
|
async function hashTask(hasher, projectGraph, taskGraph, task, env) {
|
35
35
|
performance.mark('hashSingleTask:start');
|
36
|
-
const customHasher =
|
36
|
+
const customHasher = (0, utils_1.getCustomHasher)(task, projectGraph);
|
37
37
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
38
38
|
const { value, details } = await (customHasher
|
39
39
|
? customHasher(task, {
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TaskOrchestrator = void 0;
|
4
4
|
const events_1 = require("events");
|
5
5
|
const perf_hooks_1 = require("perf_hooks");
|
6
|
+
const path_1 = require("path");
|
7
|
+
const run_commands_impl_1 = require("../executors/run-commands/run-commands.impl");
|
6
8
|
const forked_process_task_runner_1 = require("./forked-process-task-runner");
|
7
9
|
const cache_1 = require("./cache");
|
8
10
|
const utils_1 = require("./utils");
|
@@ -10,6 +12,9 @@ const tasks_schedule_1 = require("./tasks-schedule");
|
|
10
12
|
const hash_task_1 = require("../hasher/hash-task");
|
11
13
|
const task_env_1 = require("./task-env");
|
12
14
|
const os = require("os");
|
15
|
+
const workspace_root_1 = require("../utils/workspace-root");
|
16
|
+
const output_1 = require("../utils/output");
|
17
|
+
const params_1 = require("../utils/params");
|
13
18
|
class TaskOrchestrator {
|
14
19
|
// endregion internal state
|
15
20
|
constructor(hasher, initiatingProject, projectGraph, taskGraph, options, bail, daemon) {
|
@@ -205,13 +210,45 @@ class TaskOrchestrator {
|
|
205
210
|
let results = doNotSkipCache ? await this.applyCachedResults([task]) : [];
|
206
211
|
// the task wasn't cached
|
207
212
|
if (results.length === 0) {
|
208
|
-
|
209
|
-
const
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
213
|
+
const shouldPrefix = streamOutput && process.env.NX_PREFIX_OUTPUT === 'true';
|
214
|
+
const targetConfiguration = (0, utils_1.getTargetConfigurationForTask)(task, this.projectGraph);
|
215
|
+
if (process.env.NX_RUN_COMMANDS_DIRECTLY !== 'false' &&
|
216
|
+
targetConfiguration.executor === 'nx:run-commands' &&
|
217
|
+
!shouldPrefix) {
|
218
|
+
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projectGraph);
|
219
|
+
const isRunOne = this.initiatingProject != null;
|
220
|
+
const combinedOptions = (0, params_1.combineOptionsForExecutor)(task.overrides, task.target.configuration ?? targetConfiguration.defaultConfiguration, targetConfiguration, schema, task.target.project, (0, path_1.relative)(task.projectRoot ?? workspace_root_1.workspaceRoot, process.cwd()), process.env.NX_VERBOSE_LOGGING === 'true');
|
221
|
+
if (streamOutput) {
|
222
|
+
const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
|
223
|
+
output_1.output.logCommand(args.join(' '));
|
224
|
+
}
|
225
|
+
const { success, terminalOutput } = await (0, run_commands_impl_1.default)({
|
226
|
+
...combinedOptions,
|
227
|
+
env,
|
228
|
+
usePty: isRunOne && !this.tasksSchedule.hasTasks(),
|
229
|
+
streamOutput,
|
230
|
+
}, {
|
231
|
+
root: workspace_root_1.workspaceRoot, // only root is needed in runCommandsImpl
|
232
|
+
});
|
233
|
+
const status = success ? 'success' : 'failure';
|
234
|
+
if (!streamOutput) {
|
235
|
+
this.options.lifeCycle.printTaskTerminalOutput(task, status, terminalOutput);
|
236
|
+
}
|
237
|
+
results.push({
|
238
|
+
task,
|
239
|
+
status,
|
240
|
+
terminalOutput,
|
241
|
+
});
|
242
|
+
}
|
243
|
+
else {
|
244
|
+
// cache prep
|
245
|
+
const { code, terminalOutput } = await this.runTaskInForkedProcess(task, env, pipeOutput, temporaryOutputPath, streamOutput);
|
246
|
+
results.push({
|
247
|
+
task,
|
248
|
+
status: code === 0 ? 'success' : 'failure',
|
249
|
+
terminalOutput,
|
250
|
+
});
|
251
|
+
}
|
215
252
|
}
|
216
253
|
await this.postRunSteps([task], results, doNotSkipCache, { groupId });
|
217
254
|
}
|
@@ -338,7 +375,7 @@ class TaskOrchestrator {
|
|
338
375
|
if (process.env.NX_NATIVE_COMMAND_RUNNER !== 'false') {
|
339
376
|
return true;
|
340
377
|
}
|
341
|
-
const { schema } =
|
378
|
+
const { schema } = (0, utils_1.getExecutorForTask)(task, this.projectGraph);
|
342
379
|
return (schema.outputCapture === 'pipe' ||
|
343
380
|
process.env.NX_STREAM_OUTPUT === 'true');
|
344
381
|
}
|
@@ -89,7 +89,7 @@ class TasksSchedule {
|
|
89
89
|
const batchMap = {};
|
90
90
|
for (const root of this.notScheduledTaskGraph.roots) {
|
91
91
|
const rootTask = this.notScheduledTaskGraph.tasks[root];
|
92
|
-
const executorName =
|
92
|
+
const executorName = (0, utils_1.getExecutorNameForTask)(rootTask, this.projectGraph);
|
93
93
|
await this.processTaskForBatches(batchMap, rootTask, executorName, true);
|
94
94
|
}
|
95
95
|
for (const [executorName, taskGraph] of Object.entries(batchMap)) {
|
@@ -105,8 +105,8 @@ class TasksSchedule {
|
|
105
105
|
if (!this.canBatchTaskBeScheduled(task.id, batches[rootExecutorName])) {
|
106
106
|
return;
|
107
107
|
}
|
108
|
-
const { batchImplementationFactory } =
|
109
|
-
const executorName =
|
108
|
+
const { batchImplementationFactory } = (0, utils_1.getExecutorForTask)(task, this.projectGraph);
|
109
|
+
const executorName = (0, utils_1.getExecutorNameForTask)(task, this.projectGraph);
|
110
110
|
if (rootExecutorName !== executorName) {
|
111
111
|
return;
|
112
112
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Task, TaskGraph } from '../config/task-graph';
|
2
2
|
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
|
3
|
-
import { TargetDependencyConfig } from '../config/workspace-json-project-json';
|
4
|
-
import { CustomHasher } from '../config/misc-interfaces';
|
3
|
+
import { TargetConfiguration, TargetDependencyConfig } from '../config/workspace-json-project-json';
|
4
|
+
import { CustomHasher, ExecutorConfig } from '../config/misc-interfaces';
|
5
5
|
export declare function getCommandAsString(execCommand: string, task: Task): string;
|
6
6
|
export declare function getDependencyConfigs({ project, target }: {
|
7
7
|
project: string;
|
@@ -23,12 +23,13 @@ export declare function transformLegacyOutputs(projectRoot: string, error: Inval
|
|
23
23
|
export declare function getOutputsForTargetAndConfiguration(task: Task, node: ProjectGraphProjectNode): string[];
|
24
24
|
export declare function getOutputsForTargetAndConfiguration(target: Task['target'] | Task, overrides: Task['overrides'] | ProjectGraphProjectNode, node: ProjectGraphProjectNode): string[];
|
25
25
|
export declare function interpolate(template: string, data: any): string;
|
26
|
-
export declare function
|
27
|
-
export declare function
|
26
|
+
export declare function getTargetConfigurationForTask(task: Task, projectGraph: ProjectGraph): TargetConfiguration | undefined;
|
27
|
+
export declare function getExecutorNameForTask(task: Task, projectGraph: ProjectGraph): string;
|
28
|
+
export declare function getExecutorForTask(task: Task, projectGraph: ProjectGraph): ExecutorConfig & {
|
28
29
|
isNgCompat: boolean;
|
29
30
|
isNxExecutor: boolean;
|
30
|
-
}
|
31
|
-
export declare function getCustomHasher(task: Task, projectGraph: ProjectGraph):
|
31
|
+
};
|
32
|
+
export declare function getCustomHasher(task: Task, projectGraph: ProjectGraph): CustomHasher | null;
|
32
33
|
export declare function removeTasksFromTaskGraph(graph: TaskGraph, ids: string[]): TaskGraph;
|
33
34
|
export declare function removeIdsFromGraph<T>(graph: {
|
34
35
|
roots: string[];
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.unparse = exports.isCacheableTask = exports.shouldStreamOutput = exports.getSerializedArgsForTask = exports.getPrintableCommandArgsForTask = exports.getCliPath = exports.calculateReverseDeps = exports.removeIdsFromGraph = exports.removeTasksFromTaskGraph = exports.getCustomHasher = exports.getExecutorForTask = exports.getExecutorNameForTask = exports.interpolate = exports.getOutputsForTargetAndConfiguration = exports.transformLegacyOutputs = exports.validateOutputs = exports.getOutputs = exports.expandDependencyConfigSyntaxSugar = exports.getDependencyConfigs = exports.getCommandAsString = void 0;
|
3
|
+
exports.unparse = exports.isCacheableTask = exports.shouldStreamOutput = exports.getSerializedArgsForTask = exports.getPrintableCommandArgsForTask = exports.getCliPath = exports.calculateReverseDeps = exports.removeIdsFromGraph = exports.removeTasksFromTaskGraph = exports.getCustomHasher = exports.getExecutorForTask = exports.getExecutorNameForTask = exports.getTargetConfigurationForTask = exports.interpolate = exports.getOutputsForTargetAndConfiguration = exports.transformLegacyOutputs = exports.validateOutputs = exports.getOutputs = exports.expandDependencyConfigSyntaxSugar = exports.getDependencyConfigs = exports.getCommandAsString = void 0;
|
4
4
|
const output_1 = require("../utils/output");
|
5
5
|
const path_1 = require("path");
|
6
6
|
const workspace_root_1 = require("../utils/workspace-root");
|
@@ -177,19 +177,23 @@ function interpolate(template, data) {
|
|
177
177
|
});
|
178
178
|
}
|
179
179
|
exports.interpolate = interpolate;
|
180
|
-
|
180
|
+
function getTargetConfigurationForTask(task, projectGraph) {
|
181
181
|
const project = projectGraph.nodes[task.target.project].data;
|
182
|
-
return project.targets[task.target.target]
|
182
|
+
return project.targets[task.target.target];
|
183
|
+
}
|
184
|
+
exports.getTargetConfigurationForTask = getTargetConfigurationForTask;
|
185
|
+
function getExecutorNameForTask(task, projectGraph) {
|
186
|
+
return getTargetConfigurationForTask(task, projectGraph)?.executor;
|
183
187
|
}
|
184
188
|
exports.getExecutorNameForTask = getExecutorNameForTask;
|
185
|
-
|
186
|
-
const executor =
|
189
|
+
function getExecutorForTask(task, projectGraph) {
|
190
|
+
const executor = getExecutorNameForTask(task, projectGraph);
|
187
191
|
const [nodeModule, executorName] = executor.split(':');
|
188
192
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, executorName, workspace_root_1.workspaceRoot, (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph).projects);
|
189
193
|
}
|
190
194
|
exports.getExecutorForTask = getExecutorForTask;
|
191
|
-
|
192
|
-
const factory =
|
195
|
+
function getCustomHasher(task, projectGraph) {
|
196
|
+
const factory = getExecutorForTask(task, projectGraph).hasherFactory;
|
193
197
|
return factory ? factory() : null;
|
194
198
|
}
|
195
199
|
exports.getCustomHasher = getCustomHasher;
|