@teambit/envs 1.0.276 → 1.0.278
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_envs_envs-preview.js +1 -1
- package/artifacts/schema.json +1647 -867
- package/dist/environments.main.runtime.d.ts +25 -4
- package/dist/environments.main.runtime.js +82 -6
- package/dist/environments.main.runtime.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{preview-1716088732412.js → preview-1716302635312.js} +2 -2
- package/package.json +26 -20
@@ -1,8 +1,10 @@
|
|
1
1
|
import { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';
|
2
2
|
import { CLIMain } from '@teambit/cli';
|
3
3
|
import { Component, ComponentMain } from '@teambit/component';
|
4
|
+
import type { EnvPolicyConfigObject } from '@teambit/dependency-resolver';
|
4
5
|
import { GraphqlMain } from '@teambit/graphql';
|
5
6
|
import { IssuesMain } from '@teambit/issues';
|
7
|
+
import type { EnvJsoncPatterns } from '@teambit/dev-files';
|
6
8
|
import { Harmony, SlotRegistry } from '@teambit/harmony';
|
7
9
|
import { Logger, LoggerMain } from '@teambit/logger';
|
8
10
|
import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
|
@@ -14,7 +16,14 @@ import { Runtime } from './runtime';
|
|
14
16
|
import { EnvDefinition } from './env-definition';
|
15
17
|
import { EnvServiceList } from './env-service-list';
|
16
18
|
import { EnvPlugin } from './env.plugin';
|
19
|
+
export type EnvJsonc = {
|
20
|
+
extends?: string;
|
21
|
+
policy?: EnvPolicyConfigObject;
|
22
|
+
patterns?: EnvJsoncPatterns;
|
23
|
+
};
|
24
|
+
export type EnvJsoncMergeCustomizer = (parentObj: EnvJsonc, childObj: EnvJsonc) => Partial<EnvJsonc>;
|
17
25
|
export type EnvsRegistry = SlotRegistry<Environment>;
|
26
|
+
export type EnvJsoncMergeCustomizerRegistry = SlotRegistry<EnvJsoncMergeCustomizer>;
|
18
27
|
export type EnvsConfig = {
|
19
28
|
env: string;
|
20
29
|
options: EnvOptions;
|
@@ -71,6 +80,7 @@ export declare class EnvsMain {
|
|
71
80
|
private componentMain;
|
72
81
|
private loggerMain;
|
73
82
|
private workerMain;
|
83
|
+
private envJsoncMergeCustomizerSlot;
|
74
84
|
/**
|
75
85
|
* Envs that are failed to load
|
76
86
|
*/
|
@@ -103,7 +113,7 @@ export declare class EnvsMain {
|
|
103
113
|
/**
|
104
114
|
* slot for allowing extensions to register new environment.
|
105
115
|
*/
|
106
|
-
envSlot: EnvsRegistry, logger: Logger, servicesRegistry: ServicesRegistry, componentMain: ComponentMain, loggerMain: LoggerMain, workerMain: WorkerMain);
|
116
|
+
envSlot: EnvsRegistry, logger: Logger, servicesRegistry: ServicesRegistry, componentMain: ComponentMain, loggerMain: LoggerMain, workerMain: WorkerMain, envJsoncMergeCustomizerSlot: EnvJsoncMergeCustomizerRegistry);
|
107
117
|
/**
|
108
118
|
* creates a new runtime environments for a set of components.
|
109
119
|
*/
|
@@ -151,7 +161,9 @@ export declare class EnvsMain {
|
|
151
161
|
* function returns `undefined`.
|
152
162
|
*/
|
153
163
|
hasEnvManifest(envComponent?: Component, legacyFiles?: SourceFile[]): boolean | undefined;
|
154
|
-
getEnvManifest(envComponent?: Component, legacyFiles?: SourceFile[]):
|
164
|
+
getEnvManifest(envComponent?: Component, legacyFiles?: SourceFile[]): EnvJsonc | undefined;
|
165
|
+
recursivelyMergeWithParentManifest(object: EnvJsonc, originPath: string): EnvJsonc;
|
166
|
+
mergeEnvManifests(parent: EnvJsonc, child: EnvJsonc): EnvJsonc;
|
155
167
|
hasEnvManifestById(envId: string, requesting: string): Promise<boolean | undefined>;
|
156
168
|
getEnvData(component: Component): Descriptor;
|
157
169
|
/**
|
@@ -228,6 +240,7 @@ export declare class EnvsMain {
|
|
228
240
|
*/
|
229
241
|
hasEnvConfigured(component: Component): boolean;
|
230
242
|
getAllRegisteredEnvs(): string[];
|
243
|
+
getAllRegisteredEnvJsoncCustomizers(): EnvJsoncMergeCustomizer[];
|
231
244
|
getEnvPlugin(): EnvPlugin;
|
232
245
|
/**
|
233
246
|
* an env can be configured on a component in two ways:
|
@@ -301,12 +314,16 @@ export declare class EnvsMain {
|
|
301
314
|
* register an environment.
|
302
315
|
*/
|
303
316
|
registerEnv(env: Environment): void;
|
317
|
+
/**
|
318
|
+
* register an env.jsonc merge customizer.
|
319
|
+
*/
|
320
|
+
registerEnvJsoncMergeCustomizer(customizer: EnvJsoncMergeCustomizer): void;
|
304
321
|
addNonLoadedEnvAsComponentIssues(components: Component[]): Promise<void>;
|
305
322
|
private createRuntime;
|
306
323
|
private aggregateByDefs;
|
307
324
|
private getEnvAspectDef;
|
308
325
|
private throwForDuplicateComponents;
|
309
|
-
static slots: (((registerFn: () => string) => SlotRegistry<Environment>) | ((registerFn: () => string) => SlotRegistry<EnvService<any, {}, {}>>))[];
|
326
|
+
static slots: (((registerFn: () => string) => SlotRegistry<Environment>) | ((registerFn: () => string) => SlotRegistry<EnvService<any, {}, {}>>) | ((registerFn: () => string) => SlotRegistry<EnvJsoncMergeCustomizerRegistry>))[];
|
310
327
|
static dependencies: import("@teambit/bit").Aspect[];
|
311
328
|
static provider([graphql, loggerAspect, component, cli, worker, issues]: [
|
312
329
|
GraphqlMain,
|
@@ -315,6 +332,10 @@ export declare class EnvsMain {
|
|
315
332
|
CLIMain,
|
316
333
|
WorkerMain,
|
317
334
|
IssuesMain
|
318
|
-
], config: EnvsConfig, [envSlot, servicesRegistry
|
335
|
+
], config: EnvsConfig, [envSlot, servicesRegistry, envJsoncMergeCustomizerSlot]: [
|
336
|
+
EnvsRegistry,
|
337
|
+
ServicesRegistry,
|
338
|
+
EnvJsoncMergeCustomizerRegistry
|
339
|
+
], context: Harmony): Promise<EnvsMain>;
|
319
340
|
}
|
320
341
|
export {};
|
@@ -4,6 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.EnvsMain = exports.DEFAULT_ENV = void 0;
|
7
|
+
function _path() {
|
8
|
+
const data = require("path");
|
9
|
+
_path = function () {
|
10
|
+
return data;
|
11
|
+
};
|
12
|
+
return data;
|
13
|
+
}
|
14
|
+
function _findRoot() {
|
15
|
+
const data = _interopRequireDefault(require("find-root"));
|
16
|
+
_findRoot = function () {
|
17
|
+
return data;
|
18
|
+
};
|
19
|
+
return data;
|
20
|
+
}
|
21
|
+
function _toolboxModules() {
|
22
|
+
const data = require("@teambit/toolbox.modules.module-resolver");
|
23
|
+
_toolboxModules = function () {
|
24
|
+
return data;
|
25
|
+
};
|
26
|
+
return data;
|
27
|
+
}
|
7
28
|
function _bit() {
|
8
29
|
const data = require("@teambit/bit");
|
9
30
|
_bit = function () {
|
@@ -11,6 +32,13 @@ function _bit() {
|
|
11
32
|
};
|
12
33
|
return data;
|
13
34
|
}
|
35
|
+
function _fsExtra() {
|
36
|
+
const data = require("fs-extra");
|
37
|
+
_fsExtra = function () {
|
38
|
+
return data;
|
39
|
+
};
|
40
|
+
return data;
|
41
|
+
}
|
14
42
|
function _pLocate() {
|
15
43
|
const data = _interopRequireDefault(require("p-locate"));
|
16
44
|
_pLocate = function () {
|
@@ -207,7 +235,7 @@ class EnvsMain {
|
|
207
235
|
/**
|
208
236
|
* slot for allowing extensions to register new environment.
|
209
237
|
*/
|
210
|
-
envSlot, logger, servicesRegistry, componentMain, loggerMain, workerMain) {
|
238
|
+
envSlot, logger, servicesRegistry, componentMain, loggerMain, workerMain, envJsoncMergeCustomizerSlot) {
|
211
239
|
this.config = config;
|
212
240
|
this.harmony = harmony;
|
213
241
|
this.envSlot = envSlot;
|
@@ -216,6 +244,7 @@ class EnvsMain {
|
|
216
244
|
this.componentMain = componentMain;
|
217
245
|
this.loggerMain = loggerMain;
|
218
246
|
this.workerMain = workerMain;
|
247
|
+
this.envJsoncMergeCustomizerSlot = envJsoncMergeCustomizerSlot;
|
219
248
|
/**
|
220
249
|
* Envs that are failed to load
|
221
250
|
*/
|
@@ -360,8 +389,45 @@ class EnvsMain {
|
|
360
389
|
return file.relative === 'env.jsonc' || file.relative === 'env.json';
|
361
390
|
});
|
362
391
|
if (!envJson) return undefined;
|
363
|
-
const object = (0, _commentJson().parse)(envJson.contents.toString('utf8'));
|
364
|
-
|
392
|
+
const object = (0, _commentJson().parse)(envJson.contents.toString('utf8'), undefined, true);
|
393
|
+
const resolvedObject = this.recursivelyMergeWithParentManifest(object, envJson.path);
|
394
|
+
return resolvedObject;
|
395
|
+
}
|
396
|
+
recursivelyMergeWithParentManifest(object, originPath) {
|
397
|
+
if (!object.extends) return object;
|
398
|
+
const parentPackageName = object.extends;
|
399
|
+
const parentPath = (0, _toolboxModules().resolveFrom)(originPath, [parentPackageName]);
|
400
|
+
const parentResolvedPath = (0, _findRoot().default)(parentPath);
|
401
|
+
if (!parentResolvedPath || !(0, _fsExtra().existsSync)(parentResolvedPath)) {
|
402
|
+
this.logger.info(`failed finding parent manifest for ${parentPackageName} at ${parentResolvedPath}`);
|
403
|
+
}
|
404
|
+
const parentEnvJsoncPath = ['env.jsonc', 'env.json'].map(fileName => (0, _path().join)(parentResolvedPath, fileName)).find(filePath => {
|
405
|
+
return (0, _fsExtra().existsSync)(filePath);
|
406
|
+
});
|
407
|
+
if (!parentEnvJsoncPath) {
|
408
|
+
this.logger.consoleWarning(`failed finding parent manifest for ${parentPackageName} at ${parentResolvedPath} referred from ${originPath}`);
|
409
|
+
return object;
|
410
|
+
}
|
411
|
+
const parentStr = (0, _fsExtra().readFileSync)(parentEnvJsoncPath).toString('utf8');
|
412
|
+
const parentObject = (0, _commentJson().parse)(parentStr, undefined, true);
|
413
|
+
const mergedObject = this.mergeEnvManifests(parentObject, object);
|
414
|
+
if (mergedObject.extends) {
|
415
|
+
return this.recursivelyMergeWithParentManifest(mergedObject, parentEnvJsoncPath);
|
416
|
+
}
|
417
|
+
return mergedObject;
|
418
|
+
}
|
419
|
+
mergeEnvManifests(parent, child) {
|
420
|
+
let merged = {};
|
421
|
+
const mergeCustomizer = this.getAllRegisteredEnvJsoncCustomizers();
|
422
|
+
for (const customizer of mergeCustomizer) {
|
423
|
+
const oneMerged = customizer(parent, child);
|
424
|
+
merged = _objectSpread(_objectSpread({}, merged), oneMerged);
|
425
|
+
}
|
426
|
+
// Take extends specifically from the parent so we can propagate it to the next parent
|
427
|
+
if (parent.extends) {
|
428
|
+
merged.extends = parent.extends;
|
429
|
+
}
|
430
|
+
return merged;
|
365
431
|
}
|
366
432
|
async hasEnvManifestById(envId, requesting) {
|
367
433
|
const component = await this.getEnvComponentByEnvId(envId, requesting);
|
@@ -669,6 +735,9 @@ class EnvsMain {
|
|
669
735
|
getAllRegisteredEnvs() {
|
670
736
|
return this.envSlot.toArray().map(envData => envData[0]);
|
671
737
|
}
|
738
|
+
getAllRegisteredEnvJsoncCustomizers() {
|
739
|
+
return this.envJsoncMergeCustomizerSlot.toArray().map(customizerEntry => customizerEntry[1]);
|
740
|
+
}
|
672
741
|
getEnvPlugin() {
|
673
742
|
return new (_env2().EnvPlugin)(this.envSlot, this.servicesRegistry, this.loggerMain, this.workerMain, this.harmony);
|
674
743
|
}
|
@@ -963,6 +1032,13 @@ class EnvsMain {
|
|
963
1032
|
registerEnv(env) {
|
964
1033
|
return this.envSlot.register(env);
|
965
1034
|
}
|
1035
|
+
|
1036
|
+
/**
|
1037
|
+
* register an env.jsonc merge customizer.
|
1038
|
+
*/
|
1039
|
+
registerEnvJsoncMergeCustomizer(customizer) {
|
1040
|
+
return this.envJsoncMergeCustomizerSlot.register(customizer);
|
1041
|
+
}
|
966
1042
|
async addNonLoadedEnvAsComponentIssues(components) {
|
967
1043
|
await (0, _pMapSeries().default)(components, async component => {
|
968
1044
|
const envId = await this.calculateEnvId(component);
|
@@ -1032,9 +1108,9 @@ class EnvsMain {
|
|
1032
1108
|
throw new Error(`found duplicated components: ${duplications.join(', ')}`);
|
1033
1109
|
}
|
1034
1110
|
}
|
1035
|
-
static async provider([graphql, loggerAspect, component, cli, worker, issues], config, [envSlot, servicesRegistry], context) {
|
1111
|
+
static async provider([graphql, loggerAspect, component, cli, worker, issues], config, [envSlot, servicesRegistry, envJsoncMergeCustomizerSlot], context) {
|
1036
1112
|
const logger = loggerAspect.createLogger(_environments().EnvsAspect.id);
|
1037
|
-
const envs = new EnvsMain(config, context, envSlot, logger, servicesRegistry, component, loggerAspect, worker);
|
1113
|
+
const envs = new EnvsMain(config, context, envSlot, logger, servicesRegistry, component, loggerAspect, worker, envJsoncMergeCustomizerSlot);
|
1038
1114
|
component.registerShowFragments([new (_env().EnvFragment)(envs)]);
|
1039
1115
|
if (issues) issues.registerAddComponentsIssues(envs.addNonLoadedEnvAsComponentIssues.bind(envs));
|
1040
1116
|
const envsCmd = new (_envs().EnvsCmd)(envs, component);
|
@@ -1046,7 +1122,7 @@ class EnvsMain {
|
|
1046
1122
|
}
|
1047
1123
|
exports.EnvsMain = EnvsMain;
|
1048
1124
|
_defineProperty(EnvsMain, "runtime", _cli().MainRuntime);
|
1049
|
-
_defineProperty(EnvsMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
|
1125
|
+
_defineProperty(EnvsMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
1050
1126
|
_defineProperty(EnvsMain, "dependencies", [_graphql().GraphqlAspect, _logger().LoggerAspect, _component().ComponentAspect, _cli().CLIAspect, _worker().WorkerAspect, _issues().IssuesAspect]);
|
1051
1127
|
_environments().EnvsAspect.addRuntime(EnvsMain);
|
1052
1128
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_bit","data","require","_pLocate","_interopRequireDefault","_commentJson","_cli","_component","_graphql","_issues","_pMapSeries","_componentIssues","_harmony","_logger","_bitError","_toolboxArray","_lodash","_worker","_componentId","_environments","_environments2","_runtime","_envDefinition","_envServiceList","_envs","_env","_exceptions","_env2","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEFAULT_ENV","exports","EnvsMain","icon","constructor","config","harmony","envSlot","logger","servicesRegistry","componentMain","loggerMain","workerMain","Set","createEnvironment","components","createRuntime","addFailedToLoadEnvs","id","failedToLoadEnvs","add","envIds","addFailedToLoadExt","failedToLoadExt","has","resetFailedToLoadEnvs","clear","getFailedToLoadEnvs","Array","from","extId","uniq","getDefaultEnv","defaultEnv","get","Error","EnvDefinition","getCoreEnvsIds","compose","targetEnv","envTransformers","a","reduce","acc","transformer","override","propsToOverride","env","merge","sourceEnv","allNames","prototype","getPrototypeOf","name","getOwnPropertyNames","fn","includes","bind","hasEnvManifest","envComponent","legacyFiles","undefined","files","filesystem","envJson","find","file","relative","getEnvManifest","object","parse","contents","toString","hasEnvManifestById","envId","requesting","component","getEnvComponentByEnvId","getEnvData","envsData","state","aspects","EnvsAspect","getEnvIdFromEnvsData","ignoreVersion","rawEnvId","envIdWithoutVersion","ComponentID","fromString","toStringWithoutVersion","getEnvId","envIdFromEnvData","withVersion","resolveEnv","withVersionMatch","toArray","withVersionMatchId","exactMatch","exactMatchId","EnvNotConfiguredForComponent","isUsingCoreEnv","isCoreEnv","getEnv","envDef","getEnvDefinitionByStringId","EnvNotFound","getEnvComponent","host","getHost","newId","resolveComponentId","BitError","getOrCalculateEnv","err","calculateEnv","getDescriptor","calcDescriptor","opts","componentDescriptor","getComponentEnvDescriptor","envComponentSelfDescriptor","getEnvSelfDescriptor","result","self","isEnvRegistered","getEnvFromComponent","services","getServices","selfDescriptor","getEnvDescriptorFromEnvDef","toObject","__getDescriptor","systemDescriptor","type","split","description","matchedEntry","entries","aspectEntry","calculateEnvId","envIdFromEnvsConfig","getEnvIdFromEnvsConfig","envIdFromEnvsConfigWithoutVersion","ids","findFirstEnv","finalId","getEnvDefinitionById","skipWarnings","printWarningIfFirstTime","envDefFromList","getAllEnvsConfiguredOnComponent","getEnvFromEnvsConfig","getEnvsNotFromEnvsConfig","hasEnvConfigured","Boolean","getAllRegisteredEnvs","map","envData","getEnvPlugin","EnvPlugin","getEnvIdFromEnvsLegacyExtensions","extensions","envsAspect","findCoreExtension","calculateEnvIdFromExtensions","extension","extensionId","stringId","calculateEnvFromExtensions","getEnvDefinitionByLegacyExtension","isFoundWithoutVersion","pLocate","idWithoutVersion","isCoreAspect","envDefWithoutVersion","hasManifest","isUsingEnvEnv","finalEnvId","getEnvDefinition","allVersions","all","first","head","getEnvsEnvDefinition","message","alreadyShownWarning","consoleWarning","isUsingAspectEnv","isEnv","registerService","envServices","register","allServices","currentServices","service","implements","warn","EnvServiceList","registerEnv","addNonLoadedEnvAsComponentIssues","pMapSeries","envIdStr","foundComp","c","issues","getOrCreate","IssuesClasses","ExternalEnvWithoutVersion","componentId","NonLoadedEnv","Runtime","aggregateByDefs","throwForDuplicateComponents","envsMap","Promise","envAspectDef","getEnvAspectDef","EnvRuntime","resolvedAspects","resolveAspects","MainRuntime","requestedOnly","filterByRuntime","useScopeAspectsCapsule","def","idsStr","duplications","findDuplications","join","provider","graphql","loggerAspect","cli","worker","context","createLogger","envs","registerShowFragments","EnvFragment","registerAddComponentsIssues","envsCmd","EnvsCmd","commands","ListEnvsCmd","GetEnvCmd","environmentsSchema","Slot","withType","GraphqlAspect","LoggerAspect","ComponentAspect","CLIAspect","WorkerAspect","IssuesAspect","addRuntime"],"sources":["environments.main.runtime.ts"],"sourcesContent":["import { isCoreAspect } from '@teambit/bit';\nimport pLocate from 'p-locate';\nimport { parse } from 'comment-json';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect, ComponentMain } from '@teambit/component';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { IssuesAspect, IssuesMain } from '@teambit/issues';\nimport pMapSeries from 'p-map-series';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Harmony, Slot, SlotRegistry } from '@teambit/harmony';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport type { AspectDefinition } from '@teambit/aspect-loader';\nimport { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { BitError } from '@teambit/bit-error';\nimport { findDuplications } from '@teambit/toolbox.array.duplications-finder';\nimport { head, uniq } from 'lodash';\nimport { WorkerAspect, WorkerMain } from '@teambit/worker';\nimport { ComponentID } from '@teambit/component-id';\nimport { EnvService } from './services';\nimport { Environment } from './environment';\nimport { EnvsAspect } from './environments.aspect';\nimport { environmentsSchema } from './environments.graphql';\nimport { EnvRuntime, Runtime } from './runtime';\nimport { EnvDefinition } from './env-definition';\nimport { EnvServiceList } from './env-service-list';\nimport { EnvsCmd, GetEnvCmd, ListEnvsCmd } from './envs.cmd';\nimport { EnvFragment } from './env.fragment';\nimport { EnvNotFound, EnvNotConfiguredForComponent } from './exceptions';\nimport { EnvPlugin } from './env.plugin';\n\nexport type EnvsRegistry = SlotRegistry<Environment>;\n\nexport type EnvsConfig = {\n env: string;\n options: EnvOptions;\n};\n\ntype GetCalcEnvOptions = {\n skipWarnings?: boolean;\n};\n\nexport type EnvOptions = {};\n\nexport type EnvTransformer = (env: Environment) => Environment;\n\nexport type ServicesRegistry = SlotRegistry<Array<EnvService<any>>>;\n\nexport type RegularCompDescriptor = {\n id: string;\n icon?: string;\n type?: string;\n name?: string;\n description?: string;\n};\nexport type EnvCompDescriptorProps = RegularCompDescriptor & {\n services?: {\n env: {\n id: string;\n icon: string;\n name?: string;\n description?: string;\n };\n services: Array<{\n id: string;\n name?: string;\n description?: string;\n data: any;\n }>;\n };\n};\n\nexport type EnvCompDescriptor = EnvCompDescriptorProps & {\n self?: EnvCompDescriptorProps;\n};\n\nexport type Descriptor = RegularCompDescriptor | EnvCompDescriptor;\n\nexport const DEFAULT_ENV = 'teambit.harmony/node';\n\nexport class EnvsMain {\n /**\n * Envs that are failed to load\n */\n private failedToLoadEnvs = new Set<string>();\n /**\n * Extensions that are failed to load\n * We use this as sometime when we couldn't load an extension we don't know if it's an env or not\n * We should ideally take it from the aspect loader aspect, but right now the aspect loader is using envs\n */\n private failedToLoadExt = new Set<string>();\n /**\n * Ids of envs (not neccesrraly loaded successfully)\n */\n public envIds = new Set<string>();\n\n static runtime = MainRuntime;\n\n private alreadyShownWarning = {};\n\n /**\n * icon of the extension.\n */\n icon() {\n return `<svg width=\"50\" height=\"50\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"25\" cy=\"25\" r=\"20\"/>\n </svg>`;\n }\n\n constructor(\n /**\n * environments extension configuration.\n */\n readonly config: EnvsConfig,\n\n /**\n * harmony context.\n */\n private harmony: Harmony,\n\n /**\n * slot for allowing extensions to register new environment.\n */\n private envSlot: EnvsRegistry,\n\n private logger: Logger,\n\n private servicesRegistry: ServicesRegistry,\n\n private componentMain: ComponentMain,\n\n private loggerMain: LoggerMain,\n\n private workerMain: WorkerMain\n ) {}\n\n /**\n * creates a new runtime environments for a set of components.\n */\n async createEnvironment(components: Component[]): Promise<Runtime> {\n return this.createRuntime(components);\n }\n\n /**\n *\n * @param id\n */\n /**\n * This function adds an extension ID to a set of failed to load extensions.\n * This mostly used by the aspect loader to add such issues\n * Then it is used to hide different errors that are caused by the same issue.\n * @param {string} id - string - represents the unique identifier of an extension that failed to load.\n */\n addFailedToLoadEnvs(id: string) {\n this.failedToLoadEnvs.add(id);\n this.envIds.add(id);\n }\n\n addFailedToLoadExt(id: string) {\n this.failedToLoadExt.add(id);\n if (this.envIds.has(id)) {\n this.addFailedToLoadEnvs(id);\n }\n }\n\n resetFailedToLoadEnvs() {\n this.failedToLoadEnvs.clear();\n this.failedToLoadExt.clear();\n }\n\n getFailedToLoadEnvs() {\n const failedToLoadEnvs = Array.from(this.failedToLoadEnvs);\n // Add all extensions which are also envs\n for (const extId of this.failedToLoadExt) {\n if (this.envIds.has(extId)) {\n failedToLoadEnvs.push(extId);\n }\n }\n return uniq(failedToLoadEnvs);\n }\n\n /**\n * get the configured default env.\n */\n getDefaultEnv(): EnvDefinition {\n const defaultEnv = this.envSlot.get(DEFAULT_ENV);\n if (!defaultEnv) throw new Error('default env must be set.');\n\n return new EnvDefinition(DEFAULT_ENV, defaultEnv);\n }\n\n getCoreEnvsIds(): string[] {\n return [\n 'teambit.harmony/aspect',\n 'teambit.react/react',\n 'teambit.harmony/node',\n 'teambit.react/react-native',\n 'teambit.html/html',\n 'teambit.mdx/mdx',\n 'teambit.envs/env',\n 'teambit.mdx/readme',\n 'teambit.harmony/bit-custom-aspect',\n ];\n }\n\n /**\n * compose a new environment from a list of environment transformers.\n */\n compose(targetEnv: Environment, envTransformers: EnvTransformer[]) {\n const a = envTransformers.reduce((acc, transformer) => {\n acc = transformer(acc);\n return acc;\n }, targetEnv);\n\n return a;\n }\n\n /**\n * create an env transformer which overrides specific env properties.\n */\n override(propsToOverride: Environment): EnvTransformer {\n return (env: Environment) => {\n return this.merge(propsToOverride, env);\n };\n }\n\n /**\n * compose two environments into one.\n */\n merge<T extends Environment, S extends Environment>(targetEnv: Environment, sourceEnv: Environment): T & S {\n const allNames = new Set<string>();\n const keys = ['icon', 'name', 'description'];\n for (let o = sourceEnv; o !== Object.prototype; o = Object.getPrototypeOf(o)) {\n for (const name of Object.getOwnPropertyNames(o)) {\n allNames.add(name);\n }\n }\n\n allNames.forEach((key: string) => {\n const fn = sourceEnv[key];\n if (targetEnv[key]) return;\n if (keys.includes(key)) targetEnv[key] = fn;\n if (!fn || !fn.bind) {\n return;\n }\n targetEnv[key] = fn.bind(sourceEnv);\n });\n\n return targetEnv as T & S;\n }\n\n /**\n * This function checks if an environment manifest file exists in a given component or set of legacy files.\n * @param {Component} [envComponent] - A component object that represents an environment. It contains information about\n * the files and directories that make up the environment.\n * @param {SourceFile[]} [legacyFiles] - An optional array of SourceFile objects representing the files in the legacy\n * file system. If this parameter is not provided, the function will attempt to retrieve the files from the envComponent\n * parameter.\n * @returns a boolean value indicating whether an `env.jsonc` or `env.json` file exists in the `files` array of either\n * the `envComponent` object or the `legacyFiles` array. If neither `envComponent` nor `legacyFiles` are provided, the\n * function returns `undefined`.\n */\n hasEnvManifest(envComponent?: Component, legacyFiles?: SourceFile[]): boolean | undefined {\n if (!envComponent && !legacyFiles) return undefined;\n // @ts-ignore\n const files = legacyFiles || envComponent.filesystem.files;\n const envJson = files.find((file) => {\n return file.relative === 'env.jsonc' || file.relative === 'env.json';\n });\n\n if (!envJson) return false;\n return true;\n }\n\n getEnvManifest(envComponent?: Component, legacyFiles?: SourceFile[]): Object | undefined {\n // TODO: maybe throw an error here?\n if (!envComponent && !legacyFiles) return undefined;\n // @ts-ignore\n const files = legacyFiles || envComponent.filesystem.files;\n const envJson = files.find((file) => {\n return file.relative === 'env.jsonc' || file.relative === 'env.json';\n });\n\n if (!envJson) return undefined;\n\n const object = parse(envJson.contents.toString('utf8'));\n return object;\n }\n\n async hasEnvManifestById(envId: string, requesting: string): Promise<boolean | undefined> {\n const component = await this.getEnvComponentByEnvId(envId, requesting);\n return this.hasEnvManifest(component);\n }\n\n getEnvData(component: Component): Descriptor {\n let envsData = component.state.aspects.get(EnvsAspect.id);\n if (!envsData) {\n // TODO: remove this once we re-export old components used to store the data here\n envsData = component.state.aspects.get('teambit.workspace/workspace');\n }\n if (!envsData) throw new Error(`env was not configured on component ${component.id.toString()}`);\n return envsData.data as Descriptor;\n }\n\n /**\n * Return the id of the env as configured in the envs data (without version by default)\n * The reason it's not contain version by default is that we want to take the version from the aspect defined on the component itself\n * As this version is stay up to date during tagging the env along with the component\n * @param component\n * @param ignoreVersion\n */\n private getEnvIdFromEnvsData(component: Component, ignoreVersion = true): string | undefined {\n const envsData = this.getEnvData(component);\n if (!envsData) return undefined;\n const rawEnvId = envsData.id;\n if (!rawEnvId) return undefined;\n if (!ignoreVersion) return rawEnvId;\n const envIdWithoutVersion = ComponentID.fromString(rawEnvId).toStringWithoutVersion();\n return envIdWithoutVersion;\n }\n\n /**\n * get the env id of the given component.\n */\n getEnvId(component: Component): string {\n const envIdFromEnvData = this.getEnvIdFromEnvsData(component);\n if (!envIdFromEnvData) {\n // This should never happen\n throw new Error(`no env found for ${component.id.toString()}`);\n }\n const withVersion = this.resolveEnv(component, envIdFromEnvData);\n const withVersionMatch = this.envSlot.toArray().find(([envId]) => {\n return withVersion?.toString() === envId;\n });\n const withVersionMatchId = withVersionMatch?.[0];\n if (withVersionMatchId) return withVersionMatchId;\n\n // Handle core envs\n const exactMatch = this.envSlot.toArray().find(([envId]) => {\n return envIdFromEnvData === envId;\n });\n\n const exactMatchId = exactMatch?.[0];\n if (exactMatchId) return exactMatchId;\n\n if (!withVersion) throw new EnvNotConfiguredForComponent(envIdFromEnvData, component.id.toString());\n return withVersion.toString();\n }\n\n isUsingCoreEnv(component: Component): boolean {\n const envId = this.getEnvId(component);\n return this.isCoreEnv(envId);\n }\n\n isCoreEnv(envId: string): boolean {\n return this.getCoreEnvsIds().includes(envId);\n }\n\n /**\n * get the env of the given component.\n * In case you are asking for the env during on load you should use calculateEnv instead\n */\n getEnv(component: Component): EnvDefinition {\n const id = this.getEnvId(component);\n const envDef = this.getEnvDefinitionByStringId(id);\n if (envDef) {\n return envDef;\n }\n // Do not allow a non existing env\n throw new EnvNotFound(id, component.id.toString());\n }\n\n /**\n * get the env component of the given component.\n */\n async getEnvComponent(component: Component): Promise<Component> {\n const envId = this.getEnvId(component);\n return this.getEnvComponentByEnvId(envId, component.id.toString());\n }\n\n /**\n * get the env component by the env id.\n */\n async getEnvComponentByEnvId(envId: string, requesting?: string): Promise<Component> {\n const host = this.componentMain.getHost();\n const newId = await host.resolveComponentId(envId);\n const envComponent = await host.get(newId);\n if (!envComponent) {\n throw new BitError(`can't load env. env id is ${envId} used by component ${requesting || 'unknown'}`);\n }\n return envComponent;\n }\n\n /**\n * get the env of the given component.\n * This will try to use the regular getEnv but fallback to the calculate env (in case you are using it during on load)\n * This is safe to be used on onLoad as well\n */\n getOrCalculateEnv(component: Component): EnvDefinition {\n try {\n return this.getEnv(component);\n } catch (err) {\n return this.calculateEnv(component);\n }\n }\n\n /**\n * get an environment Descriptor.\n */\n getDescriptor(component: Component): Descriptor | undefined {\n const envsData = this.getEnvData(component);\n envsData.id = this.resolveEnv(component, envsData.id)?.toString() || envsData.id;\n return envsData;\n }\n\n async calcDescriptor(component: Component, opts: GetCalcEnvOptions = {}): Promise<Descriptor | undefined> {\n const componentDescriptor = await this.getComponentEnvDescriptor(component, opts);\n if (!componentDescriptor) return undefined;\n const envComponentSelfDescriptor = await this.getEnvSelfDescriptor(component);\n const result = envComponentSelfDescriptor\n ? { ...componentDescriptor, self: envComponentSelfDescriptor }\n : componentDescriptor;\n return result;\n }\n\n /**\n * Get env descriptor from the env itself if the component is an env\n * This will be empty for regular component, and will only contain data for env themself\n */\n private async getEnvSelfDescriptor(envComponent: Component): Promise<EnvCompDescriptorProps | undefined> {\n // !important calculate only on the env itself.\n if (!this.isEnvRegistered(envComponent.id.toString())) {\n return undefined;\n }\n\n const envDef = this.getEnvFromComponent(envComponent);\n if (!envDef) return undefined;\n\n const services = this.getServices(envDef);\n // const selfDescriptor = (await this.getEnvDescriptorFromEnvDef(envDef)) || {};\n const selfDescriptor = await this.getEnvDescriptorFromEnvDef(envDef);\n\n if (!selfDescriptor) return undefined;\n return {\n ...selfDescriptor,\n services: services.toObject(),\n };\n }\n\n /**\n * Get env descriptor from the env that a given component is using\n */\n private async getComponentEnvDescriptor(\n component: Component,\n opts: GetCalcEnvOptions = {}\n ): Promise<RegularCompDescriptor | undefined> {\n const envDef = this.calculateEnv(component, opts);\n return this.getEnvDescriptorFromEnvDef(envDef);\n }\n\n private async getEnvDescriptorFromEnvDef(envDef: EnvDefinition): Promise<RegularCompDescriptor | undefined> {\n if (!envDef.env.__getDescriptor || typeof envDef.env.__getDescriptor !== 'function') {\n return undefined;\n }\n const systemDescriptor = await envDef.env.__getDescriptor();\n\n return {\n type: systemDescriptor.type,\n // Make sure to store the env id in the data without the version\n // The version should always come from the aspect id configured on the component\n id: envDef.id.split('@')[0],\n name: envDef.name,\n icon: envDef.env.icon,\n description: envDef.description,\n };\n }\n\n resolveEnv(component: Component, id: string) {\n const matchedEntry = component.state.aspects.entries.find((aspectEntry) => {\n return id === aspectEntry.id.toString() || id === aspectEntry.id.toString({ ignoreVersion: true });\n });\n\n return matchedEntry?.id;\n }\n\n /**\n * This used to calculate the actual env during the component load.\n * Do not use it to get the env (use getEnv instead)\n * This should be used only during on load\n */\n async calculateEnvId(component: Component): Promise<ComponentID> {\n // Search first for env configured via envs aspect itself\n const envIdFromEnvsConfig = this.getEnvIdFromEnvsConfig(component);\n // if (!envIdFromEnvsConfig) return this.getDefaultEnv();\n const envIdFromEnvsConfigWithoutVersion = envIdFromEnvsConfig\n ? ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion()\n : undefined;\n\n if (envIdFromEnvsConfig && this.isCoreEnv(envIdFromEnvsConfig)) {\n return ComponentID.fromString(envIdFromEnvsConfig);\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = component.state.aspects.entries.find((aspectEntry) => {\n return (\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString() ||\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString({ ignoreVersion: true })\n );\n });\n\n if (matchedEntry?.id) return matchedEntry?.id;\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n let ids: string[] = [];\n component.state.aspects.entries.forEach((aspectEntry) => {\n ids.push(aspectEntry.id.toString());\n // ids.push(aspectEntry.id.toString({ ignoreVersion: true }));\n });\n ids = uniq(ids);\n const envId = await this.findFirstEnv(ids);\n const finalId = envId || this.getDefaultEnv().id;\n return ComponentID.fromString(finalId);\n }\n\n /**\n * This used to calculate the actual env during the component load.\n * Do not use it to get the env (use getEnv instead)\n * This should be used only during on load\n */\n calculateEnv(component: Component, opts: GetCalcEnvOptions = {}): EnvDefinition {\n // Search first for env configured via envs aspect itself\n const envIdFromEnvsConfig = this.getEnvIdFromEnvsConfig(component);\n let envIdFromEnvsConfigWithoutVersion;\n if (envIdFromEnvsConfig) {\n envIdFromEnvsConfigWithoutVersion = ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion();\n const envDef = this.getEnvDefinitionByStringId(envIdFromEnvsConfigWithoutVersion);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = component.state.aspects.entries.find((aspectEntry) => {\n return (\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString() ||\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString({ ignoreVersion: true })\n );\n });\n if (matchedEntry) {\n // during the tag process, the version in the aspect-entry-id is changed and is not the\n // same as it was when it registered to the slot.\n const envDef = this.getEnvDefinitionById(matchedEntry.id);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n if (!opts.skipWarnings) {\n // Do not allow a non existing env\n this.printWarningIfFirstTime(\n matchedEntry.id.toString(),\n `environment with ID: ${matchedEntry.id.toString()} configured on component ${component.id.toString()} was not loaded (run \"bit install\")`\n );\n }\n }\n // Do not allow configure teambit.envs/envs on the component without configure the env aspect itself\n // const errMsg = new EnvNotConfiguredForComponent(envIdFromEnvsConfig as string, component.id.toString()).message;\n // this.printWarningIfFirstTime(envIdFromEnvsConfig as string, errMsg);\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n let envDefFromList;\n component.state.aspects.entries.find((aspectEntry) => {\n const envDef = this.getEnvDefinitionById(aspectEntry.id);\n if (envDef) {\n envDefFromList = envDef;\n }\n return !!envDef;\n });\n\n if (envDefFromList) {\n this.envIds.add(envDefFromList.id);\n return envDefFromList;\n }\n return this.getDefaultEnv();\n }\n\n /**\n * an env can be configured on a component in two ways:\n * 1) explicitly inside \"teambit.envs/envs\". `{ \"teambit.envs/envs\": { \"env\": \"my-env\" } }`\n * 2) the env aspect is set on the variant as any other aspect, e.g. `{ \"my-env\": {} }`\n *\n * this method returns #1 if exists, otherwise, #2.\n */\n getAllEnvsConfiguredOnComponent(component: Component): EnvDefinition[] {\n // if a component has \"envs\" config, use it and ignore other components that are set up\n // in this components which happen to be envs.\n const envDef = this.getEnvFromEnvsConfig(component);\n if (envDef) {\n return [envDef];\n }\n\n return this.getEnvsNotFromEnvsConfig(component);\n }\n\n /**\n * whether a component has an env configured (either by variant or .bitmap).\n */\n hasEnvConfigured(component: Component): boolean {\n return Boolean(this.getAllEnvsConfiguredOnComponent(component).length);\n }\n\n getAllRegisteredEnvs(): string[] {\n return this.envSlot.toArray().map((envData) => envData[0]);\n }\n\n getEnvPlugin() {\n return new EnvPlugin(this.envSlot, this.servicesRegistry, this.loggerMain, this.workerMain, this.harmony);\n }\n\n /**\n * an env can be configured on a component in two ways:\n * 1) explicitly inside \"teambit.envs/envs\". `{ \"teambit.envs/envs\": { \"env\": \"my-env\" } }`\n * 2) the env aspect is set on the variant as any other aspect, e.g. `{ \"my-env\": {} }`\n *\n * this method returns only #1\n */\n getEnvFromEnvsConfig(component: Component): EnvDefinition | undefined {\n const envIdFromEnvsConfig = this.getEnvIdFromEnvsConfig(component);\n if (!envIdFromEnvsConfig) {\n return undefined;\n }\n const envIdFromEnvsConfigWithoutVersion = ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion();\n const envDef = this.getEnvDefinitionByStringId(envIdFromEnvsConfigWithoutVersion);\n return envDef;\n }\n\n /**\n * an env can be configured on a component in two ways:\n * 1) explicitly inside \"teambit.envs/envs\". `{ \"teambit.envs/envs\": { \"env\": \"my-env\" } }`\n * 2) the env aspect is set on the variant as any other aspect, e.g. `{ \"my-env\": {} }`\n *\n * this method returns only #2\n */\n getEnvsNotFromEnvsConfig(component: Component): EnvDefinition[] {\n return component.state.aspects.entries.reduce((acc: EnvDefinition[], aspectEntry) => {\n const envDef = this.getEnvDefinitionById(aspectEntry.id);\n if (envDef) acc.push(envDef);\n return acc;\n }, []);\n }\n\n getEnvIdFromEnvsLegacyExtensions(extensions: ExtensionDataList): string | undefined {\n const envsAspect = extensions.findCoreExtension(EnvsAspect.id);\n const envIdFromEnvsConfig = envsAspect?.data.id;\n return envIdFromEnvsConfig;\n }\n\n /**\n * @deprecated DO NOT USE THIS METHOD ANYMORE!!! (PLEASE USE .calculateEnvId() instead!)\n */\n async calculateEnvIdFromExtensions(extensions: ExtensionDataList): Promise<string> {\n // Search first for env configured via envs aspect itself\n const envsAspect = extensions.findCoreExtension(EnvsAspect.id);\n const envIdFromEnvsConfig = envsAspect?.config.env;\n\n const envIdFromEnvsConfigWithoutVersion = envIdFromEnvsConfig\n ? ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion()\n : undefined;\n\n if (envIdFromEnvsConfig && this.isCoreEnv(envIdFromEnvsConfig)) {\n return envIdFromEnvsConfig;\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = extensions.find((extension) => {\n if (extension.extensionId) {\n return (\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString() ||\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString({ ignoreVersion: true })\n );\n }\n return envIdFromEnvsConfigWithoutVersion === extension.stringId;\n });\n if (matchedEntry?.id) return matchedEntry?.stringId;\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n const ids: string[] = [];\n extensions.forEach((extension) => {\n if (extension.extensionId) {\n ids.push(extension.extensionId.toString());\n } else {\n ids.push(extension.stringId);\n }\n });\n const envId = await this.findFirstEnv(ids);\n const finalId = envId || this.getDefaultEnv().id;\n return finalId;\n }\n\n /**\n * @deprecated DO NOT USE THIS METHOD ANYMORE!!! (PLEASE USE .calculateEnv() instead!)\n */\n async calculateEnvFromExtensions(extensions: ExtensionDataList): Promise<EnvDefinition> {\n // Search first for env configured via envs aspect itself\n const envsAspect = extensions.findCoreExtension(EnvsAspect.id);\n const envIdFromEnvsConfig = envsAspect?.config.env;\n let envIdFromEnvsConfigWithoutVersion;\n\n if (envIdFromEnvsConfig) {\n envIdFromEnvsConfigWithoutVersion = ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion();\n const envDef = this.getEnvDefinitionByStringId(envIdFromEnvsConfigWithoutVersion);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = extensions.find((extension) => {\n if (extension.extensionId) {\n return (\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString() ||\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString({ ignoreVersion: true })\n );\n }\n return envIdFromEnvsConfigWithoutVersion === extension.stringId;\n });\n if (matchedEntry) {\n // during the tag process, the version in the aspect-entry-id is changed and is not the\n // same as it was when it registered to the slot.\n const envDef = this.getEnvDefinitionByLegacyExtension(matchedEntry);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n // Do not allow a non existing env\n // this.printWarningIfFirstTime(\n // matchedEntry.id.toString(),\n // `environment with ID: ${matchedEntry.id.toString()} was not found`\n // );\n }\n // Do not allow configure teambit.envs/envs on the component without configure the env aspect itself\n // const errMsg = new EnvNotConfiguredForComponent(envIdFromEnvsConfig).message;\n // this.printWarningIfFirstTime(envIdFromEnvsConfig, errMsg);\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n const ids: string[] = [];\n extensions.forEach((extension) => {\n if (extension.extensionId) {\n ids.push(extension.extensionId.toString());\n } else {\n ids.push(extension.stringId);\n }\n });\n const envId = await this.findFirstEnv(ids);\n const envDef = envId ? this.getEnvDefinitionByStringId(envId) : undefined;\n\n return envDef || this.getDefaultEnv();\n }\n\n /**\n * This function finds the first environment ID from a list of IDs by checking if it is register as env (to the slot).\n * or contains env.jsonc file\n * @param {string[]} ids - `ids` is an array of string values representing environment IDs. The function `findFirstEnv`\n * takes this array as input and returns a Promise that resolves to a string value representing the first environment ID\n * that matches certain conditions.\n * @returns The `findFirstEnv` function returns a Promise that resolves to a string or undefined. The string represents\n * the ID of the first environment that matches the conditions specified in the function, or undefined if no environment\n * is found.\n */\n private async findFirstEnv(ids: string[]): Promise<string | undefined> {\n let isFoundWithoutVersion = false;\n const envId = await pLocate(ids, async (id) => {\n const idWithoutVersion = id.split('@')[0];\n if (this.isCoreEnv(idWithoutVersion)) return true;\n if (isCoreAspect(idWithoutVersion)) return false;\n const envDef = this.getEnvDefinitionByStringId(id);\n if (envDef) return true;\n const envDefWithoutVersion = this.getEnvDefinitionByStringId(idWithoutVersion);\n if (envDefWithoutVersion) {\n isFoundWithoutVersion = true;\n return true;\n }\n const envComponent = await this.getEnvComponentByEnvId(id);\n const hasManifest = this.hasEnvManifest(envComponent);\n if (hasManifest) return true;\n const isUsingEnvEnv = this.isUsingEnvEnv(envComponent);\n return !!isUsingEnvEnv;\n });\n let finalEnvId;\n if (envId) {\n finalEnvId = isFoundWithoutVersion ? envId?.split('@')[0] : envId;\n this.envIds.add(envId);\n }\n return finalEnvId;\n }\n\n private getEnvDefinitionByLegacyExtension(extension: ExtensionDataEntry): EnvDefinition | undefined {\n const envDef = extension.extensionId\n ? this.getEnvDefinitionById(extension.extensionId)\n : this.getEnvDefinitionByStringId(extension.stringId);\n return envDef;\n }\n\n getEnvIdFromEnvsConfig(component: Component): string | undefined {\n const envsAspect = component.state.aspects.get(EnvsAspect.id);\n return envsAspect?.config.env;\n }\n\n getEnvDefinition(id: ComponentID) {\n const allVersions = this.envSlot.toArray();\n const all = allVersions.filter(([envId]) => envId.includes(id.toStringWithoutVersion()));\n const first = head(all);\n if (!first) return undefined;\n const [envId, env] = first;\n return new EnvDefinition(envId, env);\n }\n\n getEnvDefinitionById(id: ComponentID): EnvDefinition | undefined {\n const envDef =\n this.getEnvDefinitionByStringId(id.toString()) ||\n this.getEnvDefinitionByStringId(id.toString({ ignoreVersion: true }));\n return envDef;\n }\n\n public getEnvDefinitionByStringId(envId: string): EnvDefinition | undefined {\n const env = this.envSlot.get(envId);\n if (env) {\n return new EnvDefinition(envId, env as Environment);\n }\n return undefined;\n }\n\n getEnvFromComponent(envComponent: Component): EnvDefinition | undefined {\n const env = this.getEnvDefinitionById(envComponent.id);\n return env;\n }\n\n /**\n * Return the env definition of teambit.envs/env\n */\n getEnvsEnvDefinition(): EnvDefinition {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.getEnvDefinitionByStringId('teambit.envs/env')!;\n }\n\n private printWarningIfFirstTime(envId: string, message: string) {\n if (!this.alreadyShownWarning[envId] && !this.failedToLoadEnvs.has(envId)) {\n this.alreadyShownWarning[envId] = true;\n this.logger.consoleWarning(message);\n this.addFailedToLoadEnvs(envId);\n }\n }\n\n /**\n * determines whether an env is registered.\n */\n public isEnvRegistered(id: string) {\n return Boolean(this.envSlot.get(id));\n }\n\n isUsingAspectEnv(component: Component): boolean {\n const data = this.getEnvData(component);\n if (!data) return false;\n return data.type === 'aspect';\n }\n\n isUsingEnvEnv(component: Component): boolean {\n const data = this.getEnvData(component);\n if (!data) return false;\n return data.type === 'env';\n }\n\n /**\n * Check if the given component is an env component.\n * @param component\n * @returns\n */\n isEnv(component: Component): boolean {\n return (\n this.isUsingEnvEnv(component) ||\n this.isEnvRegistered(component.id.toString()) ||\n this.isEnvRegistered(component.id.toStringWithoutVersion())\n );\n }\n\n /**\n * register a new environment service.\n */\n registerService(...envServices: EnvService<any>[]) {\n this.servicesRegistry.register(envServices);\n return this;\n }\n\n /**\n * get list of services enabled on an env.\n */\n getServices(env: EnvDefinition): EnvServiceList {\n const allServices = this.servicesRegistry.toArray();\n const services: [string, EnvService<any>][] = [];\n allServices.forEach(([id, currentServices]) => {\n currentServices.forEach((service) => {\n try {\n if (this.implements(env, service)) {\n services.push([id, service]);\n }\n } catch (err) {\n this.logger.warn(`failed loading service ${id} for env ${env.id}`);\n }\n });\n });\n return new EnvServiceList(env, services);\n }\n\n implements(env: EnvDefinition, service: EnvService<any>) {\n // TODO: remove this after refactoring everything and remove getDescriptor from being optional.\n if (!service.getDescriptor) return false;\n return !!service.getDescriptor(env);\n }\n\n /**\n * register an environment.\n */\n registerEnv(env: Environment) {\n return this.envSlot.register(env);\n }\n\n async addNonLoadedEnvAsComponentIssues(components: Component[]) {\n await pMapSeries(components, async (component) => {\n const envId = await this.calculateEnvId(component);\n const envIdStr = envId.toString();\n if (!this.isEnvRegistered(envIdStr)) {\n this.addFailedToLoadEnvs(envIdStr);\n // If there is no version and the env is not in the workspace this is not valid\n // you can't set external env without version\n if (!envIdStr.includes('@')) {\n const foundComp = components.find((c) => c.id.toStringWithoutVersion() === envIdStr);\n if (!foundComp) {\n component.state.issues.getOrCreate(IssuesClasses.ExternalEnvWithoutVersion).data = {\n envId: envIdStr,\n componentId: component.id.toString(),\n };\n } else {\n component.state.issues.getOrCreate(IssuesClasses.NonLoadedEnv).data = envIdStr;\n }\n } else {\n component.state.issues.getOrCreate(IssuesClasses.NonLoadedEnv).data = envIdStr;\n }\n }\n });\n }\n\n // refactor here\n private async createRuntime(components: Component[]): Promise<Runtime> {\n return new Runtime(await this.aggregateByDefs(components), this.logger);\n }\n\n // :TODO can be refactored to few utilities who will make repeating this very easy.\n private async aggregateByDefs(components: Component[]): Promise<EnvRuntime[]> {\n this.throwForDuplicateComponents(components);\n const envsMap = {};\n components.forEach((component: Component) => {\n const envDef = this.getEnv(component);\n const envId = envDef.id;\n const env = envDef.env;\n // handle config as well when aggregating envs.\n if (envsMap[envId]) envsMap[envId].components.push(component);\n else\n envsMap[envId] = {\n components: [component],\n env,\n };\n });\n\n return Promise.all(\n Object.keys(envsMap).map(async (key) => {\n const envAspectDef = await this.getEnvAspectDef(key);\n return new EnvRuntime(key, envsMap[key].env, envsMap[key].components, envAspectDef);\n })\n );\n }\n\n private async getEnvAspectDef(envId: string): Promise<AspectDefinition> {\n const host = this.componentMain.getHost();\n const id = await host.resolveComponentId(envId);\n // We don't want to filter by runtime here as we want to also get envs that configured as plugins. so they don't\n // contain the runtime path.\n const resolvedAspects = await host.resolveAspects(MainRuntime.name, [id], {\n requestedOnly: true,\n filterByRuntime: false,\n useScopeAspectsCapsule: true,\n });\n const def = resolvedAspects[0];\n\n return def;\n }\n\n private throwForDuplicateComponents(components: Component[]) {\n const idsStr = components.map((c) => c.id.toString());\n const duplications = findDuplications(idsStr);\n if (duplications.length) {\n throw new Error(`found duplicated components: ${duplications.join(', ')}`);\n }\n }\n\n static slots = [Slot.withType<Environment>(), Slot.withType<EnvService<any>>()];\n\n static dependencies = [GraphqlAspect, LoggerAspect, ComponentAspect, CLIAspect, WorkerAspect, IssuesAspect];\n\n static async provider(\n [graphql, loggerAspect, component, cli, worker, issues]: [\n GraphqlMain,\n LoggerMain,\n ComponentMain,\n CLIMain,\n WorkerMain,\n IssuesMain\n ],\n config: EnvsConfig,\n [envSlot, servicesRegistry]: [EnvsRegistry, ServicesRegistry],\n context: Harmony\n ) {\n const logger = loggerAspect.createLogger(EnvsAspect.id);\n const envs = new EnvsMain(config, context, envSlot, logger, servicesRegistry, component, loggerAspect, worker);\n component.registerShowFragments([new EnvFragment(envs)]);\n if (issues) issues.registerAddComponentsIssues(envs.addNonLoadedEnvAsComponentIssues.bind(envs));\n\n const envsCmd = new EnvsCmd(envs, component);\n envsCmd.commands = [new ListEnvsCmd(envs, component), new GetEnvCmd(envs, component)];\n cli.register(envsCmd);\n graphql.register(environmentsSchema(envs));\n return envs;\n }\n}\n\nEnvsAspect.addRuntime(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CAACmC,2BAA2B,CAACH,IAAI,CAACrC,gCAAgC,CAAC9I,IAAI,CAACmL,IAAI,CAAC,CAAC;IAEhG,MAAMI,OAAO,GAAG,KAAIC,eAAO,EAACL,IAAI,EAAEhK,SAAS,CAAC;IAC5CoK,OAAO,CAACE,QAAQ,GAAG,CAAC,KAAIC,mBAAW,EAACP,IAAI,EAAEhK,SAAS,CAAC,EAAE,KAAIwK,iBAAS,EAACR,IAAI,EAAEhK,SAAS,CAAC,CAAC;IACrF4J,GAAG,CAACzC,QAAQ,CAACiD,OAAO,CAAC;IACrBV,OAAO,CAACvC,QAAQ,CAAC,IAAAsD,mCAAkB,EAACT,IAAI,CAAC,CAAC;IAC1C,OAAOA,IAAI;EACb;AACF;AAAC3O,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAAAnB,eAAA,CAz8BYmB,QAAQ,aAgBF0N,kBAAW;AAAA7O,eAAA,CAhBjBmB,QAAQ,WA66BJ,CAACoP,eAAI,CAACC,QAAQ,CAAc,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAkB,CAAC,CAAC;AAAAxQ,eAAA,CA76BpEmB,QAAQ,kBA+6BG,CAACsP,wBAAa,EAAEC,sBAAY,EAAEC,4BAAe,EAAEC,gBAAS,EAAEC,sBAAY,EAAEC,sBAAY,CAAC;AA4B7G3K,0BAAU,CAAC4K,UAAU,CAAC5P,QAAQ,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_path","data","require","_findRoot","_interopRequireDefault","_toolboxModules","_bit","_fsExtra","_pLocate","_commentJson","_cli","_component","_graphql","_issues","_pMapSeries","_componentIssues","_harmony","_logger","_bitError","_toolboxArray","_lodash","_worker","_componentId","_environments","_environments2","_runtime","_envDefinition","_envServiceList","_envs","_env","_exceptions","_env2","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","DEFAULT_ENV","exports","EnvsMain","icon","constructor","config","harmony","envSlot","logger","servicesRegistry","componentMain","loggerMain","workerMain","envJsoncMergeCustomizerSlot","Set","createEnvironment","components","createRuntime","addFailedToLoadEnvs","id","failedToLoadEnvs","add","envIds","addFailedToLoadExt","failedToLoadExt","has","resetFailedToLoadEnvs","clear","getFailedToLoadEnvs","Array","from","extId","uniq","getDefaultEnv","defaultEnv","get","Error","EnvDefinition","getCoreEnvsIds","compose","targetEnv","envTransformers","a","reduce","acc","transformer","override","propsToOverride","env","merge","sourceEnv","allNames","prototype","getPrototypeOf","name","getOwnPropertyNames","fn","includes","bind","hasEnvManifest","envComponent","legacyFiles","undefined","files","filesystem","envJson","find","file","relative","getEnvManifest","object","parse","contents","toString","resolvedObject","recursivelyMergeWithParentManifest","path","originPath","extends","parentPackageName","parentPath","resolveFrom","parentResolvedPath","findRoot","existsSync","info","parentEnvJsoncPath","map","fileName","join","filePath","consoleWarning","parentStr","readFileSync","parentObject","mergedObject","mergeEnvManifests","parent","child","merged","mergeCustomizer","getAllRegisteredEnvJsoncCustomizers","customizer","oneMerged","hasEnvManifestById","envId","requesting","component","getEnvComponentByEnvId","getEnvData","envsData","state","aspects","EnvsAspect","getEnvIdFromEnvsData","ignoreVersion","rawEnvId","envIdWithoutVersion","ComponentID","fromString","toStringWithoutVersion","getEnvId","envIdFromEnvData","withVersion","resolveEnv","withVersionMatch","toArray","withVersionMatchId","exactMatch","exactMatchId","EnvNotConfiguredForComponent","isUsingCoreEnv","isCoreEnv","getEnv","envDef","getEnvDefinitionByStringId","EnvNotFound","getEnvComponent","host","getHost","newId","resolveComponentId","BitError","getOrCalculateEnv","err","calculateEnv","getDescriptor","calcDescriptor","opts","componentDescriptor","getComponentEnvDescriptor","envComponentSelfDescriptor","getEnvSelfDescriptor","result","self","isEnvRegistered","getEnvFromComponent","services","getServices","selfDescriptor","getEnvDescriptorFromEnvDef","toObject","__getDescriptor","systemDescriptor","type","split","description","matchedEntry","entries","aspectEntry","calculateEnvId","envIdFromEnvsConfig","getEnvIdFromEnvsConfig","envIdFromEnvsConfigWithoutVersion","ids","findFirstEnv","finalId","getEnvDefinitionById","skipWarnings","printWarningIfFirstTime","envDefFromList","getAllEnvsConfiguredOnComponent","getEnvFromEnvsConfig","getEnvsNotFromEnvsConfig","hasEnvConfigured","Boolean","getAllRegisteredEnvs","envData","customizerEntry","getEnvPlugin","EnvPlugin","getEnvIdFromEnvsLegacyExtensions","extensions","envsAspect","findCoreExtension","calculateEnvIdFromExtensions","extension","extensionId","stringId","calculateEnvFromExtensions","getEnvDefinitionByLegacyExtension","isFoundWithoutVersion","pLocate","idWithoutVersion","isCoreAspect","envDefWithoutVersion","hasManifest","isUsingEnvEnv","finalEnvId","getEnvDefinition","allVersions","all","first","head","getEnvsEnvDefinition","message","alreadyShownWarning","isUsingAspectEnv","isEnv","registerService","envServices","register","allServices","currentServices","service","implements","warn","EnvServiceList","registerEnv","registerEnvJsoncMergeCustomizer","addNonLoadedEnvAsComponentIssues","pMapSeries","envIdStr","foundComp","c","issues","getOrCreate","IssuesClasses","ExternalEnvWithoutVersion","componentId","NonLoadedEnv","Runtime","aggregateByDefs","throwForDuplicateComponents","envsMap","Promise","envAspectDef","getEnvAspectDef","EnvRuntime","resolvedAspects","resolveAspects","MainRuntime","requestedOnly","filterByRuntime","useScopeAspectsCapsule","def","idsStr","duplications","findDuplications","provider","graphql","loggerAspect","cli","worker","context","createLogger","envs","registerShowFragments","EnvFragment","registerAddComponentsIssues","envsCmd","EnvsCmd","commands","ListEnvsCmd","GetEnvCmd","environmentsSchema","Slot","withType","GraphqlAspect","LoggerAspect","ComponentAspect","CLIAspect","WorkerAspect","IssuesAspect","addRuntime"],"sources":["environments.main.runtime.ts"],"sourcesContent":["import { join } from 'path';\nimport findRoot from 'find-root';\nimport { resolveFrom } from '@teambit/toolbox.modules.module-resolver';\nimport { isCoreAspect } from '@teambit/bit';\nimport { existsSync, readFileSync } from 'fs-extra';\nimport pLocate from 'p-locate';\nimport { parse } from 'comment-json';\nimport { SourceFile } from '@teambit/legacy/dist/consumer/component/sources';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Component, ComponentAspect, ComponentMain } from '@teambit/component';\nimport type { EnvPolicyConfigObject } from '@teambit/dependency-resolver';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { IssuesAspect, IssuesMain } from '@teambit/issues';\nimport type { EnvJsoncPatterns } from '@teambit/dev-files';\nimport pMapSeries from 'p-map-series';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Harmony, Slot, SlotRegistry } from '@teambit/harmony';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport type { AspectDefinition } from '@teambit/aspect-loader';\nimport { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';\nimport { BitError } from '@teambit/bit-error';\nimport { findDuplications } from '@teambit/toolbox.array.duplications-finder';\nimport { head, uniq } from 'lodash';\nimport { WorkerAspect, WorkerMain } from '@teambit/worker';\nimport { ComponentID } from '@teambit/component-id';\nimport { EnvService } from './services';\nimport { Environment } from './environment';\nimport { EnvsAspect } from './environments.aspect';\nimport { environmentsSchema } from './environments.graphql';\nimport { EnvRuntime, Runtime } from './runtime';\nimport { EnvDefinition } from './env-definition';\nimport { EnvServiceList } from './env-service-list';\nimport { EnvsCmd, GetEnvCmd, ListEnvsCmd } from './envs.cmd';\nimport { EnvFragment } from './env.fragment';\nimport { EnvNotFound, EnvNotConfiguredForComponent } from './exceptions';\nimport { EnvPlugin } from './env.plugin';\n\nexport type EnvJsonc = {\n extends?: string;\n policy?: EnvPolicyConfigObject;\n patterns?: EnvJsoncPatterns;\n};\n\nexport type EnvJsoncMergeCustomizer = (parentObj: EnvJsonc, childObj: EnvJsonc) => Partial<EnvJsonc>;\n\nexport type EnvsRegistry = SlotRegistry<Environment>;\nexport type EnvJsoncMergeCustomizerRegistry = SlotRegistry<EnvJsoncMergeCustomizer>;\n\nexport type EnvsConfig = {\n env: string;\n options: EnvOptions;\n};\n\ntype GetCalcEnvOptions = {\n skipWarnings?: boolean;\n};\n\nexport type EnvOptions = {};\n\nexport type EnvTransformer = (env: Environment) => Environment;\n\nexport type ServicesRegistry = SlotRegistry<Array<EnvService<any>>>;\n\nexport type RegularCompDescriptor = {\n id: string;\n icon?: string;\n type?: string;\n name?: string;\n description?: string;\n};\nexport type EnvCompDescriptorProps = RegularCompDescriptor & {\n services?: {\n env: {\n id: string;\n icon: string;\n name?: string;\n description?: string;\n };\n services: Array<{\n id: string;\n name?: string;\n description?: string;\n data: any;\n }>;\n };\n};\n\nexport type EnvCompDescriptor = EnvCompDescriptorProps & {\n self?: EnvCompDescriptorProps;\n};\n\nexport type Descriptor = RegularCompDescriptor | EnvCompDescriptor;\n\nexport const DEFAULT_ENV = 'teambit.harmony/node';\n\nexport class EnvsMain {\n /**\n * Envs that are failed to load\n */\n private failedToLoadEnvs = new Set<string>();\n /**\n * Extensions that are failed to load\n * We use this as sometime when we couldn't load an extension we don't know if it's an env or not\n * We should ideally take it from the aspect loader aspect, but right now the aspect loader is using envs\n */\n private failedToLoadExt = new Set<string>();\n /**\n * Ids of envs (not neccesrraly loaded successfully)\n */\n public envIds = new Set<string>();\n\n static runtime = MainRuntime;\n\n private alreadyShownWarning = {};\n\n /**\n * icon of the extension.\n */\n icon() {\n return `<svg width=\"50\" height=\"50\" xmlns=\"http://www.w3.org/2000/svg\">\n <circle cx=\"25\" cy=\"25\" r=\"20\"/>\n </svg>`;\n }\n\n constructor(\n /**\n * environments extension configuration.\n */\n readonly config: EnvsConfig,\n\n /**\n * harmony context.\n */\n private harmony: Harmony,\n\n /**\n * slot for allowing extensions to register new environment.\n */\n private envSlot: EnvsRegistry,\n\n private logger: Logger,\n\n private servicesRegistry: ServicesRegistry,\n\n private componentMain: ComponentMain,\n\n private loggerMain: LoggerMain,\n\n private workerMain: WorkerMain,\n\n private envJsoncMergeCustomizerSlot: EnvJsoncMergeCustomizerRegistry\n ) {}\n\n /**\n * creates a new runtime environments for a set of components.\n */\n async createEnvironment(components: Component[]): Promise<Runtime> {\n return this.createRuntime(components);\n }\n\n /**\n *\n * @param id\n */\n /**\n * This function adds an extension ID to a set of failed to load extensions.\n * This mostly used by the aspect loader to add such issues\n * Then it is used to hide different errors that are caused by the same issue.\n * @param {string} id - string - represents the unique identifier of an extension that failed to load.\n */\n addFailedToLoadEnvs(id: string) {\n this.failedToLoadEnvs.add(id);\n this.envIds.add(id);\n }\n\n addFailedToLoadExt(id: string) {\n this.failedToLoadExt.add(id);\n if (this.envIds.has(id)) {\n this.addFailedToLoadEnvs(id);\n }\n }\n\n resetFailedToLoadEnvs() {\n this.failedToLoadEnvs.clear();\n this.failedToLoadExt.clear();\n }\n\n getFailedToLoadEnvs() {\n const failedToLoadEnvs = Array.from(this.failedToLoadEnvs);\n // Add all extensions which are also envs\n for (const extId of this.failedToLoadExt) {\n if (this.envIds.has(extId)) {\n failedToLoadEnvs.push(extId);\n }\n }\n return uniq(failedToLoadEnvs);\n }\n\n /**\n * get the configured default env.\n */\n getDefaultEnv(): EnvDefinition {\n const defaultEnv = this.envSlot.get(DEFAULT_ENV);\n if (!defaultEnv) throw new Error('default env must be set.');\n\n return new EnvDefinition(DEFAULT_ENV, defaultEnv);\n }\n\n getCoreEnvsIds(): string[] {\n return [\n 'teambit.harmony/aspect',\n 'teambit.react/react',\n 'teambit.harmony/node',\n 'teambit.react/react-native',\n 'teambit.html/html',\n 'teambit.mdx/mdx',\n 'teambit.envs/env',\n 'teambit.mdx/readme',\n 'teambit.harmony/bit-custom-aspect',\n ];\n }\n\n /**\n * compose a new environment from a list of environment transformers.\n */\n compose(targetEnv: Environment, envTransformers: EnvTransformer[]) {\n const a = envTransformers.reduce((acc, transformer) => {\n acc = transformer(acc);\n return acc;\n }, targetEnv);\n\n return a;\n }\n\n /**\n * create an env transformer which overrides specific env properties.\n */\n override(propsToOverride: Environment): EnvTransformer {\n return (env: Environment) => {\n return this.merge(propsToOverride, env);\n };\n }\n\n /**\n * compose two environments into one.\n */\n merge<T extends Environment, S extends Environment>(targetEnv: Environment, sourceEnv: Environment): T & S {\n const allNames = new Set<string>();\n const keys = ['icon', 'name', 'description'];\n for (let o = sourceEnv; o !== Object.prototype; o = Object.getPrototypeOf(o)) {\n for (const name of Object.getOwnPropertyNames(o)) {\n allNames.add(name);\n }\n }\n\n allNames.forEach((key: string) => {\n const fn = sourceEnv[key];\n if (targetEnv[key]) return;\n if (keys.includes(key)) targetEnv[key] = fn;\n if (!fn || !fn.bind) {\n return;\n }\n targetEnv[key] = fn.bind(sourceEnv);\n });\n\n return targetEnv as T & S;\n }\n\n /**\n * This function checks if an environment manifest file exists in a given component or set of legacy files.\n * @param {Component} [envComponent] - A component object that represents an environment. It contains information about\n * the files and directories that make up the environment.\n * @param {SourceFile[]} [legacyFiles] - An optional array of SourceFile objects representing the files in the legacy\n * file system. If this parameter is not provided, the function will attempt to retrieve the files from the envComponent\n * parameter.\n * @returns a boolean value indicating whether an `env.jsonc` or `env.json` file exists in the `files` array of either\n * the `envComponent` object or the `legacyFiles` array. If neither `envComponent` nor `legacyFiles` are provided, the\n * function returns `undefined`.\n */\n hasEnvManifest(envComponent?: Component, legacyFiles?: SourceFile[]): boolean | undefined {\n if (!envComponent && !legacyFiles) return undefined;\n // @ts-ignore\n const files = legacyFiles || envComponent.filesystem.files;\n const envJson = files.find((file) => {\n return file.relative === 'env.jsonc' || file.relative === 'env.json';\n });\n\n if (!envJson) return false;\n return true;\n }\n\n getEnvManifest(envComponent?: Component, legacyFiles?: SourceFile[]): EnvJsonc | undefined {\n // TODO: maybe throw an error here?\n if (!envComponent && !legacyFiles) return undefined;\n // @ts-ignore\n const files = legacyFiles || envComponent.filesystem.files;\n const envJson = files.find((file) => {\n return file.relative === 'env.jsonc' || file.relative === 'env.json';\n });\n\n if (!envJson) return undefined;\n\n const object: EnvJsonc = parse(envJson.contents.toString('utf8'), undefined, true);\n const resolvedObject = this.recursivelyMergeWithParentManifest(object, envJson.path);\n return resolvedObject;\n }\n\n recursivelyMergeWithParentManifest(object: EnvJsonc, originPath: string): EnvJsonc {\n if (!object.extends) return object;\n const parentPackageName = object.extends;\n const parentPath = resolveFrom(originPath, [parentPackageName]);\n const parentResolvedPath = findRoot(parentPath);\n if (!parentResolvedPath || !existsSync(parentResolvedPath)) {\n this.logger.info(`failed finding parent manifest for ${parentPackageName} at ${parentResolvedPath}`);\n }\n const parentEnvJsoncPath = ['env.jsonc', 'env.json']\n .map((fileName) => join(parentResolvedPath, fileName))\n .find((filePath) => {\n return existsSync(filePath);\n });\n if (!parentEnvJsoncPath) {\n this.logger.consoleWarning(\n `failed finding parent manifest for ${parentPackageName} at ${parentResolvedPath} referred from ${originPath}`\n );\n return object;\n }\n const parentStr = readFileSync(parentEnvJsoncPath).toString('utf8');\n const parentObject: EnvJsonc = parse(parentStr, undefined, true);\n const mergedObject = this.mergeEnvManifests(parentObject, object);\n if (mergedObject.extends) {\n return this.recursivelyMergeWithParentManifest(mergedObject, parentEnvJsoncPath);\n }\n return mergedObject;\n }\n\n mergeEnvManifests(parent: EnvJsonc, child: EnvJsonc): EnvJsonc {\n let merged: EnvJsonc = {};\n const mergeCustomizer = this.getAllRegisteredEnvJsoncCustomizers();\n for (const customizer of mergeCustomizer) {\n const oneMerged = customizer(parent, child);\n merged = { ...merged, ...oneMerged };\n }\n // Take extends specifically from the parent so we can propagate it to the next parent\n if (parent.extends) {\n merged.extends = parent.extends;\n }\n return merged;\n }\n\n async hasEnvManifestById(envId: string, requesting: string): Promise<boolean | undefined> {\n const component = await this.getEnvComponentByEnvId(envId, requesting);\n return this.hasEnvManifest(component);\n }\n\n getEnvData(component: Component): Descriptor {\n let envsData = component.state.aspects.get(EnvsAspect.id);\n if (!envsData) {\n // TODO: remove this once we re-export old components used to store the data here\n envsData = component.state.aspects.get('teambit.workspace/workspace');\n }\n if (!envsData) throw new Error(`env was not configured on component ${component.id.toString()}`);\n return envsData.data as Descriptor;\n }\n\n /**\n * Return the id of the env as configured in the envs data (without version by default)\n * The reason it's not contain version by default is that we want to take the version from the aspect defined on the component itself\n * As this version is stay up to date during tagging the env along with the component\n * @param component\n * @param ignoreVersion\n */\n private getEnvIdFromEnvsData(component: Component, ignoreVersion = true): string | undefined {\n const envsData = this.getEnvData(component);\n if (!envsData) return undefined;\n const rawEnvId = envsData.id;\n if (!rawEnvId) return undefined;\n if (!ignoreVersion) return rawEnvId;\n const envIdWithoutVersion = ComponentID.fromString(rawEnvId).toStringWithoutVersion();\n return envIdWithoutVersion;\n }\n\n /**\n * get the env id of the given component.\n */\n getEnvId(component: Component): string {\n const envIdFromEnvData = this.getEnvIdFromEnvsData(component);\n if (!envIdFromEnvData) {\n // This should never happen\n throw new Error(`no env found for ${component.id.toString()}`);\n }\n const withVersion = this.resolveEnv(component, envIdFromEnvData);\n const withVersionMatch = this.envSlot.toArray().find(([envId]) => {\n return withVersion?.toString() === envId;\n });\n const withVersionMatchId = withVersionMatch?.[0];\n if (withVersionMatchId) return withVersionMatchId;\n\n // Handle core envs\n const exactMatch = this.envSlot.toArray().find(([envId]) => {\n return envIdFromEnvData === envId;\n });\n\n const exactMatchId = exactMatch?.[0];\n if (exactMatchId) return exactMatchId;\n\n if (!withVersion) throw new EnvNotConfiguredForComponent(envIdFromEnvData, component.id.toString());\n return withVersion.toString();\n }\n\n isUsingCoreEnv(component: Component): boolean {\n const envId = this.getEnvId(component);\n return this.isCoreEnv(envId);\n }\n\n isCoreEnv(envId: string): boolean {\n return this.getCoreEnvsIds().includes(envId);\n }\n\n /**\n * get the env of the given component.\n * In case you are asking for the env during on load you should use calculateEnv instead\n */\n getEnv(component: Component): EnvDefinition {\n const id = this.getEnvId(component);\n const envDef = this.getEnvDefinitionByStringId(id);\n if (envDef) {\n return envDef;\n }\n // Do not allow a non existing env\n throw new EnvNotFound(id, component.id.toString());\n }\n\n /**\n * get the env component of the given component.\n */\n async getEnvComponent(component: Component): Promise<Component> {\n const envId = this.getEnvId(component);\n return this.getEnvComponentByEnvId(envId, component.id.toString());\n }\n\n /**\n * get the env component by the env id.\n */\n async getEnvComponentByEnvId(envId: string, requesting?: string): Promise<Component> {\n const host = this.componentMain.getHost();\n const newId = await host.resolveComponentId(envId);\n const envComponent = await host.get(newId);\n if (!envComponent) {\n throw new BitError(`can't load env. env id is ${envId} used by component ${requesting || 'unknown'}`);\n }\n return envComponent;\n }\n\n /**\n * get the env of the given component.\n * This will try to use the regular getEnv but fallback to the calculate env (in case you are using it during on load)\n * This is safe to be used on onLoad as well\n */\n getOrCalculateEnv(component: Component): EnvDefinition {\n try {\n return this.getEnv(component);\n } catch (err) {\n return this.calculateEnv(component);\n }\n }\n\n /**\n * get an environment Descriptor.\n */\n getDescriptor(component: Component): Descriptor | undefined {\n const envsData = this.getEnvData(component);\n envsData.id = this.resolveEnv(component, envsData.id)?.toString() || envsData.id;\n return envsData;\n }\n\n async calcDescriptor(component: Component, opts: GetCalcEnvOptions = {}): Promise<Descriptor | undefined> {\n const componentDescriptor = await this.getComponentEnvDescriptor(component, opts);\n if (!componentDescriptor) return undefined;\n const envComponentSelfDescriptor = await this.getEnvSelfDescriptor(component);\n const result = envComponentSelfDescriptor\n ? { ...componentDescriptor, self: envComponentSelfDescriptor }\n : componentDescriptor;\n return result;\n }\n\n /**\n * Get env descriptor from the env itself if the component is an env\n * This will be empty for regular component, and will only contain data for env themself\n */\n private async getEnvSelfDescriptor(envComponent: Component): Promise<EnvCompDescriptorProps | undefined> {\n // !important calculate only on the env itself.\n if (!this.isEnvRegistered(envComponent.id.toString())) {\n return undefined;\n }\n\n const envDef = this.getEnvFromComponent(envComponent);\n if (!envDef) return undefined;\n\n const services = this.getServices(envDef);\n // const selfDescriptor = (await this.getEnvDescriptorFromEnvDef(envDef)) || {};\n const selfDescriptor = await this.getEnvDescriptorFromEnvDef(envDef);\n\n if (!selfDescriptor) return undefined;\n return {\n ...selfDescriptor,\n services: services.toObject(),\n };\n }\n\n /**\n * Get env descriptor from the env that a given component is using\n */\n private async getComponentEnvDescriptor(\n component: Component,\n opts: GetCalcEnvOptions = {}\n ): Promise<RegularCompDescriptor | undefined> {\n const envDef = this.calculateEnv(component, opts);\n return this.getEnvDescriptorFromEnvDef(envDef);\n }\n\n private async getEnvDescriptorFromEnvDef(envDef: EnvDefinition): Promise<RegularCompDescriptor | undefined> {\n if (!envDef.env.__getDescriptor || typeof envDef.env.__getDescriptor !== 'function') {\n return undefined;\n }\n const systemDescriptor = await envDef.env.__getDescriptor();\n\n return {\n type: systemDescriptor.type,\n // Make sure to store the env id in the data without the version\n // The version should always come from the aspect id configured on the component\n id: envDef.id.split('@')[0],\n name: envDef.name,\n icon: envDef.env.icon,\n description: envDef.description,\n };\n }\n\n resolveEnv(component: Component, id: string) {\n const matchedEntry = component.state.aspects.entries.find((aspectEntry) => {\n return id === aspectEntry.id.toString() || id === aspectEntry.id.toString({ ignoreVersion: true });\n });\n\n return matchedEntry?.id;\n }\n\n /**\n * This used to calculate the actual env during the component load.\n * Do not use it to get the env (use getEnv instead)\n * This should be used only during on load\n */\n async calculateEnvId(component: Component): Promise<ComponentID> {\n // Search first for env configured via envs aspect itself\n const envIdFromEnvsConfig = this.getEnvIdFromEnvsConfig(component);\n // if (!envIdFromEnvsConfig) return this.getDefaultEnv();\n const envIdFromEnvsConfigWithoutVersion = envIdFromEnvsConfig\n ? ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion()\n : undefined;\n\n if (envIdFromEnvsConfig && this.isCoreEnv(envIdFromEnvsConfig)) {\n return ComponentID.fromString(envIdFromEnvsConfig);\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = component.state.aspects.entries.find((aspectEntry) => {\n return (\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString() ||\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString({ ignoreVersion: true })\n );\n });\n\n if (matchedEntry?.id) return matchedEntry?.id;\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n let ids: string[] = [];\n component.state.aspects.entries.forEach((aspectEntry) => {\n ids.push(aspectEntry.id.toString());\n // ids.push(aspectEntry.id.toString({ ignoreVersion: true }));\n });\n ids = uniq(ids);\n const envId = await this.findFirstEnv(ids);\n const finalId = envId || this.getDefaultEnv().id;\n return ComponentID.fromString(finalId);\n }\n\n /**\n * This used to calculate the actual env during the component load.\n * Do not use it to get the env (use getEnv instead)\n * This should be used only during on load\n */\n calculateEnv(component: Component, opts: GetCalcEnvOptions = {}): EnvDefinition {\n // Search first for env configured via envs aspect itself\n const envIdFromEnvsConfig = this.getEnvIdFromEnvsConfig(component);\n let envIdFromEnvsConfigWithoutVersion;\n if (envIdFromEnvsConfig) {\n envIdFromEnvsConfigWithoutVersion = ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion();\n const envDef = this.getEnvDefinitionByStringId(envIdFromEnvsConfigWithoutVersion);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = component.state.aspects.entries.find((aspectEntry) => {\n return (\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString() ||\n envIdFromEnvsConfigWithoutVersion === aspectEntry.id.toString({ ignoreVersion: true })\n );\n });\n if (matchedEntry) {\n // during the tag process, the version in the aspect-entry-id is changed and is not the\n // same as it was when it registered to the slot.\n const envDef = this.getEnvDefinitionById(matchedEntry.id);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n if (!opts.skipWarnings) {\n // Do not allow a non existing env\n this.printWarningIfFirstTime(\n matchedEntry.id.toString(),\n `environment with ID: ${matchedEntry.id.toString()} configured on component ${component.id.toString()} was not loaded (run \"bit install\")`\n );\n }\n }\n // Do not allow configure teambit.envs/envs on the component without configure the env aspect itself\n // const errMsg = new EnvNotConfiguredForComponent(envIdFromEnvsConfig as string, component.id.toString()).message;\n // this.printWarningIfFirstTime(envIdFromEnvsConfig as string, errMsg);\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n let envDefFromList;\n component.state.aspects.entries.find((aspectEntry) => {\n const envDef = this.getEnvDefinitionById(aspectEntry.id);\n if (envDef) {\n envDefFromList = envDef;\n }\n return !!envDef;\n });\n\n if (envDefFromList) {\n this.envIds.add(envDefFromList.id);\n return envDefFromList;\n }\n return this.getDefaultEnv();\n }\n\n /**\n * an env can be configured on a component in two ways:\n * 1) explicitly inside \"teambit.envs/envs\". `{ \"teambit.envs/envs\": { \"env\": \"my-env\" } }`\n * 2) the env aspect is set on the variant as any other aspect, e.g. `{ \"my-env\": {} }`\n *\n * this method returns #1 if exists, otherwise, #2.\n */\n getAllEnvsConfiguredOnComponent(component: Component): EnvDefinition[] {\n // if a component has \"envs\" config, use it and ignore other components that are set up\n // in this components which happen to be envs.\n const envDef = this.getEnvFromEnvsConfig(component);\n if (envDef) {\n return [envDef];\n }\n\n return this.getEnvsNotFromEnvsConfig(component);\n }\n\n /**\n * whether a component has an env configured (either by variant or .bitmap).\n */\n hasEnvConfigured(component: Component): boolean {\n return Boolean(this.getAllEnvsConfiguredOnComponent(component).length);\n }\n\n getAllRegisteredEnvs(): string[] {\n return this.envSlot.toArray().map((envData) => envData[0]);\n }\n\n getAllRegisteredEnvJsoncCustomizers(): EnvJsoncMergeCustomizer[] {\n return this.envJsoncMergeCustomizerSlot.toArray().map((customizerEntry) => customizerEntry[1]);\n }\n\n getEnvPlugin() {\n return new EnvPlugin(this.envSlot, this.servicesRegistry, this.loggerMain, this.workerMain, this.harmony);\n }\n\n /**\n * an env can be configured on a component in two ways:\n * 1) explicitly inside \"teambit.envs/envs\". `{ \"teambit.envs/envs\": { \"env\": \"my-env\" } }`\n * 2) the env aspect is set on the variant as any other aspect, e.g. `{ \"my-env\": {} }`\n *\n * this method returns only #1\n */\n getEnvFromEnvsConfig(component: Component): EnvDefinition | undefined {\n const envIdFromEnvsConfig = this.getEnvIdFromEnvsConfig(component);\n if (!envIdFromEnvsConfig) {\n return undefined;\n }\n const envIdFromEnvsConfigWithoutVersion = ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion();\n const envDef = this.getEnvDefinitionByStringId(envIdFromEnvsConfigWithoutVersion);\n return envDef;\n }\n\n /**\n * an env can be configured on a component in two ways:\n * 1) explicitly inside \"teambit.envs/envs\". `{ \"teambit.envs/envs\": { \"env\": \"my-env\" } }`\n * 2) the env aspect is set on the variant as any other aspect, e.g. `{ \"my-env\": {} }`\n *\n * this method returns only #2\n */\n getEnvsNotFromEnvsConfig(component: Component): EnvDefinition[] {\n return component.state.aspects.entries.reduce((acc: EnvDefinition[], aspectEntry) => {\n const envDef = this.getEnvDefinitionById(aspectEntry.id);\n if (envDef) acc.push(envDef);\n return acc;\n }, []);\n }\n\n getEnvIdFromEnvsLegacyExtensions(extensions: ExtensionDataList): string | undefined {\n const envsAspect = extensions.findCoreExtension(EnvsAspect.id);\n const envIdFromEnvsConfig = envsAspect?.data.id;\n return envIdFromEnvsConfig;\n }\n\n /**\n * @deprecated DO NOT USE THIS METHOD ANYMORE!!! (PLEASE USE .calculateEnvId() instead!)\n */\n async calculateEnvIdFromExtensions(extensions: ExtensionDataList): Promise<string> {\n // Search first for env configured via envs aspect itself\n const envsAspect = extensions.findCoreExtension(EnvsAspect.id);\n const envIdFromEnvsConfig = envsAspect?.config.env;\n\n const envIdFromEnvsConfigWithoutVersion = envIdFromEnvsConfig\n ? ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion()\n : undefined;\n\n if (envIdFromEnvsConfig && this.isCoreEnv(envIdFromEnvsConfig)) {\n return envIdFromEnvsConfig;\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = extensions.find((extension) => {\n if (extension.extensionId) {\n return (\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString() ||\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString({ ignoreVersion: true })\n );\n }\n return envIdFromEnvsConfigWithoutVersion === extension.stringId;\n });\n if (matchedEntry?.id) return matchedEntry?.stringId;\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n const ids: string[] = [];\n extensions.forEach((extension) => {\n if (extension.extensionId) {\n ids.push(extension.extensionId.toString());\n } else {\n ids.push(extension.stringId);\n }\n });\n const envId = await this.findFirstEnv(ids);\n const finalId = envId || this.getDefaultEnv().id;\n return finalId;\n }\n\n /**\n * @deprecated DO NOT USE THIS METHOD ANYMORE!!! (PLEASE USE .calculateEnv() instead!)\n */\n async calculateEnvFromExtensions(extensions: ExtensionDataList): Promise<EnvDefinition> {\n // Search first for env configured via envs aspect itself\n const envsAspect = extensions.findCoreExtension(EnvsAspect.id);\n const envIdFromEnvsConfig = envsAspect?.config.env;\n let envIdFromEnvsConfigWithoutVersion;\n\n if (envIdFromEnvsConfig) {\n envIdFromEnvsConfigWithoutVersion = ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion();\n const envDef = this.getEnvDefinitionByStringId(envIdFromEnvsConfigWithoutVersion);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n }\n\n // in some cases we have the id configured in the teambit.envs/envs but without the version\n // in such cases we won't find it in the slot\n // we search in the component aspect list a matching aspect which is match the id from the teambit.envs/envs\n if (envIdFromEnvsConfigWithoutVersion) {\n const matchedEntry = extensions.find((extension) => {\n if (extension.extensionId) {\n return (\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString() ||\n envIdFromEnvsConfigWithoutVersion === extension.extensionId.toString({ ignoreVersion: true })\n );\n }\n return envIdFromEnvsConfigWithoutVersion === extension.stringId;\n });\n if (matchedEntry) {\n // during the tag process, the version in the aspect-entry-id is changed and is not the\n // same as it was when it registered to the slot.\n const envDef = this.getEnvDefinitionByLegacyExtension(matchedEntry);\n if (envDef) {\n this.envIds.add(envDef.id);\n return envDef;\n }\n // Do not allow a non existing env\n // this.printWarningIfFirstTime(\n // matchedEntry.id.toString(),\n // `environment with ID: ${matchedEntry.id.toString()} was not found`\n // );\n }\n // Do not allow configure teambit.envs/envs on the component without configure the env aspect itself\n // const errMsg = new EnvNotConfiguredForComponent(envIdFromEnvsConfig).message;\n // this.printWarningIfFirstTime(envIdFromEnvsConfig, errMsg);\n }\n\n // in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env\n const ids: string[] = [];\n extensions.forEach((extension) => {\n if (extension.extensionId) {\n ids.push(extension.extensionId.toString());\n } else {\n ids.push(extension.stringId);\n }\n });\n const envId = await this.findFirstEnv(ids);\n const envDef = envId ? this.getEnvDefinitionByStringId(envId) : undefined;\n\n return envDef || this.getDefaultEnv();\n }\n\n /**\n * This function finds the first environment ID from a list of IDs by checking if it is register as env (to the slot).\n * or contains env.jsonc file\n * @param {string[]} ids - `ids` is an array of string values representing environment IDs. The function `findFirstEnv`\n * takes this array as input and returns a Promise that resolves to a string value representing the first environment ID\n * that matches certain conditions.\n * @returns The `findFirstEnv` function returns a Promise that resolves to a string or undefined. The string represents\n * the ID of the first environment that matches the conditions specified in the function, or undefined if no environment\n * is found.\n */\n private async findFirstEnv(ids: string[]): Promise<string | undefined> {\n let isFoundWithoutVersion = false;\n const envId = await pLocate(ids, async (id) => {\n const idWithoutVersion = id.split('@')[0];\n if (this.isCoreEnv(idWithoutVersion)) return true;\n if (isCoreAspect(idWithoutVersion)) return false;\n const envDef = this.getEnvDefinitionByStringId(id);\n if (envDef) return true;\n const envDefWithoutVersion = this.getEnvDefinitionByStringId(idWithoutVersion);\n if (envDefWithoutVersion) {\n isFoundWithoutVersion = true;\n return true;\n }\n const envComponent = await this.getEnvComponentByEnvId(id);\n const hasManifest = this.hasEnvManifest(envComponent);\n if (hasManifest) return true;\n const isUsingEnvEnv = this.isUsingEnvEnv(envComponent);\n return !!isUsingEnvEnv;\n });\n let finalEnvId;\n if (envId) {\n finalEnvId = isFoundWithoutVersion ? envId?.split('@')[0] : envId;\n this.envIds.add(envId);\n }\n return finalEnvId;\n }\n\n private getEnvDefinitionByLegacyExtension(extension: ExtensionDataEntry): EnvDefinition | undefined {\n const envDef = extension.extensionId\n ? this.getEnvDefinitionById(extension.extensionId)\n : this.getEnvDefinitionByStringId(extension.stringId);\n return envDef;\n }\n\n getEnvIdFromEnvsConfig(component: Component): string | undefined {\n const envsAspect = component.state.aspects.get(EnvsAspect.id);\n return envsAspect?.config.env;\n }\n\n getEnvDefinition(id: ComponentID) {\n const allVersions = this.envSlot.toArray();\n const all = allVersions.filter(([envId]) => envId.includes(id.toStringWithoutVersion()));\n const first = head(all);\n if (!first) return undefined;\n const [envId, env] = first;\n return new EnvDefinition(envId, env);\n }\n\n getEnvDefinitionById(id: ComponentID): EnvDefinition | undefined {\n const envDef =\n this.getEnvDefinitionByStringId(id.toString()) ||\n this.getEnvDefinitionByStringId(id.toString({ ignoreVersion: true }));\n return envDef;\n }\n\n public getEnvDefinitionByStringId(envId: string): EnvDefinition | undefined {\n const env = this.envSlot.get(envId);\n if (env) {\n return new EnvDefinition(envId, env as Environment);\n }\n return undefined;\n }\n\n getEnvFromComponent(envComponent: Component): EnvDefinition | undefined {\n const env = this.getEnvDefinitionById(envComponent.id);\n return env;\n }\n\n /**\n * Return the env definition of teambit.envs/env\n */\n getEnvsEnvDefinition(): EnvDefinition {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.getEnvDefinitionByStringId('teambit.envs/env')!;\n }\n\n private printWarningIfFirstTime(envId: string, message: string) {\n if (!this.alreadyShownWarning[envId] && !this.failedToLoadEnvs.has(envId)) {\n this.alreadyShownWarning[envId] = true;\n this.logger.consoleWarning(message);\n this.addFailedToLoadEnvs(envId);\n }\n }\n\n /**\n * determines whether an env is registered.\n */\n public isEnvRegistered(id: string) {\n return Boolean(this.envSlot.get(id));\n }\n\n isUsingAspectEnv(component: Component): boolean {\n const data = this.getEnvData(component);\n if (!data) return false;\n return data.type === 'aspect';\n }\n\n isUsingEnvEnv(component: Component): boolean {\n const data = this.getEnvData(component);\n if (!data) return false;\n return data.type === 'env';\n }\n\n /**\n * Check if the given component is an env component.\n * @param component\n * @returns\n */\n isEnv(component: Component): boolean {\n return (\n this.isUsingEnvEnv(component) ||\n this.isEnvRegistered(component.id.toString()) ||\n this.isEnvRegistered(component.id.toStringWithoutVersion())\n );\n }\n\n /**\n * register a new environment service.\n */\n registerService(...envServices: EnvService<any>[]) {\n this.servicesRegistry.register(envServices);\n return this;\n }\n\n /**\n * get list of services enabled on an env.\n */\n getServices(env: EnvDefinition): EnvServiceList {\n const allServices = this.servicesRegistry.toArray();\n const services: [string, EnvService<any>][] = [];\n allServices.forEach(([id, currentServices]) => {\n currentServices.forEach((service) => {\n try {\n if (this.implements(env, service)) {\n services.push([id, service]);\n }\n } catch (err) {\n this.logger.warn(`failed loading service ${id} for env ${env.id}`);\n }\n });\n });\n return new EnvServiceList(env, services);\n }\n\n implements(env: EnvDefinition, service: EnvService<any>) {\n // TODO: remove this after refactoring everything and remove getDescriptor from being optional.\n if (!service.getDescriptor) return false;\n return !!service.getDescriptor(env);\n }\n\n /**\n * register an environment.\n */\n registerEnv(env: Environment) {\n return this.envSlot.register(env);\n }\n\n /**\n * register an env.jsonc merge customizer.\n */\n registerEnvJsoncMergeCustomizer(customizer: EnvJsoncMergeCustomizer) {\n return this.envJsoncMergeCustomizerSlot.register(customizer);\n }\n\n async addNonLoadedEnvAsComponentIssues(components: Component[]) {\n await pMapSeries(components, async (component) => {\n const envId = await this.calculateEnvId(component);\n const envIdStr = envId.toString();\n if (!this.isEnvRegistered(envIdStr)) {\n this.addFailedToLoadEnvs(envIdStr);\n // If there is no version and the env is not in the workspace this is not valid\n // you can't set external env without version\n if (!envIdStr.includes('@')) {\n const foundComp = components.find((c) => c.id.toStringWithoutVersion() === envIdStr);\n if (!foundComp) {\n component.state.issues.getOrCreate(IssuesClasses.ExternalEnvWithoutVersion).data = {\n envId: envIdStr,\n componentId: component.id.toString(),\n };\n } else {\n component.state.issues.getOrCreate(IssuesClasses.NonLoadedEnv).data = envIdStr;\n }\n } else {\n component.state.issues.getOrCreate(IssuesClasses.NonLoadedEnv).data = envIdStr;\n }\n }\n });\n }\n\n // refactor here\n private async createRuntime(components: Component[]): Promise<Runtime> {\n return new Runtime(await this.aggregateByDefs(components), this.logger);\n }\n\n // :TODO can be refactored to few utilities who will make repeating this very easy.\n private async aggregateByDefs(components: Component[]): Promise<EnvRuntime[]> {\n this.throwForDuplicateComponents(components);\n const envsMap = {};\n components.forEach((component: Component) => {\n const envDef = this.getEnv(component);\n const envId = envDef.id;\n const env = envDef.env;\n // handle config as well when aggregating envs.\n if (envsMap[envId]) envsMap[envId].components.push(component);\n else\n envsMap[envId] = {\n components: [component],\n env,\n };\n });\n\n return Promise.all(\n Object.keys(envsMap).map(async (key) => {\n const envAspectDef = await this.getEnvAspectDef(key);\n return new EnvRuntime(key, envsMap[key].env, envsMap[key].components, envAspectDef);\n })\n );\n }\n\n private async getEnvAspectDef(envId: string): Promise<AspectDefinition> {\n const host = this.componentMain.getHost();\n const id = await host.resolveComponentId(envId);\n // We don't want to filter by runtime here as we want to also get envs that configured as plugins. so they don't\n // contain the runtime path.\n const resolvedAspects = await host.resolveAspects(MainRuntime.name, [id], {\n requestedOnly: true,\n filterByRuntime: false,\n useScopeAspectsCapsule: true,\n });\n const def = resolvedAspects[0];\n\n return def;\n }\n\n private throwForDuplicateComponents(components: Component[]) {\n const idsStr = components.map((c) => c.id.toString());\n const duplications = findDuplications(idsStr);\n if (duplications.length) {\n throw new Error(`found duplicated components: ${duplications.join(', ')}`);\n }\n }\n\n static slots = [\n Slot.withType<Environment>(),\n Slot.withType<EnvService<any>>(),\n Slot.withType<EnvJsoncMergeCustomizerRegistry>(),\n ];\n\n static dependencies = [GraphqlAspect, LoggerAspect, ComponentAspect, CLIAspect, WorkerAspect, IssuesAspect];\n\n static async provider(\n [graphql, loggerAspect, component, cli, worker, issues]: [\n GraphqlMain,\n LoggerMain,\n ComponentMain,\n CLIMain,\n WorkerMain,\n IssuesMain\n ],\n config: EnvsConfig,\n [envSlot, servicesRegistry, envJsoncMergeCustomizerSlot]: [\n EnvsRegistry,\n ServicesRegistry,\n EnvJsoncMergeCustomizerRegistry\n ],\n context: Harmony\n ) {\n const logger = loggerAspect.createLogger(EnvsAspect.id);\n const envs = new EnvsMain(\n config,\n context,\n envSlot,\n logger,\n servicesRegistry,\n component,\n loggerAspect,\n worker,\n envJsoncMergeCustomizerSlot\n );\n component.registerShowFragments([new EnvFragment(envs)]);\n if (issues) issues.registerAddComponentsIssues(envs.addNonLoadedEnvAsComponentIssues.bind(envs));\n\n const envsCmd = new EnvsCmd(envs, component);\n envsCmd.commands = [new ListEnvsCmd(envs, component), new GetEnvCmd(envs, component)];\n cli.register(envsCmd);\n graphql.register(environmentsSchema(envs));\n return envs;\n }\n}\n\nEnvsAspect.addRuntime(EnvsMain);\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,UAAA;EAAA,MAAAF,IAAA,GAAAG,sBAAA,CAAAF,OAAA;EAAAC,SAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,KAAA;EAAA,MA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