@powerlines/plugin-react 0.1.57 → 0.1.59

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 (189) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +1 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +1 -0
  3. package/dist/alloy/src/core/components/output.cjs +1 -0
  4. package/dist/alloy/src/core/components/output.mjs +1 -0
  5. package/dist/alloy/src/core/components/single-line-comment.cjs +1 -0
  6. package/dist/alloy/src/core/components/single-line-comment.mjs +1 -0
  7. package/dist/alloy/src/core/components/source-file.cjs +1 -0
  8. package/dist/alloy/src/core/components/source-file.d.cts +22 -0
  9. package/dist/alloy/src/core/components/source-file.d.mts +22 -0
  10. package/dist/alloy/src/core/components/source-file.mjs +1 -0
  11. package/dist/alloy/src/core/contexts/context.cjs +1 -0
  12. package/dist/alloy/src/core/contexts/context.mjs +1 -0
  13. package/dist/alloy/src/core/contexts/reflection.cjs +1 -0
  14. package/dist/alloy/src/core/contexts/reflection.mjs +1 -0
  15. package/dist/alloy/src/create-plugin.cjs +2 -0
  16. package/dist/alloy/src/create-plugin.mjs +2 -0
  17. package/dist/alloy/src/helpers/refkey.cjs +1 -0
  18. package/dist/alloy/src/helpers/refkey.mjs +1 -0
  19. package/dist/alloy/src/markdown/components/markdown-file.cjs +1 -0
  20. package/dist/alloy/src/markdown/components/markdown-file.mjs +1 -0
  21. package/dist/alloy/src/markdown/components/markdown-table.cjs +1 -0
  22. package/dist/alloy/src/markdown/components/markdown-table.mjs +1 -0
  23. package/dist/alloy/src/markdown/contexts/markdown-table.cjs +1 -0
  24. package/dist/alloy/src/markdown/contexts/markdown-table.mjs +1 -0
  25. package/dist/alloy/src/types/components.d.cts +19 -0
  26. package/dist/alloy/src/types/components.d.mts +23 -0
  27. package/dist/alloy/src/types/plugin.d.cts +15 -0
  28. package/dist/alloy/src/types/plugin.d.mts +15 -0
  29. package/dist/alloy/src/typescript/components/builtin-file.cjs +1 -0
  30. package/dist/alloy/src/typescript/components/builtin-file.d.cts +25 -0
  31. package/dist/alloy/src/typescript/components/builtin-file.d.mts +26 -0
  32. package/dist/alloy/src/typescript/components/builtin-file.mjs +1 -0
  33. package/dist/alloy/src/typescript/components/tsdoc-reflection.cjs +1 -0
  34. package/dist/alloy/src/typescript/components/tsdoc-reflection.mjs +1 -0
  35. package/dist/alloy/src/typescript/components/tsdoc.cjs +1 -0
  36. package/dist/alloy/src/typescript/components/tsdoc.d.cts +27 -0
  37. package/dist/alloy/src/typescript/components/tsdoc.d.mts +28 -0
  38. package/dist/alloy/src/typescript/components/tsdoc.mjs +1 -0
  39. package/dist/alloy/src/typescript/components/typescript-file.cjs +1 -0
  40. package/dist/alloy/src/typescript/components/typescript-file.d.cts +13 -0
  41. package/dist/alloy/src/typescript/components/typescript-file.d.mts +14 -0
  42. package/dist/alloy/src/typescript/components/typescript-file.mjs +1 -0
  43. package/dist/alloy/src/typescript/components/typescript-interface.cjs +1 -0
  44. package/dist/alloy/src/typescript/components/typescript-interface.mjs +1 -0
  45. package/dist/alloy/src/typescript/components/typescript-object.cjs +1 -0
  46. package/dist/alloy/src/typescript/components/typescript-object.mjs +1 -0
  47. package/dist/components/index.cjs +1 -0
  48. package/dist/components/index.d.cts +2 -0
  49. package/dist/components/index.d.mts +2 -0
  50. package/dist/components/index.mjs +1 -0
  51. package/dist/components/react-optimized.cjs +1 -0
  52. package/dist/components/react-optimized.d.cts +14 -0
  53. package/dist/components/react-optimized.d.mts +14 -0
  54. package/dist/components/react-optimized.mjs +1 -0
  55. package/dist/deepkit/schemas/reflection.cjs +1 -0
  56. package/dist/{plugin-C-758lCD.d.cts → deepkit/schemas/reflection.d.cts} +1 -220
  57. package/dist/{plugin-CcHgBwvB.d.mts → deepkit/schemas/reflection.d.mts} +1 -220
  58. package/dist/deepkit/schemas/reflection.mjs +1 -0
  59. package/dist/deepkit/schemas/reflection2.cjs +1 -0
  60. package/dist/deepkit/schemas/reflection2.mjs +1 -0
  61. package/dist/deepkit/src/capnp.cjs +1 -0
  62. package/dist/deepkit/src/capnp.mjs +1 -0
  63. package/dist/deepkit/src/reflect-type.cjs +1 -0
  64. package/dist/deepkit/src/reflect-type.mjs +1 -0
  65. package/dist/deepkit/src/resolve-reflections.cjs +1 -0
  66. package/dist/deepkit/src/resolve-reflections.mjs +1 -0
  67. package/dist/deepkit/src/types.d.cts +10 -0
  68. package/dist/deepkit/src/types.d.mts +10 -0
  69. package/dist/deepkit/src/utilities.cjs +1 -0
  70. package/dist/deepkit/src/utilities.mjs +1 -0
  71. package/dist/deepkit/src/vendor/type.cjs +1 -0
  72. package/dist/deepkit/src/vendor/type.d.cts +7 -0
  73. package/dist/deepkit/src/vendor/type.d.mts +7 -0
  74. package/dist/deepkit/src/vendor/type.mjs +1 -0
  75. package/dist/index.cjs +1 -1
  76. package/dist/index.d.cts +13 -4
  77. package/dist/index.d.mts +16 -4
  78. package/dist/index.mjs +1 -1
  79. package/dist/plugin-babel/src/helpers/ast-utils.cjs +1 -0
  80. package/dist/plugin-babel/src/helpers/ast-utils.mjs +1 -0
  81. package/dist/plugin-babel/src/helpers/create-plugin.cjs +1 -0
  82. package/dist/plugin-babel/src/helpers/create-plugin.mjs +1 -0
  83. package/dist/plugin-babel/src/helpers/filters.cjs +1 -0
  84. package/dist/plugin-babel/src/helpers/filters.mjs +1 -0
  85. package/dist/plugin-babel/src/helpers/index.cjs +1 -0
  86. package/dist/plugin-babel/src/helpers/index.mjs +1 -0
  87. package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -0
  88. package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -0
  89. package/dist/plugin-babel/src/helpers/options.cjs +1 -0
  90. package/dist/plugin-babel/src/helpers/options.mjs +1 -0
  91. package/dist/plugin-babel/src/index.cjs +1 -0
  92. package/dist/plugin-babel/src/index.mjs +1 -0
  93. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  94. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  95. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  96. package/dist/plugin-env/src/babel/index.cjs +1 -0
  97. package/dist/plugin-env/src/babel/index.mjs +1 -0
  98. package/dist/plugin-env/src/babel/plugin.cjs +5 -0
  99. package/dist/plugin-env/src/babel/plugin.mjs +5 -0
  100. package/dist/plugin-env/src/components/docs.cjs +1 -0
  101. package/dist/plugin-env/src/components/docs.mjs +1 -0
  102. package/dist/plugin-env/src/components/env.cjs +34 -0
  103. package/dist/plugin-env/src/components/env.mjs +31 -0
  104. package/dist/plugin-env/src/components/index.cjs +1 -0
  105. package/dist/plugin-env/src/components/index.mjs +1 -0
  106. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +1 -0
  107. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +1 -0
  108. package/dist/plugin-env/src/helpers/index.cjs +1 -0
  109. package/dist/plugin-env/src/helpers/index.mjs +1 -0
  110. package/dist/plugin-env/src/helpers/load.cjs +1 -0
  111. package/dist/plugin-env/src/helpers/load.mjs +1 -0
  112. package/dist/plugin-env/src/helpers/persistence.cjs +1 -0
  113. package/dist/plugin-env/src/helpers/persistence.mjs +1 -0
  114. package/dist/plugin-env/src/helpers/reflect.cjs +1 -0
  115. package/dist/plugin-env/src/helpers/reflect.mjs +1 -0
  116. package/dist/plugin-env/src/helpers/source-file-env.cjs +1 -0
  117. package/dist/plugin-env/src/helpers/source-file-env.mjs +1 -0
  118. package/dist/plugin-env/src/helpers/template-helpers.cjs +1 -0
  119. package/dist/plugin-env/src/helpers/template-helpers.mjs +1 -0
  120. package/dist/plugin-env/src/index.cjs +16 -0
  121. package/dist/plugin-env/src/index.mjs +16 -0
  122. package/dist/plugin-env/src/types/plugin.d.cts +135 -0
  123. package/dist/plugin-env/src/types/plugin.d.mts +136 -0
  124. package/dist/plugin-env/src/types/runtime.d.cts +792 -0
  125. package/dist/plugin-env/src/types/runtime.d.mts +792 -0
  126. package/dist/plugin-plugin/src/types/plugin.d.cts +21 -0
  127. package/dist/plugin-plugin/src/types/plugin.d.mts +23 -0
  128. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  129. package/dist/powerlines/src/lib/build/esbuild.cjs +14 -0
  130. package/dist/powerlines/src/lib/build/esbuild.mjs +14 -0
  131. package/dist/powerlines/src/lib/entry.cjs +1 -0
  132. package/dist/powerlines/src/lib/entry.mjs +1 -0
  133. package/dist/powerlines/src/lib/logger.cjs +1 -0
  134. package/dist/powerlines/src/lib/logger.mjs +1 -0
  135. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +1 -0
  136. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +1 -0
  137. package/dist/powerlines/src/lib/utilities/bundle.cjs +1 -0
  138. package/dist/powerlines/src/lib/utilities/bundle.mjs +1 -0
  139. package/dist/powerlines/src/lib/utilities/resolve.cjs +1 -0
  140. package/dist/powerlines/src/lib/utilities/resolve.mjs +1 -0
  141. package/dist/powerlines/src/plugin-utils/helpers.cjs +1 -0
  142. package/dist/powerlines/src/plugin-utils/helpers.mjs +1 -0
  143. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  144. package/dist/powerlines/src/plugin-utils/paths.mjs +1 -0
  145. package/dist/powerlines/src/types/api.d.mts +5 -0
  146. package/dist/powerlines/src/types/babel.d.cts +22 -0
  147. package/dist/powerlines/src/types/babel.d.mts +22 -0
  148. package/dist/powerlines/src/types/build.d.cts +139 -0
  149. package/dist/powerlines/src/types/build.d.mts +139 -0
  150. package/dist/powerlines/src/types/commands.d.cts +8 -0
  151. package/dist/powerlines/src/types/commands.d.mts +9 -0
  152. package/dist/powerlines/src/types/config.d.cts +356 -0
  153. package/dist/powerlines/src/types/config.d.mts +357 -0
  154. package/dist/powerlines/src/types/context.d.cts +358 -0
  155. package/dist/powerlines/src/types/context.d.mts +360 -0
  156. package/dist/powerlines/src/types/fs.d.cts +458 -0
  157. package/dist/powerlines/src/types/fs.d.mts +458 -0
  158. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  159. package/dist/powerlines/src/types/index.d.mts +12 -0
  160. package/dist/powerlines/src/types/plugin.d.cts +232 -0
  161. package/dist/powerlines/src/types/plugin.d.mts +232 -0
  162. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  163. package/dist/powerlines/src/types/resolved.d.mts +82 -0
  164. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  165. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  166. package/dist/powerlines/src/types/unplugin.d.mts +6 -0
  167. package/dist/types/index.d.cts +3 -0
  168. package/dist/types/index.d.mts +3 -0
  169. package/dist/types/plugin.d.cts +73 -0
  170. package/dist/types/plugin.d.mts +73 -0
  171. package/dist/types/runtime.cjs +0 -0
  172. package/dist/{runtime-BS7oiady.d.cts → types/runtime.d.cts} +2 -2
  173. package/dist/{runtime-CDlALydB.d.mts → types/runtime.d.mts} +2 -2
  174. package/dist/types/runtime.mjs +1 -0
  175. package/package.json +14 -70
  176. package/dist/plugin.cjs +0 -1
  177. package/dist/plugin.d.cts +0 -3
  178. package/dist/plugin.d.mts +0 -3
  179. package/dist/plugin.mjs +0 -1
  180. package/dist/runtime-D8UA7rmk.d.mts +0 -2466
  181. package/dist/runtime-DgmUQXCw.d.cts +0 -2466
  182. package/dist/runtime.cjs +0 -1
  183. package/dist/runtime.d.cts +0 -3
  184. package/dist/runtime.d.mts +0 -3
  185. package/dist/runtime.mjs +0 -1
  186. /package/dist/{plugin-DHXHjv16.cjs → types/index.cjs} +0 -0
  187. /package/dist/{plugin-DzeYlbKJ.mjs → types/index.mjs} +0 -0
  188. /package/dist/{runtime-D4zTdSwv.cjs → types/plugin.cjs} +0 -0
  189. /package/dist/{runtime-2grn5p5x.mjs → types/plugin.mjs} +0 -0
