@teambit/install 1.0.385 → 1.0.387
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/artifacts/__bit_junit.xml +2 -2
- package/artifacts/schema.json +386 -340
- package/dist/install.main.runtime.d.ts +3 -0
- package/dist/install.main.runtime.js +58 -27
- package/dist/install.main.runtime.js.map +1 -1
- package/package.json +17 -17
- /package/dist/{preview-1724210355889.js → preview-1724383238078.js} +0 -0
|
@@ -67,6 +67,7 @@ export declare class InstallMain {
|
|
|
67
67
|
private ipcEvents;
|
|
68
68
|
private harmony;
|
|
69
69
|
private visitedAspects;
|
|
70
|
+
private oldNonLoadedEnvs;
|
|
70
71
|
constructor(dependencyResolver: DependencyResolverMain, logger: Logger, workspace: Workspace, variants: VariantsMain, compiler: CompilerMain, envs: EnvsMain, wsConfigFiles: WorkspaceConfigFilesMain, aspectLoader: AspectLoaderMain, app: ApplicationMain, generator: GeneratorMain, preLinkSlot: PreLinkSlot, preInstallSlot: PreInstallSlot, postInstallSlot: PostInstallSlot, ipcEvents: IpcEventsMain, harmony: Harmony);
|
|
71
72
|
/**
|
|
72
73
|
* Install dependencies for all components in the workspace
|
|
@@ -112,6 +113,7 @@ export declare class InstallMain {
|
|
|
112
113
|
private reloadMovedEnvs;
|
|
113
114
|
private reloadNonLoadedEnvs;
|
|
114
115
|
private reloadEnvs;
|
|
116
|
+
private reloadAspects;
|
|
115
117
|
private _getComponentsManifestsAndRootPolicy;
|
|
116
118
|
/**
|
|
117
119
|
* The function `tryWriteConfigFiles` attempts to write workspace config files, and if it fails, it logs an error
|
|
@@ -127,6 +129,7 @@ export declare class InstallMain {
|
|
|
127
129
|
private _getMissingPackagesWithoutRootDeps;
|
|
128
130
|
private _getAllMissingPackages;
|
|
129
131
|
private _getComponentsManifests;
|
|
132
|
+
setOldNonLoadedEnvs(): string[];
|
|
130
133
|
/**
|
|
131
134
|
* This function returns a list of old non-loaded environments names.
|
|
132
135
|
* @returns an array of strings called `oldNonLoadedEnvs`. This array contains the names of environment variables that
|
|
@@ -186,6 +186,13 @@ function _componentPackageVersion() {
|
|
|
186
186
|
};
|
|
187
187
|
return data;
|
|
188
188
|
}
|
|
189
|
+
function _aspectLoader() {
|
|
190
|
+
const data = require("@teambit/aspect-loader");
|
|
191
|
+
_aspectLoader = function () {
|
|
192
|
+
return data;
|
|
193
|
+
};
|
|
194
|
+
return data;
|
|
195
|
+
}
|
|
189
196
|
function _objectHash() {
|
|
190
197
|
const data = _interopRequireDefault(require("object-hash"));
|
|
191
198
|
_objectHash = function () {
|
|
@@ -242,13 +249,6 @@ function _update() {
|
|
|
242
249
|
};
|
|
243
250
|
return data;
|
|
244
251
|
}
|
|
245
|
-
function _aspectLoader() {
|
|
246
|
-
const data = require("@teambit/aspect-loader");
|
|
247
|
-
_aspectLoader = function () {
|
|
248
|
-
return data;
|
|
249
|
-
};
|
|
250
|
-
return data;
|
|
251
|
-
}
|
|
252
252
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
253
253
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
254
254
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -275,6 +275,7 @@ class InstallMain {
|
|
|
275
275
|
this.ipcEvents = ipcEvents;
|
|
276
276
|
this.harmony = harmony;
|
|
277
277
|
_defineProperty(this, "visitedAspects", new Set());
|
|
278
|
+
_defineProperty(this, "oldNonLoadedEnvs", []);
|
|
278
279
|
}
|
|
279
280
|
/**
|
|
280
281
|
* Install dependencies for all components in the workspace
|
|
@@ -476,6 +477,7 @@ class InstallMain {
|
|
|
476
477
|
}, pmInstallOptions);
|
|
477
478
|
let cacheCleared = false;
|
|
478
479
|
await this.linkCodemods(compDirMap);
|
|
480
|
+
const oldNonLoadedEnvs = this.setOldNonLoadedEnvs();
|
|
479
481
|
await this.reloadMovedEnvs();
|
|
480
482
|
await this.reloadNonLoadedEnvs();
|
|
481
483
|
const shouldClearCacheOnInstall = this.shouldClearCacheOnInstall();
|
|
@@ -487,9 +489,8 @@ class InstallMain {
|
|
|
487
489
|
// We need to clear cache before compiling the components or it might compile them with the default env
|
|
488
490
|
// incorrectly in case the env was not loaded correctly before the installation.
|
|
489
491
|
// We don't want to clear the failed to load envs because we want to show the warning at the end
|
|
490
|
-
await this.workspace.clearCache({
|
|
491
|
-
|
|
492
|
-
});
|
|
492
|
+
// await this.workspace.clearCache({ skipClearFailedToLoadEnvs: true });
|
|
493
|
+
await this.workspace.clearCache();
|
|
493
494
|
cacheCleared = true;
|
|
494
495
|
}
|
|
495
496
|
await this.compiler.compileOnWorkspace([], {
|
|
@@ -508,7 +509,6 @@ class InstallMain {
|
|
|
508
509
|
}
|
|
509
510
|
if (!dependenciesChanged) break;
|
|
510
511
|
if (!options?.recurringInstall) break;
|
|
511
|
-
const oldNonLoadedEnvs = this.getOldNonLoadedEnvs();
|
|
512
512
|
if (!oldNonLoadedEnvs.length) break;
|
|
513
513
|
prevManifests.add(manifestsHash(current.manifests));
|
|
514
514
|
// If we run compile we do the clear cache before the compilation so no need to clean it again (it's an expensive
|
|
@@ -597,21 +597,48 @@ class InstallMain {
|
|
|
597
597
|
// This is a bug in the flow and should be fixed.
|
|
598
598
|
// skipDeps: true,
|
|
599
599
|
});
|
|
600
|
-
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
const plugins = this.aspectLoader.getPlugins(component, localPath);
|
|
605
|
-
if (plugins.has()) {
|
|
606
|
-
return plugins.load(_cli().MainRuntime.name);
|
|
607
|
-
}
|
|
608
|
-
})));
|
|
609
|
-
await Promise.all(loadedPlugins.map(plugin => {
|
|
610
|
-
const runtime = plugin.getRuntime(_cli().MainRuntime);
|
|
611
|
-
return runtime?.provider(undefined, undefined, undefined, this.harmony);
|
|
600
|
+
await Promise.all(aspects.map(async aspectDef => {
|
|
601
|
+
const id = aspectDef.component?.id;
|
|
602
|
+
if (!id) return;
|
|
603
|
+
await this.workspace.clearComponentCache(id);
|
|
612
604
|
}));
|
|
605
|
+
await this.reloadAspects(aspects || []);
|
|
606
|
+
|
|
607
|
+
// Keeping this here for now, it was removed as part of #9138 as now that we load envs of envs
|
|
608
|
+
// correctly first it seems to be not needed anymore.
|
|
609
|
+
// But there might be cases where it will be needed. So keeping it here for now.
|
|
610
|
+
|
|
611
|
+
// This is a very special case which we need to compile our envs before loading them correctly.
|
|
612
|
+
// const grouped = groupBy(aspects, (aspectDef) => {
|
|
613
|
+
// return aspectDef.component?.id.toStringWithoutVersion() === 'bitdev.general/envs/bit-env';
|
|
614
|
+
// });
|
|
615
|
+
// await this.reloadAspects(grouped.true || []);
|
|
616
|
+
// const otherEnvs = grouped.false || [];
|
|
617
|
+
// await Promise.all(
|
|
618
|
+
// otherEnvs.map(async (aspectDef) => {
|
|
619
|
+
// const id = aspectDef.component?.id;
|
|
620
|
+
// if (!id) return;
|
|
621
|
+
// await this.workspace.clearComponentCache(id);
|
|
622
|
+
// })
|
|
623
|
+
// );
|
|
624
|
+
// await this.reloadAspects(grouped.false || []);
|
|
613
625
|
}
|
|
614
626
|
}
|
|
627
|
+
async reloadAspects(aspects) {
|
|
628
|
+
const loadedPlugins = (0, _lodash().compact)(await Promise.all(aspects.map(aspectDef => {
|
|
629
|
+
const localPath = aspectDef.aspectPath;
|
|
630
|
+
const component = aspectDef.component;
|
|
631
|
+
if (!component) return undefined;
|
|
632
|
+
const plugins = this.aspectLoader.getPlugins(component, localPath);
|
|
633
|
+
if (plugins.has()) {
|
|
634
|
+
return plugins.load(_cli().MainRuntime.name);
|
|
635
|
+
}
|
|
636
|
+
})));
|
|
637
|
+
await Promise.all(loadedPlugins.map(plugin => {
|
|
638
|
+
const runtime = plugin.getRuntime(_cli().MainRuntime);
|
|
639
|
+
return runtime?.provider(undefined, undefined, undefined, this.harmony);
|
|
640
|
+
}));
|
|
641
|
+
}
|
|
615
642
|
async _getComponentsManifestsAndRootPolicy(installer, options) {
|
|
616
643
|
const mergedRootPolicy = await this.addConfiguredAspectsToWorkspacePolicy();
|
|
617
644
|
await this.addConfiguredGeneratorEnvsToWorkspacePolicy(mergedRootPolicy);
|
|
@@ -761,6 +788,13 @@ class InstallMain {
|
|
|
761
788
|
manifests
|
|
762
789
|
};
|
|
763
790
|
}
|
|
791
|
+
setOldNonLoadedEnvs() {
|
|
792
|
+
const nonLoadedEnvs = this.envs.getFailedToLoadEnvs();
|
|
793
|
+
const envsWithoutManifest = Array.from(this.dependencyResolver.envsWithoutManifest);
|
|
794
|
+
const oldNonLoadedEnvs = (0, _lodash().intersection)(nonLoadedEnvs, envsWithoutManifest);
|
|
795
|
+
this.oldNonLoadedEnvs = oldNonLoadedEnvs;
|
|
796
|
+
return oldNonLoadedEnvs;
|
|
797
|
+
}
|
|
764
798
|
|
|
765
799
|
/**
|
|
766
800
|
* This function returns a list of old non-loaded environments names.
|
|
@@ -770,10 +804,7 @@ class InstallMain {
|
|
|
770
804
|
* correctly
|
|
771
805
|
*/
|
|
772
806
|
getOldNonLoadedEnvs() {
|
|
773
|
-
|
|
774
|
-
const envsWithoutManifest = Array.from(this.dependencyResolver.envsWithoutManifest);
|
|
775
|
-
const oldNonLoadedEnvs = (0, _lodash().intersection)(nonLoadedEnvs, envsWithoutManifest);
|
|
776
|
-
return oldNonLoadedEnvs;
|
|
807
|
+
return this.oldNonLoadedEnvs;
|
|
777
808
|
}
|
|
778
809
|
async _updateRootDirs(rootDirs) {
|
|
779
810
|
try {
|