@powerlines/plugin-env 0.16.158 → 0.16.160

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 (109) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  2. package/dist/babel/index.cjs +1 -0
  3. package/dist/babel/index.d.cts +2 -0
  4. package/dist/babel/index.d.mts +2 -0
  5. package/dist/babel/index.mjs +1 -0
  6. package/dist/babel/plugin.cjs +5 -0
  7. package/dist/babel/plugin.d.cts +8 -0
  8. package/dist/babel/plugin.d.cts.map +1 -0
  9. package/dist/babel/plugin.d.mts +8 -0
  10. package/dist/babel/plugin.d.mts.map +1 -0
  11. package/dist/babel/plugin.mjs +6 -0
  12. package/dist/babel/plugin.mjs.map +1 -0
  13. package/dist/components/docs.cjs +1 -0
  14. package/dist/components/docs.d.cts +24 -0
  15. package/dist/components/docs.d.cts.map +1 -0
  16. package/dist/components/docs.d.mts +24 -0
  17. package/dist/components/docs.d.mts.map +1 -0
  18. package/dist/components/docs.mjs +2 -0
  19. package/dist/components/docs.mjs.map +1 -0
  20. package/dist/components/env-builtin.cjs +98 -0
  21. package/dist/components/env-builtin.d.cts +21 -0
  22. package/dist/components/env-builtin.d.cts.map +1 -0
  23. package/dist/components/env-builtin.d.mts +21 -0
  24. package/dist/components/env-builtin.d.mts.map +1 -0
  25. package/dist/components/env-builtin.mjs +96 -0
  26. package/dist/components/env-builtin.mjs.map +1 -0
  27. package/dist/components/index.cjs +1 -0
  28. package/dist/components/index.d.cts +3 -0
  29. package/dist/components/index.d.mts +3 -0
  30. package/dist/components/index.mjs +1 -0
  31. package/dist/helpers/automd-generator.cjs +1 -0
  32. package/dist/helpers/automd-generator.d.cts +14 -0
  33. package/dist/helpers/automd-generator.d.cts.map +1 -0
  34. package/dist/helpers/automd-generator.d.mts +14 -0
  35. package/dist/helpers/automd-generator.d.mts.map +1 -0
  36. package/dist/helpers/automd-generator.mjs +2 -0
  37. package/dist/helpers/automd-generator.mjs.map +1 -0
  38. package/dist/helpers/create-reflection-resource.cjs +1 -0
  39. package/dist/helpers/create-reflection-resource.d.cts +13 -0
  40. package/dist/helpers/create-reflection-resource.d.cts.map +1 -0
  41. package/dist/helpers/create-reflection-resource.d.mts +13 -0
  42. package/dist/helpers/create-reflection-resource.d.mts.map +1 -0
  43. package/dist/helpers/create-reflection-resource.mjs +2 -0
  44. package/dist/helpers/create-reflection-resource.mjs.map +1 -0
  45. package/dist/helpers/index.cjs +1 -0
  46. package/dist/helpers/index.d.cts +7 -0
  47. package/dist/helpers/index.d.mts +7 -0
  48. package/dist/helpers/index.mjs +1 -0
  49. package/dist/helpers/load.cjs +1 -0
  50. package/dist/helpers/load.d.cts +36 -0
  51. package/dist/helpers/load.d.cts.map +1 -0
  52. package/dist/helpers/load.d.mts +36 -0
  53. package/dist/helpers/load.d.mts.map +1 -0
  54. package/dist/helpers/load.mjs +2 -0
  55. package/dist/helpers/load.mjs.map +1 -0
  56. package/dist/helpers/persistence.cjs +1 -0
  57. package/dist/helpers/persistence.d.cts +84 -0
  58. package/dist/helpers/persistence.d.cts.map +1 -0
  59. package/dist/helpers/persistence.d.mts +84 -0
  60. package/dist/helpers/persistence.d.mts.map +1 -0
  61. package/dist/helpers/persistence.mjs +2 -0
  62. package/dist/helpers/persistence.mjs.map +1 -0
  63. package/dist/helpers/reflect.cjs +1 -0
  64. package/dist/helpers/reflect.d.cts +68 -0
  65. package/dist/helpers/reflect.d.cts.map +1 -0
  66. package/dist/helpers/reflect.d.mts +68 -0
  67. package/dist/helpers/reflect.d.mts.map +1 -0
  68. package/dist/helpers/reflect.mjs +2 -0
  69. package/dist/helpers/reflect.mjs.map +1 -0
  70. package/dist/helpers/source-file-env.cjs +1 -0
  71. package/dist/helpers/source-file-env.d.cts +9 -0
  72. package/dist/helpers/source-file-env.d.cts.map +1 -0
  73. package/dist/helpers/source-file-env.d.mts +9 -0
  74. package/dist/helpers/source-file-env.d.mts.map +1 -0
  75. package/dist/helpers/source-file-env.mjs +2 -0
  76. package/dist/helpers/source-file-env.mjs.map +1 -0
  77. package/dist/helpers/template-helpers.cjs +1 -0
  78. package/dist/helpers/template-helpers.d.cts +15 -0
  79. package/dist/helpers/template-helpers.d.cts.map +1 -0
  80. package/dist/helpers/template-helpers.d.mts +15 -0
  81. package/dist/helpers/template-helpers.d.mts.map +1 -0
  82. package/dist/helpers/template-helpers.mjs +2 -0
  83. package/dist/helpers/template-helpers.mjs.map +1 -0
  84. package/dist/index.cjs +1 -0
  85. package/dist/index.d.cts +17 -0
  86. package/dist/index.d.cts.map +1 -0
  87. package/dist/index.d.mts +17 -0
  88. package/dist/index.d.mts.map +1 -0
  89. package/dist/index.mjs +2 -0
  90. package/dist/index.mjs.map +1 -0
  91. package/dist/types/index.cjs +1 -0
  92. package/dist/types/index.d.cts +3 -0
  93. package/dist/types/index.d.mts +3 -0
  94. package/dist/types/index.mjs +1 -0
  95. package/dist/types/plugin.cjs +1 -0
  96. package/dist/types/plugin.d.cts +163 -0
  97. package/dist/types/plugin.d.cts.map +1 -0
  98. package/dist/types/plugin.d.mts +163 -0
  99. package/dist/types/plugin.d.mts.map +1 -0
  100. package/dist/types/plugin.mjs +2 -0
  101. package/dist/types/plugin.mjs.map +1 -0
  102. package/dist/types/runtime.cjs +1 -0
  103. package/dist/types/runtime.d.cts +934 -0
  104. package/dist/types/runtime.d.cts.map +1 -0
  105. package/dist/types/runtime.d.mts +934 -0
  106. package/dist/types/runtime.d.mts.map +1 -0
  107. package/dist/types/runtime.mjs +2 -0
  108. package/dist/types/runtime.mjs.map +1 -0
  109. package/package.json +19 -19