@@ -0,0 +1 @@
1
+ import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{convertFromCapnp as t,convertToCapnp as n}from"../../../deepkit/src/capnp.mjs";import{SerializedTypes as r}from"../../../deepkit/schemas/reflection2.mjs";import{getReflectionsPath as i}from"../../../deepkit/src/resolve-reflections.mjs";import{createEnvReflection as a}from"./reflect.mjs";import*as o from"@stryke/capnp";import{readFileBuffer as s,writeFileBuffer as c}from"@stryke/fs/buffer";import{existsSync as l}from"node:fs";import{joinPaths as u}from"@stryke/path/join-paths";import{resolvePackage as d}from"@stryke/fs/resolve";import{isEmptyObject as f}from"@stryke/type-checks/is-empty-object";async function p(e){return d(`@powerlines/plugin-env/types/runtime`,{paths:[e.workspaceConfig.workspaceRoot,u(e.workspaceConfig.workspaceRoot,e.config.projectRoot)]})}async function m(e){return{file:await p(e),name:`EnvInterface`}}async function h(e){return{file:await p(e),name:`SecretsInterface`}}function g(e,t=`env`){return u(i(e),`env`,`${t}-types.bin`)}async function _(n,i=`env`){let c=g(n,i);if(!l(c)){if(!n.env.types.env||f(n.env.types.env)){let e=a(n),t=new o.Message;e.messageRoot=t.initRoot(r),e.dataBuffer=t.toArrayBuffer(),n.env.types.env=e,await v(n,n.env.types.env,i)}return n.env.types.env}let u=await s(c),d=new o.Message(u,!1).getRoot(r),p=(0,e.resolveClassType)((0,e.deserializeType)(t(d.types)));return n.env.types[i]=p,n.env.types[i].messageRoot=d,n.env.types[i].dataBuffer=u,p}async function v(e,t,i=`env`){let a=t.serializeType(),s=new o.Message;n(a,s.initRoot(r)._initTypes(a.length)),await c(g(e,i),s.toArrayBuffer())}function y(e,t){return u(i(e),`env`,`${t}.bin`)}async function b(n){let i=y(n,`env`);if(!l(i)){if(n.env.types.env||(n.env.types.env=await _(n,`env`)),!n.env.used.env||f(n.env.used.env)){let t=a(n,{type:{kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${n.config.name?`${n.config.name} application`:`application`}.`,types:[]},superReflection:n.env.types.env});t.name=`Env`;let i=new o.Message;t.messageRoot=i.initRoot(r),t.dataBuffer=i.toArrayBuffer(),n.env.used.env=t,await S(n,n.env.used.env,`env`)}return n.env.used.env}let c=await s(i),u=new o.Message(c,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(u.types)));return n.env.used.env=d,n.env.used.env.messageRoot=u,n.env.used.env.dataBuffer=c,d}async function x(n){let i=y(n,`secrets`);if(!l(i)){if(n.env.types.secrets||(n.env.types.secrets=await _(n,`secrets`)),!n.env.used.secrets||f(n.env.used.secrets)){let t=a(n,{type:{kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${n.config.name?`${n.config.name} application`:`application`}.`,types:[]},superReflection:n.env.types.secrets});t.name=`Secrets`;let i=new o.Message;t.messageRoot=i.initRoot(r),t.dataBuffer=i.toArrayBuffer(),n.env.used.secrets=t,await S(n,n.env.used.secrets,`secrets`)}return n.env.used.secrets}let c=await s(i),u=new o.Message(c,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(u.types)));return n.env.used.secrets=d,n.env.used.secrets.messageRoot=u,n.env.used.secrets.dataBuffer=c,d}async function S(e,t,i=`env`){let a=t.serializeType(),s=new o.Message;n(a,s.initRoot(r)._initTypes(a.length)),await c(y(e,i),s.toArrayBuffer())}export{m as getEnvDefaultTypeDefinition,y as getEnvReflectionsPath,g as getEnvTypeReflectionsPath,h as getSecretsDefaultTypeDefinition,b as readEnvReflection,_ as readEnvTypeReflection,x as readSecretsReflection,p as resolveRuntimeTypeFile,S as writeEnvReflection,v as writeEnvTypeReflection};
@@ -0,0 +1 @@
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../deepkit/src/vendor/type.cjs`),n=require(`../../../deepkit/src/reflect-type.cjs`),r=require(`./persistence.cjs`);let i=require(`@stryke/path/is-parent-path`),a=require(`@stryke/string-format/title-case`),o=require(`@stryke/path/join-paths`);function s(e,n){return d(e,{type:(0,t.type_exports.merge)(n.map(e=>e.type))})}function c(e,n){return f(e,{type:(0,t.type_exports.merge)(n.map(e=>e.type))})}var l=class{PLATFORM=`neutral`;MODE=`production`;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;CI=!1},u=class{};function d(e,n={}){let r=n.superReflection??new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.class,description:`The base environment configuration definition for the ${(0,a.titleCase)(e.config.name)} project.`,classType:l,types:[],implements:[{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${(0,a.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${(0,a.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function f(e,n={}){let r=n.superReflection??new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.class,description:`The base secrets configuration definition for the ${(0,a.titleCase)(e.config.name)} project.`,classType:u,types:[],implements:[{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${(0,a.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${(0,a.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function p(e,a,c){let l;a&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(a,e.workspaceConfig.workspaceRoot)?a:(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,a),name:c},{skipNodeModulesBundle:!0})));let u=await n.reflectType(e,await r.getEnvDefaultTypeDefinition(e));return s(e,[await r.readEnvTypeReflection(e,`env`),l,(0,t.type_exports.resolveClassType)(u)].filter(Boolean))}async function m(e,a,s){let l;a&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(a,e.workspaceConfig.workspaceRoot)?a:(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,a),name:s},{skipNodeModulesBundle:!0})));let u=await n.reflectType(e,await r.getSecretsDefaultTypeDefinition(e));return c(e,[await r.readSecretsReflection(e),l,(0,t.type_exports.resolveClassType)(u)].filter(Boolean))}exports.BaseEnv=l,exports.BaseSecrets=u,exports.createEnvReflection=d,exports.createSecretsReflection=f,exports.mergeEnvReflections=s,exports.mergeSecretsReflections=c,exports.reflectEnv=p,exports.reflectSecrets=m;
@@ -0,0 +1 @@
1
+ import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{reflectType as t}from"../../../deepkit/src/reflect-type.mjs";import{getEnvDefaultTypeDefinition as n,getSecretsDefaultTypeDefinition as r,readEnvTypeReflection as i,readSecretsReflection as a}from"./persistence.mjs";import{isParentPath as o}from"@stryke/path/is-parent-path";import{titleCase as s}from"@stryke/string-format/title-case";import{joinPaths as c}from"@stryke/path/join-paths";function l(t,n){return p(t,{type:(0,e.merge)(n.map(e=>e.type))})}function u(t,n){return m(t,{type:(0,e.merge)(n.map(e=>e.type))})}var d=class{PLATFORM=`neutral`;MODE=`production`;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;CI=!1},f=class{};function p(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base environment configuration definition for the ${s(t.config.name)} project.`,classType:d,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${s(t.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${t.config.name?`${s(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function m(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base secrets configuration definition for the ${s(t.config.name)} project.`,classType:f,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${s(t.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${t.config.name?`${s(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function h(r,a,s){let u;a&&(u=(0,e.resolveClassType)(await t(r,{file:o(a,r.workspaceConfig.workspaceRoot)?a:c(r.workspaceConfig.workspaceRoot,a),name:s},{skipNodeModulesBundle:!0})));let d=await t(r,await n(r));return l(r,[await i(r,`env`),u,(0,e.resolveClassType)(d)].filter(Boolean))}async function g(n,i,s){let l;i&&(l=(0,e.resolveClassType)(await t(n,{file:o(i,n.workspaceConfig.workspaceRoot)?i:c(n.workspaceConfig.workspaceRoot,i),name:s},{skipNodeModulesBundle:!0})));let d=await t(n,await r(n));return u(n,[await a(n),l,(0,e.resolveClassType)(d)].filter(Boolean))}export{d as BaseEnv,f as BaseSecrets,p as createEnvReflection,m as createSecretsReflection,l as mergeEnvReflections,u as mergeSecretsReflections,h as reflectEnv,g as reflectSecrets};
@@ -0,0 +1 @@
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/env/types`),r=require(`@stryke/string-format/camel-case`);function i(e){if((0,t.isString)(e)){let t=n.ENV_PREFIXES.reduce((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),e.toUpperCase());for(;t.startsWith(`_`);)t=t.slice(1);return t}return Object.keys(e).reduce((t,n)=>{let r=i(n);return r&&(t[r]=e[n]),t},{})}exports.removeEnvPrefix=i;
@@ -0,0 +1 @@
1
+ import{isString as e}from"@stryke/type-checks/is-string";import{ENV_PREFIXES as t}from"@stryke/env/types";import{camelCase as n}from"@stryke/string-format/camel-case";function r(n){if(e(n)){let e=t.reduce((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),n.toUpperCase());for(;e.startsWith(`_`);)e=e.slice(1);return e}return Object.keys(n).reduce((e,t)=>{let i=r(t);return i&&(e[i]=n[t]),e},{})}export{r as removeEnvPrefix};
@@ -0,0 +1 @@
1
+ require(`./persistence.cjs`);let e=require(`@stryke/string-format/title-case`);
@@ -0,0 +1 @@
1
+ import"./persistence.mjs";import{titleCase as e}from"@stryke/string-format/title-case";export{};
@@ -0,0 +1,16 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../alloy/src/create-plugin.cjs`),n=require(`../../deepkit/src/vendor/type.cjs`),r=require(`../../plugin-babel/src/index.cjs`),i=require(`./helpers/reflect.cjs`),a=require(`./helpers/persistence.cjs`),o=require(`./babel/plugin.cjs`),s=require(`./helpers/source-file-env.cjs`),c=require(`./helpers/load.cjs`),l=require(`./helpers/create-reflection-resource.cjs`),u=require(`./components/env.cjs`);require(`./babel/index.cjs`),require(`./components/index.cjs`),require(`./helpers/index.cjs`);let d=require(`@alloy-js/core/jsx-runtime`),f=require(`@storm-software/config-tools/types`),p=require(`@stryke/path/is-parent-path`),m=require(`defu`);m=e.__toESM(m);let h=require(`@stryke/convert/parse-type-definition`),g=require(`@stryke/convert/to-array`),_=require(`@stryke/env/types`),v=require(`@stryke/fs/exists`),y=require(`@stryke/fs/helpers`),b=require(`@stryke/path/join`),x=require(`@stryke/string-format/constant-case`);const S=t.createAlloyPlugin((e={})=>({name:`env`,dependsOn:[r.default(e.babel)],async config(){this.log(f.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,m.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[o.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,h.parseTypeDefinition)(t.env.types);else{this.log(f.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await a.getEnvDefaultTypeDefinition(this);t.env.types=(0,h.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,h.parseTypeDefinition)(t.env.secrets);else{let e=await a.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,h.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,g.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,x.constantCase)(t);return e.includes(n)||e.push(n),e},[..._.ENV_PREFIXES,`POWERLINES_`]),t.env.prefix=t.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),t},async configResolved(){if(this.log(f.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,m.default)({parsed:await c.loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&(0,v.existsSync)(a.getEnvTypeReflectionsPath(this,`env`)))this.log(f.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await a.readEnvTypeReflection(this,`env`),(0,v.existsSync)(a.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await a.readEnvReflection(this)),(0,v.existsSync)(a.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await a.readEnvTypeReflection(this,`secrets`)),(0,v.existsSync)(a.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await a.readSecretsReflection(this));else{if(this.env.types.env=await i.reflectEnv(this,this.config.env.types?.file?(0,p.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,b.joinPaths)(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await a.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await i.reflectSecrets(this,this.config.env.secrets?.file?(0,p.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,b.joinPaths)(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await a.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.log(f.LogLevelLabel.TRACE,`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(e=>e.getAlias().length>0);Object.entries(await c.loadEnv(this,this.config.env)).forEach(([t,n])=>{let r=this.config.env.prefix.reduce((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,t),i=e.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)}),this.env.used.env=new n.type_exports.ReflectionClass({kind:n.type_exports.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 a.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await a.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new n.type_exports.ReflectionClass({kind:n.type_exports.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 a.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},render(){let e=this;return this.log(f.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),(0,d.createComponent)(u.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(f.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=(0,b.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,v.existsSync)(e)||await(0,y.createDirectory)(e);let t=await a.readEnvTypeReflection(this,`env`),r=(0,b.joinPaths)(e,`env.md`);this.log(f.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by Powerlines -->
2
+
3
+ # Environment variables configuration
4
+
5
+ Below is a list of environment variables used by the [${this.packageJson.name}](https://www.npmjs.com/package/${this.packageJson.name}) package. These values can be updated in the \`.env\` file in the root of the project.
6
+
7
+ ## Environment Configuration
8
+
9
+ The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.
10
+
11
+ | Name | Description | Type | Default Value | Required |
12
+ | ---- | ----------- | ---- | ------------- | :------: |
13
+ ${t.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>`| ${e.getNameAsString().trim()} | ${(e.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
14
+ `,``)??``).trim()} | ${(0,n.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `)} | ${e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``} | ${e.isValueRequired()?``:`✔`} |`).join(`
15
+ `)}
16
+ `)},async buildEnd(){let e=a.getEnvReflectionsPath(this,`env`);this.log(f.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await a.writeEnvReflection(this,this.env.used.env,`env`)}}));var C=S;exports.default=C;
@@ -0,0 +1,16 @@
1
+ import{createAlloyPlugin as e}from"../../alloy/src/create-plugin.mjs";import{type_exports as t}from"../../deepkit/src/vendor/type.mjs";import n from"../../plugin-babel/src/index.mjs";import{BaseEnv as r,BaseSecrets as i,createEnvReflection as a,createSecretsReflection as o,mergeEnvReflections as s,mergeSecretsReflections as c,reflectEnv as l,reflectSecrets as u}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as d,getEnvReflectionsPath as f,getEnvTypeReflectionsPath as p,getSecretsDefaultTypeDefinition as m,readEnvReflection as h,readEnvTypeReflection as g,readSecretsReflection as _,resolveRuntimeTypeFile as v,writeEnvReflection as y,writeEnvTypeReflection as b}from"./helpers/persistence.mjs";import{envBabelPlugin as x}from"./babel/plugin.mjs";import{removeEnvPrefix as S}from"./helpers/source-file-env.mjs";import{loadEnv as C,loadEnvFromContext as w}from"./helpers/load.mjs";import{createReflectionResource as T}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as E,EnvTypeDefinition as D}from"./components/env.mjs";import"./babel/index.mjs";import"./components/index.mjs";import"./helpers/index.mjs";import{createComponent as O}from"@alloy-js/core/jsx-runtime";import{LogLevelLabel as k}from"@storm-software/config-tools/types";import{isParentPath as A}from"@stryke/path/is-parent-path";import j from"defu";import{parseTypeDefinition as M}from"@stryke/convert/parse-type-definition";import{toArray as N}from"@stryke/convert/to-array";import{ENV_PREFIXES as P}from"@stryke/env/types";import{existsSync as F}from"@stryke/fs/exists";import{createDirectory as I}from"@stryke/fs/helpers";import{joinPaths as L}from"@stryke/path/join";import{constantCase as R}from"@stryke/string-format/constant-case";var z=e((e={})=>({name:`env`,dependsOn:[n(e.babel)],async config(){this.log(k.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:j(e,{types:{},prefix:[]}),transform:{babel:{plugins:[x]}}};if(t.env.types)t.env.types=M(t.env.types);else{this.log(k.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await d(this);t.env.types=M(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=M(t.env.secrets);else{let e=await m(this);t.env.secrets=M(`${e.file}#${e.name}`)}return t.env.prefix=N(t.env.prefix??[]).reduce((e,t)=>{let n=R(t);return e.includes(n)||e.push(n),e},[...P,`POWERLINES_`]),t.env.prefix=t.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),t},async configResolved(){if(this.log(k.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=j({parsed:await C(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&F(p(this,`env`)))this.log(k.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await g(this,`env`),F(f(this,`env`))&&(this.env.used.env=await h(this)),F(p(this,`secrets`))&&(this.env.types.secrets=await g(this,`secrets`)),F(f(this,`secrets`))&&(this.env.used.secrets=await _(this));else{if(this.env.types.env=await l(this,this.config.env.types?.file?A(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:L(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await b(this,this.env.types.env,`env`),this.env.types.secrets=await u(this,this.config.env.secrets?.file?A(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:L(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await b(this,this.env.types.secrets,`secrets`),this.log(k.TRACE,`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(e=>e.getAlias().length>0);Object.entries(await C(this,this.config.env)).forEach(([t,n])=>{let r=this.config.env.prefix.reduce((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,t),i=e.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)}),this.env.used.env=new t.ReflectionClass({kind:t.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 y(this,this.env.used.env,`env`),this.env.types.secrets&&(await b(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.ReflectionClass({kind:t.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 y(this,this.env.used.secrets,`secrets`))}},render(){let e=this;return this.log(k.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),O(E,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(k.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=L(this.config.projectRoot,`docs`,`generated`);F(e)||await I(e);let n=await g(this,`env`),r=L(e,`env.md`);this.log(k.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by Powerlines -->
2
+
3
+ # Environment variables configuration
4
+
5
+ Below is a list of environment variables used by the [${this.packageJson.name}](https://www.npmjs.com/package/${this.packageJson.name}) package. These values can be updated in the \`.env\` file in the root of the project.
6
+
7
+ ## Environment Configuration
8
+
9
+ The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.
10
+
11
+ | Name | Description | Type | Default Value | Required |
12
+ | ---- | ----------- | ---- | ------------- | :------: |
13
+ ${n.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>`| ${e.getNameAsString().trim()} | ${(e.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
14
+ `,``)??``).trim()} | ${(0,t.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `)} | ${e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``} | ${e.isValueRequired()?``:`✔`} |`).join(`
15
+ `)}
16
+ `)},async buildEnd(){let e=f(this,`env`);this.log(k.TRACE,`Writing env reflection types to ${e}.`),await y(this,this.env.used.env,`env`)}}));export{z as default};
@@ -0,0 +1,135 @@
1
+ import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../../../plugin-babel/src/types/plugin.cjs";
2
+ import { Reflection } from "../../../deepkit/src/types.cjs";
3
+ import { EnvInterface, SecretsInterface } from "./runtime.cjs";
4
+ import { Children } from "@alloy-js/core/jsx-runtime";
5
+ import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
6
+ import { DotenvParseOutput } from "@stryke/env/types";
7
+
8
+ //#region ../plugin-env/src/types/plugin.d.ts
9
+ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
10
+ /**
11
+ * 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"`.
12
+ */
13
+ types?: TypeDefinitionParameter;
14
+ /**
15
+ * 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"`.
16
+ */
17
+ secrets?: TypeDefinitionParameter;
18
+ /**
19
+ * An additional prefix (or list of additional prefixes) to apply to the environment variables
20
+ *
21
+ * @remarks
22
+ * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.
23
+ */
24
+ prefix?: string | string[];
25
+ /**
26
+ * Should the plugin inject the env variables in the source code with their values?
27
+ *
28
+ * @remarks
29
+ * This option is set to `true` when building an application project.
30
+ *
31
+ * @defaultValue false
32
+ */
33
+ inject?: boolean;
34
+ /**
35
+ * The default configuration to use when loading environment variables.
36
+ *
37
+ * @remarks
38
+ * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.
39
+ */
40
+ defaultConfig?: Children;
41
+ /**
42
+ * Babel configuration options to use when injecting environment variables into the source code.
43
+ *
44
+ * @remarks
45
+ * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
46
+ */
47
+ babel?: BabelPluginOptions;
48
+ };
49
+ type EnvPluginUserConfig = BabelPluginUserConfig & {
50
+ env: EnvPluginOptions;
51
+ };
52
+ type EnvPluginResolvedConfig = BabelPluginResolvedConfig & {
53
+ env: Required<Pick<DotenvConfiguration, "additionalFiles">> & Required<Pick<EnvPluginOptions, "defaultConfig">> & {
54
+ /**
55
+ * The type definition for the expected env variable parameters
56
+ *
57
+ * @remarks
58
+ * This value is parsed from the {@link EnvPluginOptions.types} option.
59
+ */
60
+ types: TypeDefinition;
61
+ /**
62
+ * The type definition for the expected env secret parameters
63
+ *
64
+ * @remarks
65
+ * This value is parsed from the {@link EnvPluginOptions.secrets} option.
66
+ */
67
+ secrets: TypeDefinition;
68
+ /**
69
+ * Should the plugin inject the env variables in the source code with their values?
70
+ *
71
+ * @remarks
72
+ * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.
73
+ */
74
+ inject: EnvPluginOptions["inject"];
75
+ /**
76
+ * The prefix used for environment variables
77
+ *
78
+ * @remarks
79
+ * This value is used to filter environment variables that are loaded from the .env file and the process environment.
80
+ */
81
+ prefix: string[];
82
+ };
83
+ };
84
+ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig> {
85
+ env: {
86
+ /**
87
+ * The type definitions reflection for the env variables and secrets
88
+ *
89
+ * @remarks
90
+ * These reflections contains the structure of the expected environment variables and secrets as defined by the type definitions provided in the plugin configuration.
91
+ */
92
+ types: {
93
+ /**
94
+ * The type definitions for the expected env variables
95
+ */
96
+ env: Reflection;
97
+ /**
98
+ * The type definitions for the expected env secrets
99
+ */
100
+ secrets: Reflection;
101
+ };
102
+ /**
103
+ * The current **used** environment variables and secrets reflection
104
+ *
105
+ * @remarks
106
+ * This reflection contains the structure of the current environment variables and secrets as defined during the plugin initialization by extracting the values from the source code.
107
+ */
108
+ used: {
109
+ /**
110
+ * The current env variables reflection
111
+ */
112
+ env: Reflection<EnvInterface>;
113
+ /**
114
+ * The current env secrets reflection
115
+ */
116
+ secrets: Reflection<SecretsInterface>;
117
+ };
118
+ /**
119
+ * The parsed .env configuration object
120
+ *
121
+ * @remarks
122
+ * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}
123
+ */
124
+ parsed: DotenvParseOutput;
125
+ /**
126
+ * The injected environment variables and secrets reflection
127
+ *
128
+ * @remarks
129
+ * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.
130
+ */
131
+ injected: Reflection;
132
+ };
133
+ }
134
+ //#endregion
135
+ export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig };
@@ -0,0 +1,136 @@
1
+ import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../../../plugin-babel/src/types/plugin.mjs";
2
+ import { Reflection } from "../../../deepkit/src/types.mjs";
3
+ import "../../../plugin-babel/src/types/index.mjs";
4
+ import { EnvInterface, SecretsInterface } from "./runtime.mjs";
5
+ import { Children } from "@alloy-js/core/jsx-runtime";
6
+ import { DotenvParseOutput } from "@stryke/env/types";
7
+ import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
8
+
9
+ //#region ../plugin-env/src/types/plugin.d.ts
10
+ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
11
+ /**
12
+ * 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"`.
13
+ */
14
+ types?: TypeDefinitionParameter;
15
+ /**
16
+ * 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"`.
17
+ */
18
+ secrets?: TypeDefinitionParameter;
19
+ /**
20
+ * An additional prefix (or list of additional prefixes) to apply to the environment variables
21
+ *
22
+ * @remarks
23
+ * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.
24
+ */
25
+ prefix?: string | string[];
26
+ /**
27
+ * Should the plugin inject the env variables in the source code with their values?
28
+ *
29
+ * @remarks
30
+ * This option is set to `true` when building an application project.
31
+ *
32
+ * @defaultValue false
33
+ */
34
+ inject?: boolean;
35
+ /**
36
+ * The default configuration to use when loading environment variables.
37
+ *
38
+ * @remarks
39
+ * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.
40
+ */
41
+ defaultConfig?: Children;
42
+ /**
43
+ * Babel configuration options to use when injecting environment variables into the source code.
44
+ *
45
+ * @remarks
46
+ * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
47
+ */
48
+ babel?: BabelPluginOptions;
49
+ };
50
+ type EnvPluginUserConfig = BabelPluginUserConfig & {
51
+ env: EnvPluginOptions;
52
+ };
53
+ type EnvPluginResolvedConfig = BabelPluginResolvedConfig & {
54
+ env: Required<Pick<DotenvConfiguration, "additionalFiles">> & Required<Pick<EnvPluginOptions, "defaultConfig">> & {
55
+ /**
56
+ * The type definition for the expected env variable parameters
57
+ *
58
+ * @remarks
59
+ * This value is parsed from the {@link EnvPluginOptions.types} option.
60
+ */
61
+ types: TypeDefinition;
62
+ /**
63
+ * The type definition for the expected env secret parameters
64
+ *
65
+ * @remarks
66
+ * This value is parsed from the {@link EnvPluginOptions.secrets} option.
67
+ */
68
+ secrets: TypeDefinition;
69
+ /**
70
+ * Should the plugin inject the env variables in the source code with their values?
71
+ *
72
+ * @remarks
73
+ * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.
74
+ */
75
+ inject: EnvPluginOptions["inject"];
76
+ /**
77
+ * The prefix used for environment variables
78
+ *
79
+ * @remarks
80
+ * This value is used to filter environment variables that are loaded from the .env file and the process environment.
81
+ */
82
+ prefix: string[];
83
+ };
84
+ };
85
+ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig> {
86
+ env: {
87
+ /**
88
+ * The type definitions reflection for the env variables and secrets
89
+ *
90
+ * @remarks
91
+ * These reflections contains the structure of the expected environment variables and secrets as defined by the type definitions provided in the plugin configuration.
92
+ */
93
+ types: {
94
+ /**
95
+ * The type definitions for the expected env variables
96
+ */
97
+ env: Reflection;
98
+ /**
99
+ * The type definitions for the expected env secrets
100
+ */
101
+ secrets: Reflection;
102
+ };
103
+ /**
104
+ * The current **used** environment variables and secrets reflection
105
+ *
106
+ * @remarks
107
+ * This reflection contains the structure of the current environment variables and secrets as defined during the plugin initialization by extracting the values from the source code.
108
+ */
109
+ used: {
110
+ /**
111
+ * The current env variables reflection
112
+ */
113
+ env: Reflection<EnvInterface>;
114
+ /**
115
+ * The current env secrets reflection
116
+ */
117
+ secrets: Reflection<SecretsInterface>;
118
+ };
119
+ /**
120
+ * The parsed .env configuration object
121
+ *
122
+ * @remarks
123
+ * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}
124
+ */
125
+ parsed: DotenvParseOutput;
126
+ /**
127
+ * The injected environment variables and secrets reflection
128
+ *
129
+ * @remarks
130
+ * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.
131
+ */
132
+ injected: Reflection;
133
+ };
134
+ }
135
+ //#endregion
136
+ export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig };