@teambit/envs 0.0.0-00a9d07cc24d1f9461a09449d0d9056c928e8566

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.
Files changed (108) hide show
  1. package/context/context.ts +55 -0
  2. package/context/index.ts +1 -0
  3. package/dist/context/context.d.ts +44 -0
  4. package/dist/context/context.js +61 -0
  5. package/dist/context/context.js.map +1 -0
  6. package/dist/context/index.d.ts +1 -0
  7. package/dist/context/index.js +20 -0
  8. package/dist/context/index.js.map +1 -0
  9. package/dist/env-definition.d.ts +41 -0
  10. package/dist/env-definition.js +57 -0
  11. package/dist/env-definition.js.map +1 -0
  12. package/dist/env-interface.d.ts +4 -0
  13. package/dist/env-interface.js +3 -0
  14. package/dist/env-interface.js.map +1 -0
  15. package/dist/env-jsonc.detector.d.ts +5 -0
  16. package/dist/env-jsonc.detector.js +26 -0
  17. package/dist/env-jsonc.detector.js.map +1 -0
  18. package/dist/env-service-list.d.ts +35 -0
  19. package/dist/env-service-list.js +37 -0
  20. package/dist/env-service-list.js.map +1 -0
  21. package/dist/env.composition.d.ts +1 -0
  22. package/dist/env.composition.js +29 -0
  23. package/dist/env.composition.js.map +1 -0
  24. package/dist/env.fragment.d.ts +17 -0
  25. package/dist/env.fragment.js +48 -0
  26. package/dist/env.fragment.js.map +1 -0
  27. package/dist/env.plugin.d.ts +20 -0
  28. package/dist/env.plugin.js +92 -0
  29. package/dist/env.plugin.js.map +1 -0
  30. package/dist/environment.d.ts +201 -0
  31. package/dist/environment.js +17 -0
  32. package/dist/environment.js.map +1 -0
  33. package/dist/environments.aspect.d.ts +2 -0
  34. package/dist/environments.aspect.js +18 -0
  35. package/dist/environments.aspect.js.map +1 -0
  36. package/dist/environments.graphql.d.ts +3 -0
  37. package/dist/environments.graphql.js +36 -0
  38. package/dist/environments.graphql.js.map +1 -0
  39. package/dist/environments.main.runtime.d.ts +366 -0
  40. package/dist/environments.main.runtime.js +1160 -0
  41. package/dist/environments.main.runtime.js.map +1 -0
  42. package/dist/envs.cmd.d.ts +51 -0
  43. package/dist/envs.cmd.js +153 -0
  44. package/dist/envs.cmd.js.map +1 -0
  45. package/dist/envs.docs.mdx +8 -0
  46. package/dist/esm.mjs +13 -0
  47. package/dist/exceptions/env-not-configured-for-component.d.ts +4 -0
  48. package/dist/exceptions/env-not-configured-for-component.js +24 -0
  49. package/dist/exceptions/env-not-configured-for-component.js.map +1 -0
  50. package/dist/exceptions/env-not-found-in-runtime.d.ts +5 -0
  51. package/dist/exceptions/env-not-found-in-runtime.js +22 -0
  52. package/dist/exceptions/env-not-found-in-runtime.js.map +1 -0
  53. package/dist/exceptions/env-not-found.d.ts +6 -0
  54. package/dist/exceptions/env-not-found.js +27 -0
  55. package/dist/exceptions/env-not-found.js.map +1 -0
  56. package/dist/exceptions/index.d.ts +3 -0
  57. package/dist/exceptions/index.js +46 -0
  58. package/dist/exceptions/index.js.map +1 -0
  59. package/dist/index.d.ts +16 -0
  60. package/dist/index.js +128 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/preview-1754495677408.js +7 -0
  63. package/dist/runtime/env-runtime.d.ts +41 -0
  64. package/dist/runtime/env-runtime.js +36 -0
  65. package/dist/runtime/env-runtime.js.map +1 -0
  66. package/dist/runtime/envs-execution-result.d.ts +18 -0
  67. package/dist/runtime/envs-execution-result.js +56 -0
  68. package/dist/runtime/envs-execution-result.js.map +1 -0
  69. package/dist/runtime/index.d.ts +2 -0
  70. package/dist/runtime/index.js +33 -0
  71. package/dist/runtime/index.js.map +1 -0
  72. package/dist/runtime/runtime.d.ts +49 -0
  73. package/dist/runtime/runtime.js +117 -0
  74. package/dist/runtime/runtime.js.map +1 -0
  75. package/dist/services/concrete-service.d.ts +8 -0
  76. package/dist/services/concrete-service.js +3 -0
  77. package/dist/services/concrete-service.js.map +1 -0
  78. package/dist/services/index.d.ts +4 -0
  79. package/dist/services/index.js +89 -0
  80. package/dist/services/index.js.map +1 -0
  81. package/dist/services/service-handler-context.d.ts +30 -0
  82. package/dist/services/service-handler-context.js +44 -0
  83. package/dist/services/service-handler-context.js.map +1 -0
  84. package/dist/services/service-handler.d.ts +18 -0
  85. package/dist/services/service-handler.js +25 -0
  86. package/dist/services/service-handler.js.map +1 -0
  87. package/dist/services/service.d.ts +66 -0
  88. package/dist/services/service.js +3 -0
  89. package/dist/services/service.js.map +1 -0
  90. package/env.composition.tsx +7 -0
  91. package/envs.docs.mdx +8 -0
  92. package/esm.mjs +13 -0
  93. package/exceptions/env-not-configured-for-component.ts +10 -0
  94. package/exceptions/env-not-found-in-runtime.ts +7 -0
  95. package/exceptions/env-not-found.ts +15 -0
  96. package/exceptions/index.ts +3 -0
  97. package/package.json +90 -0
  98. package/runtime/env-runtime.ts +31 -0
  99. package/runtime/envs-execution-result.ts +46 -0
  100. package/runtime/index.ts +2 -0
  101. package/runtime/runtime.ts +100 -0
  102. package/services/concrete-service.ts +8 -0
  103. package/services/index.ts +13 -0
  104. package/services/service-handler-context.ts +40 -0
  105. package/services/service-handler.ts +41 -0
  106. package/services/service.ts +79 -0
  107. package/types/asset.d.ts +41 -0
  108. package/types/style.d.ts +42 -0
