@teambit/install 1.0.385 → 1.0.386
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 +3 -3
- package/artifacts/schema.json +386 -340
- package/dist/install.main.runtime.d.ts +3 -0
- package/dist/install.main.runtime.js +45 -27
- package/dist/install.main.runtime.js.map +1 -1
- package/package.json +16 -16
- /package/dist/{preview-1724210355889.js → preview-1724296760818.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,35 @@ class InstallMain {
|
|
|
597
597
|
// This is a bug in the flow and should be fixed.
|
|
598
598
|
// skipDeps: true,
|
|
599
599
|
});
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
const runtime = plugin.getRuntime(_cli().MainRuntime);
|
|
611
|
-
return runtime?.provider(undefined, undefined, undefined, this.harmony);
|
|
600
|
+
// This is a very special case which we need to compile our envs before loading them correctly.
|
|
601
|
+
const grouped = (0, _lodash().groupBy)(aspects, aspectDef => {
|
|
602
|
+
return aspectDef.component?.id.toStringWithoutVersion() === 'bitdev.general/envs/bit-env';
|
|
603
|
+
});
|
|
604
|
+
await this.reloadAspects(grouped.true || []);
|
|
605
|
+
const otherEnvs = grouped.false || [];
|
|
606
|
+
await Promise.all(otherEnvs.map(async aspectDef => {
|
|
607
|
+
const id = aspectDef.component?.id;
|
|
608
|
+
if (!id) return;
|
|
609
|
+
await this.workspace.clearComponentCache(id);
|
|
612
610
|
}));
|
|
611
|
+
await this.reloadAspects(grouped.false || []);
|
|
613
612
|
}
|
|
614
613
|
}
|
|
614
|
+
async reloadAspects(aspects) {
|
|
615
|
+
const loadedPlugins = (0, _lodash().compact)(await Promise.all(aspects.map(aspectDef => {
|
|
616
|
+
const localPath = aspectDef.aspectPath;
|
|
617
|
+
const component = aspectDef.component;
|
|
618
|
+
if (!component) return undefined;
|
|
619
|
+
const plugins = this.aspectLoader.getPlugins(component, localPath);
|
|
620
|
+
if (plugins.has()) {
|
|
621
|
+
return plugins.load(_cli().MainRuntime.name);
|
|
622
|
+
}
|
|
623
|
+
})));
|
|
624
|
+
await Promise.all(loadedPlugins.map(plugin => {
|
|
625
|
+
const runtime = plugin.getRuntime(_cli().MainRuntime);
|
|
626
|
+
return runtime?.provider(undefined, undefined, undefined, this.harmony);
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
615
629
|
async _getComponentsManifestsAndRootPolicy(installer, options) {
|
|
616
630
|
const mergedRootPolicy = await this.addConfiguredAspectsToWorkspacePolicy();
|
|
617
631
|
await this.addConfiguredGeneratorEnvsToWorkspacePolicy(mergedRootPolicy);
|
|
@@ -761,6 +775,13 @@ class InstallMain {
|
|
|
761
775
|
manifests
|
|
762
776
|
};
|
|
763
777
|
}
|
|
778
|
+
setOldNonLoadedEnvs() {
|
|
779
|
+
const nonLoadedEnvs = this.envs.getFailedToLoadEnvs();
|
|
780
|
+
const envsWithoutManifest = Array.from(this.dependencyResolver.envsWithoutManifest);
|
|
781
|
+
const oldNonLoadedEnvs = (0, _lodash().intersection)(nonLoadedEnvs, envsWithoutManifest);
|
|
782
|
+
this.oldNonLoadedEnvs = oldNonLoadedEnvs;
|
|
783
|
+
return oldNonLoadedEnvs;
|
|
784
|
+
}
|
|
764
785
|
|
|
765
786
|
/**
|
|
766
787
|
* This function returns a list of old non-loaded environments names.
|
|
@@ -770,10 +791,7 @@ class InstallMain {
|
|
|
770
791
|
* correctly
|
|
771
792
|
*/
|
|
772
793
|
getOldNonLoadedEnvs() {
|
|
773
|
-
|
|
774
|
-
const envsWithoutManifest = Array.from(this.dependencyResolver.envsWithoutManifest);
|
|
775
|
-
const oldNonLoadedEnvs = (0, _lodash().intersection)(nonLoadedEnvs, envsWithoutManifest);
|
|
776
|
-
return oldNonLoadedEnvs;
|
|
794
|
+
return this.oldNonLoadedEnvs;
|
|
777
795
|
}
|
|
778
796
|
async _updateRootDirs(rootDirs) {
|
|
779
797
|
try {
|