@nrwl/nx-cloud 14.5.0-beta.4 → 14.5.2

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,220 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.nxCloudDistributedTasksRunner = void 0;
13
- const fs_1 = require("fs");
14
- const stripJsonComments = require("strip-json-comments");
15
- const create_unchanged_value_timeout_1 = require("../../../utilities/create-unchanged-value-timeout");
16
- const environment_1 = require("../../../utilities/environment");
17
- const metric_logger_1 = require("../../../utilities/metric-logger");
18
- const serializer_overrides_1 = require("../../../utilities/serializer-overrides");
19
- const waiter_1 = require("../../../utilities/waiter");
20
- const error_reporter_api_1 = require("../../api/error-reporter.api");
21
- const print_run_group_error_1 = require("../../error/print-run-group-error");
22
- const e2e_encryption_1 = require("../../file-storage/e2e-encryption");
23
- const file_storage_1 = require("../../file-storage/file-storage");
24
- const distributed_execution_api_1 = require("./distributed-execution.api");
25
- const split_task_graph_into_stages_1 = require("./split-task-graph-into-stages");
26
- const task_graph_creator_1 = require("./task-graph-creator");
27
- const { output, workspaceRoot, getOutputs, Cache, } = require('../../../utilities/nx-imports');
28
- class NoopLifeCycle {
29
- scheduleTask(task) { }
30
- startTask(task) { }
31
- endTask(task, code) { }
32
- }
33
- function runDistributedExecution(api, options, context, fileStorage, cache, runGroup, taskGraph) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- const id = yield api.start((0, distributed_execution_api_1.createStartRequest)(runGroup, (0, split_task_graph_into_stages_1.splitTasksIntoStages)(taskGraph), options));
36
- return yield processTasks(api, fileStorage, cache, options, id, Object.values(taskGraph.tasks), context);
37
- });
38
- }
39
- function processTasks(api, fileStorage, cache, options, executionId, tasks, context) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const processedTasks = {};
42
- const failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout = (0, create_unchanged_value_timeout_1.createUnchangedValueTimeout)({
43
- title: `No new completed tasks after ${environment_1.NO_COMPLETED_TASKS_TIMEOUT / 1000} seconds.`,
44
- timeout: environment_1.NO_COMPLETED_TASKS_TIMEOUT,
45
- });
46
- const waiter = new waiter_1.Waiter();
47
- while (true) {
48
- if (environment_1.VERBOSE_LOGGING) {
49
- output.note({
50
- title: 'Waiting...',
51
- });
52
- }
53
- yield waiter.wait();
54
- const r = yield api.status(executionId);
55
- if (environment_1.VERBOSE_LOGGING) {
56
- output.note({
57
- title: `Status update`,
58
- bodyLines: [
59
- `executionId: ${executionId}`,
60
- `executionStatus: ${r.executionStatus}`,
61
- `number of completed tasks: ${r.completedTasks.length}`,
62
- `error: ${r.criticalErrorMessage}`,
63
- ],
64
- });
65
- }
66
- if (r.criticalErrorMessage) {
67
- output.error({
68
- title: 'Distributed Execution Terminated',
69
- bodyLines: ['Error:', r.criticalErrorMessage],
70
- });
71
- process.exit(1);
72
- }
73
- failIfNumberOfCompletedTasksDoesNotChangeAfterTimeout(r.completedTasks.length);
74
- for (const t of r.completedTasks) {
75
- if (processedTasks[t.taskId])
76
- continue;
77
- yield processTask(fileStorage, cache, context, options, tasks, t);
78
- waiter.reset();
79
- processedTasks[t.taskId] = true;
80
- }
81
- if (r.executionStatus === 'COMPLETED') {
82
- return { commandStatus: r.commandStatus, runUrl: r.runUrl };
83
- }
84
- }
85
- });
86
- }
87
- function processTask(fileStorage, cache, context, options, tasks, completedTask) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- if (environment_1.VERBOSE_LOGGING) {
90
- output.note({
91
- title: `Processing task ${completedTask.taskId}`,
92
- });
93
- }
94
- const matchingTask = tasks.find((tt) => completedTask.taskId === tt.id);
95
- if (!matchingTask) {
96
- throw new Error(`Found unknown task: ${completedTask.taskId}`);
97
- }
98
- if (environment_1.VERBOSE_LOGGING) {
99
- output.note({
100
- title: `Retrieving artifacts from ${completedTask.url}`,
101
- });
102
- }
103
- yield fileStorage.retrieve(completedTask.hash, completedTask.url, options.cacheDirectory || './node_modules/.cache/nx');
104
- const cachedResult = yield cache.get(Object.assign(Object.assign({}, matchingTask), { hash: completedTask.hash }));
105
- const outputs = getOutputs(context.projectGraph.nodes, matchingTask);
106
- if (environment_1.VERBOSE_LOGGING) {
107
- output.note({
108
- title: `Extracting artifacts`,
109
- bodyLines: outputs,
110
- });
111
- }
112
- yield cache.copyFilesFromCache(completedTask.hash, cachedResult, outputs);
113
- output.logCommand(getCommand(matchingTask));
114
- process.stdout.write(cachedResult.terminalOutput);
115
- output.addVerticalSeparator();
116
- });
117
- }
118
- function getCommand(task) {
119
- const config = task.target.configuration
120
- ? `:${task.target.configuration}`
121
- : '';
122
- return [
123
- 'nx',
124
- 'run',
125
- `${task.target.project}:${task.target.target}${config}`,
126
- (0, serializer_overrides_1.serializeOverrides)(task),
127
- ].join(' ');
128
- }
129
- function attachSignalListenersToCompleteRunGroupOnError(api, runGroup) {
130
- process.on('SIGINT', () => __awaiter(this, void 0, void 0, function* () {
131
- yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGINT');
132
- process.exit(1);
133
- }));
134
- process.on('SIGTERM', () => __awaiter(this, void 0, void 0, function* () {
135
- yield api.completeRunGroupWithError(runGroup, 'Main job was terminated via SIGTERM');
136
- process.exit(1);
137
- }));
138
- }
139
- const nxCloudDistributedTasksRunner = (tasks, options, context) => __awaiter(void 0, void 0, void 0, function* () {
140
- if (environment_1.VERBOSE_LOGGING) {
141
- output.note({
142
- title: 'Starting distributed command execution',
143
- });
144
- }
145
- options.lifeCycle = new NoopLifeCycle();
146
- const runGroup = (0, environment_1.getRunGroup)();
147
- if (!runGroup) {
148
- (0, print_run_group_error_1.printRunGroupError)();
149
- return process.exit(1);
150
- }
151
- const encryption = new e2e_encryption_1.E2EEncryption(environment_1.ENCRYPTION_KEY || options.encryptionKey);
152
- const errorReporter = new error_reporter_api_1.ErrorReporterApi(options);
153
- const fileStorage = new file_storage_1.FileStorage(encryption, errorReporter, true, false);
154
- const cache = new Cache(options);
155
- const api = new distributed_execution_api_1.DistributedExecutionApi(options);
156
- attachSignalListenersToCompleteRunGroupOnError(api, runGroup);
157
- try {
158
- const taskGraph = getTaskGraph(context, tasks, options);
159
- const r = yield runDistributedExecution(api, options, context, fileStorage, cache, runGroup, taskGraph);
160
- if (r.commandStatus === 0) {
161
- output.success({
162
- title: 'Successfully completed running the command.',
163
- bodyLines: [`See run details at ${r.runUrl}`],
164
- });
165
- }
166
- else {
167
- output.error({
168
- title: 'Command execution failed.',
169
- bodyLines: [`See run details at ${r.runUrl}`],
170
- });
171
- }
172
- yield (0, metric_logger_1.submitRunMetrics)(options);
173
- process.exit(r.commandStatus);
174
- }
175
- catch (e) {
176
- output.error({
177
- title: 'Unable to complete a run.',
178
- bodyLines: [e.message],
179
- });
180
- if (e.axiosException) {
181
- console.log(e.axiosException);
182
- }
183
- else {
184
- console.log(e);
185
- }
186
- try {
187
- yield api.completeRunGroupWithError(runGroup, `Main job terminated with an error: "${e.message}"`);
188
- }
189
- finally {
190
- process.exit(1);
191
- }
192
- }
193
- });
194
- exports.nxCloudDistributedTasksRunner = nxCloudDistributedTasksRunner;
195
- function getTaskGraph(context, tasks, options) {
196
- if (context.taskGraph) {
197
- return context.taskGraph;
198
- }
199
- else {
200
- const nxjson = JSON.parse(stripJsonComments((0, fs_1.readFileSync)(`${workspaceRoot}/nx.json`).toString()));
201
- return new task_graph_creator_1.TaskGraphCreator(context.projectGraph, getDefaultDependencyConfigs(nxjson, options)).createTaskGraph(tasks);
202
- }
203
- }
204
- function getDefaultDependencyConfigs(nxJson, runnerOptions) {
205
- var _a, _b;
206
- const defaults = (_a = nxJson.targetDependencies) !== null && _a !== void 0 ? _a : {};
207
- const strictlyOrderedTargets = runnerOptions
208
- ? (_b = runnerOptions.strictlyOrderedTargets) !== null && _b !== void 0 ? _b : ['build']
209
- : [];
210
- // Strictly Ordered Targets depend on their dependencies
211
- for (const target of strictlyOrderedTargets) {
212
- defaults[target] = defaults[target] || [];
213
- defaults[target].push({
214
- target,
215
- projects: 'dependencies',
216
- });
217
- }
218
- return defaults;
219
- }
220
- //# sourceMappingURL=distributed-execution.runner.js.map
1
+ const a8_0x4c02=['executionStatus:\x20','readFileSync','../../error/print-run-group-error','tasks','\x20seconds.','note','configuration','stdout','../../api/error-reporter.api','startTask','No\x20new\x20completed\x20tasks\x20after\x20','encryptionKey','./distributed-execution.api','FileStorage','SIGINT','./split-task-graph-into-stages','createTaskGraph','success','runUrl','strictlyOrderedTargets','reset','Main\x20job\x20was\x20terminated\x20via\x20SIGTERM','target','../../../utilities/environment','Extracting\x20artifacts','Main\x20job\x20was\x20terminated\x20via\x20SIGINT','targetDependencies','__awaiter','terminalOutput','../../../utilities/waiter','Processing\x20task\x20','error','Starting\x20distributed\x20command\x20execution','executionId:\x20','then','hash','retrieve','createUnchangedValueTimeout','copyFilesFromCache','defineProperty','start','number\x20of\x20completed\x20tasks:\x20','push','Waiting...','VERBOSE_LOGGING','/nx.json','build','Successfully\x20completed\x20running\x20the\x20command.','TaskGraphCreator','values','dependencies','SIGTERM','exit','log','message','toString','value','./node_modules/.cache/nx','throw','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','Retrieving\x20artifacts\x20from\x20','get','NO_COMPLETED_TASKS_TIMEOUT','nxCloudDistributedTasksRunner','scheduleTask','commandStatus','status','../../file-storage/e2e-encryption','axiosException','completeRunGroupWithError','taskGraph','addVerticalSeparator','projectGraph','done','logCommand','assign','length','criticalErrorMessage','strip-json-comments','apply','lifeCycle','Waiter','getRunGroup','run','join','printRunGroupError','E2EEncryption','createStartRequest','../../../utilities/metric-logger','Command\x20execution\x20failed.','Distributed\x20Execution\x20Terminated','find','ENCRYPTION_KEY','completedTasks','See\x20run\x20details\x20at\x20','taskId','../../../utilities/nx-imports','parse','project','Error:'];(function(_0x857983,_0x4c0213){const _0x1cc7c3=function(_0x339d02){while(--_0x339d02){_0x857983['push'](_0x857983['shift']());}};_0x1cc7c3(++_0x4c0213);}(a8_0x4c02,0x87));const a8_0x1cc7=function(_0x857983,_0x4c0213){_0x857983=_0x857983-0x0;let _0x1cc7c3=a8_0x4c02[_0x857983];return _0x1cc7c3;};'use strict';var __awaiter=this&&this[a8_0x1cc7('0x5c')]||function(_0x636931,_0xa5994b,_0x24972d,_0x1af024){function _0x52f62c(_0x36c976){return _0x36c976 instanceof _0x24972d?_0x36c976:new _0x24972d(function(_0x2740ae){_0x2740ae(_0x36c976);});}return new(_0x24972d||(_0x24972d=Promise))(function(_0x5156c4,_0x552c68){function _0x5d1336(_0x378544){try{_0x39f254(_0x1af024['next'](_0x378544));}catch(_0x5c0013){_0x552c68(_0x5c0013);}}function _0x5a2bb8(_0x3caa9d){try{_0x39f254(_0x1af024[a8_0x1cc7('0x17')](_0x3caa9d));}catch(_0x38380b){_0x552c68(_0x38380b);}}function _0x39f254(_0x45cb26){_0x45cb26[a8_0x1cc7('0x26')]?_0x5156c4(_0x45cb26[a8_0x1cc7('0x15')]):_0x52f62c(_0x45cb26[a8_0x1cc7('0x15')])[a8_0x1cc7('0x63')](_0x5d1336,_0x5a2bb8);}_0x39f254((_0x1af024=_0x1af024[a8_0x1cc7('0x2c')](_0x636931,_0xa5994b||[]))['next']());});};Object[a8_0x1cc7('0x4')](exports,'__esModule',{'value':!![]});exports[a8_0x1cc7('0x1c')]=void 0x0;const fs_1=require('fs');const stripJsonComments=require(a8_0x1cc7('0x2b'));const create_unchanged_value_timeout_1=require('../../../utilities/create-unchanged-value-timeout');const environment_1=require(a8_0x1cc7('0x58'));const metric_logger_1=require(a8_0x1cc7('0x35'));const serializer_overrides_1=require('../../../utilities/serializer-overrides');const waiter_1=require(a8_0x1cc7('0x5e'));const error_reporter_api_1=require(a8_0x1cc7('0x49'));const print_run_group_error_1=require(a8_0x1cc7('0x43'));const e2e_encryption_1=require(a8_0x1cc7('0x20'));const file_storage_1=require('../../file-storage/file-storage');const distributed_execution_api_1=require(a8_0x1cc7('0x4d'));const split_task_graph_into_stages_1=require(a8_0x1cc7('0x50'));const task_graph_creator_1=require('./task-graph-creator');const {output,workspaceRoot,getOutputs,Cache}=require(a8_0x1cc7('0x3d'));class NoopLifeCycle{[a8_0x1cc7('0x1d')](_0x533791){}[a8_0x1cc7('0x4a')](_0x58a2bd){}['endTask'](_0x2b57b7,_0x1e6c15){}}function runDistributedExecution(_0x4570ca,_0xffbba5,_0x53d22c,_0x46f942,_0x4e5d81,_0x2b40d0,_0x3b4e7f){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x37c61c=yield _0x4570ca[a8_0x1cc7('0x5')]((0x0,distributed_execution_api_1[a8_0x1cc7('0x34')])(_0x2b40d0,(0x0,split_task_graph_into_stages_1['splitTasksIntoStages'])(_0x3b4e7f),_0xffbba5));return yield processTasks(_0x4570ca,_0x46f942,_0x4e5d81,_0xffbba5,_0x37c61c,Object[a8_0x1cc7('0xe')](_0x3b4e7f[a8_0x1cc7('0x44')]),_0x53d22c);});}function processTasks(_0x3586b6,_0x314af5,_0x438652,_0x464a75,_0x46d3c3,_0x4101d4,_0x956421){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x5611be={};const _0xf21430=(0x0,create_unchanged_value_timeout_1[a8_0x1cc7('0x2')])({'title':a8_0x1cc7('0x4b')+environment_1[a8_0x1cc7('0x1b')]/0x3e8+a8_0x1cc7('0x45'),'timeout':environment_1[a8_0x1cc7('0x1b')]});const _0x50b5ac=new waiter_1[(a8_0x1cc7('0x2e'))]();while(!![]){if(environment_1[a8_0x1cc7('0x9')]){output[a8_0x1cc7('0x46')]({'title':a8_0x1cc7('0x8')});}yield _0x50b5ac['wait']();const _0x44eed2=yield _0x3586b6[a8_0x1cc7('0x1f')](_0x46d3c3);if(environment_1[a8_0x1cc7('0x9')]){output[a8_0x1cc7('0x46')]({'title':'Status\x20update','bodyLines':[a8_0x1cc7('0x62')+_0x46d3c3,a8_0x1cc7('0x41')+_0x44eed2['executionStatus'],a8_0x1cc7('0x6')+_0x44eed2[a8_0x1cc7('0x3a')][a8_0x1cc7('0x29')],'error:\x20'+_0x44eed2[a8_0x1cc7('0x2a')]]});}if(_0x44eed2[a8_0x1cc7('0x2a')]){output['error']({'title':a8_0x1cc7('0x37'),'bodyLines':[a8_0x1cc7('0x40'),_0x44eed2[a8_0x1cc7('0x2a')]]});process['exit'](0x1);}_0xf21430(_0x44eed2['completedTasks'][a8_0x1cc7('0x29')]);for(const _0x4879a9 of _0x44eed2[a8_0x1cc7('0x3a')]){if(_0x5611be[_0x4879a9[a8_0x1cc7('0x3c')]])continue;yield processTask(_0x314af5,_0x438652,_0x956421,_0x464a75,_0x4101d4,_0x4879a9);_0x50b5ac[a8_0x1cc7('0x55')]();_0x5611be[_0x4879a9['taskId']]=!![];}if(_0x44eed2['executionStatus']==='COMPLETED'){return{'commandStatus':_0x44eed2[a8_0x1cc7('0x1e')],'runUrl':_0x44eed2['runUrl']};}}});}function processTask(_0x1fbbf5,_0x5b70ee,_0x3d1c1a,_0x10957c,_0x3e72e0,_0x3ad8d9){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1[a8_0x1cc7('0x9')]){output['note']({'title':a8_0x1cc7('0x5f')+_0x3ad8d9['taskId']});}const _0x2bfbbc=_0x3e72e0[a8_0x1cc7('0x38')](_0x1e558d=>_0x3ad8d9[a8_0x1cc7('0x3c')]===_0x1e558d['id']);if(!_0x2bfbbc){throw new Error('Found\x20unknown\x20task:\x20'+_0x3ad8d9[a8_0x1cc7('0x3c')]);}if(environment_1[a8_0x1cc7('0x9')]){output['note']({'title':a8_0x1cc7('0x19')+_0x3ad8d9['url']});}yield _0x1fbbf5[a8_0x1cc7('0x1')](_0x3ad8d9[a8_0x1cc7('0x0')],_0x3ad8d9['url'],_0x10957c['cacheDirectory']||a8_0x1cc7('0x16'));const _0x354168=yield _0x5b70ee[a8_0x1cc7('0x1a')](Object[a8_0x1cc7('0x28')](Object[a8_0x1cc7('0x28')]({},_0x2bfbbc),{'hash':_0x3ad8d9[a8_0x1cc7('0x0')]}));const _0x514e0d=getOutputs(_0x3d1c1a[a8_0x1cc7('0x25')]['nodes'],_0x2bfbbc);if(environment_1['VERBOSE_LOGGING']){output['note']({'title':a8_0x1cc7('0x59'),'bodyLines':_0x514e0d});}yield _0x5b70ee[a8_0x1cc7('0x3')](_0x3ad8d9[a8_0x1cc7('0x0')],_0x354168,_0x514e0d);output[a8_0x1cc7('0x27')](getCommand(_0x2bfbbc));process[a8_0x1cc7('0x48')]['write'](_0x354168[a8_0x1cc7('0x5d')]);output[a8_0x1cc7('0x24')]();});}function getCommand(_0x148b24){const _0x3a2c27=_0x148b24['target'][a8_0x1cc7('0x47')]?':'+_0x148b24[a8_0x1cc7('0x57')]['configuration']:'';return['nx',a8_0x1cc7('0x30'),_0x148b24[a8_0x1cc7('0x57')][a8_0x1cc7('0x3f')]+':'+_0x148b24[a8_0x1cc7('0x57')][a8_0x1cc7('0x57')]+_0x3a2c27,(0x0,serializer_overrides_1['serializeOverrides'])(_0x148b24)][a8_0x1cc7('0x31')]('\x20');}function attachSignalListenersToCompleteRunGroupOnError(_0x3a49cd,_0x59810d){process['on'](a8_0x1cc7('0x4f'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x3a49cd['completeRunGroupWithError'](_0x59810d,a8_0x1cc7('0x5a'));process[a8_0x1cc7('0x11')](0x1);}));process['on'](a8_0x1cc7('0x10'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x3a49cd[a8_0x1cc7('0x22')](_0x59810d,a8_0x1cc7('0x56'));process[a8_0x1cc7('0x11')](0x1);}));}const nxCloudDistributedTasksRunner=(_0x36fb73,_0x1874b9,_0x5765ed)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(environment_1[a8_0x1cc7('0x9')]){output[a8_0x1cc7('0x46')]({'title':a8_0x1cc7('0x61')});}_0x1874b9[a8_0x1cc7('0x2d')]=new NoopLifeCycle();const _0x2baa1f=(0x0,environment_1[a8_0x1cc7('0x2f')])();if(!_0x2baa1f){(0x0,print_run_group_error_1[a8_0x1cc7('0x32')])();return process[a8_0x1cc7('0x11')](0x1);}const _0x232411=new e2e_encryption_1[(a8_0x1cc7('0x33'))](environment_1[a8_0x1cc7('0x39')]||_0x1874b9[a8_0x1cc7('0x4c')]);const _0x3a7e03=new error_reporter_api_1['ErrorReporterApi'](_0x1874b9);const _0x58f140=new file_storage_1[(a8_0x1cc7('0x4e'))](_0x232411,_0x3a7e03,!![],![]);const _0xb8dc32=new Cache(_0x1874b9);const _0x5e75ae=new distributed_execution_api_1['DistributedExecutionApi'](_0x1874b9);attachSignalListenersToCompleteRunGroupOnError(_0x5e75ae,_0x2baa1f);try{const _0x1317b0=getTaskGraph(_0x5765ed,_0x36fb73,_0x1874b9);const _0x576854=yield runDistributedExecution(_0x5e75ae,_0x1874b9,_0x5765ed,_0x58f140,_0xb8dc32,_0x2baa1f,_0x1317b0);if(_0x576854[a8_0x1cc7('0x1e')]===0x0){output[a8_0x1cc7('0x52')]({'title':a8_0x1cc7('0xc'),'bodyLines':[a8_0x1cc7('0x3b')+_0x576854[a8_0x1cc7('0x53')]]});}else{output[a8_0x1cc7('0x60')]({'title':a8_0x1cc7('0x36'),'bodyLines':[a8_0x1cc7('0x3b')+_0x576854[a8_0x1cc7('0x53')]]});}yield(0x0,metric_logger_1['submitRunMetrics'])(_0x1874b9);process[a8_0x1cc7('0x11')](_0x576854[a8_0x1cc7('0x1e')]);}catch(_0x1ede5b){output['error']({'title':'Unable\x20to\x20complete\x20a\x20run.','bodyLines':[_0x1ede5b[a8_0x1cc7('0x13')]]});if(_0x1ede5b[a8_0x1cc7('0x21')]){console[a8_0x1cc7('0x12')](_0x1ede5b[a8_0x1cc7('0x21')]);}else{console['log'](_0x1ede5b);}try{yield _0x5e75ae['completeRunGroupWithError'](_0x2baa1f,a8_0x1cc7('0x18')+_0x1ede5b[a8_0x1cc7('0x13')]+'\x22');}finally{process['exit'](0x1);}}});exports[a8_0x1cc7('0x1c')]=nxCloudDistributedTasksRunner;function getTaskGraph(_0x3fa550,_0x58e956,_0x338235){if(_0x3fa550[a8_0x1cc7('0x23')]){return _0x3fa550[a8_0x1cc7('0x23')];}else{const _0x13b669=JSON[a8_0x1cc7('0x3e')](stripJsonComments((0x0,fs_1[a8_0x1cc7('0x42')])(workspaceRoot+a8_0x1cc7('0xa'))[a8_0x1cc7('0x14')]()));return new task_graph_creator_1[(a8_0x1cc7('0xd'))](_0x3fa550[a8_0x1cc7('0x25')],getDefaultDependencyConfigs(_0x13b669,_0x338235))[a8_0x1cc7('0x51')](_0x58e956);}}function getDefaultDependencyConfigs(_0x4498bc,_0x2eeb72){var _0x1472bc,_0x4e9f7d;const _0x1b86df=(_0x1472bc=_0x4498bc[a8_0x1cc7('0x5b')])!==null&&_0x1472bc!==void 0x0?_0x1472bc:{};const _0x4fd9ff=_0x2eeb72?(_0x4e9f7d=_0x2eeb72[a8_0x1cc7('0x54')])!==null&&_0x4e9f7d!==void 0x0?_0x4e9f7d:[a8_0x1cc7('0xb')]:[];for(const _0x321c45 of _0x4fd9ff){_0x1b86df[_0x321c45]=_0x1b86df[_0x321c45]||[];_0x1b86df[_0x321c45][a8_0x1cc7('0x7')]({'target':_0x321c45,'projects':a8_0x1cc7('0xf')});}return _0x1b86df;}
@@ -1,37 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splitTasksIntoStages = void 0;
4
- function splitTasksIntoStages(taskGraph) {
5
- const stages = [];
6
- const notStagedTaskIds = new Set(Object.values(taskGraph.tasks).map((t) => t.id));
7
- let stageIndex = 0;
8
- // Loop through tasks and try to stage them. As tasks are staged, they are removed from the loop
9
- while (notStagedTaskIds.size > 0) {
10
- const currentStage = (stages[stageIndex] = []);
11
- for (const taskId of notStagedTaskIds) {
12
- let ready = true;
13
- for (const dependency of taskGraph.dependencies[taskId]) {
14
- if (notStagedTaskIds.has(dependency)) {
15
- // dependency has not been staged yet, this task is not ready to be staged.
16
- ready = false;
17
- break;
18
- }
19
- }
20
- // Some dependency still has not been staged, skip it for now, it will be processed again
21
- if (!ready) {
22
- continue;
23
- }
24
- // All the dependencies have been staged, let's stage it.
25
- const task = taskGraph.tasks[taskId];
26
- currentStage.push(task);
27
- }
28
- // Remove the entire new stage of tasks from the list
29
- for (const task of currentStage) {
30
- notStagedTaskIds.delete(task.id);
31
- }
32
- stageIndex++;
33
- }
34
- return stages;
35
- }
36
- exports.splitTasksIntoStages = splitTasksIntoStages;
37
- //# sourceMappingURL=split-task-graph-into-stages.js.map
1
+ const a9_0x16a1=['dependencies','__esModule','map','splitTasksIntoStages','tasks','size','push'];(function(_0x277c7e,_0x16a156){const _0x4fb01d=function(_0x5ec366){while(--_0x5ec366){_0x277c7e['push'](_0x277c7e['shift']());}};_0x4fb01d(++_0x16a156);}(a9_0x16a1,0x10a));const a9_0x4fb0=function(_0x277c7e,_0x16a156){_0x277c7e=_0x277c7e-0x0;let _0x4fb01d=a9_0x16a1[_0x277c7e];return _0x4fb01d;};'use strict';Object['defineProperty'](exports,a9_0x4fb0('0x1'),{'value':!![]});exports[a9_0x4fb0('0x3')]=void 0x0;function splitTasksIntoStages(_0x458410){const _0x5b0605=[];const _0x30b652=new Set(Object['values'](_0x458410[a9_0x4fb0('0x4')])[a9_0x4fb0('0x2')](_0x4da67b=>_0x4da67b['id']));let _0xf4bbe0=0x0;while(_0x30b652[a9_0x4fb0('0x5')]>0x0){const _0x1b6ec6=_0x5b0605[_0xf4bbe0]=[];for(const _0x426a8a of _0x30b652){let _0x29aa3a=!![];for(const _0x6a22e9 of _0x458410[a9_0x4fb0('0x0')][_0x426a8a]){if(_0x30b652['has'](_0x6a22e9)){_0x29aa3a=![];break;}}if(!_0x29aa3a){continue;}const _0x37e0e9=_0x458410['tasks'][_0x426a8a];_0x1b6ec6[a9_0x4fb0('0x6')](_0x37e0e9);}for(const _0x259aa7 of _0x1b6ec6){_0x30b652['delete'](_0x259aa7['id']);}_0xf4bbe0++;}return _0x5b0605;}exports[a9_0x4fb0('0x3')]=splitTasksIntoStages;
@@ -1,77 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TaskGraphCreator = void 0;
4
- const { getDependencyConfigs } = require('../../../utilities/nx-imports');
5
- /**
6
- * This is only used for versions of Nx prior to 14 where the task graph
7
- * wasn't part of the context so we have to recreate it
8
- */
9
- class TaskGraphCreator {
10
- constructor(projectGraph, defaultTargetDependencies) {
11
- this.projectGraph = projectGraph;
12
- this.defaultTargetDependencies = defaultTargetDependencies;
13
- }
14
- createTaskGraph(tasks) {
15
- const graph = {
16
- roots: [],
17
- tasks: {},
18
- dependencies: {},
19
- };
20
- for (const task of tasks) {
21
- this.addTaskToGraph(task, graph);
22
- const dependencyConfigs = getDependencyConfigs(task.target, this.defaultTargetDependencies, this.projectGraph);
23
- if (!dependencyConfigs) {
24
- continue;
25
- }
26
- this.addTaskDependencies(task, dependencyConfigs, tasks, graph);
27
- }
28
- graph.roots = Object.keys(graph.dependencies).filter((k) => graph.dependencies[k].length === 0);
29
- return graph;
30
- }
31
- addTaskDependencies(task, dependencyConfigs, tasks, graph) {
32
- for (const dependencyConfig of dependencyConfigs) {
33
- if (dependencyConfig.projects === 'self') {
34
- for (const t of tasks) {
35
- if (t.target.project === task.target.project &&
36
- t.target.target === dependencyConfig.target) {
37
- graph.dependencies[task.id].push(t.id);
38
- }
39
- }
40
- }
41
- else if (dependencyConfig.projects === 'dependencies') {
42
- const seen = new Set();
43
- this.addDependencies(task.target.project, dependencyConfig.target, tasks, graph, task.id, seen);
44
- }
45
- }
46
- }
47
- addDependencies(project, target, tasks, graph, taskId, seen) {
48
- seen.add(project);
49
- const dependencies = this.projectGraph.dependencies[project];
50
- if (dependencies) {
51
- const projectDependencies = dependencies.map((dependency) => dependency.target);
52
- for (const projectDependency of projectDependencies) {
53
- if (seen.has(projectDependency)) {
54
- continue;
55
- }
56
- const dependency = this.findTask({ project: projectDependency, target }, tasks);
57
- if (dependency) {
58
- if (graph.dependencies[taskId].indexOf(dependency.id) === -1) {
59
- graph.dependencies[taskId].push(dependency.id);
60
- }
61
- }
62
- else {
63
- this.addDependencies(projectDependency, target, tasks, graph, taskId, seen);
64
- }
65
- }
66
- }
67
- }
68
- findTask({ project, target }, tasks) {
69
- return tasks.find((t) => t.target.project === project && t.target.target === target);
70
- }
71
- addTaskToGraph(task, graph) {
72
- graph.tasks[task.id] = task;
73
- graph.dependencies[task.id] = [];
74
- }
75
- }
76
- exports.TaskGraphCreator = TaskGraphCreator;
77
- //# sourceMappingURL=task-graph-creator.js.map
1
+ const a10_0x3a0a=['find','findTask','has','dependencies','project','map','keys','indexOf','addTaskDependencies','addTaskToGraph','roots','projects','projectGraph','__esModule','createTaskGraph','add','target','tasks','length','push','TaskGraphCreator','defaultTargetDependencies','addDependencies','defineProperty'];(function(_0x3868df,_0x3a0a61){const _0x530a42=function(_0x1b2e7e){while(--_0x1b2e7e){_0x3868df['push'](_0x3868df['shift']());}};_0x530a42(++_0x3a0a61);}(a10_0x3a0a,0x151));const a10_0x530a=function(_0x3868df,_0x3a0a61){_0x3868df=_0x3868df-0x0;let _0x530a42=a10_0x3a0a[_0x3868df];return _0x530a42;};'use strict';Object[a10_0x530a('0x16')](exports,a10_0x530a('0xc'),{'value':!![]});exports[a10_0x530a('0x13')]=void 0x0;const {getDependencyConfigs}=require('../../../utilities/nx-imports');class TaskGraphCreator{constructor(_0x2ba2c3,_0xb9e8b7){this['projectGraph']=_0x2ba2c3;this[a10_0x530a('0x14')]=_0xb9e8b7;}[a10_0x530a('0xd')](_0x5c26c9){const _0x1e495a={'roots':[],'tasks':{},'dependencies':{}};for(const _0x264fbc of _0x5c26c9){this[a10_0x530a('0x8')](_0x264fbc,_0x1e495a);const _0x539a8f=getDependencyConfigs(_0x264fbc[a10_0x530a('0xf')],this[a10_0x530a('0x14')],this[a10_0x530a('0xb')]);if(!_0x539a8f){continue;}this[a10_0x530a('0x7')](_0x264fbc,_0x539a8f,_0x5c26c9,_0x1e495a);}_0x1e495a[a10_0x530a('0x9')]=Object[a10_0x530a('0x5')](_0x1e495a['dependencies'])['filter'](_0x2f2b09=>_0x1e495a[a10_0x530a('0x2')][_0x2f2b09][a10_0x530a('0x11')]===0x0);return _0x1e495a;}[a10_0x530a('0x7')](_0x2409b7,_0x3bbea1,_0x451da6,_0x3e5637){for(const _0x59c085 of _0x3bbea1){if(_0x59c085[a10_0x530a('0xa')]==='self'){for(const _0x214742 of _0x451da6){if(_0x214742[a10_0x530a('0xf')][a10_0x530a('0x3')]===_0x2409b7[a10_0x530a('0xf')][a10_0x530a('0x3')]&&_0x214742[a10_0x530a('0xf')][a10_0x530a('0xf')]===_0x59c085[a10_0x530a('0xf')]){_0x3e5637[a10_0x530a('0x2')][_0x2409b7['id']][a10_0x530a('0x12')](_0x214742['id']);}}}else if(_0x59c085[a10_0x530a('0xa')]===a10_0x530a('0x2')){const _0x1cec20=new Set();this[a10_0x530a('0x15')](_0x2409b7[a10_0x530a('0xf')][a10_0x530a('0x3')],_0x59c085[a10_0x530a('0xf')],_0x451da6,_0x3e5637,_0x2409b7['id'],_0x1cec20);}}}[a10_0x530a('0x15')](_0x38bfd9,_0x45d2b7,_0x5ed4a6,_0x6d162,_0x1819cb,_0x23b887){_0x23b887[a10_0x530a('0xe')](_0x38bfd9);const _0x1966a1=this[a10_0x530a('0xb')]['dependencies'][_0x38bfd9];if(_0x1966a1){const _0x3ea21e=_0x1966a1[a10_0x530a('0x4')](_0x3f1413=>_0x3f1413[a10_0x530a('0xf')]);for(const _0x117199 of _0x3ea21e){if(_0x23b887[a10_0x530a('0x1')](_0x117199)){continue;}const _0x5ed89f=this['findTask']({'project':_0x117199,'target':_0x45d2b7},_0x5ed4a6);if(_0x5ed89f){if(_0x6d162[a10_0x530a('0x2')][_0x1819cb][a10_0x530a('0x6')](_0x5ed89f['id'])===-0x1){_0x6d162[a10_0x530a('0x2')][_0x1819cb][a10_0x530a('0x12')](_0x5ed89f['id']);}}else{this[a10_0x530a('0x15')](_0x117199,_0x45d2b7,_0x5ed4a6,_0x6d162,_0x1819cb,_0x23b887);}}}}[a10_0x530a('0x0')]({project,target},_0x2a3bcf){return _0x2a3bcf[a10_0x530a('0x17')](_0x304871=>_0x304871[a10_0x530a('0xf')][a10_0x530a('0x3')]===project&&_0x304871[a10_0x530a('0xf')]['target']===target);}[a10_0x530a('0x8')](_0x1c061a,_0x1559ab){_0x1559ab[a10_0x530a('0x10')][_0x1c061a['id']]=_0x1c061a;_0x1559ab['dependencies'][_0x1c061a['id']]=[];}}exports['TaskGraphCreator']=TaskGraphCreator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/nx-cloud",
3
- "version": "14.5.0-beta.4",
3
+ "version": "14.5.2",
4
4
  "description": "Nx Cloud plugin for Nx",
5
5
  "keywords": [
6
6
  "Monorepo",