@@ -0,0 +1,55 @@
1
+ import { EnvDefinition } from '../env-definition';
2
+ import type { Environment } from '../environment';
3
+
4
+ import type { EnvRuntime, Runtime } from '../runtime';
5
+
6
+ export type ServiceMap<T> = {
7
+ [env: string]: T;
8
+ };
9
+
10
+ export class ExecutionContext {
11
+ constructor(
12
+ /**
13
+ * upper scope of all environment contexts.
14
+ */
15
+ readonly upper: Runtime,
16
+
17
+ /**
18
+ * runtime instance of the environment.
19
+ */
20
+ readonly envRuntime: EnvRuntime,
21
+
22
+ /**
23
+ * components applied in the execution context.
24
+ */
25
+ public components = envRuntime.components
26
+ ) {}
27
+
28
+ relatedContexts: string[] = [];
29
+
30
+ /**
31
+ * extension ID of the environment
32
+ */
33
+ get id() {
34
+ return this.envRuntime.id;
35
+ }
36
+
37
+ /**
38
+ * environment instance.
39
+ */
40
+ get env(): Environment {
41
+ return this.envRuntime.env;
42
+ }
43
+
44
+ get envDefinition(): EnvDefinition {
45
+ return new EnvDefinition(this.id, this.env);
46
+ }
47
+
48
+ apply<T>(name: string, args: any[]): T {
49
+ if (!this.env[name]) {
50
+ throw new Error(`method ${name} not implemented`);
51
+ }
52
+
53
+ return this.env[name].apply(this.env, ...args);
54
+ }
55
+ }
@@ -0,0 +1 @@
1
+ export { ExecutionContext } from './context';
@@ -0,0 +1,44 @@
1
+ import { EnvDefinition } from '../env-definition';
2
+ import type { Environment } from '../environment';
3
+ import type { EnvRuntime, Runtime } from '../runtime';
4
+ export type ServiceMap<T> = {
5
+ [env: string]: T;
6
+ };
7
+ export declare class ExecutionContext {
8
+ /**
9
+ * upper scope of all environment contexts.
10
+ */
11
+ readonly upper: Runtime;
12
+ /**
13
+ * runtime instance of the environment.
14
+ */
15
+ readonly envRuntime: EnvRuntime;
16
+ /**
17
+ * components applied in the execution context.
18
+ */
19
+ components: import("@teambit/component").Component[];
20
+ constructor(
21
+ /**
22
+ * upper scope of all environment contexts.
23
+ */
24
+ upper: Runtime,
25
+ /**
26
+ * runtime instance of the environment.
27
+ */
28
+ envRuntime: EnvRuntime,
29
+ /**
30
+ * components applied in the execution context.
31
+ */
32
+ components?: import("@teambit/component").Component[]);
33
+ relatedContexts: string[];
34
+ /**
35
+ * extension ID of the environment
36
+ */
37
+ get id(): string;
38
+ /**
39
+ * environment instance.
40
+ */
41
+ get env(): Environment;
42
+ get envDefinition(): EnvDefinition;
43
+ apply<T>(name: string, args: any[]): T;
44
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ExecutionContext = void 0;
7
+ function _envDefinition() {
8
+ const data = require("../env-definition");
9
+ _envDefinition = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
16
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
+ class ExecutionContext {
18
+ constructor(
19
+ /**
20
+ * upper scope of all environment contexts.
21
+ */
22
+ upper,
23
+ /**
24
+ * runtime instance of the environment.
25
+ */
26
+ envRuntime,
27
+ /**
28
+ * components applied in the execution context.
29
+ */
30
+ components = envRuntime.components) {
31
+ this.upper = upper;
32
+ this.envRuntime = envRuntime;
33
+ this.components = components;
34
+ _defineProperty(this, "relatedContexts", []);
35
+ }
36
+ /**
37
+ * extension ID of the environment
38
+ */
39
+ get id() {
40
+ return this.envRuntime.id;
41
+ }
42
+
43
+ /**
44
+ * environment instance.
45
+ */
46
+ get env() {
47
+ return this.envRuntime.env;
48
+ }
49
+ get envDefinition() {
50
+ return new (_envDefinition().EnvDefinition)(this.id, this.env);
51
+ }
52
+ apply(name, args) {
53
+ if (!this.env[name]) {
54
+ throw new Error(`method ${name} not implemented`);
55
+ }
56
+ return this.env[name].apply(this.env, ...args);
57
+ }
58
+ }
59
+ exports.ExecutionContext = ExecutionContext;
60
+
61
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_envDefinition","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","ExecutionContext","constructor","upper","envRuntime","components","id","env","envDefinition","EnvDefinition","apply","name","args","Error","exports"],"sources":["context.ts"],"sourcesContent":["import { EnvDefinition } from '../env-definition';\nimport type { Environment } from '../environment';\n\nimport type { EnvRuntime, Runtime } from '../runtime';\n\nexport type ServiceMap<T> = {\n [env: string]: T;\n};\n\nexport class ExecutionContext {\n constructor(\n /**\n * upper scope of all environment contexts.\n */\n readonly upper: Runtime,\n\n /**\n * runtime instance of the environment.\n */\n readonly envRuntime: EnvRuntime,\n\n /**\n * components applied in the execution context.\n */\n public components = envRuntime.components\n ) {}\n\n relatedContexts: string[] = [];\n\n /**\n * extension ID of the environment\n */\n get id() {\n return this.envRuntime.id;\n }\n\n /**\n * environment instance.\n */\n get env(): Environment {\n return this.envRuntime.env;\n }\n\n get envDefinition(): EnvDefinition {\n return new EnvDefinition(this.id, this.env);\n }\n\n apply<T>(name: string, args: any[]): T {\n if (!this.env[name]) {\n throw new Error(`method ${name} not implemented`);\n }\n\n return this.env[name].apply(this.env, ...args);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,eAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,cAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkD,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAS3C,MAAMgB,gBAAgB,CAAC;EAC5BC,WAAWA;EACT;AACJ;AACA;EACaC,KAAc;EAEvB;AACJ;AACA;EACaC,UAAsB;EAE/B;AACJ;AACA;EACWC,UAAU,GAAGD,UAAU,CAACC,UAAU,EACzC;IAAA,KAXSF,KAAc,GAAdA,KAAc;IAAA,KAKdC,UAAsB,GAAtBA,UAAsB;IAAA,KAKxBC,UAAU,GAAVA,UAAU;IAAAvB,eAAA,0BAGS,EAAE;EAF3B;EAIH;AACF;AACA;EACE,IAAIwB,EAAEA,CAAA,EAAG;IACP,OAAO,IAAI,CAACF,UAAU,CAACE,EAAE;EAC3B;;EAEA;AACF;AACA;EACE,IAAIC,GAAGA,CAAA,EAAgB;IACrB,OAAO,IAAI,CAACH,UAAU,CAACG,GAAG;EAC5B;EAEA,IAAIC,aAAaA,CAAA,EAAkB;IACjC,OAAO,KAAIC,8BAAa,EAAC,IAAI,CAACH,EAAE,EAAE,IAAI,CAACC,GAAG,CAAC;EAC7C;EAEAG,KAAKA,CAAIC,IAAY,EAAEC,IAAW,EAAK;IACrC,IAAI,CAAC,IAAI,CAACL,GAAG,CAACI,IAAI,CAAC,EAAE;MACnB,MAAM,IAAIE,KAAK,CAAC,UAAUF,IAAI,kBAAkB,CAAC;IACnD;IAEA,OAAO,IAAI,CAACJ,GAAG,CAACI,IAAI,CAAC,CAACD,KAAK,CAAC,IAAI,CAACH,GAAG,EAAE,GAAGK,IAAI,CAAC;EAChD;AACF;AAACE,OAAA,CAAAb,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { ExecutionContext } from './context';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ExecutionContext", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _context().ExecutionContext;
10
+ }
11
+ });
12
+ function _context() {
13
+ const data = require("./context");
14
+ _context = function () {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_context","data","require"],"sources":["index.ts"],"sourcesContent":["export { ExecutionContext } from './context';\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,41 @@
1
+ import type { Environment } from './environment';
2
+ /**
3
+ * API for component development environment.
4
+ */
5
+ export declare class EnvDefinition {
6
+ /**
7
+ * id of the env.
8
+ */
9
+ readonly id: string;
10
+ /**
11
+ * env instance.
12
+ */
13
+ readonly env: Environment;
14
+ constructor(
15
+ /**
16
+ * id of the env.
17
+ */
18
+ id: string,
19
+ /**
20
+ * env instance.
21
+ */
22
+ env: Environment);
23
+ /**
24
+ * get icon of the env.
25
+ */
26
+ get icon(): string;
27
+ /**
28
+ * get the name of the env.
29
+ */
30
+ get name(): string | undefined;
31
+ /**
32
+ * get the description of the env.
33
+ */
34
+ get description(): string | undefined;
35
+ toObject(): {
36
+ id: string;
37
+ description: string | undefined;
38
+ name: string | undefined;
39
+ icon: string;
40
+ };
41
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EnvDefinition = void 0;
7
+ /**
8
+ * API for component development environment.
9
+ */
10
+ class EnvDefinition {
11
+ constructor(
12
+ /**
13
+ * id of the env.
14
+ */
15
+ id,
16
+ /**
17
+ * env instance.
18
+ */
19
+ env) {
20
+ this.id = id;
21
+ this.env = env;
22
+ }
23
+
24
+ /**
25
+ * get icon of the env.
26
+ */
27
+ get icon() {
28
+ // TODO: refactor this away from here.
29
+ const defaultIcon = `https://static.bit.dev/extensions-icons/default.svg`;
30
+ return this.env.icon || defaultIcon;
31
+ }
32
+
33
+ /**
34
+ * get the name of the env.
35
+ */
36
+ get name() {
37
+ return this.env.name;
38
+ }
39
+
40
+ /**
41
+ * get the description of the env.
42
+ */
43
+ get description() {
44
+ return this.env.description;
45
+ }
46
+ toObject() {
47
+ return {
48
+ id: this.id,
49
+ description: this.description,
50
+ name: this.name,
51
+ icon: this.icon
52
+ };
53
+ }
54
+ }
55
+ exports.EnvDefinition = EnvDefinition;
56
+
57
+ //# sourceMappingURL=env-definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EnvDefinition","constructor","id","env","icon","defaultIcon","name","description","toObject","exports"],"sources":["env-definition.ts"],"sourcesContent":["import type { Environment } from './environment';\n\n/**\n * API for component development environment.\n */\nexport class EnvDefinition {\n constructor(\n /**\n * id of the env.\n */\n readonly id: string,\n\n /**\n * env instance.\n */\n readonly env: Environment\n ) {}\n\n /**\n * get icon of the env.\n */\n get icon() {\n // TODO: refactor this away from here.\n const defaultIcon = `https://static.bit.dev/extensions-icons/default.svg`;\n return this.env.icon || defaultIcon;\n }\n\n /**\n * get the name of the env.\n */\n get name() {\n return this.env.name;\n }\n\n /**\n * get the description of the env.\n */\n get description() {\n return this.env.description;\n }\n\n toObject() {\n return {\n id: this.id,\n description: this.description,\n name: this.name,\n icon: this.icon,\n };\n }\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACO,MAAMA,aAAa,CAAC;EACzBC,WAAWA;EACT;AACJ;AACA;EACaC,EAAU;EAEnB;AACJ;AACA;EACaC,GAAgB,EACzB;IAAA,KANSD,EAAU,GAAVA,EAAU;IAAA,KAKVC,GAAgB,GAAhBA,GAAgB;EACxB;;EAEH;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAG;IACT;IACA,MAAMC,WAAW,GAAG,qDAAqD;IACzE,OAAO,IAAI,CAACF,GAAG,CAACC,IAAI,IAAIC,WAAW;EACrC;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAG;IACT,OAAO,IAAI,CAACH,GAAG,CAACG,IAAI;EACtB;;EAEA;AACF;AACA;EACE,IAAIC,WAAWA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACJ,GAAG,CAACI,WAAW;EAC7B;EAEAC,QAAQA,CAAA,EAAG;IACT,OAAO;MACLN,EAAE,EAAE,IAAI,CAACA,EAAE;MACXK,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BD,IAAI,EAAE,IAAI,CAACA,IAAI;MACfF,IAAI,EAAE,IAAI,CAACA;IACb,CAAC;EACH;AACF;AAACK,OAAA,CAAAT,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import type { ServiceHandlerFactory as EnvHandler } from './services/service-handler';
2
+ export interface Env {
3
+ [key: string]: EnvHandler<unknown> | any;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ //# sourceMappingURL=env-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["env-interface.ts"],"sourcesContent":["import type { ServiceHandlerFactory as EnvHandler } from './services/service-handler';\n\nexport interface Env {\n [key: string]: EnvHandler<unknown> | any;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import type { DependencyDetector, FileContext } from '@teambit/dependency-resolver';
2
+ export declare class EnvJsoncDetector implements DependencyDetector {
3
+ isSupported(context: FileContext): boolean;
4
+ detect(source: string): string[];
5
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EnvJsoncDetector = void 0;
7
+ function _commentJson() {
8
+ const data = require("comment-json");
9
+ _commentJson = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ class EnvJsoncDetector {
15
+ isSupported(context) {
16
+ return context.filename.endsWith('env.jsonc');
17
+ }
18
+ detect(source) {
19
+ const parsed = (0, _commentJson().parse)(source);
20
+ if (!parsed.extends) return [];
21
+ return [parsed.extends];
22
+ }
23
+ }
24
+ exports.EnvJsoncDetector = EnvJsoncDetector;
25
+
26
+ //# sourceMappingURL=env-jsonc.detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_commentJson","data","require","EnvJsoncDetector","isSupported","context","filename","endsWith","detect","source","parsed","parse","extends","exports"],"sources":["env-jsonc.detector.ts"],"sourcesContent":["import { parse } from 'comment-json';\nimport type { DependencyDetector, FileContext } from '@teambit/dependency-resolver';\n\nexport class EnvJsoncDetector implements DependencyDetector {\n isSupported(context: FileContext): boolean {\n return context.filename.endsWith('env.jsonc');\n }\n\n detect(source: string): string[] {\n const parsed = parse(source) as Record<string, any>;\n if (!parsed.extends) return [];\n return [parsed.extends];\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAME,gBAAgB,CAA+B;EAC1DC,WAAWA,CAACC,OAAoB,EAAW;IACzC,OAAOA,OAAO,CAACC,QAAQ,CAACC,QAAQ,CAAC,WAAW,CAAC;EAC/C;EAEAC,MAAMA,CAACC,MAAc,EAAY;IAC/B,MAAMC,MAAM,GAAG,IAAAC,oBAAK,EAACF,MAAM,CAAwB;IACnD,IAAI,CAACC,MAAM,CAACE,OAAO,EAAE,OAAO,EAAE;IAC9B,OAAO,CAACF,MAAM,CAACE,OAAO,CAAC;EACzB;AACF;AAACC,OAAA,CAAAV,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ import type { EnvDefinition } from './env-definition';
2
+ import type { EnvService } from './services';
3
+ export declare class EnvServiceList {
4
+ /**
5
+ * environment
6
+ */
7
+ readonly env: EnvDefinition;
8
+ /**
9
+ * services available on the env.
10
+ */
11
+ readonly services: [string, EnvService<any>][];
12
+ constructor(
13
+ /**
14
+ * environment
15
+ */
16
+ env: EnvDefinition,
17
+ /**
18
+ * services available on the env.
19
+ */
20
+ services: [string, EnvService<any>][]);
21
+ toObject(): {
22
+ env: {
23
+ id: string;
24
+ description: string | undefined;
25
+ name: string | undefined;
26
+ icon: string;
27
+ };
28
+ services: {
29
+ id: string;
30
+ name: string | undefined;
31
+ description: string | undefined;
32
+ data: {} | Promise<{} | undefined> | undefined;
33
+ }[];
34
+ };
35
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EnvServiceList = void 0;
7
+ class EnvServiceList {
8
+ constructor(
9
+ /**
10
+ * environment
11
+ */
12
+ env,
13
+ /**
14
+ * services available on the env.
15
+ */
16
+ services) {
17
+ this.env = env;
18
+ this.services = services;
19
+ }
20
+ toObject() {
21
+ return {
22
+ env: this.env.toObject(),
23
+ services: this.services.map(([id, service]) => {
24
+ return {
25
+ id,
26
+ name: service.name,
27
+ description: service.description,
28
+ // @ts-ignore
29
+ data: service.getDescriptor(this.env)
30
+ };
31
+ })
32
+ };
33
+ }
34
+ }
35
+ exports.EnvServiceList = EnvServiceList;
36
+
37
+ //# sourceMappingURL=env-service-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EnvServiceList","constructor","env","services","toObject","map","id","service","name","description","data","getDescriptor","exports"],"sources":["env-service-list.ts"],"sourcesContent":["import type { EnvDefinition } from './env-definition';\nimport type { EnvService } from './services';\n\nexport class EnvServiceList {\n constructor(\n /**\n * environment\n */\n readonly env: EnvDefinition,\n\n /**\n * services available on the env.\n */\n readonly services: [string, EnvService<any>][]\n ) {}\n\n toObject() {\n return {\n env: this.env.toObject(),\n services: this.services.map(([id, service]) => {\n return {\n id,\n name: service.name,\n description: service.description,\n // @ts-ignore\n data: service.getDescriptor(this.env),\n };\n }),\n };\n }\n}\n"],"mappings":";;;;;;AAGO,MAAMA,cAAc,CAAC;EAC1BC,WAAWA;EACT;AACJ;AACA;EACaC,GAAkB;EAE3B;AACJ;AACA;EACaC,QAAqC,EAC9C;IAAA,KANSD,GAAkB,GAAlBA,GAAkB;IAAA,KAKlBC,QAAqC,GAArCA,QAAqC;EAC7C;EAEHC,QAAQA,CAAA,EAAG;IACT,OAAO;MACLF,GAAG,EAAE,IAAI,CAACA,GAAG,CAACE,QAAQ,CAAC,CAAC;MACxBD,QAAQ,EAAE,IAAI,CAACA,QAAQ,CAACE,GAAG,CAAC,CAAC,CAACC,EAAE,EAAEC,OAAO,CAAC,KAAK;QAC7C,OAAO;UACLD,EAAE;UACFE,IAAI,EAAED,OAAO,CAACC,IAAI;UAClBC,WAAW,EAAEF,OAAO,CAACE,WAAW;UAChC;UACAC,IAAI,EAAEH,OAAO,CAACI,aAAa,CAAC,IAAI,CAACT,GAAG;QACtC,CAAC;MACH,CAAC;IACH,CAAC;EACH;AACF;AAACU,OAAA,CAAAZ,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Logo = void 0;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
16
+ style: {
17
+ height: '100%',
18
+ display: 'flex',
19
+ justifyContent: 'center'
20
+ }
21
+ }, /*#__PURE__*/_react().default.createElement("img", {
22
+ style: {
23
+ width: 70
24
+ },
25
+ src: "https://static.bit.dev/extensions-icons/env.svg"
26
+ }));
27
+ exports.Logo = Logo;
28
+
29
+ //# sourceMappingURL=env.composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["env.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/env.svg\" />\n </div>\n);\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAAiD,CAAE,CAC/E,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ import type { ShowFragment, Component } from '@teambit/component';
2
+ import type { EnvsMain } from './environments.main.runtime';
3
+ export declare class EnvFragment implements ShowFragment {
4
+ private envs;
5
+ constructor(envs: EnvsMain);
6
+ readonly title = "env";
7
+ renderRow(component: Component): Promise<{
8
+ title: string;
9
+ content: string;
10
+ }>;
11
+ json(component: Component): Promise<{
12
+ title: string;
13
+ json: string;
14
+ }>;
15
+ private getEnvId;
16
+ weight: number;
17
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EnvFragment = void 0;
7
+ function _chalk() {
8
+ const data = _interopRequireDefault(require("chalk"));
9
+ _chalk = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ class EnvFragment {
19
+ constructor(envs) {
20
+ this.envs = envs;
21
+ _defineProperty(this, "title", 'env');
22
+ _defineProperty(this, "weight", 3);
23
+ }
24
+ async renderRow(component) {
25
+ const envId = await this.getEnvId(component);
26
+ const isLoaded = this.envs.isEnvRegistered(envId);
27
+ return {
28
+ title: this.title,
29
+ content: isLoaded ? envId : `${envId} ${_chalk().default.red('(not loaded)')}`
30
+ };
31
+ }
32
+ async json(component) {
33
+ const envId = await this.getEnvId(component);
34
+ return {
35
+ title: this.title,
36
+ json: envId
37
+ };
38
+ }
39
+ async getEnvId(component) {
40
+ // don't use this.envs.getEnv(). otherwise, it'll throw an error when running bit-show on a remote component
41
+ // where the env can't register to the slot.
42
+ // return this.envs.getEnvId(component);
43
+ return (await this.envs.calculateEnvId(component)).toString();
44
+ }
45
+ }
46
+ exports.EnvFragment = EnvFragment;
47
+
48
+ //# sourceMappingURL=env.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","EnvFragment","constructor","envs","renderRow","component","envId","getEnvId","isLoaded","isEnvRegistered","title","content","chalk","red","json","calculateEnvId","toString","exports"],"sources":["env.fragment.ts"],"sourcesContent":["import type { ShowFragment, Component } from '@teambit/component';\nimport chalk from 'chalk';\nimport type { EnvsMain } from './environments.main.runtime';\n\nexport class EnvFragment implements ShowFragment {\n constructor(private envs: EnvsMain) {}\n\n readonly title = 'env';\n\n async renderRow(component: Component) {\n const envId = await this.getEnvId(component);\n const isLoaded = this.envs.isEnvRegistered(envId);\n return {\n title: this.title,\n content: isLoaded ? envId : `${envId} ${chalk.red('(not loaded)')}`,\n };\n }\n\n async json(component: Component) {\n const envId = await this.getEnvId(component);\n return {\n title: this.title,\n json: envId,\n };\n }\n\n private async getEnvId(component: Component) {\n // don't use this.envs.getEnv(). otherwise, it'll throw an error when running bit-show on a remote component\n // where the env can't register to the slot.\n // return this.envs.getEnvId(component);\n return (await this.envs.calculateEnvId(component)).toString();\n }\n\n weight = 3;\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAGnB,MAAMgB,WAAW,CAAyB;EAC/CC,WAAWA,CAASC,IAAc,EAAE;IAAA,KAAhBA,IAAc,GAAdA,IAAc;IAAApB,eAAA,gBAEjB,KAAK;IAAAA,eAAA,iBA0Bb,CAAC;EA5B2B;EAIrC,MAAMqB,SAASA,CAACC,SAAoB,EAAE;IACpC,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACC,QAAQ,CAACF,SAAS,CAAC;IAC5C,MAAMG,QAAQ,GAAG,IAAI,CAACL,IAAI,CAACM,eAAe,CAACH,KAAK,CAAC;IACjD,OAAO;MACLI,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,OAAO,EAAEH,QAAQ,GAAGF,KAAK,GAAG,GAAGA,KAAK,IAAIM,gBAAK,CAACC,GAAG,CAAC,cAAc,CAAC;IACnE,CAAC;EACH;EAEA,MAAMC,IAAIA,CAACT,SAAoB,EAAE;IAC/B,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACC,QAAQ,CAACF,SAAS,CAAC;IAC5C,OAAO;MACLK,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBI,IAAI,EAAER;IACR,CAAC;EACH;EAEA,MAAcC,QAAQA,CAACF,SAAoB,EAAE;IAC3C;IACA;IACA;IACA,OAAO,CAAC,MAAM,IAAI,CAACF,IAAI,CAACY,cAAc,CAACV,SAAS,CAAC,EAAEW,QAAQ,CAAC,CAAC;EAC/D;AAGF;AAACC,OAAA,CAAAhB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ import type { PluginDefinition } from '@teambit/aspect-loader';
2
+ import type { Harmony } from '@teambit/harmony';
3
+ import type { WorkerMain } from '@teambit/worker';
4
+ import type { LoggerMain } from '@teambit/logger';
5
+ import type { EnvsRegistry, ServicesRegistry } from './environments.main.runtime';
6
+ export declare class EnvPlugin implements PluginDefinition {
7
+ private envSlot;
8
+ private servicesRegistry;
9
+ private loggerMain;
10
+ private workerMain;
11
+ private harmony;
12
+ constructor(envSlot: EnvsRegistry, servicesRegistry: ServicesRegistry, loggerMain: LoggerMain, workerMain: WorkerMain, harmony: Harmony);
13
+ pattern: string;
14
+ runtimes: string[];
15
+ private createContext;
16
+ private transformToLegacyEnv;
17
+ register(object: any, aspect: {
18
+ id: string;
19
+ }): void;
20
+ }