@@ -0,0 +1,68 @@
1
+ import { EnvInterface, SecretsInterface } from "../types/runtime.cjs";
2
+ import { EnvPluginContext } from "../types/plugin.cjs";
3
+ import { ReflectionClass, TypeClass, TypeObjectLiteral } from "@powerlines/deepkit/vendor/type";
4
+
5
+ //#region src/helpers/reflect.d.ts
6
+ declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
7
+ declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
8
+ interface CreateEnvReflectionOptions {
9
+ type?: TypeObjectLiteral | TypeClass;
10
+ superReflection?: ReflectionClass<any>;
11
+ }
12
+ declare class BaseEnv implements EnvInterface {
13
+ APP_NAME: string;
14
+ APP_VERSION: string;
15
+ BUILD_ID: string;
16
+ BUILD_TIMESTAMP: string;
17
+ BUILD_CHECKSUM: string;
18
+ RELEASE_ID: string;
19
+ RELEASE_TAG: string;
20
+ ORGANIZATION: string;
21
+ PLATFORM: "node" | "browser" | "neutral";
22
+ MODE: "development" | "test" | "production";
23
+ ENVIRONMENT: string;
24
+ DEBUG: boolean;
25
+ TEST: boolean;
26
+ MINIMAL: boolean;
27
+ NO_COLOR: boolean;
28
+ FORCE_COLOR: number | boolean;
29
+ FORCE_HYPERLINK: number | boolean;
30
+ STACKTRACE: boolean;
31
+ INCLUDE_ERROR_DATA: boolean;
32
+ ERROR_URL: string;
33
+ DEFAULT_TIMEZONE: string;
34
+ DEFAULT_LOCALE: string;
35
+ CI: boolean;
36
+ }
37
+ declare class BaseSecrets implements SecretsInterface {
38
+ ENCRYPTION_KEY: string;
39
+ }
40
+ declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
41
+ declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
42
+ /**
43
+ * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.
44
+ *
45
+ * @remarks
46
+ * The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
47
+ *
48
+ * @param context - The plugin context
49
+ * @param file - The file path to reflect the environment configuration type definition from
50
+ * @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
51
+ * @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
52
+ */
53
+ declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
54
+ /**
55
+ * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.
56
+ *
57
+ * @remarks
58
+ * The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
59
+ *
60
+ * @param context - The plugin context
61
+ * @param file - The file path to reflect the secrets configuration type definition from
62
+ * @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
63
+ * @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
64
+ */
65
+ declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
66
+ //#endregion
67
+ export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
68
+ //# sourceMappingURL=reflect.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/helpers/reflect.ts"],"mappings":";;;;;iBAuCgB,mBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,iBAQa,uBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,UAQc,0BAAA;EACf,IAAA,GAAO,iBAAA,GAAoB,SAAA;EAC3B,eAAA,GAAkB,eAAA;AAAA;AAAA,cAGP,OAAA,YAAmB,YAAA;EAC9B,QAAA;EAEA,WAAA;EAEA,QAAA;EAEA,eAAA;EAEA,cAAA;EAEA,UAAA;EAEA,WAAA;EAEA,YAAA;EAEA,QAAA;EAEA,IAAA;EAEA,WAAA;EAEA,KAAA;EAEA,IAAA;EAEA,OAAA;EAEA,QAAA;EAEA,WAAA;EAEA,eAAA;EAEA,UAAA;EAEA,kBAAA;EAEA,SAAA;EAEA,gBAAA;EAEA,cAAA;EAEA,EAAA;AAAA;AAAA,cAGW,WAAA,YAAuB,gBAAA;EAClC,cAAA;AAAA;AAAA,iBAGc,mBAAA,CACd,OAAA,EAAS,gBAAA,EACT,OAAA,GAAS,0BAAA,GACR,eAAA;AAAA,iBAyCa,uBAAA,CACd,OAAA,EAAS,gBAAA,EACT,OAAA,GAAS,0BAAA,GACR,eAAA;;;;;;;;;;;;iBAoDmB,UAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,WACA,IAAA,YAAa,OAAA,CAAA,eAAA;;;;;;;;;;;;iBAqCO,cAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,WACA,IAAA,YAAa,OAAA,CAAA,eAAA"}
@@ -0,0 +1,68 @@
1
+ import { EnvInterface, SecretsInterface } from "../types/runtime.mjs";
2
+ import { EnvPluginContext } from "../types/plugin.mjs";
3
+ import { ReflectionClass, TypeClass, TypeObjectLiteral } from "@powerlines/deepkit/vendor/type";
4
+
5
+ //#region src/helpers/reflect.d.ts
6
+ declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
7
+ declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
8
+ interface CreateEnvReflectionOptions {
9
+ type?: TypeObjectLiteral | TypeClass;
10
+ superReflection?: ReflectionClass<any>;
11
+ }
12
+ declare class BaseEnv implements EnvInterface {
13
+ APP_NAME: string;
14
+ APP_VERSION: string;
15
+ BUILD_ID: string;
16
+ BUILD_TIMESTAMP: string;
17
+ BUILD_CHECKSUM: string;
18
+ RELEASE_ID: string;
19
+ RELEASE_TAG: string;
20
+ ORGANIZATION: string;
21
+ PLATFORM: "node" | "browser" | "neutral";
22
+ MODE: "development" | "test" | "production";
23
+ ENVIRONMENT: string;
24
+ DEBUG: boolean;
25
+ TEST: boolean;
26
+ MINIMAL: boolean;
27
+ NO_COLOR: boolean;
28
+ FORCE_COLOR: number | boolean;
29
+ FORCE_HYPERLINK: number | boolean;
30
+ STACKTRACE: boolean;
31
+ INCLUDE_ERROR_DATA: boolean;
32
+ ERROR_URL: string;
33
+ DEFAULT_TIMEZONE: string;
34
+ DEFAULT_LOCALE: string;
35
+ CI: boolean;
36
+ }
37
+ declare class BaseSecrets implements SecretsInterface {
38
+ ENCRYPTION_KEY: string;
39
+ }
40
+ declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
41
+ declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
42
+ /**
43
+ * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.
44
+ *
45
+ * @remarks
46
+ * The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
47
+ *
48
+ * @param context - The plugin context
49
+ * @param file - The file path to reflect the environment configuration type definition from
50
+ * @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
51
+ * @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
52
+ */
53
+ declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
54
+ /**
55
+ * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.
56
+ *
57
+ * @remarks
58
+ * The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
59
+ *
60
+ * @param context - The plugin context
61
+ * @param file - The file path to reflect the secrets configuration type definition from
62
+ * @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
63
+ * @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
64
+ */
65
+ declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
66
+ //#endregion
67
+ export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
68
+ //# sourceMappingURL=reflect.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.d.mts","names":[],"sources":["../../src/helpers/reflect.ts"],"mappings":";;;;;iBAuCgB,mBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,iBAQa,uBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,UAQc,0BAAA;EACf,IAAA,GAAO,iBAAA,GAAoB,SAAA;EAC3B,eAAA,GAAkB,eAAA;AAAA;AAAA,cAGP,OAAA,YAAmB,YAAA;EAC9B,QAAA;EAEA,WAAA;EAEA,QAAA;EAEA,eAAA;EAEA,cAAA;EAEA,UAAA;EAEA,WAAA;EAEA,YAAA;EAEA,QAAA;EAEA,IAAA;EAEA,WAAA;EAEA,KAAA;EAEA,IAAA;EAEA,OAAA;EAEA,QAAA;EAEA,WAAA;EAEA,eAAA;EAEA,UAAA;EAEA,kBAAA;EAEA,SAAA;EAEA,gBAAA;EAEA,cAAA;EAEA,EAAA;AAAA;AAAA,cAGW,WAAA,YAAuB,gBAAA;EAClC,cAAA;AAAA;AAAA,iBAGc,mBAAA,CACd,OAAA,EAAS,gBAAA,EACT,OAAA,GAAS,0BAAA,GACR,eAAA;AAAA,iBAyCa,uBAAA,CACd,OAAA,EAAS,gBAAA,EACT,OAAA,GAAS,0BAAA,GACR,eAAA;;;;;;;;;;;;iBAoDmB,UAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,WACA,IAAA,YAAa,OAAA,CAAA,eAAA;;;;;;;;;;;;iBAqCO,cAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,WACA,IAAA,YAAa,OAAA,CAAA,eAAA"}
@@ -0,0 +1,2 @@
1
+ import{__ΩEnvInterface as e,__ΩSecretsInterface as t}from"../types/runtime.mjs";import{__ΩEnvPluginContext as n}from"../types/plugin.mjs";import{getEnvDefaultTypeDefinition as r,getSecretsDefaultTypeDefinition as i,readEnvTypeReflection as a,readSecretsReflection as o}from"./persistence.mjs";import{titleCase as s}from"@stryke/string-format/title-case";import{ReflectionClass as c,ReflectionKind as l,merge as u,resolveClassType as d}from"@powerlines/deepkit/vendor/type";import{joinPaths as f}from"@stryke/path/join-paths";import{reflectType as p}from"@powerlines/deepkit/reflect-type";import{isParentPath as m}from"@stryke/path/is-parent-path";function h(e,t){return e.__type=t,e}function g(e,t){return x(e,{type:u(t.map(h(e=>e.type,[`reflection`,``,`P"2!"/"`])))})}g.__type=[()=>n,`context`,`reflections`,`mergeEnvReflections`,`Pn!2"!F2#!/$`];function _(e,t){return S(e,{type:u(t.map(h(e=>e.type,[`reflection`,``,`P"2!"/"`])))})}_.__type=[()=>n,`context`,`reflections`,`mergeSecretsReflections`,`Pn!2"!F2#!/$`];const v=[`type`,`superReflection`,`CreateEnvReflectionOptions`,`PP!!J4!8!4"8Mw#y`];var y=class{APP_NAME;APP_VERSION;BUILD_ID;BUILD_TIMESTAMP;BUILD_CHECKSUM;RELEASE_ID;RELEASE_TAG;ORGANIZATION;PLATFORM=`neutral`;MODE=`production`;ENVIRONMENT;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;ERROR_URL;DEFAULT_TIMEZONE;DEFAULT_LOCALE;CI=!1;static __type=[`APP_NAME`,`APP_VERSION`,`BUILD_ID`,`BUILD_TIMESTAMP`,`BUILD_CHECKSUM`,`RELEASE_ID`,`RELEASE_TAG`,`ORGANIZATION`,`node`,`browser`,`neutral`,`PLATFORM`,function(){return`neutral`},`development`,`test`,`production`,`MODE`,function(){return`production`},`ENVIRONMENT`,`DEBUG`,function(){return!1},`TEST`,function(){return!1},`MINIMAL`,function(){return!1},`NO_COLOR`,function(){return!1},`FORCE_COLOR`,function(){return!1},`FORCE_HYPERLINK`,function(){return!1},`STACKTRACE`,function(){return!1},`INCLUDE_ERROR_DATA`,function(){return!1},`ERROR_URL`,`DEFAULT_TIMEZONE`,`DEFAULT_LOCALE`,`CI`,function(){return!1},()=>e,`BaseEnv`,`&3!&3"&3#&3$&3%&3&&3'&3(P.).*.+J3,>-P.../.0J31>2&33)34>5)36>7)38>9)3:>;P')J3<>=P')J3>>?)3@>A)3B>C&3D&3E&3F)3G>H5nIx"wJ`]},b=class{ENCRYPTION_KEY;static __type=[`ENCRYPTION_KEY`,()=>t,`BaseSecrets`,`&3!5n"x"w#`]};function x(e,t={}){let n=t.superReflection??new c({kind:l.class,description:`The base environment configuration definition for the ${s(e.config.name)} project.`,classType:y,types:[],implements:[{kind:l.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${s(e.config.name)} project.`,types:[]}]});n.name=`Env`;let r=new c(t.type??{kind:l.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${s(e.config.name)} application`:`application`}.`,types:[]},n);return r.name=`Env`,r}x.__type=[()=>n,`context`,()=>v,`options`,()=>({}),`createEnvReflection`,`Pn!2"n#2$>%!/&`];function S(e,t={}){let n=t.superReflection??new c({kind:l.class,description:`The base secrets configuration definition for the ${s(e.config.name)} project.`,classType:b,types:[],implements:[{kind:l.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${s(e.config.name)} project.`,types:[]}]});n.name=`Secrets`;let r=new c(t.type??{kind:l.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${s(e.config.name)} application`:`application`}.`,types:[]},n);return r.name=`Secrets`,r}S.__type=[()=>n,`context`,()=>v,`options`,()=>({}),`createSecretsReflection`,`Pn!2"n#2$>%!/&`];async function C(e,t,n){let i;return t&&(i=d(await p(e,{file:m(t,e.config.cwd)?t:f(e.config.cwd,t),name:n}))),g(e,[await a(e,`env`),i,d(await p(e,await r(e)))].filter(Boolean))}C.__type=[()=>n,`context`,`file`,`name`,`reflectEnv`,`Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.`,`Pn!2"&2#8&2$8"/%?&`];async function w(e,t,n){let r;return t&&(r=d(await p(e,{file:m(t,e.config.cwd)?t:f(e.config.cwd,t),name:n}))),_(e,[await o(e),r,d(await p(e,await i(e)))].filter(Boolean))}w.__type=[()=>n,`context`,`file`,`name`,`reflectSecrets`,`Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.`,`Pn!2"&2#8&2$8"/%?&`];export{y as BaseEnv,b as BaseSecrets,v as __ΩCreateEnvReflectionOptions,x as createEnvReflection,S as createSecretsReflection,g as mergeEnvReflections,_ as mergeSecretsReflections,C as reflectEnv,w as reflectSecrets};
2
+ //# sourceMappingURL=reflect.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/helpers/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { reflectType } from \"@powerlines/deepkit/reflect-type\";\nimport {\n merge,\n ReflectionClass,\n ReflectionKind,\n resolveClassType,\n TypeClass,\n TypeObjectLiteral\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext } from \"../types/plugin\";\nimport { EnvInterface, SecretsInterface } from \"../types/runtime\";\nimport {\n getEnvDefaultTypeDefinition,\n getSecretsDefaultTypeDefinition,\n readEnvTypeReflection,\n readSecretsReflection\n} from \"./persistence\";\n\nexport function mergeEnvReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createEnvReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport function mergeSecretsReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createSecretsReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport interface CreateEnvReflectionOptions {\n type?: TypeObjectLiteral | TypeClass;\n superReflection?: ReflectionClass<any>;\n}\n\nexport class BaseEnv implements EnvInterface {\n APP_NAME!: string;\n\n APP_VERSION!: string;\n\n BUILD_ID!: string;\n\n BUILD_TIMESTAMP!: string;\n\n BUILD_CHECKSUM!: string;\n\n RELEASE_ID!: string;\n\n RELEASE_TAG!: string;\n\n ORGANIZATION!: string;\n\n PLATFORM: \"node\" | \"browser\" | \"neutral\" = \"neutral\";\n\n MODE: \"development\" | \"test\" | \"production\" = \"production\";\n\n ENVIRONMENT!: string;\n\n DEBUG: boolean = false;\n\n TEST: boolean = false;\n\n MINIMAL: boolean = false;\n\n NO_COLOR: boolean = false;\n\n FORCE_COLOR: number | boolean = false;\n\n FORCE_HYPERLINK: number | boolean = false;\n\n STACKTRACE: boolean = false;\n\n INCLUDE_ERROR_DATA: boolean = false;\n\n ERROR_URL!: string;\n\n DEFAULT_TIMEZONE!: string;\n\n DEFAULT_LOCALE!: string;\n\n CI: boolean = false;\n}\n\nexport class BaseSecrets implements SecretsInterface {\n ENCRYPTION_KEY!: string;\n}\n\nexport function createEnvReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base environment configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseEnv,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"EnvInterface\",\n description: `The environment configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Env\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `A schema describing the list of available environment variables that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Env\";\n\n return result;\n}\n\nexport function createSecretsReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base secrets configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseSecrets,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"SecretsInterface\",\n description: `The secrets configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Secrets\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `A schema describing the list of available environment secrets that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Secrets\";\n\n return result;\n}\n\n/**\n * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the environment configuration type definition from\n * @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n */\nexport async function reflectEnv(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.config.cwd)\n ? joinPaths(context.config.cwd, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeEnvReflections(\n context,\n [\n await readEnvTypeReflection(context, \"env\"),\n config,\n resolveClassType(\n await reflectType(context, await getEnvDefaultTypeDefinition(context))\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n\n/**\n * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the secrets configuration type definition from\n * @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n */\nexport async function reflectSecrets(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.config.cwd)\n ? joinPaths(context.config.cwd, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeSecretsReflections(\n context,\n [\n await readSecretsReflection(context),\n config,\n resolveClassType(\n await reflectType(\n context,\n await getSecretsDefaultTypeDefinition(context)\n )\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n"],"mappings":"uoBAMA,SAAS,EAAY,EAAI,EAAO,OAC/B,GAAI,OAAS,IA0Bd,SAAE,EAA2B,EAAA,EAAA,CAI3B,OAHA,EAA+B,EAAA,CAC/B,KAAA,EAAA,EAAqB,IAAA,EAAA,GAAA,EAAA,KAAA,CAAA,aAAA,GAAA,UAAA,CAAA,CAAA,CAAA,CACrB,CACQ,CAEV,EAAgB,OAAA,KAAmB,EAAA,UAAA,cAAA,sBAAA,eAAA,CACnC,SAAW,EAAgB,EAAA,EAAA,CAIzB,OAHa,EAAqB,EAAA,CACjC,KAAA,EAAA,EAAqB,IAAA,EAAA,GAAA,EAAA,KAAA,CAAA,aAAA,GAAA,UAAA,CAAA,CAAA,CAAA,CACtB,CACc,mFAGhB,MAAE,EAAiB,CAAA,OAAA,kBAAA,6BAAA,mBAAA,aAGnB,SACE,YACA,SACA,gBACA,eACA,WACA,yBAEA,SAAO,UACT,KAAA,yBAEA,MAAO,GACL,KAAO,GACP,QAAA,GACF,SAAA,kBAE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,CACL,CAAC,CACH,CAAC,CACF,EAAO,KAAO,UACd,IAAM,EAAA,IAAA,EAAA,EAAA,MAAA,CACJ,KAAE,EAAA,cACF,SAAE,UACJ,YAAe,yFAAI,EAAA,OAAA,KAAA,GAAA,EAAA,EAAA,OAAA,KAAA,CAAA,cAAA,cAAA,YAEnB,CAAA,EAAM,CAEN,MADA,GAAE,KAAY,UACV,EAEN,EAAsB,OAAO,KAAW,EAAqB,cAAa,EAAmC,eAAA,EAAA,EAAA,0BAAA,iBAAA,CAY7G,eAAA,EAAA,EAAA,EAAA,EAAA,OASE,OAPI,IAKF,EAAQ,EAAiB,MAJF,EAAA,EAAA,CACzB,KAAS,EAAA,EAAA,EAA6B,OAAC,IAAA,CAAA,EAAA,EAAA,EAAA,OAAA,IAAA,EAAA,CACtC,OACD,CAAA,CAC2B,EAEvB,EAAqB,EAAK,CAAA,MAAA,EAAA,EAAA,MAAA,CAAA,EAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,OAAA,QAAA,CAAA,CAEhC,EAAQ,OAAQ,KAAO,EAAA,UAAA,OAAA,OAAA,aAAA,2NAAA,qBAAA,CAYvB,eAAQ,EAAA,EAAA,EAAA,EAAA,CACN,IAAI,EAQJ,OAPI,IAKF,EAAQ,EAAe,MAJF,EAAA,EAAA,4CAEvB,OACE,CAAA,CACoC,EAElC,EAAuB,EAAW,CAAG,MAAM,EAAa,EAAY,CAAO,EAAM,EAAmB,MAAC,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,OAAA,QAAA,CAAA,CAE3G,EAAe,OAAS,KAAC,EAAsB,UAAW,OAAA,OAAA,iBAAA,+MAAA,qBAAA"}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@stryke/env/types`),t=require(`@stryke/string-format/camel-case`),n=require(`@stryke/type-checks/is-string`);function r(e,t){return e.__type=t,e}const i=[`TEnv`,`TReturned`,`l2&R!RPe#!&qk#%QRb!Pde"!p'w"y`];function a(t){if((0,n.isString)(t)){let n=e.ENV_PREFIXES.reduce(r((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),[`ret`,`prefix`,``,`P"2!"2""/#`]),t.toUpperCase());for(;n.startsWith(`_`);)n=n.slice(1);return n}return Object.keys(t).reduce(r((e,n)=>{let r=a(n);return r&&(e[r]=t[n]),e},[`ret`,`key`,``,`P"2!"2""/#`]),{})}a.__type=[`env`,()=>i,`removeEnvPrefix`,`P"2!"o""/#`];function o(e){return(0,t.camelCase)(a(e))}o.__type=[`key`,`formatEnvField`,`P&2!&/"`],exports.formatEnvField=o,exports.removeEnvPrefix=a;
@@ -0,0 +1,9 @@
1
+ import { DotenvParseOutput } from "@stryke/env/types";
2
+
3
+ //#region src/helpers/source-file-env.d.ts
4
+ type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
5
+ declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
6
+ declare function formatEnvField(key: string): string;
7
+ //#endregion
8
+ export { formatEnvField, removeEnvPrefix };
9
+ //# sourceMappingURL=source-file-env.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-env.d.cts","names":[],"sources":["../../src/helpers/source-file-env.ts"],"mappings":";;;KAuBK,SAAA,SAAkB,IAAA,2BAA+B,iBAAA;AAAA,iBAEtC,eAAA,cAA6B,iBAAA,UAAA,CAC3C,GAAA,EAAK,IAAA,GACJ,SAAA,CAAU,IAAA;AAAA,iBA2BG,cAAA,CAAe,GAAA"}
@@ -0,0 +1,9 @@
1
+ import { DotenvParseOutput } from "@stryke/env/types";
2
+
3
+ //#region src/helpers/source-file-env.d.ts
4
+ type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
5
+ declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
6
+ declare function formatEnvField(key: string): string;
7
+ //#endregion
8
+ export { formatEnvField, removeEnvPrefix };
9
+ //# sourceMappingURL=source-file-env.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-env.d.mts","names":[],"sources":["../../src/helpers/source-file-env.ts"],"mappings":";;;KAuBK,SAAA,SAAkB,IAAA,2BAA+B,iBAAA;AAAA,iBAEtC,eAAA,cAA6B,iBAAA,UAAA,CAC3C,GAAA,EAAK,IAAA,GACJ,SAAA,CAAU,IAAA;AAAA,iBA2BG,cAAA,CAAe,GAAA"}
@@ -0,0 +1,2 @@
1
+ import{ENV_PREFIXES as e}from"@stryke/env/types";import{camelCase as t}from"@stryke/string-format/camel-case";import{isString as n}from"@stryke/type-checks/is-string";function r(e,t){return e.__type=t,e}const i=[`TEnv`,`TReturned`,`l2&R!RPe#!&qk#%QRb!Pde"!p'w"y`];function a(t){if(n(t)){let n=e.reduce(r((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),[`ret`,`prefix`,``,`P"2!"2""/#`]),t.toUpperCase());for(;n.startsWith(`_`);)n=n.slice(1);return n}return Object.keys(t).reduce(r((e,n)=>{let r=a(n);return r&&(e[r]=t[n]),e},[`ret`,`key`,``,`P"2!"2""/#`]),{})}a.__type=[`env`,()=>i,`removeEnvPrefix`,`P"2!"o""/#`];function o(e){return t(a(e))}o.__type=[`key`,`formatEnvField`,`P&2!&/"`];export{o as formatEnvField,a as removeEnvPrefix};
2
+ //# sourceMappingURL=source-file-env.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-env.mjs","names":[],"sources":["../../src/helpers/source-file-env.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\ntype TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;\n\nexport function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(\n env: TEnv\n): TReturned<TEnv> {\n if (isString(env)) {\n let name: string = ENV_PREFIXES.reduce((ret, prefix) => {\n if (ret.startsWith(prefix)) {\n ret = ret.slice(prefix.length);\n }\n\n return ret;\n }, env.toUpperCase());\n\n while (name.startsWith(\"_\")) {\n name = name.slice(1);\n }\n\n return name as TReturned<TEnv>;\n }\n\n return Object.keys(env).reduce((ret, key) => {\n const name = removeEnvPrefix(key);\n if (name) {\n (ret as DotenvParseOutput)[name] = env[key];\n }\n\n return ret;\n }, {} as TReturned<TEnv>);\n}\n\nexport function formatEnvField(key: string): string {\n return camelCase(removeEnvPrefix(key));\n}\n"],"mappings":"uKAAA,SAAS,EAAa,EAAI,EAAM,CAE9B,kBAAO,EAKT,MAAK,EAAe,CAAE,OAAQ,YAAC,gCAAoC,eAElE,GAAA,EAAc,EAAI,CAAE,CACpB,IAAA,EAAc,EAAY,OAAQ,GAAW,EAAM,KACnD,EAAa,WAAW,EAAO,GACxB,EAAM,EAAI,MAAM,EAAG,OAAQ,EAEtB,sDAET,KAAO,EAAK,WAAW,IAAI,EAAA,EAAA,EAAA,MAAA,EAAA,CAG/B,OAAS,EAET,OAAS,OAAA,KAAW,EAAK,CAAC,OAAO,GAAa,EAAG,IAAO,YAKtD,OAHG,IAAA,EAAA,GAAA,EAAA,IAGE,GACJ,CAAA,MAAU,MAAM,GAAA,aAAA,CAAA,CAAA,EAAA,CAAA,CAEnB,EAAc,OAAS,CAAA,UAAa,EAAa,kBAAW,aAAA,CAC5D,SAAc,EAAiB,EAAG,CAChC,OAAM,EAAU,EAAa,EAAO,CAAA"}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../types/plugin.cjs`),t=require(`./persistence.cjs`);let n=require(`@stryke/string-format/title-case`);function r(e,t){return e.__type=t,e}async function i(e,i){let a=await t.readEnvTypeReflection(e,i);return a.getProperties().forEach(r(e=>{e.getAlias().filter(Boolean).forEach(r(t=>{a.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),runtime:e.isRuntime(),alias:e.getAlias().filter(r(e=>e!==t,[`a`,``,`P"2!"/"`])).concat(e.name),title:e.getTitle()||(0,n.titleCase)(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})},[`alias`,``,`P"2!"/"`]))},[`prop`,``,`P"2!"/"`])),a}i.__type=[()=>e.__ΩEnvPluginContext,`context`,()=>e.__ΩEnvType,`name`,`createTemplateReflection`,`Creates the reflection data used when generating runtime template files.`,'Pn!2"n#2$8!`/%?&'],exports.createTemplateReflection=i;
@@ -0,0 +1,15 @@
1
+ import { EnvPluginContext, EnvType } from "../types/plugin.cjs";
2
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
3
+
4
+ //#region src/helpers/template-helpers.d.ts
5
+ /**
6
+ * Creates the reflection data used when generating runtime template files.
7
+ *
8
+ * @param context - The context for the configuration plugin.
9
+ * @param name - The name of the configuration template.
10
+ * @returns The reflection for the specified configuration template.
11
+ */
12
+ declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
13
+ //#endregion
14
+ export { createTemplateReflection };
15
+ //# sourceMappingURL=template-helpers.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-helpers.d.cts","names":[],"sources":["../../src/helpers/template-helpers.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAsB,wBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAO,OAAA,GACN,OAAA,CAAQ,eAAA"}
@@ -0,0 +1,15 @@
1
+ import { EnvPluginContext, EnvType } from "../types/plugin.mjs";
2
+ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
3
+
4
+ //#region src/helpers/template-helpers.d.ts
5
+ /**
6
+ * Creates the reflection data used when generating runtime template files.
7
+ *
8
+ * @param context - The context for the configuration plugin.
9
+ * @param name - The name of the configuration template.
10
+ * @returns The reflection for the specified configuration template.
11
+ */
12
+ declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
13
+ //#endregion
14
+ export { createTemplateReflection };
15
+ //# sourceMappingURL=template-helpers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-helpers.d.mts","names":[],"sources":["../../src/helpers/template-helpers.ts"],"mappings":";;;;;;AA8BA;;;;;iBAAsB,wBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAO,OAAA,GACN,OAAA,CAAQ,eAAA"}
@@ -0,0 +1,2 @@
1
+ import{__ΩEnvPluginContext as e,__ΩEnvType as t}from"../types/plugin.mjs";import{readEnvTypeReflection as n}from"./persistence.mjs";import{titleCase as r}from"@stryke/string-format/title-case";function i(e,t){return e.__type=t,e}async function a(e,t){let a=await n(e,t);return a.getProperties().forEach(i(e=>{e.getAlias().filter(Boolean).forEach(i(t=>{a.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),runtime:e.isRuntime(),alias:e.getAlias().filter(i(e=>e!==t,[`a`,``,`P"2!"/"`])).concat(e.name),title:e.getTitle()||r(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})},[`alias`,``,`P"2!"/"`]))},[`prop`,``,`P"2!"/"`])),a}a.__type=[()=>e,`context`,()=>t,`name`,`createTemplateReflection`,`Creates the reflection data used when generating runtime template files.`,'Pn!2"n#2$8!`/%?&'];export{a as createTemplateReflection};
2
+ //# sourceMappingURL=template-helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-helpers.mjs","names":[],"sources":["../../src/helpers/template-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext, EnvType } from \"../types/plugin\";\nimport { readEnvTypeReflection } from \"./persistence\";\n\n/**\n * Creates the reflection data used when generating runtime template files.\n *\n * @param context - The context for the configuration plugin.\n * @param name - The name of the configuration template.\n * @returns The reflection for the specified configuration template.\n */\nexport async function createTemplateReflection(\n context: EnvPluginContext,\n name?: EnvType\n): Promise<ReflectionClass<any>> {\n const reflection = await readEnvTypeReflection(context, name);\n\n reflection.getProperties().forEach(prop => {\n const aliases = prop.getAlias();\n aliases.filter(Boolean).forEach(alias => {\n reflection.addProperty({\n name: alias,\n optional: prop.isOptional() ? true : undefined,\n readonly: prop.isReadonly() ? true : undefined,\n description: prop.getDescription(),\n visibility: prop.getVisibility(),\n type: prop.getType(),\n default: prop.getDefaultValue(),\n tags: {\n hidden: prop.isHidden(),\n ignore: prop.isIgnored(),\n internal: prop.isInternal(),\n runtime: prop.isRuntime(),\n alias: prop\n .getAlias()\n .filter(a => a !== alias)\n .concat(prop.name),\n title: prop.getTitle() || titleCase(prop.name),\n readonly: prop.isReadonly(),\n permission: prop.getPermission(),\n domain: prop.getDomain()\n }\n });\n });\n });\n\n return reflection;\n}\n"],"mappings":"iMAIA,SAAM,EAAS,EAAW,EAAM,CAE/B,MADA,GAAG,OAAU,EACL,wBAYT,IAAQ,EAAC,MAAkB,EAAkB,EAAQ,EAAO,CA0B1D,OAzBF,EAAS,eAAmB,CAAA,QAAO,EAAc,GAAM,CAC9C,EAAgB,UAChB,CAAA,OAAA,QAAA,CAAA,QAAwB,EAAQ,GAAY,gBAEnD,KAAA,EACC,SAAY,EAAA,YAAoB,CAAC,GAAK,IAAA,GACxC,SAAA,EAAA,YAAA,CAAA,GAAA,IAAA,GACG,YAAgB,EAAI,gBAAgB,CACpC,WAAgB,EAAK,eAAQ,CAC7B,KAAQ,EAAI,SAAW,CACzB,QAAA,EAAA,iBAAA,CACK,KAAM,CACH,OAAC,EAAA,UAAgB,CAClB,OAAA,EAAA,WAAA,CACC,SAAC,EAAA,YAAsB,CACzB,QAAW,EAAE,WAAM,0EAEzB,MAAW,EAAA,UAAgB,EAAO,EAAS,EAAA,KAAA,CACnC,SAAU,EAAK,YAAU,CAC/B,WAAe,EAAQ,eAAe,CACpC,OAAW,EAAA,WAAY,CACrB,CACD,CAAC,EACD,CAAC,QAAS,GAAC,UAAK,CAAA,CAAU,EAC5B,CAAC,OAAE,GAAA,UAAkB,CAAA,CAAA,CAClB,EAER,EAAsB,OAAA,KAAiB,EAAA,cAAA,EAAA,OAAA,2BAAA,2EAAA,mBAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./types/plugin.cjs`),n=require(`./helpers/reflect.cjs`),r=require(`./helpers/persistence.cjs`),i=require(`./helpers/load.cjs`),a=require(`./helpers/automd-generator.cjs`),o=require(`./components/docs.cjs`),s=require(`./components/env-builtin.cjs`),c=require(`./babel/plugin.cjs`);let l=require(`@powerlines/deepkit/vendor/type`),u=require(`defu`);u=e.__toESM(u);let d=require(`powerlines/constants`),f=require(`powerlines/plugin-utils`),p=require(`@alloy-js/core/jsx-runtime`),m=require(`@stryke/path/join`),h=require(`@stryke/helpers/get-unique`),g=require(`@powerlines/plugin-alloy/render`),_=require(`@powerlines/plugin-automd`);_=e.__toESM(_);let v=require(`@powerlines/plugin-babel`);v=e.__toESM(v);let y=require(`@powerlines/plugin-deepkit`);y=e.__toESM(y);let b=require(`@stryke/convert/parse-type-definition`),x=require(`@stryke/convert/to-array`),S=require(`@stryke/fs/exists`),C=require(`@stryke/string-format/constant-case`),w=require(`@stryke/type-checks/is-set-string`);function T(e,t){return e.__type=t,e}const E=T((e={})=>[(0,y.default)(e.deepkit),(0,v.default)(e.babel),{name:`env:core`,async config(){this.debug("Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,u.default)(e,{types:{},validate:!1,inject:!1,prefix:[]}),babel:{plugins:[c.envBabelPlugin]},deepkit:{reflection:`default`,level:`all`},tsc:{}};if((0,w.isSetString)(t.env.types)||t.env.types&&(0,w.isSetString)(t.env.types.file)){t.env.types=(0,b.parseTypeDefinition)(t.env.types);let e=await this.fs.resolve(t.env.types.file);e&&(t.env.types.file=e)}else{this.warn("The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await r.getEnvDefaultTypeDefinition(this),n=await this.fs.resolve(e.file);n&&(t.env.types=(0,b.parseTypeDefinition)(`${n}#${e.name}`))}if((0,w.isSetString)(t.env.secrets)||t.env.secrets&&(0,w.isSetString)(t.env.secrets.file)){t.env.secrets=(0,b.parseTypeDefinition)(t.env.secrets);let e=await this.fs.resolve(t.env.secrets.file);e&&(t.env.secrets.file=e)}else{let e=await r.getSecretsDefaultTypeDefinition(this),n=await this.fs.resolve(e.file);n&&(t.env.secrets=(0,b.parseTypeDefinition)(`${n}#${e.name}`))}return(t.env.types||t.env.secrets)&&(t.tsc.filter={id:[RegExp(`^(${d.VIRTUAL_MODULE_PREFIX})?${(0,m.joinPaths)(this.builtinsPath,`env.ts`).replace(/\\/g,`\\\\`).replace(/\//g,`\\/`).replace(/\./g,`\\.`).replace(/\$/g,`\\$`)}$`)]}),t.env.prefix=(0,x.toArray)(t.env.prefix??[]).reduce(T((e,t)=>{let n=(0,C.constantCase)(t);return e.includes(n)||e.push(n),e},[`ret`,`prefix`,``,`P&F2!&2""/#`]),[`POWERLINES_`,this.config.framework&&this.config.framework!==`powerlines`&&`${(0,C.constantCase)(this.config.framework)}_`].filter(Boolean)),t.env.prefix=(0,h.getUnique)((0,x.toArray)(t.env.prefix).reduce(T((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[`ret`,`prefix`,``,`P"2!"2""/#`]),[])),t},async configResolved(){if(this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`),this.env=(0,u.default)({parsed:await i.loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&!this.config.skipCache&&this.persistedMeta?.checksum===this.meta.checksum&&(0,S.existsSync)(r.getEnvTypeReflectionsPath(this,`env`)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await r.readEnvTypeReflection(this,`env`),(0,S.existsSync)(r.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await r.readEnvReflection(this)),(0,S.existsSync)(r.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await r.readEnvTypeReflection(this,`secrets`)),(0,S.existsSync)(r.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await r.readSecretsReflection(this));else{if(this.debug(`Starting environment configuration reflection initialization.`),this.env.types.env=await n.reflectEnv(this,this.config.env.types?.file,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await r.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await n.reflectSecrets(this,this.config.env.secrets?.file,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await r.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.debug(`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let e=this.env.types.env.getProperties().filter(T(e=>e.getAlias().length>0,[`prop`,``,`P"2!"/"`]));Object.entries(await i.loadEnv(this,this.config.env)).forEach(T(([t,n])=>{let r=this.config.env.prefix.reduce(T((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,[`ret`,`prefix`,``,`P"2!"2""/#`]),t),i=e.find(T(e=>e?.getAlias().reverse().includes(r),[`prop`,``,`P"2!"/"`]));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)},[`param0`,``,`P"2!"/"`])),this.env.used.env=new l.ReflectionClass({kind:l.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await r.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await r.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new l.ReflectionClass({kind:l.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await r.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},prepare:T(async function(){let e=this;this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);let t=await r.readEnvTypeReflection(this,`env`);return(0,g.render)(this,(0,p.createComponent)(s.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig},reflection:t}))},[`prepare`,`P"/!`]),transform:{order:`post`,handler:T(async function(){this.env.used.env.getProperties().length>0&&(this.trace(`Persisting used environment configuration reflections to ${r.getEnvReflectionsPath(this,`env`)}.`),await r.writeEnvReflection(this,this.env.used.env,`env`)),this.env.used.secrets.getProperties().length>0&&(this.trace(`Persisting used secret configuration reflections to ${r.getEnvReflectionsPath(this,`secrets`)}.`),await r.writeEnvReflection(this,this.env.used.secrets,`secrets`))},[`handler`,`P"/!`])},docs:T(async function(){this.debug(`Documenting environment variables configuration values in "${(0,m.joinPaths)((0,f.getDocsOutputPath)(this.config.root),`env.md`)}"`);let e=await r.readEnvTypeReflection(this,`env`);return(0,g.render)(this,(0,p.createComponent)(o.EnvDocsFile,{levelOffset:0,reflection:e}))},[`docs`,`P"/!`]),buildEnd:T(async function(){let e=r.getEnvReflectionsPath(this,`env`);this.debug(`Writing env reflection types to ${e}.`),await r.writeEnvReflection(this,this.env.used.env,`env`)},[`buildEnd`,`P"/!`])},{name:`env:automd-generator`,config:T(function(){return{automd:(0,u.default)(e.automd??{},{generators:{env:a.env(this)}})}},[`config`,`P"/!`])},{name:`env:vite`,vite:{configResolved:T(function(){return{envPrefix:this.config?.env?.prefix}},[()=>t.__ΩEnvPluginContext,`this`,`configResolved`,`Pn!2""/#`])}},(0,_.default)(e.automd)],[()=>t.__ΩEnvPluginOptions,`options`,()=>({}),``,`Pn!2">#"/$`]);exports.default=E,exports.plugin=E;
@@ -0,0 +1,17 @@
1
+ import { EnvInterface, SecretsInterface } from "./types/runtime.cjs";
2
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType } from "./types/plugin.cjs";
3
+ import { Plugin } from "powerlines";
4
+
5
+ //#region src/index.d.ts
6
+ declare module "powerlines" {
7
+ interface Config {
8
+ env?: EnvPluginOptions;
9
+ }
10
+ }
11
+ /**
12
+ * A Powerlines plugin to inject environment variables into the source code.
13
+ */
14
+ declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
15
+ //#endregion
16
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, plugin as default, plugin };
17
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAiEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA8WJ,MAAA,CAAO,QAAA"}
@@ -0,0 +1,17 @@
1
+ import { EnvInterface, SecretsInterface } from "./types/runtime.mjs";
2
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType } from "./types/plugin.mjs";
3
+ import { Plugin } from "powerlines";
4
+
5
+ //#region src/index.d.ts
6
+ declare module "powerlines" {
7
+ interface Config {
8
+ env?: EnvPluginOptions;
9
+ }
10
+ }
11
+ /**
12
+ * A Powerlines plugin to inject environment variables into the source code.
13
+ */
14
+ declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
15
+ //#endregion
16
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, plugin as default, plugin };
17
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAiEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA8WJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{__ΩEnvPluginContext as e,__ΩEnvPluginOptions as t}from"./types/plugin.mjs";import{reflectEnv as n,reflectSecrets as r}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as i,getEnvReflectionsPath as a,getEnvTypeReflectionsPath as o,getSecretsDefaultTypeDefinition as s,readEnvReflection as c,readEnvTypeReflection as l,readSecretsReflection as u,writeEnvReflection as d,writeEnvTypeReflection as f}from"./helpers/persistence.mjs";import{loadEnv as p}from"./helpers/load.mjs";import{env as m}from"./helpers/automd-generator.mjs";import{EnvDocsFile as h}from"./components/docs.mjs";import{EnvBuiltin as g}from"./components/env-builtin.mjs";import{envBabelPlugin as _}from"./babel/plugin.mjs";import{ReflectionClass as v,ReflectionKind as y}from"@powerlines/deepkit/vendor/type";import b from"defu";import{VIRTUAL_MODULE_PREFIX as x}from"powerlines/constants";import{getDocsOutputPath as S}from"powerlines/plugin-utils";import{createComponent as C}from"@alloy-js/core/jsx-runtime";import{joinPaths as w}from"@stryke/path/join";import{getUnique as T}from"@stryke/helpers/get-unique";import{render as E}from"@powerlines/plugin-alloy/render";import D from"@powerlines/plugin-automd";import O from"@powerlines/plugin-babel";import k from"@powerlines/plugin-deepkit";import{parseTypeDefinition as A}from"@stryke/convert/parse-type-definition";import{toArray as j}from"@stryke/convert/to-array";import{existsSync as M}from"@stryke/fs/exists";import{constantCase as N}from"@stryke/string-format/constant-case";import{isSetString as P}from"@stryke/type-checks/is-set-string";function F(e,t){return e.__type=t,e}const I=F((t={})=>[k(t.deepkit),O(t.babel),{name:`env:core`,async config(){this.debug("Providing default configuration for the Powerlines `env` build plugin.");let e={env:b(t,{types:{},validate:!1,inject:!1,prefix:[]}),babel:{plugins:[_]},deepkit:{reflection:`default`,level:`all`},tsc:{}};if(P(e.env.types)||e.env.types&&P(e.env.types.file)){e.env.types=A(e.env.types);let t=await this.fs.resolve(e.env.types.file);t&&(e.env.types.file=t)}else{this.warn("The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await i(this),n=await this.fs.resolve(t.file);n&&(e.env.types=A(`${n}#${t.name}`))}if(P(e.env.secrets)||e.env.secrets&&P(e.env.secrets.file)){e.env.secrets=A(e.env.secrets);let t=await this.fs.resolve(e.env.secrets.file);t&&(e.env.secrets.file=t)}else{let t=await s(this),n=await this.fs.resolve(t.file);n&&(e.env.secrets=A(`${n}#${t.name}`))}return(e.env.types||e.env.secrets)&&(e.tsc.filter={id:[RegExp(`^(${x})?${w(this.builtinsPath,`env.ts`).replace(/\\/g,`\\\\`).replace(/\//g,`\\/`).replace(/\./g,`\\.`).replace(/\$/g,`\\$`)}$`)]}),e.env.prefix=j(e.env.prefix??[]).reduce(F((e,t)=>{let n=N(t);return e.includes(n)||e.push(n),e},[`ret`,`prefix`,``,`P&F2!&2""/#`]),[`POWERLINES_`,this.config.framework&&this.config.framework!==`powerlines`&&`${N(this.config.framework)}_`].filter(Boolean)),e.env.prefix=T(j(e.env.prefix).reduce(F((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[`ret`,`prefix`,``,`P"2!"2""/#`]),[])),e},async configResolved(){if(this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`),this.env=b({parsed:await p(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&!this.config.skipCache&&this.persistedMeta?.checksum===this.meta.checksum&&M(o(this,`env`)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await l(this,`env`),M(a(this,`env`))&&(this.env.used.env=await c(this)),M(o(this,`secrets`))&&(this.env.types.secrets=await l(this,`secrets`)),M(a(this,`secrets`))&&(this.env.used.secrets=await u(this));else{if(this.debug(`Starting environment configuration reflection initialization.`),this.env.types.env=await n(this,this.config.env.types?.file,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await f(this,this.env.types.env,`env`),this.env.types.secrets=await r(this,this.config.env.secrets?.file,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await f(this,this.env.types.secrets,`secrets`),this.debug(`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let e=this.env.types.env.getProperties().filter(F(e=>e.getAlias().length>0,[`prop`,``,`P"2!"/"`]));Object.entries(await p(this,this.config.env)).forEach(F(([t,n])=>{let r=this.config.env.prefix.reduce(F((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,[`ret`,`prefix`,``,`P"2!"2""/#`]),t),i=e.find(F(e=>e?.getAlias().reverse().includes(r),[`prop`,``,`P"2!"/"`]));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)},[`param0`,``,`P"2!"/"`])),this.env.used.env=new v({kind:y.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await d(this,this.env.used.env,`env`),this.env.types.secrets&&(await f(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new v({kind:y.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await d(this,this.env.used.secrets,`secrets`))}},prepare:F(async function(){let e=this;this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);let t=await l(this,`env`);return E(this,C(g,{get defaultConfig(){return e.config.env.defaultConfig},reflection:t}))},[`prepare`,`P"/!`]),transform:{order:`post`,handler:F(async function(){this.env.used.env.getProperties().length>0&&(this.trace(`Persisting used environment configuration reflections to ${a(this,`env`)}.`),await d(this,this.env.used.env,`env`)),this.env.used.secrets.getProperties().length>0&&(this.trace(`Persisting used secret configuration reflections to ${a(this,`secrets`)}.`),await d(this,this.env.used.secrets,`secrets`))},[`handler`,`P"/!`])},docs:F(async function(){this.debug(`Documenting environment variables configuration values in "${w(S(this.config.root),`env.md`)}"`);let e=await l(this,`env`);return E(this,C(h,{levelOffset:0,reflection:e}))},[`docs`,`P"/!`]),buildEnd:F(async function(){let e=a(this,`env`);this.debug(`Writing env reflection types to ${e}.`),await d(this,this.env.used.env,`env`)},[`buildEnd`,`P"/!`])},{name:`env:automd-generator`,config:F(function(){return{automd:b(t.automd??{},{generators:{env:m(this)}})}},[`config`,`P"/!`])},{name:`env:vite`,vite:{configResolved:F(function(){return{envPrefix:this.config?.env?.prefix}},[()=>e,`this`,`configResolved`,`Pn!2""/#`])}},D(t.automd)],[()=>t,`options`,()=>({}),``,`Pn!2">#"/$`]);export{I as default,I as plugin};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { VIRTUAL_MODULE_PREFIX } from \"powerlines/constants\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n deepkit(options.deepkit),\n babel(options.babel),\n {\n name: \"env:core\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n isSetString(config.env.types) ||\n (config.env.types && isSetString(config.env.types.file))\n ) {\n config.env.types = parseTypeDefinition(\n config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(config.env.types.file);\n if (file) {\n config.env.types.file = file;\n }\n } else {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n const envDefaultTypeDefinition =\n await getEnvDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(envDefaultTypeDefinition.file);\n if (file) {\n config.env.types = parseTypeDefinition(\n `${file}#${envDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\n }\n\n if (\n isSetString(config.env.secrets) ||\n (config.env.secrets && isSetString(config.env.secrets.file))\n ) {\n config.env.secrets = parseTypeDefinition(config.env.secrets);\n\n const file = await this.fs.resolve(config.env.secrets!.file);\n if (file) {\n config.env.secrets!.file = file;\n }\n } else {\n const secretsDefaultTypeDefinition =\n await getSecretsDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(secretsDefaultTypeDefinition.file);\n if (file) {\n config.env.secrets = parseTypeDefinition(\n `${file}#${secretsDefaultTypeDefinition.name}`\n );\n }\n }\n\n if (config.env.types || config.env.secrets) {\n config.tsc.filter = {\n id: [\n new RegExp(\n `^(${VIRTUAL_MODULE_PREFIX})?${joinPaths(\n this.builtinsPath,\n \"env.ts\"\n )\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\//g, \"\\\\/\")\n .replace(/\\./g, \"\\\\.\")\n .replace(/\\$/g, \"\\\\$\")}$`\n )\n ]\n };\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework &&\n this.config.framework !== \"powerlines\" &&\n `${constantCase(this.config.framework)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.debug(\n `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n );\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"+iDAKA,SAAI,EAAc,EAAM,EAAQ,CAE/B,MADA,GAAI,OAAK,EACL,EA4CL,MAAE,EAAA,GAAyB,EAAA,EAAA,GACzB,CAAA,EAAA,EAAA,QAA+B,CAAA,EAAA,EAAA,MAAA,CAAA,CAC/B,KAAA,WACA,MAAA,QAAA,CACA,KAAA,MAAA,yEAAqB,CACrB,IAAA,EAAkB,CAClB,IAAA,EAAA,EAAA,CACQ,MAAO,EAAC,CACT,SAAW,GACX,OAAA,aAEF,CAAA,QAEC,QAAQ,CAAA,EAAY,CAC1B,CACM,QAAE,CACR,WAAA,UACF,MAAA,OAEE,IAAA,EAAA,CACG,CACH,GAAA,EAAA,EAAA,IAAA,MAAA,EAAA,EAAA,IAAA,OAAA,EAAA,EAAA,IAAA,MAAA,KAAA,CAAA,CACK,EAAM,IAAM,MAAI,EAAiB,EAAA,IAAkB,MAAC,CACzD,IAAS,EAAA,MAAgB,KAAI,GAAA,QAAA,EAAA,IAAA,MAAA,KAAA,CAC1B,IACI,EAAA,IAAA,MAAA,KAAA,OAEC,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AEJ,CAAE,CACD,KAAM,WACN,KAAM,CACJ,eAAgB,EAAA,UAAA,CACd,MAAK,CACH,UAAA,KAAA,QAAA,KAAA,OAAA,EAED,KAAK,EAAW,OAAA,iBAAsC,WAAG,CAAA,CAC7D,CACF,CAAE,EAAK,EAAA,OAAA,CAAA,CACP,KAAO,EAAK,eAAA,EAAA,EAAA,GAAA,aAAA,CAAA"}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./runtime.cjs`),t=require(`./plugin.cjs`);exports.__ΩEnvInterface=e.__ΩEnvInterface,exports.__ΩEnvPluginContext=t.__ΩEnvPluginContext,exports.__ΩEnvPluginOptions=t.__ΩEnvPluginOptions,exports.__ΩEnvPluginResolvedConfig=t.__ΩEnvPluginResolvedConfig,exports.__ΩEnvPluginUserConfig=t.__ΩEnvPluginUserConfig,exports.__ΩEnvType=t.__ΩEnvType,exports.__ΩSecretsInterface=e.__ΩSecretsInterface;
@@ -0,0 +1,3 @@
1
+ import { EnvInterface, SecretsInterface } from "./runtime.cjs";
2
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType } from "./plugin.cjs";
3
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface };
@@ -0,0 +1,3 @@
1
+ import { EnvInterface, SecretsInterface } from "./runtime.mjs";
2
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType } from "./plugin.mjs";
3
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface };
@@ -0,0 +1 @@
1
+ import{__ΩEnvInterface as e,__ΩSecretsInterface as t}from"./runtime.mjs";import{__ΩEnvPluginContext as n,__ΩEnvPluginOptions as r,__ΩEnvPluginResolvedConfig as i,__ΩEnvPluginUserConfig as a,__ΩEnvType as o}from"./plugin.mjs";export{e as __ΩEnvInterface,n as __ΩEnvPluginContext,r as __ΩEnvPluginOptions,i as __ΩEnvPluginResolvedConfig,a as __ΩEnvPluginUserConfig,o as __ΩEnvType,t as __ΩSecretsInterface};
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=[`T`,`K`,()=>n,()=>r,`Omit`,`b!b"e!!e!!ge!"o$#o##w%y`],t=[`T`,`Required`,`l+e#!e"!fRb!Pde"!gN##w"y`],n=[`T`,`K`,`Pick`,`l+e#!e"!fRb!b"Pde""N#!w#y`],r=[`T`,`U`,`Exclude`,`l6!Re$!RPe#!e$"qk#%QRb!b"Pde"!p)w#y`],i=[`env`,`secrets`,`EnvType`,`P.!."Jw#y`],a=[()=>e,`types`,`types`,'A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigConfiguration"`.',`secrets`,'A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigSecrets"`.',`prefix`,`An additional prefix (or list of additional prefixes) to apply to the environment variables`,`inject`,!0,`Should the plugin inject the env variables in the source code with their values?`,`validate`,`Should the plugin validate the loaded environment variables against the provided type definitions?`,`Children`,`defaultConfig`,`The default configuration to use when loading environment variables.`,`babel`,`Babel configuration options to use when injecting environment variables into the source code.`,`automd`,`AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.`,`deepkit`,`Alloy configuration options to use when injecting environment variables into the source code.`,`EnvPluginOptions`,`P!."o!#P!4#8?$!4%8?&P&&FJ4'8?()4)8>*?+)4,8>*?-"w.4/8?0!418?2!438?4!458?6MKw7y`],o=[()=>a,`env`,`EnvPluginUserConfig`,`P!!Pn!4"MKw#y`],s=[()=>t,()=>n,`additionalFiles`,()=>t,()=>n,()=>a,`defaultConfig`,`types`,`The type definition for the expected env variable parameters`,`secrets`,`The type definition for the expected env secret parameters`,`inject`,`Should the plugin inject the env variables in the source code with their values?`,`validate`,`Should the plugin validate the loaded environment variables against the provided type definitions?`,`prefix`,`The prefix used for environment variables`,`env`,`EnvPluginResolvedConfig`,`P!!PP!.#o"#o!"n&.'o%#o$"P!4(?)!4*?+)4,?-)4.?/&F40?1MK42MKw3y`],c=[()=>s,`TResolvedConfig`,`env`,`The type definitions for the expected env variables`,`secrets`,`The type definitions for the expected env secrets`,`The type definitions reflection for the env variables and secrets`,`types`,`The current env variables reflection`,`The current env secrets reflection`,`The current **used** environment variables and secrets reflection`,`used`,`parsed`,`The parsed .env configuration object`,`injected`,`The injected environment variables and secrets reflection`,`EnvPluginContext`,`n!c"P!!PP!4#?$!4%?&M?'4(?'P!4#?)!4%?*M?+4,?+!4-?.!4/?0M4#Mw1y`];exports.__ΩEnvPluginContext=c,exports.__ΩEnvPluginOptions=a,exports.__ΩEnvPluginResolvedConfig=s,exports.__ΩEnvPluginUserConfig=o,exports.__ΩEnvType=i;