@nrwl/nx-cloud 14.5.0-beta.2 → 14.5.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.
@@ -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_0x371d=['\x20seconds.','readFileSync','configuration','parse','url','../../../utilities/environment','commandStatus','target','createUnchangedValueTimeout','apply','./task-graph-creator','stdout','TaskGraphCreator','Command\x20execution\x20failed.','error:\x20','taskGraph','../../api/error-reporter.api','splitTasksIntoStages','build','Status\x20update','See\x20run\x20details\x20at\x20','executionStatus','./node_modules/.cache/nx','assign','retrieve','../../../utilities/create-unchanged-value-timeout','completedTasks','toString','Main\x20job\x20was\x20terminated\x20via\x20SIGTERM','ENCRYPTION_KEY','projectGraph','Error:','get','message','../../../utilities/metric-logger','getRunGroup','submitRunMetrics','VERBOSE_LOGGING','createStartRequest','copyFilesFromCache','write','join','../../file-storage/file-storage','../../../utilities/serializer-overrides','strictlyOrderedTargets','../../error/print-run-group-error','then','number\x20of\x20completed\x20tasks:\x20','find','runUrl','DistributedExecutionApi','run','/nx.json','taskId','wait','tasks','terminalOutput','error','value','Waiter','start','Extracting\x20artifacts','executionId:\x20','Successfully\x20completed\x20running\x20the\x20command.','success','Main\x20job\x20terminated\x20with\x20an\x20error:\x20\x22','criticalErrorMessage','Unable\x20to\x20complete\x20a\x20run.','__esModule','E2EEncryption','completeRunGroupWithError','./split-task-graph-into-stages','COMPLETED','note','strip-json-comments','hash','nodes','FileStorage','targetDependencies','endTask','reset','values','Starting\x20distributed\x20command\x20execution','exit','done','Distributed\x20Execution\x20Terminated','executionStatus:\x20','axiosException','next','Processing\x20task\x20','encryptionKey','cacheDirectory','SIGTERM','printRunGroupError','nxCloudDistributedTasksRunner','ErrorReporterApi','Waiting...','NO_COMPLETED_TASKS_TIMEOUT','./distributed-execution.api','scheduleTask','Found\x20unknown\x20task:\x20','../../file-storage/e2e-encryption','serializeOverrides'];(function(_0x4b376b,_0x371d6b){const _0x34b3fc=function(_0x4f1cbe){while(--_0x4f1cbe){_0x4b376b['push'](_0x4b376b['shift']());}};_0x34b3fc(++_0x371d6b);}(a8_0x371d,0x1a0));const a8_0x34b3=function(_0x4b376b,_0x371d6b){_0x4b376b=_0x4b376b-0x0;let _0x34b3fc=a8_0x371d[_0x4b376b];return _0x34b3fc;};'use strict';var __awaiter=this&&this['__awaiter']||function(_0x12be12,_0x4b1453,_0x1cecc6,_0x533f21){function _0x25942e(_0xb5def2){return _0xb5def2 instanceof _0x1cecc6?_0xb5def2:new _0x1cecc6(function(_0x23dacc){_0x23dacc(_0xb5def2);});}return new(_0x1cecc6||(_0x1cecc6=Promise))(function(_0x439273,_0x145440){function _0x5ee2c0(_0x7bf919){try{_0x7d591a(_0x533f21[a8_0x34b3('0x54')](_0x7bf919));}catch(_0x188aed){_0x145440(_0x188aed);}}function _0x26914a(_0x5b48d0){try{_0x7d591a(_0x533f21['throw'](_0x5b48d0));}catch(_0x3b9bea){_0x145440(_0x3b9bea);}}function _0x7d591a(_0x4c8bb6){_0x4c8bb6[a8_0x34b3('0x50')]?_0x439273(_0x4c8bb6['value']):_0x25942e(_0x4c8bb6[a8_0x34b3('0x36')])[a8_0x34b3('0x2a')](_0x5ee2c0,_0x26914a);}_0x7d591a((_0x533f21=_0x533f21[a8_0x34b3('0x5')](_0x12be12,_0x4b1453||[]))[a8_0x34b3('0x54')]());});};Object['defineProperty'](exports,a8_0x34b3('0x40'),{'value':!![]});exports[a8_0x34b3('0x5a')]=void 0x0;const fs_1=require('fs');const stripJsonComments=require(a8_0x34b3('0x46'));const create_unchanged_value_timeout_1=require(a8_0x34b3('0x15'));const environment_1=require(a8_0x34b3('0x1'));const metric_logger_1=require(a8_0x34b3('0x1e'));const serializer_overrides_1=require(a8_0x34b3('0x27'));const waiter_1=require('../../../utilities/waiter');const error_reporter_api_1=require(a8_0x34b3('0xc'));const print_run_group_error_1=require(a8_0x34b3('0x29'));const e2e_encryption_1=require(a8_0x34b3('0x61'));const file_storage_1=require(a8_0x34b3('0x26'));const distributed_execution_api_1=require(a8_0x34b3('0x5e'));const split_task_graph_into_stages_1=require(a8_0x34b3('0x43'));const task_graph_creator_1=require(a8_0x34b3('0x6'));const {output,workspaceRoot,getOutputs,Cache}=require('../../../utilities/nx-imports');class NoopLifeCycle{[a8_0x34b3('0x5f')](_0x1bb5b6){}['startTask'](_0x1b111d){}[a8_0x34b3('0x4b')](_0x4913cf,_0x241f7c){}}function runDistributedExecution(_0x15a844,_0x36007e,_0x2dd376,_0x573d54,_0x4b7870,_0x2afb79,_0x5ec5e3){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x51cb9e=yield _0x15a844[a8_0x34b3('0x38')]((0x0,distributed_execution_api_1[a8_0x34b3('0x22')])(_0x2afb79,(0x0,split_task_graph_into_stages_1[a8_0x34b3('0xd')])(_0x5ec5e3),_0x36007e));return yield processTasks(_0x15a844,_0x573d54,_0x4b7870,_0x36007e,_0x51cb9e,Object[a8_0x34b3('0x4d')](_0x5ec5e3[a8_0x34b3('0x33')]),_0x2dd376);});}function processTasks(_0x2be397,_0x31823b,_0x547937,_0x2098ec,_0xc740ae,_0x22e580,_0x38bb5c){return __awaiter(this,void 0x0,void 0x0,function*(){const _0x2903db={};const _0x4f76dd=(0x0,create_unchanged_value_timeout_1[a8_0x34b3('0x4')])({'title':'No\x20new\x20completed\x20tasks\x20after\x20'+environment_1[a8_0x34b3('0x5d')]/0x3e8+a8_0x34b3('0x63'),'timeout':environment_1[a8_0x34b3('0x5d')]});const _0x46e786=new waiter_1[(a8_0x34b3('0x37'))]();while(!![]){if(environment_1[a8_0x34b3('0x21')]){output[a8_0x34b3('0x45')]({'title':a8_0x34b3('0x5c')});}yield _0x46e786[a8_0x34b3('0x32')]();const _0x3e4e32=yield _0x2be397['status'](_0xc740ae);if(environment_1[a8_0x34b3('0x21')]){output['note']({'title':a8_0x34b3('0xf'),'bodyLines':[a8_0x34b3('0x3a')+_0xc740ae,a8_0x34b3('0x52')+_0x3e4e32[a8_0x34b3('0x11')],a8_0x34b3('0x2b')+_0x3e4e32['completedTasks']['length'],a8_0x34b3('0xa')+_0x3e4e32[a8_0x34b3('0x3e')]]});}if(_0x3e4e32[a8_0x34b3('0x3e')]){output[a8_0x34b3('0x35')]({'title':a8_0x34b3('0x51'),'bodyLines':[a8_0x34b3('0x1b'),_0x3e4e32[a8_0x34b3('0x3e')]]});process['exit'](0x1);}_0x4f76dd(_0x3e4e32[a8_0x34b3('0x16')]['length']);for(const _0x62d2fe of _0x3e4e32[a8_0x34b3('0x16')]){if(_0x2903db[_0x62d2fe[a8_0x34b3('0x31')]])continue;yield processTask(_0x31823b,_0x547937,_0x38bb5c,_0x2098ec,_0x22e580,_0x62d2fe);_0x46e786[a8_0x34b3('0x4c')]();_0x2903db[_0x62d2fe['taskId']]=!![];}if(_0x3e4e32[a8_0x34b3('0x11')]===a8_0x34b3('0x44')){return{'commandStatus':_0x3e4e32[a8_0x34b3('0x2')],'runUrl':_0x3e4e32[a8_0x34b3('0x2d')]};}}});}function processTask(_0x556249,_0x1f9a63,_0x3cb150,_0xb52b3,_0x20b5da,_0x197268){return __awaiter(this,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a8_0x34b3('0x45')]({'title':a8_0x34b3('0x55')+_0x197268['taskId']});}const _0x1fede0=_0x20b5da[a8_0x34b3('0x2c')](_0x30f449=>_0x197268[a8_0x34b3('0x31')]===_0x30f449['id']);if(!_0x1fede0){throw new Error(a8_0x34b3('0x60')+_0x197268[a8_0x34b3('0x31')]);}if(environment_1[a8_0x34b3('0x21')]){output[a8_0x34b3('0x45')]({'title':'Retrieving\x20artifacts\x20from\x20'+_0x197268[a8_0x34b3('0x0')]});}yield _0x556249[a8_0x34b3('0x14')](_0x197268[a8_0x34b3('0x47')],_0x197268['url'],_0xb52b3[a8_0x34b3('0x57')]||a8_0x34b3('0x12'));const _0x5bdd69=yield _0x1f9a63[a8_0x34b3('0x1c')](Object['assign'](Object[a8_0x34b3('0x13')]({},_0x1fede0),{'hash':_0x197268[a8_0x34b3('0x47')]}));const _0x1e82b5=getOutputs(_0x3cb150['projectGraph'][a8_0x34b3('0x48')],_0x1fede0);if(environment_1[a8_0x34b3('0x21')]){output[a8_0x34b3('0x45')]({'title':a8_0x34b3('0x39'),'bodyLines':_0x1e82b5});}yield _0x1f9a63[a8_0x34b3('0x23')](_0x197268[a8_0x34b3('0x47')],_0x5bdd69,_0x1e82b5);output['logCommand'](getCommand(_0x1fede0));process[a8_0x34b3('0x7')][a8_0x34b3('0x24')](_0x5bdd69[a8_0x34b3('0x34')]);output['addVerticalSeparator']();});}function getCommand(_0x9005bf){const _0x5938da=_0x9005bf[a8_0x34b3('0x3')][a8_0x34b3('0x65')]?':'+_0x9005bf['target'][a8_0x34b3('0x65')]:'';return['nx',a8_0x34b3('0x2f'),_0x9005bf[a8_0x34b3('0x3')]['project']+':'+_0x9005bf['target'][a8_0x34b3('0x3')]+_0x5938da,(0x0,serializer_overrides_1[a8_0x34b3('0x62')])(_0x9005bf)][a8_0x34b3('0x25')]('\x20');}function attachSignalListenersToCompleteRunGroupOnError(_0x58a5bd,_0x2ebe43){process['on']('SIGINT',()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x58a5bd[a8_0x34b3('0x42')](_0x2ebe43,'Main\x20job\x20was\x20terminated\x20via\x20SIGINT');process[a8_0x34b3('0x4f')](0x1);}));process['on'](a8_0x34b3('0x58'),()=>__awaiter(this,void 0x0,void 0x0,function*(){yield _0x58a5bd[a8_0x34b3('0x42')](_0x2ebe43,a8_0x34b3('0x18'));process[a8_0x34b3('0x4f')](0x1);}));}const nxCloudDistributedTasksRunner=(_0x49ab31,_0x569f51,_0x4d7567)=>__awaiter(void 0x0,void 0x0,void 0x0,function*(){if(environment_1['VERBOSE_LOGGING']){output[a8_0x34b3('0x45')]({'title':a8_0x34b3('0x4e')});}_0x569f51['lifeCycle']=new NoopLifeCycle();const _0x6d2523=(0x0,environment_1[a8_0x34b3('0x1f')])();if(!_0x6d2523){(0x0,print_run_group_error_1[a8_0x34b3('0x59')])();return process[a8_0x34b3('0x4f')](0x1);}const _0x53907e=new e2e_encryption_1[(a8_0x34b3('0x41'))](environment_1[a8_0x34b3('0x19')]||_0x569f51[a8_0x34b3('0x56')]);const _0x3f193f=new error_reporter_api_1[(a8_0x34b3('0x5b'))](_0x569f51);const _0x1331c4=new file_storage_1[(a8_0x34b3('0x49'))](_0x53907e,_0x3f193f,!![],![]);const _0x9c3746=new Cache(_0x569f51);const _0x1e9caa=new distributed_execution_api_1[(a8_0x34b3('0x2e'))](_0x569f51);attachSignalListenersToCompleteRunGroupOnError(_0x1e9caa,_0x6d2523);try{const _0x2f141d=getTaskGraph(_0x4d7567,_0x49ab31,_0x569f51);const _0x5be54f=yield runDistributedExecution(_0x1e9caa,_0x569f51,_0x4d7567,_0x1331c4,_0x9c3746,_0x6d2523,_0x2f141d);if(_0x5be54f[a8_0x34b3('0x2')]===0x0){output[a8_0x34b3('0x3c')]({'title':a8_0x34b3('0x3b'),'bodyLines':[a8_0x34b3('0x10')+_0x5be54f[a8_0x34b3('0x2d')]]});}else{output[a8_0x34b3('0x35')]({'title':a8_0x34b3('0x9'),'bodyLines':['See\x20run\x20details\x20at\x20'+_0x5be54f['runUrl']]});}yield(0x0,metric_logger_1[a8_0x34b3('0x20')])(_0x569f51);process[a8_0x34b3('0x4f')](_0x5be54f[a8_0x34b3('0x2')]);}catch(_0x2239e6){output[a8_0x34b3('0x35')]({'title':a8_0x34b3('0x3f'),'bodyLines':[_0x2239e6[a8_0x34b3('0x1d')]]});if(_0x2239e6[a8_0x34b3('0x53')]){console['log'](_0x2239e6[a8_0x34b3('0x53')]);}else{console['log'](_0x2239e6);}try{yield _0x1e9caa[a8_0x34b3('0x42')](_0x6d2523,a8_0x34b3('0x3d')+_0x2239e6['message']+'\x22');}finally{process[a8_0x34b3('0x4f')](0x1);}}});exports['nxCloudDistributedTasksRunner']=nxCloudDistributedTasksRunner;function getTaskGraph(_0x1d73fb,_0xc5fa56,_0x28f179){if(_0x1d73fb['taskGraph']){return _0x1d73fb[a8_0x34b3('0xb')];}else{const _0x164c5c=JSON[a8_0x34b3('0x66')](stripJsonComments((0x0,fs_1[a8_0x34b3('0x64')])(workspaceRoot+a8_0x34b3('0x30'))[a8_0x34b3('0x17')]()));return new task_graph_creator_1[(a8_0x34b3('0x8'))](_0x1d73fb[a8_0x34b3('0x1a')],getDefaultDependencyConfigs(_0x164c5c,_0x28f179))['createTaskGraph'](_0xc5fa56);}}function getDefaultDependencyConfigs(_0x4ce304,_0x3355f8){var _0x3164d3,_0x5a7148;const _0x51f3bb=(_0x3164d3=_0x4ce304[a8_0x34b3('0x4a')])!==null&&_0x3164d3!==void 0x0?_0x3164d3:{};const _0x3d4b6c=_0x3355f8?(_0x5a7148=_0x3355f8[a8_0x34b3('0x28')])!==null&&_0x5a7148!==void 0x0?_0x5a7148:[a8_0x34b3('0xe')]:[];for(const _0x888aa8 of _0x3d4b6c){_0x51f3bb[_0x888aa8]=_0x51f3bb[_0x888aa8]||[];_0x51f3bb[_0x888aa8]['push']({'target':_0x888aa8,'projects':'dependencies'});}return _0x51f3bb;}
@@ -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_0x24d5=['delete','has','dependencies','size','tasks','splitTasksIntoStages','defineProperty','values','__esModule'];(function(_0x1d8a68,_0x24d5f7){const _0x32dead=function(_0x3fc651){while(--_0x3fc651){_0x1d8a68['push'](_0x1d8a68['shift']());}};_0x32dead(++_0x24d5f7);}(a9_0x24d5,0xe0));const a9_0x32de=function(_0x1d8a68,_0x24d5f7){_0x1d8a68=_0x1d8a68-0x0;let _0x32dead=a9_0x24d5[_0x1d8a68];return _0x32dead;};'use strict';Object[a9_0x32de('0x7')](exports,a9_0x32de('0x0'),{'value':!![]});exports[a9_0x32de('0x6')]=void 0x0;function splitTasksIntoStages(_0xf94bf6){const _0xa935b4=[];const _0x702e42=new Set(Object[a9_0x32de('0x8')](_0xf94bf6[a9_0x32de('0x5')])['map'](_0x56f732=>_0x56f732['id']));let _0x594401=0x0;while(_0x702e42[a9_0x32de('0x4')]>0x0){const _0x50279c=_0xa935b4[_0x594401]=[];for(const _0x2300d9 of _0x702e42){let _0xb60453=!![];for(const _0x73046a of _0xf94bf6[a9_0x32de('0x3')][_0x2300d9]){if(_0x702e42[a9_0x32de('0x2')](_0x73046a)){_0xb60453=![];break;}}if(!_0xb60453){continue;}const _0x8e2c03=_0xf94bf6[a9_0x32de('0x5')][_0x2300d9];_0x50279c['push'](_0x8e2c03);}for(const _0x50943e of _0x50279c){_0x702e42[a9_0x32de('0x1')](_0x50943e['id']);}_0x594401++;}return _0xa935b4;}exports[a9_0x32de('0x6')]=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_0x4a35=['add','addTaskToGraph','roots','map','addDependencies','tasks','target','createTaskGraph','dependencies','project','has','indexOf','../../../utilities/nx-imports','projects','defaultTargetDependencies','defineProperty','__esModule','addTaskDependencies','TaskGraphCreator','findTask','push','projectGraph','keys'];(function(_0x3f7b4f,_0x4a35d9){const _0x5d123b=function(_0x301adc){while(--_0x301adc){_0x3f7b4f['push'](_0x3f7b4f['shift']());}};_0x5d123b(++_0x4a35d9);}(a10_0x4a35,0x16e));const a10_0x5d12=function(_0x3f7b4f,_0x4a35d9){_0x3f7b4f=_0x3f7b4f-0x0;let _0x5d123b=a10_0x4a35[_0x3f7b4f];return _0x5d123b;};'use strict';Object[a10_0x5d12('0x11')](exports,a10_0x5d12('0x12'),{'value':!![]});exports[a10_0x5d12('0x14')]=void 0x0;const {getDependencyConfigs}=require(a10_0x5d12('0xe'));class TaskGraphCreator{constructor(_0x1e1b44,_0xb81ed5){this[a10_0x5d12('0x0')]=_0x1e1b44;this[a10_0x5d12('0x10')]=_0xb81ed5;}[a10_0x5d12('0x9')](_0x4828b0){const _0x58729e={'roots':[],'tasks':{},'dependencies':{}};for(const _0x24c020 of _0x4828b0){this[a10_0x5d12('0x3')](_0x24c020,_0x58729e);const _0x19fb9f=getDependencyConfigs(_0x24c020['target'],this[a10_0x5d12('0x10')],this[a10_0x5d12('0x0')]);if(!_0x19fb9f){continue;}this[a10_0x5d12('0x13')](_0x24c020,_0x19fb9f,_0x4828b0,_0x58729e);}_0x58729e[a10_0x5d12('0x4')]=Object[a10_0x5d12('0x1')](_0x58729e[a10_0x5d12('0xa')])['filter'](_0x57b790=>_0x58729e[a10_0x5d12('0xa')][_0x57b790]['length']===0x0);return _0x58729e;}['addTaskDependencies'](_0x5e998f,_0x290fe6,_0x1999d2,_0x1709ff){for(const _0x3ffca7 of _0x290fe6){if(_0x3ffca7[a10_0x5d12('0xf')]==='self'){for(const _0x3369f4 of _0x1999d2){if(_0x3369f4[a10_0x5d12('0x8')][a10_0x5d12('0xb')]===_0x5e998f[a10_0x5d12('0x8')]['project']&&_0x3369f4[a10_0x5d12('0x8')][a10_0x5d12('0x8')]===_0x3ffca7[a10_0x5d12('0x8')]){_0x1709ff['dependencies'][_0x5e998f['id']][a10_0x5d12('0x16')](_0x3369f4['id']);}}}else if(_0x3ffca7['projects']===a10_0x5d12('0xa')){const _0x117fa7=new Set();this[a10_0x5d12('0x6')](_0x5e998f['target']['project'],_0x3ffca7[a10_0x5d12('0x8')],_0x1999d2,_0x1709ff,_0x5e998f['id'],_0x117fa7);}}}['addDependencies'](_0x415cea,_0x4addb5,_0x1336ec,_0x400c16,_0x249464,_0x351394){_0x351394[a10_0x5d12('0x2')](_0x415cea);const _0x1e2f4f=this[a10_0x5d12('0x0')][a10_0x5d12('0xa')][_0x415cea];if(_0x1e2f4f){const _0xefc502=_0x1e2f4f[a10_0x5d12('0x5')](_0x1464f7=>_0x1464f7[a10_0x5d12('0x8')]);for(const _0x490f40 of _0xefc502){if(_0x351394[a10_0x5d12('0xc')](_0x490f40)){continue;}const _0x454b78=this[a10_0x5d12('0x15')]({'project':_0x490f40,'target':_0x4addb5},_0x1336ec);if(_0x454b78){if(_0x400c16[a10_0x5d12('0xa')][_0x249464][a10_0x5d12('0xd')](_0x454b78['id'])===-0x1){_0x400c16[a10_0x5d12('0xa')][_0x249464][a10_0x5d12('0x16')](_0x454b78['id']);}}else{this[a10_0x5d12('0x6')](_0x490f40,_0x4addb5,_0x1336ec,_0x400c16,_0x249464,_0x351394);}}}}[a10_0x5d12('0x15')]({project,target},_0x137c33){return _0x137c33['find'](_0x31574c=>_0x31574c['target']['project']===project&&_0x31574c['target'][a10_0x5d12('0x8')]===target);}[a10_0x5d12('0x3')](_0x1756ff,_0x2ab785){_0x2ab785[a10_0x5d12('0x7')][_0x1756ff['id']]=_0x1756ff;_0x2ab785[a10_0x5d12('0xa')][_0x1756ff['id']]=[];}}exports[a10_0x5d12('0x14')]=TaskGraphCreator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/nx-cloud",
3
- "version": "14.5.0-beta.2",
3
+ "version": "14.5.0",
4
4
  "description": "Nx Cloud plugin for Nx",
5
5
  "keywords": [
6
6
  "Monorepo",