@teambit/scope 0.0.881 → 0.0.882
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/dist/exceptions/component-not-found.js +0 -6
- package/dist/exceptions/component-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -6
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/no-id-match-pattern.js +0 -6
- package/dist/exceptions/no-id-match-pattern.js.map +1 -1
- package/dist/index.js +0 -14
- package/dist/index.js.map +1 -1
- package/dist/routes/action.route.js +2 -19
- package/dist/routes/action.route.js.map +1 -1
- package/dist/routes/delete.route.js +0 -11
- package/dist/routes/delete.route.js.map +1 -1
- package/dist/routes/fetch.route.js +0 -27
- package/dist/routes/fetch.route.js.map +1 -1
- package/dist/routes/index.js +0 -12
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/put.route.js +0 -18
- package/dist/routes/put.route.js.map +1 -1
- package/dist/scope-cmd.js +0 -13
- package/dist/scope-cmd.js.map +1 -1
- package/dist/scope-component-loader.js +18 -69
- package/dist/scope-component-loader.js.map +1 -1
- package/dist/scope.aspect.js +0 -5
- package/dist/scope.aspect.js.map +1 -1
- package/dist/scope.composition.js +0 -6
- package/dist/scope.composition.js.map +1 -1
- package/dist/scope.graphql.js +4 -23
- package/dist/scope.graphql.js.map +1 -1
- package/dist/scope.main.runtime.js +71 -349
- package/dist/scope.main.runtime.js.map +1 -1
- package/dist/scope.ui-root.js +0 -14
- package/dist/scope.ui-root.js.map +1 -1
- package/dist/scope.ui.drawer.js +5 -38
- package/dist/scope.ui.drawer.js.map +1 -1
- package/dist/scope.ui.runtime.js +11 -97
- package/dist/scope.ui.runtime.js.map +1 -1
- package/dist/staged-config.js +0 -35
- package/dist/staged-config.js.map +1 -1
- package/dist/ui/menu/index.js +0 -3
- package/dist/ui/menu/index.js.map +1 -1
- package/dist/ui/menu/menu.js +3 -35
- package/dist/ui/menu/menu.js.map +1 -1
- package/dist/ui/scope-overview/index.js +0 -2
- package/dist/ui/scope-overview/index.js.map +1 -1
- package/dist/ui/scope-overview/scope-overview.js +0 -32
- package/dist/ui/scope-overview/scope-overview.js.map +1 -1
- package/dist/ui/scope.js +0 -57
- package/dist/ui/scope.js.map +1 -1
- package/package-tar/teambit-scope-0.0.882.tgz +0 -0
- package/package.json +13 -13
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-scope-0.0.881.tgz +0 -0
|
@@ -1,472 +1,328 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.symbol.description.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.flat-map.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.array.iterator.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.array.unscopables.flat-map.js");
|
|
12
|
-
|
|
13
8
|
require("core-js/modules/es.promise.js");
|
|
14
|
-
|
|
15
9
|
require("core-js/modules/es.regexp.exec.js");
|
|
16
|
-
|
|
17
10
|
require("core-js/modules/es.string.replace.js");
|
|
18
|
-
|
|
19
11
|
require("core-js/modules/es.string.trim.js");
|
|
20
|
-
|
|
21
12
|
Object.defineProperty(exports, "__esModule", {
|
|
22
13
|
value: true
|
|
23
14
|
});
|
|
24
15
|
exports.ScopeMain = void 0;
|
|
25
|
-
|
|
26
16
|
function _defineProperty2() {
|
|
27
17
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
|
-
|
|
29
18
|
_defineProperty2 = function () {
|
|
30
19
|
return data;
|
|
31
20
|
};
|
|
32
|
-
|
|
33
21
|
return data;
|
|
34
22
|
}
|
|
35
|
-
|
|
36
23
|
function _pMapSeries() {
|
|
37
24
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
38
|
-
|
|
39
25
|
_pMapSeries = function () {
|
|
40
26
|
return data;
|
|
41
27
|
};
|
|
42
|
-
|
|
43
28
|
return data;
|
|
44
29
|
}
|
|
45
|
-
|
|
46
30
|
function _semver() {
|
|
47
31
|
const data = _interopRequireDefault(require("semver"));
|
|
48
|
-
|
|
49
32
|
_semver = function () {
|
|
50
33
|
return data;
|
|
51
34
|
};
|
|
52
|
-
|
|
53
35
|
return data;
|
|
54
36
|
}
|
|
55
|
-
|
|
56
37
|
function _multimatch() {
|
|
57
38
|
const data = _interopRequireDefault(require("multimatch"));
|
|
58
|
-
|
|
59
39
|
_multimatch = function () {
|
|
60
40
|
return data;
|
|
61
41
|
};
|
|
62
|
-
|
|
63
42
|
return data;
|
|
64
43
|
}
|
|
65
|
-
|
|
66
44
|
function _builder() {
|
|
67
45
|
const data = require("@teambit/builder");
|
|
68
|
-
|
|
69
46
|
_builder = function () {
|
|
70
47
|
return data;
|
|
71
48
|
};
|
|
72
|
-
|
|
73
49
|
return data;
|
|
74
50
|
}
|
|
75
|
-
|
|
76
51
|
function _fsExtra() {
|
|
77
52
|
const data = require("fs-extra");
|
|
78
|
-
|
|
79
53
|
_fsExtra = function () {
|
|
80
54
|
return data;
|
|
81
55
|
};
|
|
82
|
-
|
|
83
56
|
return data;
|
|
84
57
|
}
|
|
85
|
-
|
|
86
58
|
function _path() {
|
|
87
59
|
const data = require("path");
|
|
88
|
-
|
|
89
60
|
_path = function () {
|
|
90
61
|
return data;
|
|
91
62
|
};
|
|
92
|
-
|
|
93
63
|
return data;
|
|
94
64
|
}
|
|
95
|
-
|
|
96
65
|
function _aspectLoader() {
|
|
97
66
|
const data = require("@teambit/aspect-loader");
|
|
98
|
-
|
|
99
67
|
_aspectLoader = function () {
|
|
100
68
|
return data;
|
|
101
69
|
};
|
|
102
|
-
|
|
103
70
|
return data;
|
|
104
71
|
}
|
|
105
|
-
|
|
106
72
|
function _cli() {
|
|
107
73
|
const data = require("@teambit/cli");
|
|
108
|
-
|
|
109
74
|
_cli = function () {
|
|
110
75
|
return data;
|
|
111
76
|
};
|
|
112
|
-
|
|
113
77
|
return data;
|
|
114
78
|
}
|
|
115
|
-
|
|
116
79
|
function _component() {
|
|
117
80
|
const data = require("@teambit/component");
|
|
118
|
-
|
|
119
81
|
_component = function () {
|
|
120
82
|
return data;
|
|
121
83
|
};
|
|
122
|
-
|
|
123
84
|
return data;
|
|
124
85
|
}
|
|
125
|
-
|
|
126
86
|
function _graphql() {
|
|
127
87
|
const data = require("@teambit/graphql");
|
|
128
|
-
|
|
129
88
|
_graphql = function () {
|
|
130
89
|
return data;
|
|
131
90
|
};
|
|
132
|
-
|
|
133
91
|
return data;
|
|
134
92
|
}
|
|
135
|
-
|
|
136
93
|
function _harmony() {
|
|
137
94
|
const data = require("@teambit/harmony");
|
|
138
|
-
|
|
139
95
|
_harmony = function () {
|
|
140
96
|
return data;
|
|
141
97
|
};
|
|
142
|
-
|
|
143
98
|
return data;
|
|
144
99
|
}
|
|
145
|
-
|
|
146
100
|
function _isolator() {
|
|
147
101
|
const data = require("@teambit/isolator");
|
|
148
|
-
|
|
149
102
|
_isolator = function () {
|
|
150
103
|
return data;
|
|
151
104
|
};
|
|
152
|
-
|
|
153
105
|
return data;
|
|
154
106
|
}
|
|
155
|
-
|
|
156
107
|
function _logger() {
|
|
157
108
|
const data = require("@teambit/logger");
|
|
158
|
-
|
|
159
109
|
_logger = function () {
|
|
160
110
|
return data;
|
|
161
111
|
};
|
|
162
|
-
|
|
163
112
|
return data;
|
|
164
113
|
}
|
|
165
|
-
|
|
166
114
|
function _express() {
|
|
167
115
|
const data = require("@teambit/express");
|
|
168
|
-
|
|
169
116
|
_express = function () {
|
|
170
117
|
return data;
|
|
171
118
|
};
|
|
172
|
-
|
|
173
119
|
return data;
|
|
174
120
|
}
|
|
175
|
-
|
|
176
121
|
function _ui() {
|
|
177
122
|
const data = require("@teambit/ui");
|
|
178
|
-
|
|
179
123
|
_ui = function () {
|
|
180
124
|
return data;
|
|
181
125
|
};
|
|
182
|
-
|
|
183
126
|
return data;
|
|
184
127
|
}
|
|
185
|
-
|
|
186
128
|
function _harmonyModules() {
|
|
187
129
|
const data = require("@teambit/harmony.modules.requireable-component");
|
|
188
|
-
|
|
189
130
|
_harmonyModules = function () {
|
|
190
131
|
return data;
|
|
191
132
|
};
|
|
192
|
-
|
|
193
133
|
return data;
|
|
194
134
|
}
|
|
195
|
-
|
|
196
135
|
function _legacyBitId() {
|
|
197
136
|
const data = require("@teambit/legacy-bit-id");
|
|
198
|
-
|
|
199
137
|
_legacyBitId = function () {
|
|
200
138
|
return data;
|
|
201
139
|
};
|
|
202
|
-
|
|
203
140
|
return data;
|
|
204
141
|
}
|
|
205
|
-
|
|
206
142
|
function _bitId() {
|
|
207
143
|
const data = require("@teambit/legacy/dist/bit-id");
|
|
208
|
-
|
|
209
144
|
_bitId = function () {
|
|
210
145
|
return data;
|
|
211
146
|
};
|
|
212
|
-
|
|
213
147
|
return data;
|
|
214
148
|
}
|
|
215
|
-
|
|
216
149
|
function _objects() {
|
|
217
150
|
const data = require("@teambit/legacy/dist/scope/objects");
|
|
218
|
-
|
|
219
151
|
_objects = function () {
|
|
220
152
|
return data;
|
|
221
153
|
};
|
|
222
|
-
|
|
223
154
|
return data;
|
|
224
155
|
}
|
|
225
|
-
|
|
226
156
|
function _scopeLoader() {
|
|
227
157
|
const data = require("@teambit/legacy/dist/scope/scope-loader");
|
|
228
|
-
|
|
229
158
|
_scopeLoader = function () {
|
|
230
159
|
return data;
|
|
231
160
|
};
|
|
232
|
-
|
|
233
161
|
return data;
|
|
234
162
|
}
|
|
235
|
-
|
|
236
163
|
function _constants() {
|
|
237
164
|
const data = require("@teambit/legacy/dist/constants");
|
|
238
|
-
|
|
239
165
|
_constants = function () {
|
|
240
166
|
return data;
|
|
241
167
|
};
|
|
242
|
-
|
|
243
168
|
return data;
|
|
244
169
|
}
|
|
245
|
-
|
|
246
170
|
function _actions() {
|
|
247
171
|
const data = require("@teambit/legacy/dist/scope/actions");
|
|
248
|
-
|
|
249
172
|
_actions = function () {
|
|
250
173
|
return data;
|
|
251
174
|
};
|
|
252
|
-
|
|
253
175
|
return data;
|
|
254
176
|
}
|
|
255
|
-
|
|
256
177
|
function _scopeRemotes() {
|
|
257
178
|
const data = require("@teambit/legacy/dist/scope/scope-remotes");
|
|
258
|
-
|
|
259
179
|
_scopeRemotes = function () {
|
|
260
180
|
return data;
|
|
261
181
|
};
|
|
262
|
-
|
|
263
182
|
return data;
|
|
264
183
|
}
|
|
265
|
-
|
|
266
184
|
function _workspaceModules() {
|
|
267
185
|
const data = require("@teambit/workspace.modules.match-pattern");
|
|
268
|
-
|
|
269
186
|
_workspaceModules = function () {
|
|
270
187
|
return data;
|
|
271
188
|
};
|
|
272
|
-
|
|
273
189
|
return data;
|
|
274
190
|
}
|
|
275
|
-
|
|
276
191
|
function _scope() {
|
|
277
192
|
const data = require("@teambit/legacy/dist/scope");
|
|
278
|
-
|
|
279
193
|
_scope = function () {
|
|
280
194
|
return data;
|
|
281
195
|
};
|
|
282
|
-
|
|
283
196
|
return data;
|
|
284
197
|
}
|
|
285
|
-
|
|
286
198
|
function _objectList() {
|
|
287
199
|
const data = require("@teambit/legacy/dist/scope/objects/object-list");
|
|
288
|
-
|
|
289
200
|
_objectList = function () {
|
|
290
201
|
return data;
|
|
291
202
|
};
|
|
292
|
-
|
|
293
203
|
return data;
|
|
294
204
|
}
|
|
295
|
-
|
|
296
205
|
function _http() {
|
|
297
206
|
const data = require("@teambit/legacy/dist/scope/network/http/http");
|
|
298
|
-
|
|
299
207
|
_http = function () {
|
|
300
208
|
return data;
|
|
301
209
|
};
|
|
302
|
-
|
|
303
210
|
return data;
|
|
304
211
|
}
|
|
305
|
-
|
|
306
212
|
function _componentsGraph() {
|
|
307
213
|
const data = require("@teambit/legacy/dist/scope/graph/components-graph");
|
|
308
|
-
|
|
309
214
|
_componentsGraph = function () {
|
|
310
215
|
return data;
|
|
311
216
|
};
|
|
312
|
-
|
|
313
217
|
return data;
|
|
314
218
|
}
|
|
315
|
-
|
|
316
219
|
function _scope2() {
|
|
317
220
|
const data = require("@teambit/legacy/dist/api/scope");
|
|
318
|
-
|
|
319
221
|
_scope2 = function () {
|
|
320
222
|
return data;
|
|
321
223
|
};
|
|
322
|
-
|
|
323
224
|
return data;
|
|
324
225
|
}
|
|
325
|
-
|
|
326
226
|
function _bitError() {
|
|
327
227
|
const data = require("@teambit/bit-error");
|
|
328
|
-
|
|
329
228
|
_bitError = function () {
|
|
330
229
|
return data;
|
|
331
230
|
};
|
|
332
|
-
|
|
333
231
|
return data;
|
|
334
232
|
}
|
|
335
|
-
|
|
336
233
|
function _exportScopeComponents() {
|
|
337
234
|
const data = require("@teambit/legacy/dist/scope/component-ops/export-scope-components");
|
|
338
|
-
|
|
339
235
|
_exportScopeComponents = function () {
|
|
340
236
|
return data;
|
|
341
237
|
};
|
|
342
|
-
|
|
343
238
|
return data;
|
|
344
239
|
}
|
|
345
|
-
|
|
346
240
|
function _config() {
|
|
347
241
|
const data = require("@teambit/legacy/dist/consumer/config");
|
|
348
|
-
|
|
349
242
|
_config = function () {
|
|
350
243
|
return data;
|
|
351
244
|
};
|
|
352
|
-
|
|
353
245
|
return data;
|
|
354
246
|
}
|
|
355
|
-
|
|
356
247
|
function _envs() {
|
|
357
248
|
const data = _interopRequireDefault(require("@teambit/envs"));
|
|
358
|
-
|
|
359
249
|
_envs = function () {
|
|
360
250
|
return data;
|
|
361
251
|
};
|
|
362
|
-
|
|
363
252
|
return data;
|
|
364
253
|
}
|
|
365
|
-
|
|
366
254
|
function _lodash() {
|
|
367
255
|
const data = require("lodash");
|
|
368
|
-
|
|
369
256
|
_lodash = function () {
|
|
370
257
|
return data;
|
|
371
258
|
};
|
|
372
|
-
|
|
373
259
|
return data;
|
|
374
260
|
}
|
|
375
|
-
|
|
376
261
|
function _exceptions() {
|
|
377
262
|
const data = require("./exceptions");
|
|
378
|
-
|
|
379
263
|
_exceptions = function () {
|
|
380
264
|
return data;
|
|
381
265
|
};
|
|
382
|
-
|
|
383
266
|
return data;
|
|
384
267
|
}
|
|
385
|
-
|
|
386
268
|
function _scope3() {
|
|
387
269
|
const data = require("./scope.aspect");
|
|
388
|
-
|
|
389
270
|
_scope3 = function () {
|
|
390
271
|
return data;
|
|
391
272
|
};
|
|
392
|
-
|
|
393
273
|
return data;
|
|
394
274
|
}
|
|
395
|
-
|
|
396
275
|
function _scope4() {
|
|
397
276
|
const data = require("./scope.graphql");
|
|
398
|
-
|
|
399
277
|
_scope4 = function () {
|
|
400
278
|
return data;
|
|
401
279
|
};
|
|
402
|
-
|
|
403
280
|
return data;
|
|
404
281
|
}
|
|
405
|
-
|
|
406
282
|
function _scope5() {
|
|
407
283
|
const data = require("./scope.ui-root");
|
|
408
|
-
|
|
409
284
|
_scope5 = function () {
|
|
410
285
|
return data;
|
|
411
286
|
};
|
|
412
|
-
|
|
413
287
|
return data;
|
|
414
288
|
}
|
|
415
|
-
|
|
416
289
|
function _routes() {
|
|
417
290
|
const data = require("./routes");
|
|
418
|
-
|
|
419
291
|
_routes = function () {
|
|
420
292
|
return data;
|
|
421
293
|
};
|
|
422
|
-
|
|
423
294
|
return data;
|
|
424
295
|
}
|
|
425
|
-
|
|
426
296
|
function _scopeComponentLoader() {
|
|
427
297
|
const data = require("./scope-component-loader");
|
|
428
|
-
|
|
429
298
|
_scopeComponentLoader = function () {
|
|
430
299
|
return data;
|
|
431
300
|
};
|
|
432
|
-
|
|
433
301
|
return data;
|
|
434
302
|
}
|
|
435
|
-
|
|
436
303
|
function _scopeCmd() {
|
|
437
304
|
const data = require("./scope-cmd");
|
|
438
|
-
|
|
439
305
|
_scopeCmd = function () {
|
|
440
306
|
return data;
|
|
441
307
|
};
|
|
442
|
-
|
|
443
308
|
return data;
|
|
444
309
|
}
|
|
445
|
-
|
|
446
310
|
function _stagedConfig() {
|
|
447
311
|
const data = require("./staged-config");
|
|
448
|
-
|
|
449
312
|
_stagedConfig = function () {
|
|
450
313
|
return data;
|
|
451
314
|
};
|
|
452
|
-
|
|
453
315
|
return data;
|
|
454
316
|
}
|
|
455
|
-
|
|
456
317
|
function _noIdMatchPattern() {
|
|
457
318
|
const data = require("./exceptions/no-id-match-pattern");
|
|
458
|
-
|
|
459
319
|
_noIdMatchPattern = function () {
|
|
460
320
|
return data;
|
|
461
321
|
};
|
|
462
|
-
|
|
463
322
|
return data;
|
|
464
323
|
}
|
|
465
|
-
|
|
466
324
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
467
|
-
|
|
468
325
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
469
|
-
|
|
470
326
|
class ScopeMain {
|
|
471
327
|
constructor(
|
|
472
328
|
/**
|
|
@@ -484,6 +340,7 @@ class ScopeMain {
|
|
|
484
340
|
/**
|
|
485
341
|
* slot registry for subscribing to build
|
|
486
342
|
*/
|
|
343
|
+
|
|
487
344
|
config, postPutSlot, postDeleteSlot, postExportSlot, postObjectsPersist, preFetchObjects, isolator, aspectLoader, logger, envs) {
|
|
488
345
|
this.harmony = harmony;
|
|
489
346
|
this.legacyScope = legacyScope;
|
|
@@ -502,62 +359,55 @@ class ScopeMain {
|
|
|
502
359
|
(0, _defineProperty2().default)(this, "localAspects", []);
|
|
503
360
|
this.componentLoader = new (_scopeComponentLoader().ScopeComponentLoader)(this, this.logger);
|
|
504
361
|
}
|
|
362
|
+
|
|
505
363
|
/**
|
|
506
364
|
* name of the scope
|
|
507
365
|
*/
|
|
508
|
-
|
|
509
|
-
|
|
510
366
|
get name() {
|
|
511
367
|
return this.legacyScope.name;
|
|
512
368
|
}
|
|
513
|
-
|
|
514
369
|
get icon() {
|
|
515
370
|
return this.config.icon;
|
|
516
371
|
}
|
|
517
|
-
|
|
518
372
|
get backgroundIconColor() {
|
|
519
373
|
return this.config.backgroundIconColor;
|
|
520
374
|
}
|
|
521
|
-
|
|
522
375
|
get description() {
|
|
523
376
|
return this.config.description;
|
|
524
377
|
}
|
|
525
|
-
|
|
526
378
|
get path() {
|
|
527
379
|
return this.legacyScope.path;
|
|
528
380
|
}
|
|
529
|
-
|
|
530
381
|
get isLegacy() {
|
|
531
382
|
return this.legacyScope.isLegacy;
|
|
532
|
-
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// We need to reload the aspects with their new version since:
|
|
533
386
|
// during get many by legacy, we go load component which in turn go to getEnv
|
|
534
387
|
// get env validates that the env written on the component is really exist by checking the envs slot registry
|
|
535
388
|
// when we load here, it's env version in the aspect list already has the new version in case the env itself is being tagged
|
|
536
389
|
// so we are search for the env in the registry with the new version number
|
|
537
390
|
// but since the env only registered during the on load of the bit process (before the tag) it's version in the registry is only the old one
|
|
538
391
|
// once we reload them we will have it registered with the new version as well
|
|
539
|
-
|
|
540
|
-
|
|
541
392
|
async reloadAspectsWithNewVersion(components) {
|
|
542
|
-
const host = this.componentExtension.getHost();
|
|
393
|
+
const host = this.componentExtension.getHost();
|
|
543
394
|
|
|
395
|
+
// Return only aspects that defined on components but not in the root config file (workspace.jsonc/scope.jsonc)
|
|
544
396
|
const getUserAspectsIdsWithoutRootIds = () => {
|
|
545
397
|
const allUserAspectIds = this.aspectLoader.getUserAspects();
|
|
546
398
|
const rootIds = Object.keys(this.harmony.config.toObject());
|
|
547
399
|
const diffIds = (0, _lodash().difference)(allUserAspectIds, rootIds);
|
|
548
400
|
return diffIds;
|
|
549
|
-
};
|
|
550
|
-
|
|
401
|
+
};
|
|
551
402
|
|
|
403
|
+
// Based on the list of components to be tagged return those who are loaded to harmony with their used version
|
|
552
404
|
const getAspectsByPreviouslyUsedVersion = async () => {
|
|
553
405
|
const harmonyIds = getUserAspectsIdsWithoutRootIds();
|
|
554
406
|
const aspectsIds = [];
|
|
555
407
|
const aspectsP = components.map(async component => {
|
|
556
408
|
const newId = await host.resolveComponentId(component.id);
|
|
557
|
-
|
|
558
409
|
if (component.previouslyUsedVersion && component.version && component.previouslyUsedVersion !== component.version) {
|
|
559
410
|
const newIdWithPreviouslyUsedVersion = newId.changeVersion(component.previouslyUsedVersion);
|
|
560
|
-
|
|
561
411
|
if (harmonyIds.includes(newIdWithPreviouslyUsedVersion.toString())) {
|
|
562
412
|
aspectsIds.push(newId.toString());
|
|
563
413
|
}
|
|
@@ -566,81 +416,69 @@ class ScopeMain {
|
|
|
566
416
|
await Promise.all(aspectsP);
|
|
567
417
|
return aspectsIds;
|
|
568
418
|
};
|
|
569
|
-
|
|
570
419
|
const idsToLoad = await getAspectsByPreviouslyUsedVersion();
|
|
571
420
|
await host.loadAspects(idsToLoad, false, 'scope.reloadAspectsWithNewVersion');
|
|
572
421
|
}
|
|
573
|
-
|
|
574
422
|
getManyByLegacy(components) {
|
|
575
423
|
return (0, _pMapSeries().default)(components, async component => this.getFromConsumerComponent(component));
|
|
576
424
|
}
|
|
577
|
-
|
|
578
425
|
clearCache() {
|
|
579
426
|
this.logger.debug('clearing the components and the legacy cache');
|
|
580
427
|
this.componentLoader.clearCache();
|
|
581
428
|
this.legacyScope.objects.clearCache();
|
|
582
429
|
}
|
|
583
|
-
|
|
584
430
|
builderDataMapToLegacyOnTagResults(builderDataComponentMap) {
|
|
585
431
|
const builderDataToLegacyExtension = (component, builderData) => {
|
|
586
432
|
var _component$state$aspe;
|
|
587
|
-
|
|
588
433
|
const existingBuilder = (_component$state$aspe = component.state.aspects.get(_builder().BuilderAspect.id)) === null || _component$state$aspe === void 0 ? void 0 : _component$state$aspe.legacy;
|
|
589
434
|
const builderExtension = existingBuilder || new (_config().ExtensionDataEntry)(undefined, undefined, _builder().BuilderAspect.id);
|
|
590
435
|
builderExtension.data = builderData;
|
|
591
436
|
return builderExtension;
|
|
592
437
|
};
|
|
593
|
-
|
|
594
438
|
return builderDataComponentMap.toArray().map(([component, builderData]) => ({
|
|
595
439
|
id: component.id._legacy,
|
|
596
440
|
builderData: builderDataToLegacyExtension(component, builderData)
|
|
597
441
|
}));
|
|
598
442
|
}
|
|
443
|
+
|
|
599
444
|
/**
|
|
600
445
|
* register to the post-export slot.
|
|
601
446
|
*/
|
|
602
|
-
|
|
603
|
-
|
|
604
447
|
onPostPut(postPutFn) {
|
|
605
448
|
this.postPutSlot.register(postPutFn);
|
|
606
449
|
return this;
|
|
607
450
|
}
|
|
451
|
+
|
|
608
452
|
/**
|
|
609
453
|
* register to the post-delete slot.
|
|
610
454
|
*/
|
|
611
|
-
|
|
612
|
-
|
|
613
455
|
onPostDelete(postDeleteFn) {
|
|
614
456
|
this.postDeleteSlot.register(postDeleteFn);
|
|
615
457
|
return this;
|
|
616
458
|
}
|
|
459
|
+
|
|
617
460
|
/**
|
|
618
461
|
* register to the post-export slot.
|
|
619
462
|
*/
|
|
620
|
-
|
|
621
|
-
|
|
622
463
|
registerOnPostExport(postExportFn) {
|
|
623
464
|
this.postExportSlot.register(postExportFn);
|
|
624
465
|
return this;
|
|
625
466
|
}
|
|
626
|
-
|
|
627
467
|
registerOnPreFetchObjects(preFetchObjectsFn) {
|
|
628
468
|
this.preFetchObjects.register(preFetchObjectsFn);
|
|
629
469
|
return this;
|
|
630
470
|
}
|
|
631
|
-
|
|
632
471
|
registerOnPostObjectsPersist(postObjectsPersistFn) {
|
|
633
472
|
this.postObjectsPersist.register(postObjectsPersistFn);
|
|
634
473
|
return this;
|
|
635
474
|
}
|
|
475
|
+
|
|
636
476
|
/**
|
|
637
477
|
* Will fetch a list of components into the current scope.
|
|
638
478
|
* This will only fetch the object and won't write the files to the actual FS
|
|
639
479
|
*
|
|
640
480
|
* @param {ComponentsIds} ids list of ids to fetch
|
|
641
481
|
*/
|
|
642
|
-
|
|
643
|
-
|
|
644
482
|
fetch(ids) {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
645
483
|
|
|
646
484
|
/**
|
|
@@ -649,11 +487,8 @@ class ScopeMain {
|
|
|
649
487
|
* @param {Component[]} components A list of components to seal with specific persist options (such as message and version number)
|
|
650
488
|
* @param {PersistOptions} persistGeneralOptions General persistence options such as verbose
|
|
651
489
|
*/
|
|
652
|
-
|
|
653
|
-
|
|
654
490
|
persist(components, options) {} // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
655
491
|
|
|
656
|
-
|
|
657
492
|
async delete({
|
|
658
493
|
ids,
|
|
659
494
|
force,
|
|
@@ -683,18 +518,16 @@ class ScopeMain {
|
|
|
683
518
|
});
|
|
684
519
|
return result;
|
|
685
520
|
}
|
|
686
|
-
|
|
687
521
|
async toObjectList(types) {
|
|
688
522
|
const objects = await this.legacyScope.objects.list(types);
|
|
689
523
|
return _objectList().ObjectList.fromBitObjects(objects);
|
|
690
|
-
}
|
|
691
|
-
|
|
524
|
+
}
|
|
692
525
|
|
|
526
|
+
// TODO: temporary compiler workaround - discuss this with david.
|
|
693
527
|
toJs(str) {
|
|
694
528
|
if (str.endsWith('.ts')) return str.replace('.ts', '.js');
|
|
695
529
|
return str;
|
|
696
530
|
}
|
|
697
|
-
|
|
698
531
|
parseLocalAspect(localAspects) {
|
|
699
532
|
const dirPaths = localAspects.map(localAspect => (0, _path().resolve)(localAspect.replace('file://', '')));
|
|
700
533
|
const nonExistsDirPaths = dirPaths.filter(path => !(0, _fsExtra().existsSync)(path));
|
|
@@ -702,35 +535,27 @@ class ScopeMain {
|
|
|
702
535
|
const existsDirPaths = dirPaths.filter(path => (0, _fsExtra().existsSync)(path));
|
|
703
536
|
return existsDirPaths;
|
|
704
537
|
}
|
|
705
|
-
|
|
706
538
|
findRuntime(dirPath, runtime) {
|
|
707
539
|
const files = (0, _fsExtra().readdirSync)((0, _path().join)(dirPath, 'dist'));
|
|
708
540
|
return files.find(path => path.includes(`${runtime}.runtime.js`));
|
|
709
541
|
}
|
|
710
|
-
|
|
711
542
|
async loadAspectFromPath(localAspects) {
|
|
712
543
|
const dirPaths = this.parseLocalAspect(localAspects);
|
|
713
544
|
const manifests = dirPaths.map(dirPath => {
|
|
714
545
|
const scopeRuntime = this.findRuntime(dirPath, 'scope');
|
|
715
|
-
|
|
716
546
|
if (scopeRuntime) {
|
|
717
547
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
718
548
|
const module = require((0, _path().join)(dirPath, 'dist', scopeRuntime));
|
|
719
|
-
|
|
720
549
|
return module.default || module;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
|
|
550
|
+
}
|
|
551
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
724
552
|
const module = require(dirPath);
|
|
725
|
-
|
|
726
553
|
return module.default || module;
|
|
727
554
|
});
|
|
728
555
|
await this.aspectLoader.loadExtensionsByManifests(manifests, true);
|
|
729
556
|
}
|
|
730
|
-
|
|
731
557
|
async loadAspects(ids, throwOnError = false, neededFor) {
|
|
732
558
|
var _grouped$envs, _grouped$other;
|
|
733
|
-
|
|
734
559
|
// generate a random callId to be able to identify the call from the logs
|
|
735
560
|
const callId = Math.floor(Math.random() * 1000);
|
|
736
561
|
const loggerPrefix = `[${callId}] loadAspects,`;
|
|
@@ -745,12 +570,11 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
745
570
|
this.logger.debug(`${loggerPrefix} finish loading aspects`);
|
|
746
571
|
return envsManifestsIds.concat(otherManifestsIds);
|
|
747
572
|
}
|
|
573
|
+
|
|
748
574
|
/**
|
|
749
575
|
* This function get's a list of aspect ids and return them grouped by whether any of them is the env of other from the list
|
|
750
576
|
* @param ids
|
|
751
577
|
*/
|
|
752
|
-
|
|
753
|
-
|
|
754
578
|
async groupAspectIdsByEnvOfTheList(ids) {
|
|
755
579
|
const components = await this.getNonLoadedAspects(ids);
|
|
756
580
|
const envsIds = (0, _lodash().uniq)(components.map(component => this.envs.getEnvId(component)).filter(envId => !this.aspectLoader.isCoreEnv(envId)));
|
|
@@ -760,7 +584,6 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
760
584
|
});
|
|
761
585
|
return grouped;
|
|
762
586
|
}
|
|
763
|
-
|
|
764
587
|
async getManifestsAndLoadAspects(ids = [], throwOnError = false) {
|
|
765
588
|
const {
|
|
766
589
|
manifests: scopeManifests,
|
|
@@ -774,35 +597,32 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
774
597
|
const allManifests = scopeManifests.concat(scopePluginsManifests);
|
|
775
598
|
return (0, _lodash().compact)(allManifests.map(manifest => manifest.id));
|
|
776
599
|
}
|
|
777
|
-
|
|
778
600
|
async getManifestsGraphRecursively(ids, visited = [], throwOnError = false, opts = {}) {
|
|
779
601
|
ids = (0, _lodash().uniq)(ids);
|
|
780
602
|
this.logger.debug(`getManifestsGraphRecursively, ids:\n${ids.join('\n')}`);
|
|
781
603
|
const nonVisitedId = ids.filter(id => !visited.includes(id));
|
|
782
|
-
|
|
783
604
|
if (!nonVisitedId.length) {
|
|
784
605
|
return {
|
|
785
606
|
manifests: [],
|
|
786
607
|
potentialPluginsIds: []
|
|
787
608
|
};
|
|
788
609
|
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
610
|
+
const components = await this.getNonLoadedAspects(nonVisitedId);
|
|
611
|
+
// Adding all the envs ids to the array to support case when one (or more) of the aspects has custom aspect env
|
|
612
|
+
const customEnvsIds = components.map(component => this.envs.getEnvId(component)).filter(envId => !this.aspectLoader.isCoreEnv(envId));
|
|
613
|
+
// In case there is custom env we need to load it right away, otherwise we will fail during the require aspects
|
|
794
614
|
await this.getManifestsAndLoadAspects(customEnvsIds);
|
|
795
615
|
visited.push(...nonVisitedId);
|
|
796
616
|
const manifests = await this.requireAspects(components, throwOnError, opts);
|
|
797
617
|
const potentialPluginsIds = (0, _lodash().compact)(manifests.map((manifest, index) => {
|
|
798
|
-
if (this.aspectLoader.isValidAspect(manifest)) return undefined;
|
|
799
|
-
|
|
618
|
+
if (this.aspectLoader.isValidAspect(manifest)) return undefined;
|
|
619
|
+
// return index;
|
|
800
620
|
return components[index].id.toString();
|
|
801
621
|
}));
|
|
802
622
|
const depsToLoad = [];
|
|
803
623
|
await (0, _pMapSeries().default)(manifests, async manifest => {
|
|
804
|
-
depsToLoad.push(...(manifest.dependencies || []));
|
|
805
|
-
|
|
624
|
+
depsToLoad.push(...(manifest.dependencies || []));
|
|
625
|
+
// @ts-ignore
|
|
806
626
|
(manifest._runtimes || []).forEach(runtime => {
|
|
807
627
|
depsToLoad.push(...(runtime.dependencies || []));
|
|
808
628
|
});
|
|
@@ -818,17 +638,16 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
818
638
|
potentialPluginsIds
|
|
819
639
|
};
|
|
820
640
|
}
|
|
821
|
-
|
|
822
641
|
async getNonLoadedAspects(ids) {
|
|
823
642
|
const notLoadedIds = ids.filter(id => !this.aspectLoader.isAspectLoaded(id));
|
|
824
643
|
if (!notLoadedIds.length) return [];
|
|
825
644
|
const coreAspectsStringIds = this.aspectLoader.getCoreAspectIds();
|
|
826
645
|
const idsWithoutCore = (0, _lodash().difference)(ids, coreAspectsStringIds);
|
|
827
|
-
const aspectIds = idsWithoutCore.filter(id => !id.startsWith('file://'));
|
|
828
|
-
|
|
646
|
+
const aspectIds = idsWithoutCore.filter(id => !id.startsWith('file://'));
|
|
647
|
+
// TODO: use diff instead of filter twice
|
|
829
648
|
const localAspects = ids.filter(id => id.startsWith('file://'));
|
|
830
|
-
this.localAspects = this.localAspects.concat(localAspects);
|
|
831
|
-
|
|
649
|
+
this.localAspects = this.localAspects.concat(localAspects);
|
|
650
|
+
// load local aspects for debugging purposes.
|
|
832
651
|
await this.loadAspectFromPath(localAspects);
|
|
833
652
|
const componentIds = await this.resolveMultipleComponentIds(aspectIds);
|
|
834
653
|
if (!componentIds || !componentIds.length) return [];
|
|
@@ -837,7 +656,6 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
837
656
|
});
|
|
838
657
|
return components;
|
|
839
658
|
}
|
|
840
|
-
|
|
841
659
|
async resolveLocalAspects(ids, runtime) {
|
|
842
660
|
const dirs = this.parseLocalAspect(ids);
|
|
843
661
|
return dirs.map(dir => {
|
|
@@ -845,12 +663,11 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
845
663
|
return new (_aspectLoader().AspectDefinition)(dir, runtimeManifest ? (0, _path().join)(dir, 'dist', runtimeManifest) : null, undefined, undefined, true);
|
|
846
664
|
});
|
|
847
665
|
}
|
|
848
|
-
|
|
849
666
|
async getResolvedAspects(components, opts) {
|
|
850
667
|
var _opts$skipIfExists;
|
|
851
|
-
|
|
852
668
|
if (!components || !components.length) return [];
|
|
853
|
-
const network = await this.isolator.isolateComponents(components.map(c => c.id),
|
|
669
|
+
const network = await this.isolator.isolateComponents(components.map(c => c.id),
|
|
670
|
+
// includeFromNestedHosts - to support case when you are in a workspace, trying to load aspect defined in the workspace.jsonc but not part of the workspace
|
|
854
671
|
{
|
|
855
672
|
baseDir: this.getAspectCapsulePath(),
|
|
856
673
|
skipIfExists: (_opts$skipIfExists = opts === null || opts === void 0 ? void 0 : opts.skipIfExists) !== null && _opts$skipIfExists !== void 0 ? _opts$skipIfExists : true,
|
|
@@ -870,32 +687,26 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
870
687
|
return new (_harmonyModules().RequireableComponent)(capsule.component, async () => {
|
|
871
688
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
872
689
|
const plugins = this.aspectLoader.getPlugins(capsule.component, capsule.path);
|
|
873
|
-
|
|
874
690
|
if (plugins.has()) {
|
|
875
691
|
await this.compileIfNoDist(capsule, capsule.component);
|
|
876
692
|
return plugins.load(_cli().MainRuntime.name);
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
|
|
693
|
+
}
|
|
694
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
880
695
|
const aspect = require(capsule.path);
|
|
881
|
-
|
|
882
696
|
const scopeRuntime = await this.aspectLoader.getRuntimePath(capsule.component, capsule.path, 'scope');
|
|
883
697
|
const mainRuntime = await this.aspectLoader.getRuntimePath(capsule.component, capsule.path, _cli().MainRuntime.name);
|
|
884
|
-
const runtimePath = scopeRuntime || mainRuntime;
|
|
885
|
-
|
|
886
|
-
if (runtimePath) require(runtimePath);
|
|
887
|
-
|
|
698
|
+
const runtimePath = scopeRuntime || mainRuntime;
|
|
699
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
700
|
+
if (runtimePath) require(runtimePath);
|
|
701
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
888
702
|
return aspect;
|
|
889
703
|
}, capsule);
|
|
890
704
|
});
|
|
891
705
|
}
|
|
892
|
-
|
|
893
706
|
async compileIfNoDist(capsule, component) {
|
|
894
707
|
const env = this.envs.getEnv(component);
|
|
895
708
|
const compiler = env.env.getCompiler();
|
|
896
|
-
|
|
897
709
|
const distDir = (compiler === null || compiler === void 0 ? void 0 : compiler.distDir) || _constants().DEFAULT_DIST_DIRNAME;
|
|
898
|
-
|
|
899
710
|
const distExists = (0, _fsExtra().existsSync)((0, _path().join)(capsule.path, distDir));
|
|
900
711
|
if (distExists) return;
|
|
901
712
|
const compiledCode = component.filesystem.files.flatMap(file => {
|
|
@@ -905,14 +716,12 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
905
716
|
outputPath: file.path
|
|
906
717
|
}];
|
|
907
718
|
}
|
|
908
|
-
|
|
909
719
|
if (compiler.transpileFile) {
|
|
910
720
|
return compiler.transpileFile(file.contents.toString('utf8'), {
|
|
911
721
|
filePath: file.path,
|
|
912
722
|
componentDir: capsule.path
|
|
913
723
|
});
|
|
914
724
|
}
|
|
915
|
-
|
|
916
725
|
return [];
|
|
917
726
|
});
|
|
918
727
|
await Promise.all((0, _lodash().compact)(compiledCode).map(compiledFile => {
|
|
@@ -920,32 +729,25 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
920
729
|
return capsule === null || capsule === void 0 ? void 0 : capsule.outputFile(path, compiledFile.outputText);
|
|
921
730
|
}));
|
|
922
731
|
}
|
|
923
|
-
|
|
924
732
|
async tryCompile(requirableAspect) {
|
|
925
733
|
if (requirableAspect.capsule) return this.compileIfNoDist(requirableAspect.capsule, requirableAspect.component);
|
|
926
734
|
return undefined;
|
|
927
735
|
}
|
|
928
|
-
|
|
929
736
|
async requireAspects(components, throwOnError = false, opts = {}) {
|
|
930
737
|
const requireableExtensions = await this.getResolvedAspects(components, opts);
|
|
931
|
-
|
|
932
738
|
if (!requireableExtensions) {
|
|
933
739
|
return [];
|
|
934
740
|
}
|
|
935
|
-
|
|
936
741
|
let error;
|
|
937
742
|
let erroredId = '';
|
|
938
|
-
|
|
939
743
|
const requireWithCatch = async requireableAspects => {
|
|
940
744
|
error = undefined;
|
|
941
|
-
|
|
942
745
|
try {
|
|
943
746
|
const manifests = await (0, _pMapSeries().default)(requireableAspects, async requireableExtension => {
|
|
944
747
|
try {
|
|
945
748
|
return await this.aspectLoader.doRequire(requireableExtension);
|
|
946
749
|
} catch (err) {
|
|
947
750
|
erroredId = requireableExtension.component.id.toString();
|
|
948
|
-
|
|
949
751
|
if (err.code === 'MODULE_NOT_FOUND') {
|
|
950
752
|
try {
|
|
951
753
|
await this.tryCompile(requireableExtension);
|
|
@@ -955,7 +757,6 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
955
757
|
throw newErr;
|
|
956
758
|
}
|
|
957
759
|
}
|
|
958
|
-
|
|
959
760
|
error = err;
|
|
960
761
|
throw err;
|
|
961
762
|
}
|
|
@@ -965,33 +766,26 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
965
766
|
return null;
|
|
966
767
|
}
|
|
967
768
|
};
|
|
968
|
-
|
|
969
769
|
const manifests = await requireWithCatch(requireableExtensions);
|
|
970
|
-
|
|
971
770
|
if (!error) {
|
|
972
771
|
return (0, _lodash().compact)(manifests);
|
|
973
772
|
}
|
|
974
|
-
|
|
975
773
|
if (error.code === 'MODULE_NOT_FOUND') {
|
|
976
774
|
this.logger.warn(`failed loading aspects from capsules due to MODULE_NOT_FOUND error, re-creating the capsules and trying again`);
|
|
977
775
|
const resolvedAspectsAgain = await this.getResolvedAspects(components, _objectSpread(_objectSpread({}, opts), {}, {
|
|
978
776
|
skipIfExists: false
|
|
979
777
|
}));
|
|
980
778
|
const manifestAgain = await requireWithCatch(resolvedAspectsAgain);
|
|
981
|
-
|
|
982
779
|
if (!error) {
|
|
983
780
|
return (0, _lodash().compact)(manifestAgain);
|
|
984
781
|
}
|
|
985
782
|
}
|
|
986
|
-
|
|
987
783
|
this.aspectLoader.handleExtensionLoadingError(error, erroredId, throwOnError);
|
|
988
784
|
return [];
|
|
989
785
|
}
|
|
990
|
-
|
|
991
786
|
getAspectCapsulePath() {
|
|
992
787
|
return `${this.path}-aspects`;
|
|
993
788
|
}
|
|
994
|
-
|
|
995
789
|
async resolveUserAspects(runtimeName, userAspectsIds) {
|
|
996
790
|
if (!userAspectsIds || !userAspectsIds.length) return [];
|
|
997
791
|
const components = await this.getMany(userAspectsIds);
|
|
@@ -1027,7 +821,6 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1027
821
|
});
|
|
1028
822
|
return aspectDefs;
|
|
1029
823
|
}
|
|
1030
|
-
|
|
1031
824
|
async resolveAspects(runtimeName, componentIds, opts) {
|
|
1032
825
|
const originalStringIds = componentIds === null || componentIds === void 0 ? void 0 : componentIds.map(id => id.toString());
|
|
1033
826
|
this.logger.debug(`scope resolveAspects, runtimeName: ${runtimeName}, componentIds: ${originalStringIds}`);
|
|
@@ -1035,23 +828,18 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1035
828
|
excludeCore: false,
|
|
1036
829
|
requestedOnly: false
|
|
1037
830
|
};
|
|
1038
|
-
|
|
1039
831
|
const mergedOpts = _objectSpread(_objectSpread({}, defaultOpts), opts);
|
|
1040
|
-
|
|
1041
832
|
const coreAspectsIds = this.aspectLoader.getCoreAspectIds();
|
|
1042
833
|
let userAspectsIds;
|
|
1043
834
|
let requestedCoreStringIds;
|
|
1044
|
-
|
|
1045
835
|
if (componentIds && componentIds.length) {
|
|
1046
836
|
var _groupedByIsCore$true;
|
|
1047
|
-
|
|
1048
837
|
const groupedByIsCore = (0, _lodash().groupBy)(componentIds, id => coreAspectsIds.includes(id.toString()));
|
|
1049
838
|
userAspectsIds = groupedByIsCore.false || [];
|
|
1050
839
|
requestedCoreStringIds = ((_groupedByIsCore$true = groupedByIsCore.true) === null || _groupedByIsCore$true === void 0 ? void 0 : _groupedByIsCore$true.map(id => id.toStringWithoutVersion())) || [];
|
|
1051
840
|
} else {
|
|
1052
841
|
userAspectsIds = await this.resolveMultipleComponentIds(this.aspectLoader.getUserAspects());
|
|
1053
842
|
}
|
|
1054
|
-
|
|
1055
843
|
const withoutLocalAspects = userAspectsIds.filter(aspectId => {
|
|
1056
844
|
return !this.localAspects.find(localAspect => {
|
|
1057
845
|
return localAspect.includes(aspectId.fullName.replace('/', '.'));
|
|
@@ -1062,62 +850,51 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1062
850
|
const coreAspectsDefs = await this.aspectLoader.getCoreAspectDefs(runtimeName);
|
|
1063
851
|
const allDefs = userAspectsDefs.concat(coreAspectsDefs).concat(localResolved);
|
|
1064
852
|
let afterExclusion = allDefs;
|
|
1065
|
-
|
|
1066
853
|
if (mergedOpts.excludeCore) {
|
|
1067
854
|
const userAspectsIdsWithoutVersion = userAspectsIds.map(aspectId => aspectId.toStringWithoutVersion());
|
|
1068
855
|
const userAspectsIdsWithoutVersionAndCoreRequested = userAspectsIdsWithoutVersion.concat(requestedCoreStringIds);
|
|
1069
856
|
afterExclusion = allDefs.filter(def => {
|
|
1070
857
|
const id = _component().ComponentID.fromString(def.getId || '');
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
858
|
+
const isTarget = userAspectsIdsWithoutVersionAndCoreRequested.includes(id.toStringWithoutVersion());
|
|
859
|
+
// If it's core, but requested explicitly, keep it
|
|
1074
860
|
if (isTarget) return true;
|
|
1075
861
|
const isCore = coreAspectsDefs.find(coreId => def.getId === coreId.getId);
|
|
1076
862
|
return !isCore;
|
|
1077
863
|
});
|
|
1078
864
|
}
|
|
1079
|
-
|
|
1080
865
|
const uniqDefs = (0, _lodash().uniqBy)(afterExclusion, def => `${def.aspectPath}-${def.runtimePath}`);
|
|
1081
866
|
let defs = uniqDefs;
|
|
1082
|
-
|
|
1083
867
|
if (runtimeName) {
|
|
1084
868
|
defs = defs.filter(def => def.runtimePath);
|
|
1085
869
|
}
|
|
1086
|
-
|
|
1087
870
|
if (componentIds && componentIds.length && mergedOpts.requestedOnly) {
|
|
1088
871
|
const componentIdsString = componentIds.map(id => id.toString());
|
|
1089
872
|
defs = defs.filter(def => {
|
|
1090
873
|
var _def$component;
|
|
1091
|
-
|
|
1092
874
|
return def.id && componentIdsString.includes(def.id) || def.component && componentIdsString.includes((_def$component = def.component) === null || _def$component === void 0 ? void 0 : _def$component.id.toString());
|
|
1093
875
|
});
|
|
1094
876
|
}
|
|
1095
|
-
|
|
1096
877
|
return defs;
|
|
1097
878
|
}
|
|
1098
|
-
|
|
1099
879
|
async getLegacyGraph(ids) {
|
|
1100
880
|
if (!ids || ids.length < 1) ids = (await this.list()).map(comp => comp.id) || [];
|
|
1101
881
|
const legacyIds = ids.map(id => {
|
|
1102
|
-
let bitId = id._legacy;
|
|
882
|
+
let bitId = id._legacy;
|
|
883
|
+
// The resolve bitId in scope will remove the scope name in case it's the same as the scope
|
|
1103
884
|
// We restore it back to use it correctly in the legacy code.
|
|
1104
|
-
|
|
1105
885
|
if (!bitId.hasScope()) {
|
|
1106
886
|
var _this$legacyScope;
|
|
1107
|
-
|
|
1108
887
|
bitId = bitId.changeScope((_this$legacyScope = this.legacyScope) === null || _this$legacyScope === void 0 ? void 0 : _this$legacyScope.name);
|
|
1109
888
|
}
|
|
1110
|
-
|
|
1111
889
|
return bitId;
|
|
1112
890
|
});
|
|
1113
891
|
const legacyGraph = await (0, _componentsGraph().buildOneGraphForComponentsUsingScope)(legacyIds, this.legacyScope);
|
|
1114
892
|
return legacyGraph;
|
|
1115
893
|
}
|
|
894
|
+
|
|
1116
895
|
/**
|
|
1117
896
|
* import components into the scope.
|
|
1118
897
|
*/
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
898
|
async import(ids, {
|
|
1122
899
|
useCache = true,
|
|
1123
900
|
throwIfNotExist = false,
|
|
@@ -1136,81 +913,69 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1136
913
|
await this.legacyScope.import(_bitId().BitIds.fromArray(withoutOwnScopeAndLocals), useCache, reFetchUnBuiltVersion, lanes);
|
|
1137
914
|
return this.getMany(ids, throwIfNotExist);
|
|
1138
915
|
}
|
|
1139
|
-
|
|
1140
916
|
async get(id) {
|
|
1141
917
|
return this.componentLoader.get(id);
|
|
1142
918
|
}
|
|
1143
|
-
|
|
1144
919
|
async getFromConsumerComponent(consumerComponent) {
|
|
1145
920
|
return this.componentLoader.getFromConsumerComponent(consumerComponent);
|
|
1146
921
|
}
|
|
922
|
+
|
|
1147
923
|
/**
|
|
1148
924
|
* get a component from a remote without importing it
|
|
1149
925
|
*/
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
926
|
async getRemoteComponent(id) {
|
|
1153
927
|
return this.componentLoader.getRemoteComponent(id);
|
|
1154
928
|
}
|
|
929
|
+
|
|
1155
930
|
/**
|
|
1156
931
|
* get a component from a remote without importing it
|
|
1157
932
|
*/
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
933
|
async getManyRemoteComponents(ids) {
|
|
1161
934
|
return this.componentLoader.getManyRemoteComponents(ids);
|
|
1162
935
|
}
|
|
936
|
+
|
|
1163
937
|
/**
|
|
1164
938
|
* list all components in the scope.
|
|
1165
939
|
*/
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
940
|
async list(filter, includeCache = false, includeFromLanes = false) {
|
|
1169
941
|
const patternsWithScope = (filter === null || filter === void 0 ? void 0 : filter.namespaces) && (filter === null || filter === void 0 ? void 0 : filter.namespaces.map(pattern => `**/${pattern || '**'}`)) || undefined;
|
|
1170
942
|
const componentsIds = await this.listIds(includeCache, includeFromLanes, patternsWithScope);
|
|
1171
943
|
return this.getMany(filter && filter.limit ? (0, _lodash().slice)(componentsIds, filter.offset, filter.offset + filter.limit) : componentsIds);
|
|
1172
944
|
}
|
|
945
|
+
|
|
1173
946
|
/**
|
|
1174
947
|
* for now, list of invalid components are mostly useful for the workspace.
|
|
1175
948
|
* in the future, this can return components that failed to load in the scope due to objects file
|
|
1176
949
|
* corruption or similar issues.
|
|
1177
950
|
*/
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
951
|
async listInvalid() {
|
|
1181
952
|
return [];
|
|
1182
953
|
}
|
|
954
|
+
|
|
1183
955
|
/**
|
|
1184
956
|
* get ids of all scope components.
|
|
1185
957
|
* @param includeCache whether or not include components that their scope-name is different than the current scope-name
|
|
1186
958
|
*/
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
959
|
async listIds(includeCache = false, includeFromLanes = false, patterns) {
|
|
1190
960
|
const allModelComponents = await this.legacyScope.list();
|
|
1191
|
-
|
|
1192
961
|
const filterByCacheAndLanes = modelComponent => {
|
|
1193
962
|
const cacheFilter = includeCache ? true : this.exists(modelComponent);
|
|
1194
963
|
const lanesFilter = includeFromLanes ? true : modelComponent.hasHead();
|
|
1195
964
|
return cacheFilter && lanesFilter;
|
|
1196
965
|
};
|
|
1197
|
-
|
|
1198
966
|
const modelComponentsToList = allModelComponents.filter(filterByCacheAndLanes);
|
|
1199
967
|
let ids = modelComponentsToList.map(component => _component().ComponentID.fromLegacy(component.toBitIdWithLatestVersion(), component.scope || this.name));
|
|
1200
|
-
|
|
1201
968
|
if (patterns && patterns.length > 0) {
|
|
1202
969
|
ids = ids.filter(id => patterns === null || patterns === void 0 ? void 0 : patterns.some(pattern => (0, _workspaceModules().isMatchNamespacePatternItem)(id.toStringWithoutVersion(), pattern).match));
|
|
1203
970
|
}
|
|
1204
|
-
|
|
1205
971
|
this.logger.debug(`scope listIds: total ${ids.length} components after filter scope`);
|
|
1206
972
|
return ids;
|
|
1207
973
|
}
|
|
974
|
+
|
|
1208
975
|
/**
|
|
1209
976
|
* Check if a specific id exist in the scope
|
|
1210
977
|
* @param componentId
|
|
1211
978
|
*/
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
979
|
async hasId(componentId, includeCache = false) {
|
|
1215
980
|
if (!includeCache && componentId.scope !== this.name) return false;
|
|
1216
981
|
const opts = {
|
|
@@ -1219,19 +984,16 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1219
984
|
};
|
|
1220
985
|
return this.legacyScope.hasId(componentId._legacy, opts);
|
|
1221
986
|
}
|
|
1222
|
-
|
|
1223
987
|
async hasIdNested(componentId, includeCache = false) {
|
|
1224
988
|
return this.hasId(componentId, includeCache);
|
|
1225
989
|
}
|
|
990
|
+
|
|
1226
991
|
/**
|
|
1227
992
|
* determine whether a component exists in the scope.
|
|
1228
993
|
*/
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
994
|
exists(modelComponent) {
|
|
1232
995
|
return modelComponent.scope === this.name;
|
|
1233
996
|
}
|
|
1234
|
-
|
|
1235
997
|
async getMany(ids, throwIfNotExist = false) {
|
|
1236
998
|
const idsWithoutEmpty = (0, _lodash().compact)(ids);
|
|
1237
999
|
const componentsP = (0, _pMapSeries().default)(idsWithoutEmpty, async id => {
|
|
@@ -1240,97 +1002,83 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1240
1002
|
const components = await componentsP;
|
|
1241
1003
|
return (0, _lodash().compact)(components);
|
|
1242
1004
|
}
|
|
1005
|
+
|
|
1243
1006
|
/**
|
|
1244
1007
|
* load components from a scope and load their aspects
|
|
1245
1008
|
*/
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
1009
|
async loadMany(ids) {
|
|
1249
1010
|
const components = await (0, _pMapSeries().default)(ids, id => this.load(id));
|
|
1250
1011
|
return (0, _lodash().compact)(components);
|
|
1251
1012
|
}
|
|
1013
|
+
|
|
1252
1014
|
/**
|
|
1253
1015
|
* get a component and throw an exception if not found.
|
|
1254
1016
|
* @param id component id
|
|
1255
1017
|
*/
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
1018
|
async getOrThrow(id) {
|
|
1259
1019
|
const component = await this.get(id);
|
|
1260
1020
|
if (!component) throw new (_exceptions().ComponentNotFound)(id);
|
|
1261
1021
|
return component;
|
|
1262
1022
|
}
|
|
1023
|
+
|
|
1263
1024
|
/**
|
|
1264
1025
|
* returns a specific state of a component.
|
|
1265
1026
|
* @param id component ID.
|
|
1266
1027
|
* @param hash state hash.
|
|
1267
1028
|
*/
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
1029
|
async getState(id, hash) {
|
|
1271
1030
|
return this.componentLoader.getState(id, hash);
|
|
1272
1031
|
}
|
|
1273
|
-
|
|
1274
1032
|
async getSnap(id, hash) {
|
|
1275
1033
|
return this.componentLoader.getSnap(id, hash);
|
|
1276
1034
|
}
|
|
1277
|
-
|
|
1278
1035
|
async getLogs(id, shortHash = false, startsFrom) {
|
|
1279
1036
|
return this.legacyScope.loadComponentLogs(id._legacy, shortHash, startsFrom);
|
|
1280
1037
|
}
|
|
1281
|
-
|
|
1282
1038
|
async getStagedConfig() {
|
|
1283
1039
|
const currentLaneId = this.legacyScope.currentLaneId;
|
|
1284
1040
|
return _stagedConfig().StagedConfig.load(this.path, currentLaneId);
|
|
1285
1041
|
}
|
|
1042
|
+
|
|
1286
1043
|
/**
|
|
1287
1044
|
* resolve a component ID.
|
|
1288
1045
|
* @param id component ID.
|
|
1289
1046
|
*/
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
1047
|
async resolveComponentId(id) {
|
|
1293
1048
|
const idStr = id.toString();
|
|
1294
1049
|
const component = await this.legacyScope.loadModelComponentByIdStr(idStr);
|
|
1295
|
-
|
|
1296
1050
|
const getIdToCheck = () => {
|
|
1297
1051
|
if (component) return idStr; // component exists in the scope with the scope-name.
|
|
1298
|
-
|
|
1299
1052
|
if (idStr.startsWith(`${this.name}/`)) {
|
|
1300
1053
|
// component with the full name doesn't exist in the scope, it might be locally tagged
|
|
1301
1054
|
return idStr.replace(`${this.name}/`, '');
|
|
1302
1055
|
}
|
|
1303
|
-
|
|
1304
1056
|
return idStr;
|
|
1305
1057
|
};
|
|
1306
|
-
|
|
1307
1058
|
const IdToCheck = getIdToCheck();
|
|
1308
1059
|
const legacyId = id instanceof _legacyBitId().BitId ? id : await this.legacyScope.getParsedId(IdToCheck);
|
|
1309
1060
|
if (!legacyId.scope) return _component().ComponentID.fromLegacy(legacyId, this.name);
|
|
1310
1061
|
return _component().ComponentID.fromLegacy(legacyId);
|
|
1311
1062
|
}
|
|
1312
|
-
|
|
1313
1063
|
async resolveMultipleComponentIds(ids) {
|
|
1314
1064
|
return Promise.all(ids.map(async id => this.resolveComponentId(id)));
|
|
1315
1065
|
}
|
|
1066
|
+
|
|
1316
1067
|
/**
|
|
1317
1068
|
* @deprecated use `this.idsByPattern` instead for consistency, which supports also negation and list of patterns.
|
|
1318
1069
|
*/
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
1070
|
async byPattern(patterns, scope = '**') {
|
|
1322
1071
|
const patternsWithScope = patterns.map(pattern => `${scope}/${pattern || '**'}`);
|
|
1323
1072
|
const ids = await this.listIds(true, false, patternsWithScope);
|
|
1324
1073
|
const components = await this.getMany(ids);
|
|
1325
1074
|
return components;
|
|
1326
1075
|
}
|
|
1076
|
+
|
|
1327
1077
|
/**
|
|
1328
1078
|
* get component-ids matching the given pattern. a pattern can have multiple patterns separated by a comma.
|
|
1329
1079
|
* it uses multimatch (https://www.npmjs.com/package/multimatch) package for the matching algorithm, which supports
|
|
1330
1080
|
* (among others) negate character "!" to exclude ids. See the package page for more supported characters.
|
|
1331
1081
|
*/
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
1082
|
async idsByPattern(pattern, throwForNoMatch = true) {
|
|
1335
1083
|
if (!pattern.includes('*') && !pattern.includes(',')) {
|
|
1336
1084
|
// if it's not a pattern but just id, resolve it without multimatch to support specifying id without scope-name
|
|
@@ -1340,60 +1088,49 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1340
1088
|
if (throwForNoMatch) throw new (_bitError().BitError)(`unable to find "${pattern}" in the scope`);
|
|
1341
1089
|
return [];
|
|
1342
1090
|
}
|
|
1343
|
-
|
|
1344
1091
|
const ids = await this.listIds(true);
|
|
1345
1092
|
return this.filterIdsFromPoolIdsByPattern(pattern, ids, throwForNoMatch);
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1093
|
+
}
|
|
1348
1094
|
|
|
1095
|
+
// todo: move this to somewhere else (where?)
|
|
1349
1096
|
filterIdsFromPoolIdsByPattern(pattern, ids, throwForNoMatch = true) {
|
|
1350
1097
|
const patterns = pattern.split(',').map(p => p.trim());
|
|
1351
|
-
|
|
1352
1098
|
if (patterns.every(p => p.startsWith('!'))) {
|
|
1353
1099
|
// otherwise it'll never match anything. don't use ".push()". it must be the first item in the array.
|
|
1354
1100
|
patterns.unshift('**');
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1101
|
+
}
|
|
1102
|
+
// check also as legacyId.toString, as it doesn't have the defaultScope
|
|
1358
1103
|
const idsToCheck = id => [id.toStringWithoutVersion(), id._legacy.toStringWithoutVersion()];
|
|
1359
|
-
|
|
1360
1104
|
const idsFiltered = ids.filter(id => (0, _multimatch().default)(idsToCheck(id), patterns).length);
|
|
1361
|
-
|
|
1362
1105
|
if (throwForNoMatch && !idsFiltered.length) {
|
|
1363
1106
|
throw new (_noIdMatchPattern().NoIdMatchPattern)(pattern);
|
|
1364
1107
|
}
|
|
1365
|
-
|
|
1366
1108
|
return idsFiltered;
|
|
1367
1109
|
}
|
|
1368
|
-
|
|
1369
1110
|
async getExactVersionBySemverRange(id, range) {
|
|
1370
1111
|
var _semver$maxSatisfying;
|
|
1371
|
-
|
|
1372
1112
|
const modelComponent = await this.legacyScope.getModelComponent(id._legacy);
|
|
1373
1113
|
const versions = modelComponent.listVersions();
|
|
1374
1114
|
return (_semver$maxSatisfying = _semver().default.maxSatisfying(versions, range, {
|
|
1375
1115
|
includePrerelease: true
|
|
1376
1116
|
})) === null || _semver$maxSatisfying === void 0 ? void 0 : _semver$maxSatisfying.toString();
|
|
1377
1117
|
}
|
|
1378
|
-
|
|
1379
1118
|
async resumeExport(exportId, remotes) {
|
|
1380
1119
|
return (0, _exportScopeComponents().resumeExport)(this.legacyScope, exportId, remotes);
|
|
1381
1120
|
}
|
|
1382
|
-
|
|
1383
1121
|
async resolveId(id) {
|
|
1384
1122
|
const legacyId = await this.legacyScope.getParsedId(id);
|
|
1385
1123
|
return _component().ComponentID.fromLegacy(legacyId);
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1124
|
+
}
|
|
1388
1125
|
|
|
1126
|
+
// TODO: add new API for this
|
|
1389
1127
|
async _legacyRemotes() {
|
|
1390
1128
|
return (0, _scopeRemotes().getScopeRemotes)(this.legacyScope);
|
|
1391
1129
|
}
|
|
1130
|
+
|
|
1392
1131
|
/**
|
|
1393
1132
|
* list all component ids from a remote-scope
|
|
1394
1133
|
*/
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
1134
|
async listRemoteScope(scopeName) {
|
|
1398
1135
|
const remotes = await this._legacyRemotes();
|
|
1399
1136
|
const remote = await remotes.resolve(scopeName, this.legacyScope);
|
|
@@ -1402,48 +1139,42 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1402
1139
|
id
|
|
1403
1140
|
}) => _component().ComponentID.fromLegacy(id));
|
|
1404
1141
|
}
|
|
1142
|
+
|
|
1405
1143
|
/**
|
|
1406
1144
|
* get a component and load its aspect
|
|
1407
1145
|
*/
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
1146
|
async load(id) {
|
|
1411
1147
|
const component = await this.get(id);
|
|
1412
1148
|
if (!component) return undefined;
|
|
1413
|
-
const aspectIds = component.state.aspects.ids;
|
|
1414
|
-
|
|
1149
|
+
const aspectIds = component.state.aspects.ids;
|
|
1150
|
+
// load components from type aspects as aspects.
|
|
1415
1151
|
if (this.aspectLoader.isAspectComponent(component)) {
|
|
1416
1152
|
aspectIds.push(component.id.toString());
|
|
1417
1153
|
}
|
|
1418
|
-
|
|
1419
1154
|
await this.loadAspects(aspectIds, true, id.toString());
|
|
1420
1155
|
return component;
|
|
1421
1156
|
}
|
|
1422
|
-
|
|
1423
1157
|
async loadComponentsAspect(component) {
|
|
1424
1158
|
const aspectIds = component.state.aspects.ids;
|
|
1425
1159
|
await this.loadAspects(aspectIds, true, component.id.toString());
|
|
1426
1160
|
}
|
|
1427
|
-
|
|
1428
1161
|
async isModified() {
|
|
1429
1162
|
return false;
|
|
1430
1163
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1164
|
+
async write() {
|
|
1165
|
+
// no-op (it's relevant for the workspace only)
|
|
1433
1166
|
}
|
|
1167
|
+
|
|
1434
1168
|
/**
|
|
1435
1169
|
* declare the slots of scope extension.
|
|
1436
1170
|
*/
|
|
1437
1171
|
|
|
1438
|
-
|
|
1439
1172
|
static async provider([componentExt, ui, graphql, cli, isolator, aspectLoader, express, loggerMain, envs], config, [postPutSlot, postDeleteSlot, postExportSlot, postObjectsPersistSlot, preFetchObjectsSlot], harmony) {
|
|
1440
1173
|
const bitConfig = harmony.config.get('teambit.harmony/bit');
|
|
1441
1174
|
const legacyScope = await (0, _scopeLoader().loadScopeIfExist)(bitConfig === null || bitConfig === void 0 ? void 0 : bitConfig.cwd);
|
|
1442
|
-
|
|
1443
1175
|
if (!legacyScope) {
|
|
1444
1176
|
return undefined;
|
|
1445
1177
|
}
|
|
1446
|
-
|
|
1447
1178
|
const logger = loggerMain.createLogger(_scope3().ScopeAspect.id);
|
|
1448
1179
|
const scope = new ScopeMain(harmony, legacyScope, componentExt, config, postPutSlot, postDeleteSlot, postExportSlot, postObjectsPersistSlot, preFetchObjectsSlot, isolator, aspectLoader, logger, envs);
|
|
1449
1180
|
cli.registerOnStart(async hasWorkspace => {
|
|
@@ -1451,7 +1182,6 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1451
1182
|
await scope.loadAspects(aspectLoader.getNotLoadedConfiguredExtensions(), undefined, 'scope.cli.registerOnStart');
|
|
1452
1183
|
});
|
|
1453
1184
|
cli.register(new (_scopeCmd().ScopeCmd)());
|
|
1454
|
-
|
|
1455
1185
|
const onPutHook = async (ids, lanes, authData) => {
|
|
1456
1186
|
logger.debug(`onPutHook, started. (${ids.length} components)`);
|
|
1457
1187
|
scope.componentLoader.clearCache();
|
|
@@ -1467,16 +1197,13 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1467
1197
|
await Promise.all(fns.map(async fn => fn(data, metadata)));
|
|
1468
1198
|
logger.debug(`onPutHook, completed. (${ids.length} components)`);
|
|
1469
1199
|
};
|
|
1470
|
-
|
|
1471
1200
|
const getAuthData = () => {
|
|
1472
1201
|
const token = _http().Http.getToken();
|
|
1473
|
-
|
|
1474
1202
|
return token ? {
|
|
1475
1203
|
type: _http().DEFAULT_AUTH_TYPE,
|
|
1476
1204
|
credentials: token
|
|
1477
1205
|
} : undefined;
|
|
1478
1206
|
};
|
|
1479
|
-
|
|
1480
1207
|
const onPostExportHook = async (ids, lanes) => {
|
|
1481
1208
|
logger.debug(`onPostExportHook, started. (${ids.length} components)`);
|
|
1482
1209
|
const componentIds = await scope.resolveMultipleComponentIds(ids);
|
|
@@ -1491,7 +1218,6 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1491
1218
|
await Promise.all(fns.map(async fn => fn(data, metadata)));
|
|
1492
1219
|
logger.debug(`onPostExportHook, completed. (${ids.length} components)`);
|
|
1493
1220
|
};
|
|
1494
|
-
|
|
1495
1221
|
const onPostObjectsPersistHook = async () => {
|
|
1496
1222
|
logger.debug(`onPostObjectsPersistHook, started`);
|
|
1497
1223
|
const fns = postObjectsPersistSlot.values();
|
|
@@ -1501,21 +1227,18 @@ needed-for: ${neededFor || '<unknown>'}`);
|
|
|
1501
1227
|
await Promise.all(fns.map(async fn => fn(undefined, metadata)));
|
|
1502
1228
|
logger.debug(`onPostObjectsPersistHook, completed`);
|
|
1503
1229
|
};
|
|
1504
|
-
|
|
1505
1230
|
_actions().ExportPersist.onPutHook = onPutHook;
|
|
1506
1231
|
_actions().PostSign.onPutHook = onPutHook;
|
|
1507
1232
|
_scope().Scope.onPostExport = onPostExportHook;
|
|
1508
1233
|
_objects().Repository.onPostObjectsPersist = onPostObjectsPersistHook;
|
|
1509
|
-
express.register([new (_routes().PutRoute)(scope, postPutSlot), new (_routes().FetchRoute)(scope, logger), new (_routes().ActionRoute)(scope), new (_routes().DeleteRoute)(scope)]);
|
|
1510
|
-
|
|
1234
|
+
express.register([new (_routes().PutRoute)(scope, postPutSlot), new (_routes().FetchRoute)(scope, logger), new (_routes().ActionRoute)(scope), new (_routes().DeleteRoute)(scope)]);
|
|
1235
|
+
// @ts-ignore - @ran to implement the missing functions and remove it
|
|
1511
1236
|
ui.registerUiRoot(new (_scope5().ScopeUIRoot)(scope));
|
|
1512
1237
|
graphql.register((0, _scope4().scopeSchema)(scope));
|
|
1513
1238
|
componentExt.registerHost(scope);
|
|
1514
1239
|
return scope;
|
|
1515
1240
|
}
|
|
1516
|
-
|
|
1517
1241
|
}
|
|
1518
|
-
|
|
1519
1242
|
exports.ScopeMain = ScopeMain;
|
|
1520
1243
|
(0, _defineProperty2().default)(ScopeMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
1521
1244
|
(0, _defineProperty2().default)(ScopeMain, "runtime", _cli().MainRuntime);
|
|
@@ -1523,7 +1246,6 @@ exports.ScopeMain = ScopeMain;
|
|
|
1523
1246
|
(0, _defineProperty2().default)(ScopeMain, "defaultConfig", {
|
|
1524
1247
|
httpTimeOut: 600000
|
|
1525
1248
|
});
|
|
1526
|
-
|
|
1527
1249
|
_scope3().ScopeAspect.addRuntime(ScopeMain);
|
|
1528
1250
|
|
|
1529
1251
|
//# sourceMappingURL=scope.main.runtime.js.map
|