@teambit/pkg 0.0.881 → 0.0.883
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/index.js +0 -9
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/package-tar-filet-not-found.js +0 -6
- package/dist/exceptions/package-tar-filet-not-found.js.map +1 -1
- package/dist/exceptions/pkg-artifact-not-found.js +0 -6
- package/dist/exceptions/pkg-artifact-not-found.js.map +1 -1
- package/dist/exceptions/scope-not-found.js +0 -8
- package/dist/exceptions/scope-not-found.js.map +1 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/pack.cmd.js +6 -20
- package/dist/pack.cmd.js.map +1 -1
- package/dist/pack.task.js +0 -9
- package/dist/pack.task.js.map +1 -1
- package/dist/package-dependency/index.js +0 -6
- package/dist/package-dependency/index.js.map +1 -1
- package/dist/package-dependency/package-dependency-factory.js +6 -22
- package/dist/package-dependency/package-dependency-factory.js.map +1 -1
- package/dist/package-dependency/package-dependency.js +0 -7
- package/dist/package-dependency/package-dependency.js.map +1 -1
- package/dist/package.fragment.js +0 -10
- package/dist/package.fragment.js.map +1 -1
- package/dist/package.route.js +2 -16
- package/dist/package.route.js.map +1 -1
- package/dist/packer.js +5 -39
- package/dist/packer.js.map +1 -1
- package/dist/pkg-artifact.js +0 -3
- package/dist/pkg-artifact.js.map +1 -1
- package/dist/pkg.aspect.js +0 -5
- package/dist/pkg.aspect.js.map +1 -1
- package/dist/pkg.composition.js +0 -6
- package/dist/pkg.composition.js.map +1 -1
- package/dist/pkg.graphql.js +0 -6
- package/dist/pkg.graphql.js.map +1 -1
- package/dist/pkg.main.runtime.js +28 -204
- package/dist/pkg.main.runtime.js.map +1 -1
- package/dist/pkg.service.js +0 -19
- package/dist/pkg.service.js.map +1 -1
- package/dist/pkg.ui.runtime.js +0 -27
- package/dist/pkg.ui.runtime.js.map +1 -1
- package/dist/prepare-packages.task.js +6 -37
- package/dist/prepare-packages.task.js.map +1 -1
- package/dist/publish-dry-run.task.js +2 -12
- package/dist/publish-dry-run.task.js.map +1 -1
- package/dist/publish.cmd.js +0 -23
- package/dist/publish.cmd.js.map +1 -1
- package/dist/publish.task.js +2 -12
- package/dist/publish.task.js.map +1 -1
- package/dist/publisher.js +5 -55
- package/dist/publisher.js.map +1 -1
- package/dist/write-npm-ignore.js +0 -12
- package/dist/write-npm-ignore.js.map +1 -1
- package/package-tar/teambit-pkg-0.0.883.tgz +0 -0
- package/package.json +13 -13
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/package-tar/teambit-pkg-0.0.881.tgz +0 -0
package/dist/pkg.main.runtime.js
CHANGED
|
@@ -1,388 +1,270 @@
|
|
|
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.symbol.async-iterator.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.array.iterator.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.promise.js");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.PkgMain = void 0;
|
|
17
|
-
|
|
18
12
|
function _defineProperty2() {
|
|
19
13
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
-
|
|
21
14
|
_defineProperty2 = function () {
|
|
22
15
|
return data;
|
|
23
16
|
};
|
|
24
|
-
|
|
25
17
|
return data;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
function _lodash() {
|
|
29
20
|
const data = require("lodash");
|
|
30
|
-
|
|
31
21
|
_lodash = function () {
|
|
32
22
|
return data;
|
|
33
23
|
};
|
|
34
|
-
|
|
35
24
|
return data;
|
|
36
25
|
}
|
|
37
|
-
|
|
38
26
|
function _path() {
|
|
39
27
|
const data = require("path");
|
|
40
|
-
|
|
41
28
|
_path = function () {
|
|
42
29
|
return data;
|
|
43
30
|
};
|
|
44
|
-
|
|
45
31
|
return data;
|
|
46
32
|
}
|
|
47
|
-
|
|
48
33
|
function _fsExtra() {
|
|
49
34
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
50
|
-
|
|
51
35
|
_fsExtra = function () {
|
|
52
36
|
return data;
|
|
53
37
|
};
|
|
54
|
-
|
|
55
38
|
return data;
|
|
56
39
|
}
|
|
57
|
-
|
|
58
40
|
function _cli() {
|
|
59
41
|
const data = require("@teambit/cli");
|
|
60
|
-
|
|
61
42
|
_cli = function () {
|
|
62
43
|
return data;
|
|
63
44
|
};
|
|
64
|
-
|
|
65
45
|
return data;
|
|
66
46
|
}
|
|
67
|
-
|
|
68
47
|
function _component() {
|
|
69
48
|
const data = _interopRequireDefault(require("@teambit/component"));
|
|
70
|
-
|
|
71
49
|
_component = function () {
|
|
72
50
|
return data;
|
|
73
51
|
};
|
|
74
|
-
|
|
75
52
|
return data;
|
|
76
53
|
}
|
|
77
|
-
|
|
78
54
|
function _envs() {
|
|
79
55
|
const data = require("@teambit/envs");
|
|
80
|
-
|
|
81
56
|
_envs = function () {
|
|
82
57
|
return data;
|
|
83
58
|
};
|
|
84
|
-
|
|
85
59
|
return data;
|
|
86
60
|
}
|
|
87
|
-
|
|
88
61
|
function _harmony() {
|
|
89
62
|
const data = require("@teambit/harmony");
|
|
90
|
-
|
|
91
63
|
_harmony = function () {
|
|
92
64
|
return data;
|
|
93
65
|
};
|
|
94
|
-
|
|
95
66
|
return data;
|
|
96
67
|
}
|
|
97
|
-
|
|
98
68
|
function _isolator() {
|
|
99
69
|
const data = require("@teambit/isolator");
|
|
100
|
-
|
|
101
70
|
_isolator = function () {
|
|
102
71
|
return data;
|
|
103
72
|
};
|
|
104
|
-
|
|
105
73
|
return data;
|
|
106
74
|
}
|
|
107
|
-
|
|
108
75
|
function _logger() {
|
|
109
76
|
const data = require("@teambit/logger");
|
|
110
|
-
|
|
111
77
|
_logger = function () {
|
|
112
78
|
return data;
|
|
113
79
|
};
|
|
114
|
-
|
|
115
80
|
return data;
|
|
116
81
|
}
|
|
117
|
-
|
|
118
82
|
function _scope() {
|
|
119
83
|
const data = require("@teambit/scope");
|
|
120
|
-
|
|
121
84
|
_scope = function () {
|
|
122
85
|
return data;
|
|
123
86
|
};
|
|
124
|
-
|
|
125
87
|
return data;
|
|
126
88
|
}
|
|
127
|
-
|
|
128
89
|
function _workspace() {
|
|
129
90
|
const data = require("@teambit/workspace");
|
|
130
|
-
|
|
131
91
|
_workspace = function () {
|
|
132
92
|
return data;
|
|
133
93
|
};
|
|
134
|
-
|
|
135
94
|
return data;
|
|
136
95
|
}
|
|
137
|
-
|
|
138
96
|
function _packageJsonTransformer() {
|
|
139
97
|
const data = require("@teambit/legacy/dist/consumer/component/package-json-transformer");
|
|
140
|
-
|
|
141
98
|
_packageJsonTransformer = function () {
|
|
142
99
|
return data;
|
|
143
100
|
};
|
|
144
|
-
|
|
145
101
|
return data;
|
|
146
102
|
}
|
|
147
|
-
|
|
148
103
|
function _builder() {
|
|
149
104
|
const data = require("@teambit/builder");
|
|
150
|
-
|
|
151
105
|
_builder = function () {
|
|
152
106
|
return data;
|
|
153
107
|
};
|
|
154
|
-
|
|
155
108
|
return data;
|
|
156
109
|
}
|
|
157
|
-
|
|
158
110
|
function _bitError() {
|
|
159
111
|
const data = require("@teambit/bit-error");
|
|
160
|
-
|
|
161
112
|
_bitError = function () {
|
|
162
113
|
return data;
|
|
163
114
|
};
|
|
164
|
-
|
|
165
115
|
return data;
|
|
166
116
|
}
|
|
167
|
-
|
|
168
117
|
function _componentPackageVersion() {
|
|
169
118
|
const data = require("@teambit/component-package-version");
|
|
170
|
-
|
|
171
119
|
_componentPackageVersion = function () {
|
|
172
120
|
return data;
|
|
173
121
|
};
|
|
174
|
-
|
|
175
122
|
return data;
|
|
176
123
|
}
|
|
177
|
-
|
|
178
124
|
function _componentIssues() {
|
|
179
125
|
const data = require("@teambit/component-issues");
|
|
180
|
-
|
|
181
126
|
_componentIssues = function () {
|
|
182
127
|
return data;
|
|
183
128
|
};
|
|
184
|
-
|
|
185
129
|
return data;
|
|
186
130
|
}
|
|
187
|
-
|
|
188
131
|
function _graphql() {
|
|
189
132
|
const data = require("@teambit/graphql");
|
|
190
|
-
|
|
191
133
|
_graphql = function () {
|
|
192
134
|
return data;
|
|
193
135
|
};
|
|
194
|
-
|
|
195
136
|
return data;
|
|
196
137
|
}
|
|
197
|
-
|
|
198
138
|
function _dependencyResolver() {
|
|
199
139
|
const data = require("@teambit/dependency-resolver");
|
|
200
|
-
|
|
201
140
|
_dependencyResolver = function () {
|
|
202
141
|
return data;
|
|
203
142
|
};
|
|
204
|
-
|
|
205
143
|
return data;
|
|
206
144
|
}
|
|
207
|
-
|
|
208
145
|
function _inMemoryCache() {
|
|
209
146
|
const data = require("@teambit/legacy/dist/cache/in-memory-cache");
|
|
210
|
-
|
|
211
147
|
_inMemoryCache = function () {
|
|
212
148
|
return data;
|
|
213
149
|
};
|
|
214
|
-
|
|
215
150
|
return data;
|
|
216
151
|
}
|
|
217
|
-
|
|
218
152
|
function _cacheFactory() {
|
|
219
153
|
const data = require("@teambit/legacy/dist/cache/cache-factory");
|
|
220
|
-
|
|
221
154
|
_cacheFactory = function () {
|
|
222
155
|
return data;
|
|
223
156
|
};
|
|
224
|
-
|
|
225
157
|
return data;
|
|
226
158
|
}
|
|
227
|
-
|
|
228
159
|
function _packer() {
|
|
229
160
|
const data = require("./packer");
|
|
230
|
-
|
|
231
161
|
_packer = function () {
|
|
232
162
|
return data;
|
|
233
163
|
};
|
|
234
|
-
|
|
235
164
|
return data;
|
|
236
165
|
}
|
|
237
|
-
|
|
238
166
|
function _pack() {
|
|
239
167
|
const data = require("./pack.cmd");
|
|
240
|
-
|
|
241
168
|
_pack = function () {
|
|
242
169
|
return data;
|
|
243
170
|
};
|
|
244
|
-
|
|
245
171
|
return data;
|
|
246
172
|
}
|
|
247
|
-
|
|
248
173
|
function _pkg() {
|
|
249
174
|
const data = require("./pkg.aspect");
|
|
250
|
-
|
|
251
175
|
_pkg = function () {
|
|
252
176
|
return data;
|
|
253
177
|
};
|
|
254
|
-
|
|
255
178
|
return data;
|
|
256
179
|
}
|
|
257
|
-
|
|
258
180
|
function _preparePackages() {
|
|
259
181
|
const data = require("./prepare-packages.task");
|
|
260
|
-
|
|
261
182
|
_preparePackages = function () {
|
|
262
183
|
return data;
|
|
263
184
|
};
|
|
264
|
-
|
|
265
185
|
return data;
|
|
266
186
|
}
|
|
267
|
-
|
|
268
187
|
function _publish() {
|
|
269
188
|
const data = require("./publish.cmd");
|
|
270
|
-
|
|
271
189
|
_publish = function () {
|
|
272
190
|
return data;
|
|
273
191
|
};
|
|
274
|
-
|
|
275
192
|
return data;
|
|
276
193
|
}
|
|
277
|
-
|
|
278
194
|
function _publisher() {
|
|
279
195
|
const data = require("./publisher");
|
|
280
|
-
|
|
281
196
|
_publisher = function () {
|
|
282
197
|
return data;
|
|
283
198
|
};
|
|
284
|
-
|
|
285
199
|
return data;
|
|
286
200
|
}
|
|
287
|
-
|
|
288
201
|
function _publish2() {
|
|
289
202
|
const data = require("./publish.task");
|
|
290
|
-
|
|
291
203
|
_publish2 = function () {
|
|
292
204
|
return data;
|
|
293
205
|
};
|
|
294
|
-
|
|
295
206
|
return data;
|
|
296
207
|
}
|
|
297
|
-
|
|
298
208
|
function _exceptions() {
|
|
299
209
|
const data = require("./exceptions");
|
|
300
|
-
|
|
301
210
|
_exceptions = function () {
|
|
302
211
|
return data;
|
|
303
212
|
};
|
|
304
|
-
|
|
305
213
|
return data;
|
|
306
214
|
}
|
|
307
|
-
|
|
308
215
|
function _pkgArtifact() {
|
|
309
216
|
const data = require("./pkg-artifact");
|
|
310
|
-
|
|
311
217
|
_pkgArtifact = function () {
|
|
312
218
|
return data;
|
|
313
219
|
};
|
|
314
|
-
|
|
315
220
|
return data;
|
|
316
221
|
}
|
|
317
|
-
|
|
318
222
|
function _package() {
|
|
319
223
|
const data = require("./package.route");
|
|
320
|
-
|
|
321
224
|
_package = function () {
|
|
322
225
|
return data;
|
|
323
226
|
};
|
|
324
|
-
|
|
325
227
|
return data;
|
|
326
228
|
}
|
|
327
|
-
|
|
328
229
|
function _packageDependency() {
|
|
329
230
|
const data = require("./package-dependency");
|
|
330
|
-
|
|
331
231
|
_packageDependency = function () {
|
|
332
232
|
return data;
|
|
333
233
|
};
|
|
334
|
-
|
|
335
234
|
return data;
|
|
336
235
|
}
|
|
337
|
-
|
|
338
236
|
function _pkg2() {
|
|
339
237
|
const data = require("./pkg.graphql");
|
|
340
|
-
|
|
341
238
|
_pkg2 = function () {
|
|
342
239
|
return data;
|
|
343
240
|
};
|
|
344
|
-
|
|
345
241
|
return data;
|
|
346
242
|
}
|
|
347
|
-
|
|
348
243
|
function _package2() {
|
|
349
244
|
const data = require("./package.fragment");
|
|
350
|
-
|
|
351
245
|
_package2 = function () {
|
|
352
246
|
return data;
|
|
353
247
|
};
|
|
354
|
-
|
|
355
248
|
return data;
|
|
356
249
|
}
|
|
357
|
-
|
|
358
250
|
function _pack2() {
|
|
359
251
|
const data = require("./pack.task");
|
|
360
|
-
|
|
361
252
|
_pack2 = function () {
|
|
362
253
|
return data;
|
|
363
254
|
};
|
|
364
|
-
|
|
365
255
|
return data;
|
|
366
256
|
}
|
|
367
|
-
|
|
368
257
|
function _pkg3() {
|
|
369
258
|
const data = require("./pkg.service");
|
|
370
|
-
|
|
371
259
|
_pkg3 = function () {
|
|
372
260
|
return data;
|
|
373
261
|
};
|
|
374
|
-
|
|
375
262
|
return data;
|
|
376
263
|
}
|
|
377
|
-
|
|
378
264
|
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; }
|
|
379
|
-
|
|
380
265
|
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; }
|
|
381
|
-
|
|
382
266
|
function _asyncIterator(iterable) { var method, async, sync, retry = 2; for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { if (async && null != (method = iterable[async])) return method.call(iterable); if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
383
|
-
|
|
384
267
|
function AsyncFromSyncIterator(s) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var done = r.done; return Promise.resolve(r.value).then(function (value) { return { value: value, done: done }; }); } return AsyncFromSyncIterator = function (s) { this.s = s, this.n = s.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function () { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function (value) { var ret = this.s.return; return void 0 === ret ? Promise.resolve({ value: value, done: !0 }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); }, throw: function (value) { var thr = this.s.return; return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(s); }
|
|
385
|
-
|
|
386
268
|
class PkgMain {
|
|
387
269
|
static async provider([cli, scope, envs, isolator, logger, workspace, builder, dependencyResolver, componentAspect, graphql], config, [packageJsonPropsRegistry]) {
|
|
388
270
|
const logPublisher = logger.createLogger(_pkg().PkgAspect.id);
|
|
@@ -396,17 +278,17 @@ class PkgMain {
|
|
|
396
278
|
dependencyResolver.registerDependencyFactories([new (_packageDependency().PackageDependencyFactory)()]);
|
|
397
279
|
graphql.register((0, _pkg2().pkgSchema)(pkg));
|
|
398
280
|
envs.registerService(new (_pkg3().PkgService)());
|
|
399
|
-
componentAspect.registerRoute([new (_package().PackageRoute)(pkg)]);
|
|
281
|
+
componentAspect.registerRoute([new (_package().PackageRoute)(pkg)]);
|
|
282
|
+
|
|
283
|
+
// we ended up not using the publish-dry-run task. It used to run "npm publish --dry-run"
|
|
400
284
|
// and also "npm pack --dry-run", but it's not that useful and it takes long to complete.
|
|
401
285
|
// we might revise our decision later.
|
|
402
286
|
// const dryRunTask = new PublishDryRunTask(PkgAspect.id, publisher, packer, logPublisher);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
287
|
+
const preparePackagesTask = new (_preparePackages().PreparePackagesTask)(_pkg().PkgAspect.id, logPublisher, envs);
|
|
288
|
+
// dryRunTask.dependencies = [BuildTaskHelper.serializeId(preparePackagesTask)];
|
|
406
289
|
builder.registerBuildTasks([preparePackagesTask]);
|
|
407
290
|
builder.registerTagTasks([packTask, publishTask]);
|
|
408
291
|
builder.registerSnapTasks([packTask]);
|
|
409
|
-
|
|
410
292
|
if (workspace) {
|
|
411
293
|
// workspace.onComponentLoad(pkg.mergePackageJsonProps.bind(pkg));
|
|
412
294
|
workspace.onComponentLoad(async component => {
|
|
@@ -417,77 +299,61 @@ class PkgMain {
|
|
|
417
299
|
};
|
|
418
300
|
});
|
|
419
301
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
302
|
+
_packageJsonTransformer().PackageJsonTransformer.registerPackageJsonTransformer(pkg.transformPackageJson.bind(pkg));
|
|
303
|
+
// TODO: consider passing the pkg instead of packer
|
|
424
304
|
cli.register(new (_pack().PackCmd)(packer), new (_publish().PublishCmd)(publisher));
|
|
425
305
|
return pkg;
|
|
426
306
|
}
|
|
427
|
-
|
|
428
307
|
/**
|
|
429
308
|
* get the package name of a component.
|
|
430
309
|
*/
|
|
431
310
|
getPackageName(component) {
|
|
432
311
|
return this.dependencyResolver.getPackageName(component);
|
|
433
312
|
}
|
|
313
|
+
|
|
434
314
|
/*
|
|
435
315
|
* Returns the location where the component is installed with its peer dependencies
|
|
436
316
|
* This is used in cases you want to actually run the components and make sure all the dependencies (especially peers) are resolved correctly
|
|
437
317
|
*/
|
|
438
|
-
|
|
439
|
-
|
|
440
318
|
getRuntimeModulePath(component, options = {}) {
|
|
441
319
|
const relativePath = this.dependencyResolver.getRuntimeModulePath(component);
|
|
442
|
-
|
|
443
320
|
if (options !== null && options !== void 0 && options.absPath) {
|
|
444
321
|
if (this.workspace) {
|
|
445
322
|
return (0, _path().join)(this.workspace.path, relativePath);
|
|
446
323
|
}
|
|
447
|
-
|
|
448
324
|
throw new Error('getModulePath with abs path option is not implemented for scope');
|
|
449
325
|
}
|
|
450
|
-
|
|
451
326
|
return relativePath;
|
|
452
327
|
}
|
|
328
|
+
|
|
453
329
|
/**
|
|
454
330
|
* returns the package path in the /node_modules/ folder
|
|
455
331
|
* In case you call this in order to run the code from the path, please refer to the `getRuntimeModulePath` API
|
|
456
332
|
*/
|
|
457
|
-
|
|
458
|
-
|
|
459
333
|
getModulePath(component, options = {}) {
|
|
460
334
|
const relativePath = this.dependencyResolver.getModulePath(component);
|
|
461
|
-
|
|
462
335
|
if (options !== null && options !== void 0 && options.absPath) {
|
|
463
336
|
if (this.workspace) {
|
|
464
337
|
return (0, _path().join)(this.workspace.path, relativePath);
|
|
465
338
|
}
|
|
466
|
-
|
|
467
339
|
throw new Error('getModulePath with abs path option is not implemented for scope');
|
|
468
340
|
}
|
|
469
|
-
|
|
470
341
|
return relativePath;
|
|
471
342
|
}
|
|
472
|
-
|
|
473
343
|
isModulePathExists(component) {
|
|
474
344
|
const packageDir = this.getModulePath(component, {
|
|
475
345
|
absPath: true
|
|
476
346
|
});
|
|
477
347
|
return _fsExtra().default.existsSync(packageDir);
|
|
478
348
|
}
|
|
479
|
-
|
|
480
349
|
async addMissingLinksFromNodeModulesIssue(component) {
|
|
481
350
|
const exist = this.isModulePathExists(component);
|
|
482
|
-
|
|
483
351
|
if (!exist) {
|
|
484
352
|
component.state.issues.getOrCreate(_componentIssues().IssuesClasses.MissingLinksFromNodeModulesToSrc).data = true;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
|
|
353
|
+
}
|
|
354
|
+
// we don't want to add any data to the compiler aspect, only to add issues on the component
|
|
488
355
|
return undefined;
|
|
489
356
|
}
|
|
490
|
-
|
|
491
357
|
// cache components manifests
|
|
492
358
|
constructor(
|
|
493
359
|
/**
|
|
@@ -531,14 +397,14 @@ class PkgMain {
|
|
|
531
397
|
maxSize: (0, _inMemoryCache().getMaxSizeForComponents)()
|
|
532
398
|
});
|
|
533
399
|
}
|
|
400
|
+
|
|
534
401
|
/**
|
|
535
402
|
* register changes in the package.json
|
|
536
403
|
*/
|
|
537
|
-
|
|
538
|
-
|
|
539
404
|
registerPackageJsonNewProps(props) {
|
|
540
405
|
return this.packageJsonPropsRegistry.register(props);
|
|
541
406
|
}
|
|
407
|
+
|
|
542
408
|
/**
|
|
543
409
|
* Pack a component and generate a tarball suitable for npm registry
|
|
544
410
|
*
|
|
@@ -551,104 +417,79 @@ class PkgMain {
|
|
|
551
417
|
* @returns {Promise<PackResult>}
|
|
552
418
|
* @memberof PkgExtension
|
|
553
419
|
*/
|
|
554
|
-
|
|
555
|
-
|
|
556
420
|
async packComponent(componentId, scopePath, options) {
|
|
557
421
|
return this.packer.packComponent(componentId, scopePath, options);
|
|
558
422
|
}
|
|
423
|
+
|
|
559
424
|
/**
|
|
560
425
|
* Merge the configs provided by:
|
|
561
426
|
* 1. envs configured in the component - via getPackageJsonProps method
|
|
562
427
|
* 2. extensions that registered to the registerPackageJsonNewProps slot (and configured for the component)
|
|
563
428
|
* 3. props defined by the user (they are the strongest one)
|
|
564
429
|
*/
|
|
565
|
-
|
|
566
|
-
|
|
567
430
|
async mergePackageJsonProps(component) {
|
|
568
431
|
var _this$envs$calculateE;
|
|
569
|
-
|
|
570
432
|
let newProps = {};
|
|
571
|
-
|
|
572
433
|
const mergeToNewProps = otherProps => {
|
|
573
434
|
const files = [...(newProps.files || []), ...(otherProps.files || [])];
|
|
574
|
-
|
|
575
435
|
const merged = _objectSpread(_objectSpread({}, newProps), otherProps);
|
|
576
|
-
|
|
577
436
|
if (files.length) merged.files = files;
|
|
578
437
|
return merged;
|
|
579
438
|
};
|
|
580
|
-
|
|
581
439
|
const env = (_this$envs$calculateE = this.envs.calculateEnv(component)) === null || _this$envs$calculateE === void 0 ? void 0 : _this$envs$calculateE.env;
|
|
582
|
-
|
|
583
440
|
if (env !== null && env !== void 0 && env.getPackageJsonProps && typeof env.getPackageJsonProps === 'function') {
|
|
584
441
|
const propsFromEnv = env.getPackageJsonProps();
|
|
585
442
|
newProps = mergeToNewProps(propsFromEnv);
|
|
586
443
|
}
|
|
587
|
-
|
|
588
444
|
const configuredIds = component.state.aspects.ids;
|
|
589
445
|
configuredIds.forEach(extId => {
|
|
590
446
|
// Only get props from configured extensions on this specific component
|
|
591
447
|
const props = this.packageJsonPropsRegistry.get(extId);
|
|
592
|
-
|
|
593
448
|
if (props) {
|
|
594
449
|
newProps = mergeToNewProps(props);
|
|
595
450
|
}
|
|
596
451
|
});
|
|
597
452
|
const currentExtension = component.state.aspects.get(_pkg().PkgAspect.id);
|
|
598
453
|
const currentConfig = currentExtension === null || currentExtension === void 0 ? void 0 : currentExtension.config;
|
|
599
|
-
|
|
600
454
|
if (currentConfig && currentConfig.packageJson) {
|
|
601
455
|
newProps = mergeToNewProps(currentConfig.packageJson);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
|
|
456
|
+
}
|
|
457
|
+
// Keys not allowed to override
|
|
605
458
|
const specialKeys = ['extensions', 'dependencies', 'devDependencies', 'peerDependencies'];
|
|
606
459
|
return (0, _lodash().omit)(newProps, specialKeys);
|
|
607
460
|
}
|
|
608
|
-
|
|
609
461
|
getPackageJsonModifications(component) {
|
|
610
462
|
var _currentData$packageJ;
|
|
611
|
-
|
|
612
463
|
const currentExtension = component.state.aspects.get(_pkg().PkgAspect.id);
|
|
613
464
|
const currentData = currentExtension === null || currentExtension === void 0 ? void 0 : currentExtension.data;
|
|
614
465
|
return (_currentData$packageJ = currentData === null || currentData === void 0 ? void 0 : currentData.packageJsonModification) !== null && _currentData$packageJ !== void 0 ? _currentData$packageJ : {};
|
|
615
466
|
}
|
|
616
|
-
|
|
617
467
|
async getPkgArtifact(component) {
|
|
618
468
|
const artifacts = await this.builder.getArtifactsVinylByAspect(component, _pkg().PkgAspect.id);
|
|
619
469
|
if (!artifacts.length) throw new (_exceptions().PkgArtifactNotFound)(component.id);
|
|
620
470
|
return new (_pkgArtifact().PkgArtifact)(artifacts);
|
|
621
471
|
}
|
|
622
|
-
|
|
623
472
|
async getManifest(component) {
|
|
624
473
|
const name = this.getPackageName(component);
|
|
625
474
|
const latestVersion = component.latest;
|
|
626
|
-
|
|
627
475
|
if (!latestVersion) {
|
|
628
476
|
throw new (_bitError().BitError)('can not get manifest for component without versions');
|
|
629
477
|
}
|
|
630
|
-
|
|
631
478
|
const preReleaseLatestTags = component.tags.getPreReleaseLatestTags();
|
|
632
479
|
const latest = (0, _componentPackageVersion().snapToSemver)(latestVersion);
|
|
633
|
-
|
|
634
480
|
const distTags = _objectSpread({
|
|
635
481
|
latest
|
|
636
482
|
}, preReleaseLatestTags);
|
|
637
|
-
|
|
638
483
|
const versionsFromCache = this.manifestCache.get(name);
|
|
639
|
-
|
|
640
484
|
const getVersions = async () => {
|
|
641
485
|
var _component$head;
|
|
642
|
-
|
|
643
486
|
const headHash = (_component$head = component.head) === null || _component$head === void 0 ? void 0 : _component$head.hash;
|
|
644
487
|
if (!headHash) throw new (_bitError().BitError)(`unable to get manifest for "${name}", the head is empty`);
|
|
645
|
-
|
|
646
488
|
if (versionsFromCache) {
|
|
647
489
|
if (versionsFromCache.head !== headHash) this.manifestCache.delete(name);else {
|
|
648
490
|
return versionsFromCache.manifest;
|
|
649
491
|
}
|
|
650
492
|
}
|
|
651
|
-
|
|
652
493
|
const versions = await this.getAllSnapsManifests(component);
|
|
653
494
|
const versionsWithoutEmpty = (0, _lodash().compact)(versions);
|
|
654
495
|
this.manifestCache.set(name, {
|
|
@@ -657,7 +498,6 @@ class PkgMain {
|
|
|
657
498
|
});
|
|
658
499
|
return versionsWithoutEmpty;
|
|
659
500
|
};
|
|
660
|
-
|
|
661
501
|
const versions = await getVersions();
|
|
662
502
|
const externalRegistry = this.isPublishedToExternalRegistry(component);
|
|
663
503
|
return {
|
|
@@ -667,20 +507,16 @@ class PkgMain {
|
|
|
667
507
|
versions
|
|
668
508
|
};
|
|
669
509
|
}
|
|
670
|
-
|
|
671
510
|
async getAllSnapsManifests(component) {
|
|
672
511
|
const iterable = component.snapsIterable();
|
|
673
512
|
const result = [];
|
|
674
513
|
var _iteratorAbruptCompletion = false;
|
|
675
514
|
var _didIteratorError = false;
|
|
676
|
-
|
|
677
515
|
var _iteratorError;
|
|
678
|
-
|
|
679
516
|
try {
|
|
680
517
|
for (var _iterator = _asyncIterator(iterable), _step; _iteratorAbruptCompletion = !(_step = await _iterator.next()).done; _iteratorAbruptCompletion = false) {
|
|
681
518
|
const snap = _step.value;
|
|
682
519
|
const manifest = await this.getSnapManifest(component, snap);
|
|
683
|
-
|
|
684
520
|
if (manifest) {
|
|
685
521
|
result.push(manifest);
|
|
686
522
|
}
|
|
@@ -699,80 +535,71 @@ class PkgMain {
|
|
|
699
535
|
}
|
|
700
536
|
}
|
|
701
537
|
}
|
|
702
|
-
|
|
703
538
|
return result;
|
|
704
539
|
}
|
|
540
|
+
|
|
705
541
|
/**
|
|
706
542
|
* Check if the component should be fetched from bit registry or from another registry
|
|
707
543
|
* This will usually determined by the latest version of the component
|
|
708
544
|
* @param component
|
|
709
545
|
*/
|
|
710
|
-
|
|
711
|
-
|
|
712
546
|
isPublishedToExternalRegistry(component) {
|
|
713
547
|
var _pkgExt$config, _pkgExt$config$packag, _pkgExt$config2, _pkgExt$config2$packa;
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
548
|
+
const pkgExt = component.get(_pkg().PkgAspect.id);
|
|
549
|
+
// By default publish to bit registry
|
|
717
550
|
if (!pkgExt) return false;
|
|
718
551
|
return !!((_pkgExt$config = pkgExt.config) !== null && _pkgExt$config !== void 0 && (_pkgExt$config$packag = _pkgExt$config.packageJson) !== null && _pkgExt$config$packag !== void 0 && _pkgExt$config$packag.name || (_pkgExt$config2 = pkgExt.config) !== null && _pkgExt$config2 !== void 0 && (_pkgExt$config2$packa = _pkgExt$config2.packageJson) !== null && _pkgExt$config2$packa !== void 0 && _pkgExt$config2$packa.publishConfig);
|
|
719
552
|
}
|
|
720
|
-
|
|
721
553
|
getComponentBuildData(component) {
|
|
722
554
|
const data = this.builder.getDataByAspect(component, _pkg().PkgAspect.id);
|
|
723
|
-
if (data) return data;
|
|
555
|
+
if (data) return data;
|
|
556
|
+
// backward compatibility. the data used to be saved on the pkg aspect rather than on the
|
|
724
557
|
// builder aspect
|
|
725
|
-
|
|
726
558
|
const currentExtension = component.state.aspects.get(_pkg().PkgAspect.id);
|
|
727
559
|
return currentExtension === null || currentExtension === void 0 ? void 0 : currentExtension.data;
|
|
728
560
|
}
|
|
729
|
-
|
|
730
561
|
async getSnapManifest(component, snap) {
|
|
731
562
|
var _version$extensions$f, _version$extensions$f2, _builderData$find, _currentData$pkgJson;
|
|
563
|
+
const idWithCorrectVersion = component.id.changeVersion(snap.hash);
|
|
732
564
|
|
|
733
|
-
|
|
734
|
-
|
|
565
|
+
// @todo: this is a hack. see below the right way to do it.
|
|
735
566
|
const version = await this.scope.legacyScope.getVersionInstance(idWithCorrectVersion._legacy);
|
|
736
567
|
const builderData = (_version$extensions$f = version.extensions.findCoreExtension(_builder().BuilderAspect.id)) === null || _version$extensions$f === void 0 ? void 0 : (_version$extensions$f2 = _version$extensions$f.data) === null || _version$extensions$f2 === void 0 ? void 0 : _version$extensions$f2.aspectsData;
|
|
737
|
-
const currentData = builderData === null || builderData === void 0 ? void 0 : (_builderData$find = builderData.find(a => a.aspectId === _pkg().PkgAspect.id)) === null || _builderData$find === void 0 ? void 0 : _builderData$find.data;
|
|
568
|
+
const currentData = builderData === null || builderData === void 0 ? void 0 : (_builderData$find = builderData.find(a => a.aspectId === _pkg().PkgAspect.id)) === null || _builderData$find === void 0 ? void 0 : _builderData$find.data;
|
|
569
|
+
|
|
570
|
+
// @todo: this is the proper way to communicate with the builder aspect. however, getting
|
|
738
571
|
// the entire Component for each one of the snaps is terrible in terms of the performance.
|
|
572
|
+
|
|
739
573
|
// const updatedComponent = await this.componentAspect.getHost().get(idWithCorrectVersion, true);
|
|
740
574
|
// if (!updatedComponent) {
|
|
741
575
|
// throw new BitError(`snap ${snap.hash} for component ${component.id.toString()} is missing`);
|
|
742
576
|
// }
|
|
743
577
|
// const currentData = this.getComponentBuildData(updatedComponent);
|
|
744
|
-
// If for some reason the version has no package.json manifest, return undefined
|
|
745
578
|
|
|
579
|
+
// If for some reason the version has no package.json manifest, return undefined
|
|
746
580
|
if (!(currentData !== null && currentData !== void 0 && currentData.pkgJson)) {
|
|
747
581
|
return undefined;
|
|
748
582
|
}
|
|
749
|
-
|
|
750
583
|
const pkgJson = (_currentData$pkgJson = currentData === null || currentData === void 0 ? void 0 : currentData.pkgJson) !== null && _currentData$pkgJson !== void 0 ? _currentData$pkgJson : {};
|
|
751
584
|
const checksum = currentData === null || currentData === void 0 ? void 0 : currentData.checksum;
|
|
752
|
-
|
|
753
585
|
if (!checksum) {
|
|
754
586
|
this.logger.error(`checksum for ${component.id.toString()} is missing`);
|
|
755
587
|
return undefined;
|
|
756
588
|
}
|
|
757
|
-
|
|
758
589
|
const dist = {
|
|
759
590
|
shasum: checksum,
|
|
760
591
|
tarball: this.componentAspect.getRoute(idWithCorrectVersion, _package().routePath)
|
|
761
592
|
};
|
|
762
|
-
|
|
763
593
|
const manifest = _objectSpread(_objectSpread({}, pkgJson), {}, {
|
|
764
594
|
dist
|
|
765
595
|
});
|
|
766
|
-
|
|
767
596
|
return manifest;
|
|
768
597
|
}
|
|
769
|
-
|
|
770
598
|
async getPackageTarFile(component) {
|
|
771
599
|
const artifacts = await this.builder.getArtifactsVinylByAspectAndName(component, _pkg().PkgAspect.id, _packer().TAR_FILE_ARTIFACT_NAME);
|
|
772
600
|
if (!artifacts.length) throw new (_exceptions().PackageTarFiletNotFound)(component.id);
|
|
773
601
|
return artifacts[0];
|
|
774
602
|
}
|
|
775
|
-
|
|
776
603
|
async transformPackageJson(legacyComponent, packageJsonObject) {
|
|
777
604
|
// const newId = await this.workspace.resolveComponentId(component.id);
|
|
778
605
|
// const newComponent = await this.workspace.get(newId);
|
|
@@ -783,15 +610,12 @@ class PkgMain {
|
|
|
783
610
|
const newProps = this.getPackageJsonModifications(newComponent);
|
|
784
611
|
return Object.assign(packageJsonObject, newProps);
|
|
785
612
|
}
|
|
786
|
-
|
|
787
613
|
}
|
|
788
|
-
|
|
789
614
|
exports.PkgMain = PkgMain;
|
|
790
615
|
(0, _defineProperty2().default)(PkgMain, "runtime", _cli().MainRuntime);
|
|
791
616
|
(0, _defineProperty2().default)(PkgMain, "dependencies", [_cli().CLIAspect, _scope().ScopeAspect, _envs().EnvsAspect, _isolator().IsolatorAspect, _logger().LoggerAspect, _workspace().WorkspaceAspect, _builder().BuilderAspect, _dependencyResolver().DependencyResolverAspect, _component().default, _graphql().GraphqlAspect]);
|
|
792
617
|
(0, _defineProperty2().default)(PkgMain, "slots", [_harmony().Slot.withType()]);
|
|
793
618
|
(0, _defineProperty2().default)(PkgMain, "defaultConfig", {});
|
|
794
|
-
|
|
795
619
|
_pkg().PkgAspect.addRuntime(PkgMain);
|
|
796
620
|
|
|
797
621
|
//# sourceMappingURL=pkg.main.runtime.js.map
|