@teambit/envs 1.0.106 → 1.0.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/env-console/env-console.d.ts +3 -3
- package/dist/components/env-overview/env-overview.d.ts +3 -3
- package/dist/context/context.d.ts +1 -1
- package/dist/env-definition.d.ts +4 -4
- package/dist/env-service-list.d.ts +5 -5
- package/dist/env.composition.d.ts +2 -2
- package/dist/environment.d.ts +3 -3
- package/dist/environments.main.runtime.d.ts +12 -12
- package/dist/environments.main.runtime.js +12 -13
- package/dist/environments.main.runtime.js.map +1 -1
- package/dist/envs.cmd.d.ts +5 -5
- package/dist/exceptions/env-not-found.d.ts +1 -1
- package/dist/{preview-1703505948637.js → preview-1703647408454.js} +2 -2
- package/dist/services/service-handler.d.ts +3 -3
- package/dist/services/service.d.ts +3 -3
- package/env-definition.ts +50 -0
- package/env-interface.ts +5 -0
- package/env-service-list.ts +31 -0
- package/env.fragment.ts +35 -0
- package/env.plugin.ts +60 -0
- package/environment.ts +236 -0
- package/environments.aspect.ts +5 -0
- package/environments.graphql.ts +27 -0
- package/environments.main.runtime.ts +1058 -0
- package/index.ts +29 -0
- package/package.json +33 -40
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
/// <reference types="react" />
|
2
2
|
import { EnvRuntime } from '../../runtime';
|
3
|
-
export
|
3
|
+
export type EnvConsoleProps = {
|
4
4
|
runtime: EnvRuntime;
|
5
5
|
};
|
6
|
-
export declare function EnvConsole():
|
6
|
+
export declare function EnvConsole(): JSX.Element;
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
1
|
+
/// <reference types="react" />
|
2
2
|
import { EnvDefinition } from '../../env-definition';
|
3
|
-
export
|
3
|
+
export type EnvOverviewProps = {
|
4
4
|
envDef: EnvDefinition;
|
5
5
|
};
|
6
6
|
/**
|
7
7
|
* renders an env overview in the terminal.
|
8
8
|
*/
|
9
|
-
export declare function EnvOverview({ envDef }: EnvOverviewProps):
|
9
|
+
export declare function EnvOverview({ envDef }: EnvOverviewProps): JSX.Element;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { EnvDefinition } from '../env-definition';
|
2
2
|
import { Environment } from '../environment';
|
3
3
|
import { EnvRuntime, Runtime } from '../runtime';
|
4
|
-
export
|
4
|
+
export type ServiceMap<T> = {
|
5
5
|
[env: string]: T;
|
6
6
|
};
|
7
7
|
export declare class ExecutionContext {
|
package/dist/env-definition.d.ts
CHANGED
@@ -27,15 +27,15 @@ export declare class EnvDefinition {
|
|
27
27
|
/**
|
28
28
|
* get the name of the env.
|
29
29
|
*/
|
30
|
-
get name(): string
|
30
|
+
get name(): string;
|
31
31
|
/**
|
32
32
|
* get the description of the env.
|
33
33
|
*/
|
34
|
-
get description(): string
|
34
|
+
get description(): string;
|
35
35
|
toObject(): {
|
36
36
|
id: string;
|
37
|
-
description: string
|
38
|
-
name: string
|
37
|
+
description: string;
|
38
|
+
name: string;
|
39
39
|
icon: string;
|
40
40
|
};
|
41
41
|
}
|
@@ -21,15 +21,15 @@ export declare class EnvServiceList {
|
|
21
21
|
toObject(): {
|
22
22
|
env: {
|
23
23
|
id: string;
|
24
|
-
description: string
|
25
|
-
name: string
|
24
|
+
description: string;
|
25
|
+
name: string;
|
26
26
|
icon: string;
|
27
27
|
};
|
28
28
|
services: {
|
29
29
|
id: string;
|
30
|
-
name: string
|
31
|
-
description: string
|
32
|
-
data: {} | Promise<{}
|
30
|
+
name: string;
|
31
|
+
description: string;
|
32
|
+
data: {} | Promise<{}>;
|
33
33
|
}[];
|
34
34
|
};
|
35
35
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
export declare const Logo: () =>
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare const Logo: () => JSX.Element;
|
package/dist/environment.d.ts
CHANGED
@@ -11,7 +11,7 @@ import type { DependencyDetector, EnvPolicyConfigObject } from '@teambit/depende
|
|
11
11
|
import type { Capsule } from '@teambit/isolator';
|
12
12
|
import type { Component } from '@teambit/component';
|
13
13
|
import { EnvPreviewConfig } from '@teambit/preview';
|
14
|
-
export
|
14
|
+
export type EnvDescriptor = {
|
15
15
|
type: string;
|
16
16
|
};
|
17
17
|
/**
|
@@ -81,7 +81,7 @@ export interface DependenciesEnv extends Environment {
|
|
81
81
|
*/
|
82
82
|
getDepDetectors?: () => DependencyDetector[] | null;
|
83
83
|
}
|
84
|
-
export
|
84
|
+
export type GetNpmIgnoreContext = {
|
85
85
|
capsule: Capsule;
|
86
86
|
component: Component;
|
87
87
|
};
|
@@ -137,7 +137,7 @@ export interface PreviewEnv extends Environment {
|
|
137
137
|
*/
|
138
138
|
getTemplateBundler?: (context: BundlerContext, transformers?: any[]) => Promise<Bundler>;
|
139
139
|
}
|
140
|
-
export
|
140
|
+
export type PipeServiceModifiersMap = Record<string, PipeServiceModifier>;
|
141
141
|
export interface PipeServiceModifier {
|
142
142
|
transformers?: Function[];
|
143
143
|
module?: any;
|
@@ -14,25 +14,25 @@ import { Runtime } from './runtime';
|
|
14
14
|
import { EnvDefinition } from './env-definition';
|
15
15
|
import { EnvServiceList } from './env-service-list';
|
16
16
|
import { EnvPlugin } from './env.plugin';
|
17
|
-
export
|
18
|
-
export
|
17
|
+
export type EnvsRegistry = SlotRegistry<Environment>;
|
18
|
+
export type EnvsConfig = {
|
19
19
|
env: string;
|
20
20
|
options: EnvOptions;
|
21
21
|
};
|
22
|
-
|
22
|
+
type GetCalcEnvOptions = {
|
23
23
|
skipWarnings?: boolean;
|
24
24
|
};
|
25
|
-
export
|
26
|
-
export
|
27
|
-
export
|
28
|
-
export
|
25
|
+
export type EnvOptions = {};
|
26
|
+
export type EnvTransformer = (env: Environment) => Environment;
|
27
|
+
export type ServicesRegistry = SlotRegistry<Array<EnvService<any>>>;
|
28
|
+
export type RegularCompDescriptor = {
|
29
29
|
id: string;
|
30
30
|
icon?: string;
|
31
31
|
type?: string;
|
32
32
|
name?: string;
|
33
33
|
description?: string;
|
34
34
|
};
|
35
|
-
export
|
35
|
+
export type EnvCompDescriptorProps = RegularCompDescriptor & {
|
36
36
|
services?: {
|
37
37
|
env: {
|
38
38
|
id: string;
|
@@ -48,10 +48,10 @@ export declare type EnvCompDescriptorProps = RegularCompDescriptor & {
|
|
48
48
|
}>;
|
49
49
|
};
|
50
50
|
};
|
51
|
-
export
|
51
|
+
export type EnvCompDescriptor = EnvCompDescriptorProps & {
|
52
52
|
self?: EnvCompDescriptorProps;
|
53
53
|
};
|
54
|
-
export
|
54
|
+
export type Descriptor = RegularCompDescriptor | EnvCompDescriptor;
|
55
55
|
export declare const DEFAULT_ENV = "teambit.harmony/node";
|
56
56
|
export declare class EnvsMain {
|
57
57
|
/**
|
@@ -202,7 +202,7 @@ export declare class EnvsMain {
|
|
202
202
|
*/
|
203
203
|
private getComponentEnvDescriptor;
|
204
204
|
private getEnvDescriptorFromEnvDef;
|
205
|
-
resolveEnv(component: Component, id: string): ComponentID
|
205
|
+
resolveEnv(component: Component, id: string): ComponentID;
|
206
206
|
/**
|
207
207
|
* This used to calculate the actual env during the component load.
|
208
208
|
* Do not use it to get the env (use getEnv instead)
|
@@ -267,7 +267,7 @@ export declare class EnvsMain {
|
|
267
267
|
private findFirstEnv;
|
268
268
|
private getEnvDefinitionByLegacyExtension;
|
269
269
|
getEnvIdFromEnvsConfig(component: Component): string | undefined;
|
270
|
-
getEnvDefinition(id: ComponentID): EnvDefinition
|
270
|
+
getEnvDefinition(id: ComponentID): EnvDefinition;
|
271
271
|
getEnvDefinitionById(id: ComponentID): EnvDefinition | undefined;
|
272
272
|
getEnvDefinitionByLegacyId(id: ComponentID): Promise<EnvDefinition | undefined>;
|
273
273
|
getEnvDefinitionByStringId(envId: string): EnvDefinition | undefined;
|
@@ -405,16 +405,16 @@ class EnvsMain {
|
|
405
405
|
}
|
406
406
|
const withVersion = this.resolveEnv(component, envIdFromEnvData);
|
407
407
|
const withVersionMatch = this.envSlot.toArray().find(([envId]) => {
|
408
|
-
return
|
408
|
+
return withVersion?.toString() === envId;
|
409
409
|
});
|
410
|
-
const withVersionMatchId = withVersionMatch
|
410
|
+
const withVersionMatchId = withVersionMatch?.[0];
|
411
411
|
if (withVersionMatchId) return withVersionMatchId;
|
412
412
|
|
413
413
|
// Handle core envs
|
414
414
|
const exactMatch = this.envSlot.toArray().find(([envId]) => {
|
415
415
|
return envIdFromEnvData === envId;
|
416
416
|
});
|
417
|
-
const exactMatchId = exactMatch
|
417
|
+
const exactMatchId = exactMatch?.[0];
|
418
418
|
if (exactMatchId) return exactMatchId;
|
419
419
|
if (!withVersion) throw new (_exceptions().EnvNotConfiguredForComponent)(envIdFromEnvData, component.id.toString());
|
420
420
|
return withVersion.toString();
|
@@ -479,9 +479,8 @@ class EnvsMain {
|
|
479
479
|
* get an environment Descriptor.
|
480
480
|
*/
|
481
481
|
getDescriptor(component) {
|
482
|
-
var _this$resolveEnv;
|
483
482
|
const envsData = this.getEnvData(component);
|
484
|
-
envsData.id =
|
483
|
+
envsData.id = this.resolveEnv(component, envsData.id)?.toString() || envsData.id;
|
485
484
|
return envsData;
|
486
485
|
}
|
487
486
|
async calcDescriptor(component, opts = {}) {
|
@@ -542,7 +541,7 @@ class EnvsMain {
|
|
542
541
|
ignoreVersion: true
|
543
542
|
});
|
544
543
|
});
|
545
|
-
return matchedEntry
|
544
|
+
return matchedEntry?.id;
|
546
545
|
}
|
547
546
|
|
548
547
|
/**
|
@@ -568,7 +567,7 @@ class EnvsMain {
|
|
568
567
|
ignoreVersion: true
|
569
568
|
});
|
570
569
|
});
|
571
|
-
if (matchedEntry
|
570
|
+
if (matchedEntry?.id) return matchedEntry?.id;
|
572
571
|
}
|
573
572
|
|
574
573
|
// in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env
|
@@ -707,7 +706,7 @@ class EnvsMain {
|
|
707
706
|
}
|
708
707
|
getEnvIdFromEnvsLegacyExtensions(extensions) {
|
709
708
|
const envsAspect = extensions.findCoreExtension(_environments().EnvsAspect.id);
|
710
|
-
const envIdFromEnvsConfig = envsAspect
|
709
|
+
const envIdFromEnvsConfig = envsAspect?.data.id;
|
711
710
|
return envIdFromEnvsConfig;
|
712
711
|
}
|
713
712
|
|
@@ -717,7 +716,7 @@ class EnvsMain {
|
|
717
716
|
async calculateEnvIdFromExtensions(extensions) {
|
718
717
|
// Search first for env configured via envs aspect itself
|
719
718
|
const envsAspect = extensions.findCoreExtension(_environments().EnvsAspect.id);
|
720
|
-
const envIdFromEnvsConfig = envsAspect
|
719
|
+
const envIdFromEnvsConfig = envsAspect?.config.env;
|
721
720
|
const envIdFromEnvsConfigWithoutVersion = envIdFromEnvsConfig ? _componentId().ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion() : undefined;
|
722
721
|
if (envIdFromEnvsConfig && this.isCoreEnv(envIdFromEnvsConfig)) {
|
723
722
|
return envIdFromEnvsConfig;
|
@@ -735,7 +734,7 @@ class EnvsMain {
|
|
735
734
|
}
|
736
735
|
return envIdFromEnvsConfigWithoutVersion === extension.stringId;
|
737
736
|
});
|
738
|
-
if (matchedEntry
|
737
|
+
if (matchedEntry?.id) return matchedEntry?.stringId;
|
739
738
|
}
|
740
739
|
|
741
740
|
// in case there is no config in teambit.envs/envs search the aspects for the first env that registered as env
|
@@ -758,7 +757,7 @@ class EnvsMain {
|
|
758
757
|
async calculateEnvFromExtensions(extensions) {
|
759
758
|
// Search first for env configured via envs aspect itself
|
760
759
|
const envsAspect = extensions.findCoreExtension(_environments().EnvsAspect.id);
|
761
|
-
const envIdFromEnvsConfig = envsAspect
|
760
|
+
const envIdFromEnvsConfig = envsAspect?.config.env;
|
762
761
|
let envIdFromEnvsConfigWithoutVersion;
|
763
762
|
if (envIdFromEnvsConfig) {
|
764
763
|
envIdFromEnvsConfigWithoutVersion = _componentId().ComponentID.fromString(envIdFromEnvsConfig).toStringWithoutVersion();
|
@@ -845,7 +844,7 @@ class EnvsMain {
|
|
845
844
|
});
|
846
845
|
let finalEnvId;
|
847
846
|
if (envId) {
|
848
|
-
finalEnvId = isFoundWithoutVersion ? envId
|
847
|
+
finalEnvId = isFoundWithoutVersion ? envId?.split('@')[0] : envId;
|
849
848
|
this.envIds.add(envId);
|
850
849
|
}
|
851
850
|
return finalEnvId;
|
@@ -856,7 +855,7 @@ class EnvsMain {
|
|
856
855
|
}
|
857
856
|
getEnvIdFromEnvsConfig(component) {
|
858
857
|
const envsAspect = component.state.aspects.get(_environments().EnvsAspect.id);
|
859
|
-
return envsAspect
|
858
|
+
return envsAspect?.config.env;
|
860
859
|
}
|
861
860
|
getEnvDefinition(id) {
|
862
861
|
const allVersions = this.envSlot.toArray();
|