@powerlines/plugin-react 0.1.105 → 0.1.106

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 (218) hide show
  1. package/dist/{_virtual/rolldown_runtime.mjs → chunk-CF6LXmkI.mjs} +1 -1
  2. package/dist/components/index.cjs +1 -1
  3. package/dist/components/index.d.cts +2 -1
  4. package/dist/components/index.d.mts +2 -1
  5. package/dist/components/index.mjs +1 -1
  6. package/dist/components/react-optimized.cjs +1 -1
  7. package/dist/components/react-optimized.d.cts +1 -13
  8. package/dist/components/react-optimized.d.mts +1 -13
  9. package/dist/components/react-optimized.mjs +1 -1
  10. package/dist/components-BWLXb7a2.cjs +0 -0
  11. package/dist/components-MTvNCZDU.mjs +1 -0
  12. package/dist/index-C-svZlpj.d.mts +1 -0
  13. package/dist/index-CtCMUyZA.d.cts +1 -0
  14. package/dist/index-DEHBdV_z.d.mts +1 -0
  15. package/dist/index-_wQ5ClJU.d.cts +1 -0
  16. package/dist/index.cjs +63 -1
  17. package/dist/index.d.cts +7 -6
  18. package/dist/index.d.mts +7 -9
  19. package/dist/index.mjs +60 -1
  20. package/dist/{deepkit/schemas/reflection.d.mts → plugin-DOauJa_m.d.mts} +299 -1
  21. package/dist/plugin-G4qbpIjB.mjs +1 -0
  22. package/dist/plugin-pBKbb5K9.cjs +0 -0
  23. package/dist/{deepkit/schemas/reflection.d.cts → plugin-yYQdItCy.d.cts} +299 -1
  24. package/dist/react-optimized-Btf0j0ZP.cjs +1 -0
  25. package/dist/react-optimized-C8ZBC6OY.mjs +1 -0
  26. package/dist/react-optimized-DmMl-ZEI.d.cts +14 -0
  27. package/dist/react-optimized-Y1x3FeDm.d.mts +14 -0
  28. package/dist/runtime--8U-2SZ9.d.mts +15 -0
  29. package/dist/runtime-BFk0BLpy.d.mts +2497 -0
  30. package/dist/runtime-Bp9G0scd.cjs +0 -0
  31. package/dist/runtime-CEUG_XjE.d.cts +15 -0
  32. package/dist/runtime-cDYyRPa0.mjs +1 -0
  33. package/dist/runtime-eJB4FEow.d.cts +2495 -0
  34. package/dist/types/index.cjs +1 -0
  35. package/dist/types/index.d.cts +4 -2
  36. package/dist/types/index.d.mts +4 -2
  37. package/dist/types/index.mjs +1 -1
  38. package/dist/types/plugin.cjs +1 -0
  39. package/dist/types/plugin.d.cts +2 -72
  40. package/dist/types/plugin.d.mts +2 -72
  41. package/dist/types/plugin.mjs +1 -1
  42. package/dist/types/runtime.cjs +1 -0
  43. package/dist/types/runtime.d.cts +2 -14
  44. package/dist/types/runtime.d.mts +2 -14
  45. package/dist/types/runtime.mjs +1 -1
  46. package/dist/types-C5ggNT4K.mjs +1 -0
  47. package/dist/types-a8gm_IaQ.cjs +0 -0
  48. package/package.json +11 -9
  49. package/dist/_virtual/rolldown_runtime.cjs +0 -1
  50. package/dist/alloy/src/core/components/output.cjs +0 -1
  51. package/dist/alloy/src/core/components/output.mjs +0 -1
  52. package/dist/alloy/src/core/components/single-line-comment.cjs +0 -1
  53. package/dist/alloy/src/core/components/single-line-comment.mjs +0 -1
  54. package/dist/alloy/src/core/components/source-file.cjs +0 -1
  55. package/dist/alloy/src/core/components/source-file.d.cts +0 -22
  56. package/dist/alloy/src/core/components/source-file.d.mts +0 -22
  57. package/dist/alloy/src/core/components/source-file.mjs +0 -1
  58. package/dist/alloy/src/core/contexts/context.cjs +0 -1
  59. package/dist/alloy/src/core/contexts/context.mjs +0 -1
  60. package/dist/alloy/src/core/contexts/reflection.cjs +0 -1
  61. package/dist/alloy/src/core/contexts/reflection.mjs +0 -1
  62. package/dist/alloy/src/create-plugin.cjs +0 -2
  63. package/dist/alloy/src/create-plugin.mjs +0 -2
  64. package/dist/alloy/src/helpers/refkey.cjs +0 -1
  65. package/dist/alloy/src/helpers/refkey.mjs +0 -1
  66. package/dist/alloy/src/markdown/components/markdown-file.cjs +0 -1
  67. package/dist/alloy/src/markdown/components/markdown-file.mjs +0 -1
  68. package/dist/alloy/src/markdown/components/markdown-table.cjs +0 -1
  69. package/dist/alloy/src/markdown/components/markdown-table.mjs +0 -1
  70. package/dist/alloy/src/markdown/contexts/markdown-table.cjs +0 -1
  71. package/dist/alloy/src/markdown/contexts/markdown-table.mjs +0 -1
  72. package/dist/alloy/src/types/components.d.cts +0 -19
  73. package/dist/alloy/src/types/components.d.mts +0 -23
  74. package/dist/alloy/src/types/plugin.d.cts +0 -15
  75. package/dist/alloy/src/types/plugin.d.mts +0 -15
  76. package/dist/alloy/src/typescript/components/builtin-file.cjs +0 -1
  77. package/dist/alloy/src/typescript/components/builtin-file.d.cts +0 -25
  78. package/dist/alloy/src/typescript/components/builtin-file.d.mts +0 -26
  79. package/dist/alloy/src/typescript/components/builtin-file.mjs +0 -1
  80. package/dist/alloy/src/typescript/components/tsdoc-reflection.cjs +0 -1
  81. package/dist/alloy/src/typescript/components/tsdoc-reflection.mjs +0 -1
  82. package/dist/alloy/src/typescript/components/tsdoc.cjs +0 -1
  83. package/dist/alloy/src/typescript/components/tsdoc.d.cts +0 -27
  84. package/dist/alloy/src/typescript/components/tsdoc.d.mts +0 -28
  85. package/dist/alloy/src/typescript/components/tsdoc.mjs +0 -1
  86. package/dist/alloy/src/typescript/components/typescript-file.cjs +0 -1
  87. package/dist/alloy/src/typescript/components/typescript-file.d.cts +0 -14
  88. package/dist/alloy/src/typescript/components/typescript-file.d.mts +0 -15
  89. package/dist/alloy/src/typescript/components/typescript-file.mjs +0 -1
  90. package/dist/alloy/src/typescript/components/typescript-interface.cjs +0 -1
  91. package/dist/alloy/src/typescript/components/typescript-interface.mjs +0 -1
  92. package/dist/alloy/src/typescript/components/typescript-object.cjs +0 -1
  93. package/dist/alloy/src/typescript/components/typescript-object.mjs +0 -1
  94. package/dist/deepkit/schemas/reflection.cjs +0 -1
  95. package/dist/deepkit/schemas/reflection.mjs +0 -1
  96. package/dist/deepkit/schemas/reflection2.cjs +0 -1
  97. package/dist/deepkit/schemas/reflection2.mjs +0 -1
  98. package/dist/deepkit/src/capnp.cjs +0 -1
  99. package/dist/deepkit/src/capnp.mjs +0 -1
  100. package/dist/deepkit/src/esbuild-plugin.cjs +0 -4
  101. package/dist/deepkit/src/esbuild-plugin.mjs +0 -4
  102. package/dist/deepkit/src/reflect-type.cjs +0 -1
  103. package/dist/deepkit/src/reflect-type.mjs +0 -1
  104. package/dist/deepkit/src/resolve-reflections.cjs +0 -1
  105. package/dist/deepkit/src/resolve-reflections.mjs +0 -1
  106. package/dist/deepkit/src/transformer.cjs +0 -1
  107. package/dist/deepkit/src/transformer.mjs +0 -1
  108. package/dist/deepkit/src/transpile.cjs +0 -1
  109. package/dist/deepkit/src/transpile.mjs +0 -1
  110. package/dist/deepkit/src/types.d.cts +0 -10
  111. package/dist/deepkit/src/types.d.mts +0 -10
  112. package/dist/deepkit/src/utilities.cjs +0 -1
  113. package/dist/deepkit/src/utilities.mjs +0 -1
  114. package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -1
  115. package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -1
  116. package/dist/deepkit/src/vendor/type.cjs +0 -1
  117. package/dist/deepkit/src/vendor/type.d.cts +0 -7
  118. package/dist/deepkit/src/vendor/type.d.mts +0 -7
  119. package/dist/deepkit/src/vendor/type.mjs +0 -1
  120. package/dist/plugin-automd/src/index.cjs +0 -1
  121. package/dist/plugin-automd/src/index.mjs +0 -1
  122. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  123. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  124. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  125. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  126. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -1
  127. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -1
  128. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -1
  129. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -1
  130. package/dist/plugin-babel/src/helpers/filters.cjs +0 -1
  131. package/dist/plugin-babel/src/helpers/filters.mjs +0 -1
  132. package/dist/plugin-babel/src/helpers/index.cjs +0 -1
  133. package/dist/plugin-babel/src/helpers/index.mjs +0 -1
  134. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -1
  135. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -1
  136. package/dist/plugin-babel/src/helpers/options.cjs +0 -1
  137. package/dist/plugin-babel/src/helpers/options.mjs +0 -1
  138. package/dist/plugin-babel/src/index.cjs +0 -1
  139. package/dist/plugin-babel/src/index.mjs +0 -1
  140. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  141. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  142. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  143. package/dist/plugin-env/src/babel/index.cjs +0 -1
  144. package/dist/plugin-env/src/babel/index.mjs +0 -1
  145. package/dist/plugin-env/src/babel/plugin.cjs +0 -5
  146. package/dist/plugin-env/src/babel/plugin.mjs +0 -5
  147. package/dist/plugin-env/src/components/docs.cjs +0 -1
  148. package/dist/plugin-env/src/components/docs.mjs +0 -1
  149. package/dist/plugin-env/src/components/env.cjs +0 -34
  150. package/dist/plugin-env/src/components/env.mjs +0 -31
  151. package/dist/plugin-env/src/components/index.cjs +0 -1
  152. package/dist/plugin-env/src/components/index.mjs +0 -1
  153. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -1
  154. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -1
  155. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -1
  156. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -1
  157. package/dist/plugin-env/src/helpers/index.cjs +0 -1
  158. package/dist/plugin-env/src/helpers/index.mjs +0 -1
  159. package/dist/plugin-env/src/helpers/load.cjs +0 -1
  160. package/dist/plugin-env/src/helpers/load.mjs +0 -1
  161. package/dist/plugin-env/src/helpers/persistence.cjs +0 -1
  162. package/dist/plugin-env/src/helpers/persistence.mjs +0 -1
  163. package/dist/plugin-env/src/helpers/reflect.cjs +0 -1
  164. package/dist/plugin-env/src/helpers/reflect.mjs +0 -1
  165. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -1
  166. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -1
  167. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -1
  168. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -1
  169. package/dist/plugin-env/src/index.cjs +0 -10
  170. package/dist/plugin-env/src/index.mjs +0 -10
  171. package/dist/plugin-env/src/types/plugin.d.cts +0 -143
  172. package/dist/plugin-env/src/types/plugin.d.mts +0 -144
  173. package/dist/plugin-env/src/types/runtime.d.cts +0 -792
  174. package/dist/plugin-env/src/types/runtime.d.mts +0 -792
  175. package/dist/plugin-plugin/src/types/plugin.d.cts +0 -21
  176. package/dist/plugin-plugin/src/types/plugin.d.mts +0 -24
  177. package/dist/powerlines/schemas/fs.d.mts +0 -1
  178. package/dist/powerlines/src/api.d.mts +0 -7
  179. package/dist/powerlines/src/index.d.mts +0 -12
  180. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -5
  181. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -14
  182. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -14
  183. package/dist/powerlines/src/lib/entry.cjs +0 -1
  184. package/dist/powerlines/src/lib/entry.mjs +0 -1
  185. package/dist/powerlines/src/lib/logger.cjs +0 -1
  186. package/dist/powerlines/src/lib/logger.mjs +0 -1
  187. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -1
  188. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -1
  189. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -1
  190. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -1
  191. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -1
  192. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -1
  193. package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -1
  194. package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -1
  195. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  196. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -1
  197. package/dist/powerlines/src/types/api.d.mts +0 -5
  198. package/dist/powerlines/src/types/babel.d.cts +0 -22
  199. package/dist/powerlines/src/types/babel.d.mts +0 -22
  200. package/dist/powerlines/src/types/build.d.cts +0 -145
  201. package/dist/powerlines/src/types/build.d.mts +0 -147
  202. package/dist/powerlines/src/types/commands.d.cts +0 -8
  203. package/dist/powerlines/src/types/commands.d.mts +0 -9
  204. package/dist/powerlines/src/types/config.d.cts +0 -368
  205. package/dist/powerlines/src/types/config.d.mts +0 -369
  206. package/dist/powerlines/src/types/context.d.cts +0 -373
  207. package/dist/powerlines/src/types/context.d.mts +0 -375
  208. package/dist/powerlines/src/types/fs.d.cts +0 -458
  209. package/dist/powerlines/src/types/fs.d.mts +0 -458
  210. package/dist/powerlines/src/types/hooks.d.mts +0 -2
  211. package/dist/powerlines/src/types/index.d.mts +0 -12
  212. package/dist/powerlines/src/types/plugin.d.cts +0 -232
  213. package/dist/powerlines/src/types/plugin.d.mts +0 -232
  214. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  215. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  216. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  217. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  218. package/dist/powerlines/src/types/unplugin.d.mts +0 -7
@@ -1,7 +0,0 @@
1
- export * from "@deepkit/type";
2
-
3
- //#region ../deepkit/src/vendor/type.d.ts
4
-
5
- import * as import___deepkit_type from "@deepkit/type";
6
- //#endregion
7
- export { import___deepkit_type as type_d_exports };
@@ -1,7 +0,0 @@
1
- export * from "@deepkit/type";
2
-
3
- //#region ../deepkit/src/vendor/type.d.ts
4
-
5
- import * as import___deepkit_type from "@deepkit/type";
6
- //#endregion
7
- export { import___deepkit_type as type_d_exports };
@@ -1 +0,0 @@
1
- import{__reExport as e}from"../../../_virtual/rolldown_runtime.mjs";export*from"@deepkit/type";var t={};import*as n from"@deepkit/type";e(t,n);export{t as type_exports};
@@ -1 +0,0 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/append`),n=require(`defu`);n=e.__toESM(n);let r=require(`@stryke/path/replace`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/fs/is-file`),o=require(`@stryke/fs/list-files`),s=require(`@stryke/path/is-type`),c=require(`@stryke/path/join-paths`),l=require(`automd`),u=require(`c12`),d=require(`markdown-toc`);d=e.__toESM(d);const f=(e={})=>({name:`automd`,async config(){let t=await(0,l.loadConfig)((0,c.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=(0,i.toArray)(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:(0,n.default)(t??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!(0,i.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,i.toArray)(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await(0,u.loadConfig)({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=(0,l.resolveConfig)((0,n.default)(this.config.automd,{...e,prefix:(0,i.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,o.listFiles)((0,s.isAbsolutePath)(e)?e:(0,t.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,s.isAbsolutePath)(e)?e:(0,t.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,s.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,t.appendPath)(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:(0,d.default)(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>{let n=await this.fs.read(e);if(n){let i=await(0,l.transform)(n,this.config.automd);if(i.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);i.hasChanged&&await this.fs.write((0,t.appendPath)(this.config.automd.output?(0,a.isDirectory)(this.config.automd.output)?(0,r.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),i.contents)}}))}});var p=f;exports.default=p;
@@ -1 +0,0 @@
1
- import{appendPath as e}from"@stryke/path/append";import t from"defu";import{replacePath as n}from"@stryke/path/replace";import{toArray as r}from"@stryke/convert/to-array";import{isDirectory as i}from"@stryke/fs/is-file";import{listFiles as a}from"@stryke/fs/list-files";import{isAbsolutePath as o}from"@stryke/path/is-type";import{joinPaths as s}from"@stryke/path/join-paths";import{loadConfig as c,resolveConfig as l,transform as u}from"automd";import{loadConfig as d}from"c12";import f from"markdown-toc";var p=(p={})=>({name:`automd`,async config(){let e=await c(s(this.workspaceConfig.workspaceRoot,this.config.projectRoot),p);return(!e.prefix||!Array.isArray(e.prefix))&&(e.prefix=r(e.prefix??[])),e.prefix.includes(`automd`)||e.prefix.push(`automd`),e.prefix.includes(`powerlines`)||e.prefix.push(`powerlines`),{automd:t(e??{},{configFile:p.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!r(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=r(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await d({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=l(t(this.config.automd,{...e,prefix:r(e.prefix??[])}))}this.config.automd.input=(await Promise.all(r(this.config.automd.input).map(async t=>t.includes(`*`)?a(o(t)?t:e(t,this.config.projectRoot),{ignore:this.config.automd.ignore}):o(t)?t:e(t,this.config.projectRoot)))).flat(),this.config.automd.output&&!o(this.config.automd.output)&&(this.config.automd.output=e(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:f(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all(r(this.config.automd.input).map(async t=>{let r=await this.fs.read(t);if(r){let a=await u(r,this.config.automd);if(a.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${t}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);a.hasChanged&&await this.fs.write(e(this.config.automd.output?i(this.config.automd.output)?n(t,this.config.automd.output):this.config.automd.output:t,this.config.projectRoot),a.contents)}}))}});export{p as default};
@@ -1,38 +0,0 @@
1
- import { TOCOptions } from "./toc.cjs";
2
- import { Config } from "automd";
3
-
4
- //#region ../plugin-automd/src/types/plugin.d.ts
5
-
6
- type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
7
- /**
8
- * Path to the AutoMD configuration file.
9
- *
10
- * @remarks
11
- * If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
12
- */
13
- configFile?: string;
14
- /**
15
- * An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
16
- *
17
- * @defaultValue true
18
- */
19
- allowIssues?: boolean;
20
- /**
21
- * Alternate prefix strings to use for finding generators
22
- *
23
- * @remarks
24
- * By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
25
- *
26
- * @defaultValue ["automd", "powerlines", "\{framework\}"]
27
- */
28
- prefix?: string | string[];
29
- /**
30
- * Table of Contents generator options
31
- *
32
- * @remarks
33
- * If set to `false`, the built-in Table of Contents generator will be disabled.
34
- */
35
- toc?: false | TOCOptions;
36
- };
37
- //#endregion
38
- export { AutoMDPluginOptions };
@@ -1,40 +0,0 @@
1
- import "../../../powerlines/src/types/context.mjs";
2
- import "../../../powerlines/src/types/config.mjs";
3
- import "../../../powerlines/src/types/resolved.mjs";
4
- import { TOCOptions } from "./toc.mjs";
5
- import { Config } from "automd";
6
-
7
- //#region ../plugin-automd/src/types/plugin.d.ts
8
- type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
9
- /**
10
- * Path to the AutoMD configuration file.
11
- *
12
- * @remarks
13
- * If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
14
- */
15
- configFile?: string;
16
- /**
17
- * An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
18
- *
19
- * @defaultValue true
20
- */
21
- allowIssues?: boolean;
22
- /**
23
- * Alternate prefix strings to use for finding generators
24
- *
25
- * @remarks
26
- * By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
27
- *
28
- * @defaultValue ["automd", "powerlines", "\{framework\}"]
29
- */
30
- prefix?: string | string[];
31
- /**
32
- * Table of Contents generator options
33
- *
34
- * @remarks
35
- * If set to `false`, the built-in Table of Contents generator will be disabled.
36
- */
37
- toc?: false | TOCOptions;
38
- };
39
- //#endregion
40
- export { AutoMDPluginOptions };
@@ -1,33 +0,0 @@
1
- //#region ../plugin-automd/src/types/toc.d.ts
2
- interface TOCOptions {
3
- /**
4
- * A slugify function to generate slugs for the headings.
5
- */
6
- slugify?: (str: string) => string;
7
- /**
8
- * The maximum depth of headings to include in the TOC.
9
- *
10
- * @defaultValue 6
11
- */
12
- maxDepth?: number;
13
- /**
14
- * Whether to include the first H1 heading in the TOC.
15
- */
16
- firstH1?: boolean;
17
- /**
18
- * The bullet character to use for list items in the TOC.
19
- *
20
- * @defaultValue "-"
21
- */
22
- bullets?: string;
23
- /**
24
- * A prefix to add to each heading in the TOC.
25
- */
26
- prefix?: string;
27
- /**
28
- * A filter function to determine which headings to include in the TOC.
29
- */
30
- filter?: (str: string, level: number) => boolean;
31
- }
32
- //#endregion
33
- export { TOCOptions };
@@ -1,33 +0,0 @@
1
- //#region ../plugin-automd/src/types/toc.d.ts
2
- interface TOCOptions {
3
- /**
4
- * A slugify function to generate slugs for the headings.
5
- */
6
- slugify?: (str: string) => string;
7
- /**
8
- * The maximum depth of headings to include in the TOC.
9
- *
10
- * @defaultValue 6
11
- */
12
- maxDepth?: number;
13
- /**
14
- * Whether to include the first H1 heading in the TOC.
15
- */
16
- firstH1?: boolean;
17
- /**
18
- * The bullet character to use for list items in the TOC.
19
- *
20
- * @defaultValue "-"
21
- */
22
- bullets?: string;
23
- /**
24
- * A prefix to add to each heading in the TOC.
25
- */
26
- prefix?: string;
27
- /**
28
- * A filter function to determine which headings to include in the TOC.
29
- */
30
- filter?: (str: string, level: number) => boolean;
31
- }
32
- //#endregion
33
- export { TOCOptions };
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@babel/generator`);t=e.__toESM(t),require(`@babel/parser`);let n=t.default;`default`in n&&(n=n.default);
@@ -1 +0,0 @@
1
- import e from"@babel/generator";import"@babel/parser";let t=e;`default`in t&&(t=t.default);export{};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../powerlines/src/lib/logger.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`chalk`);r=e.__toESM(r);let i=require(`@babel/helper-plugin-utils`);function a(e,a){let o=o=>(0,i.declare)((i,s,c)=>{i.cache.using(()=>o.meta.checksum),i.assertVersion(`^7.0.0-0`);let l=t.extendLog(o.log,e);l(n.LogLevelLabel.TRACE,`Initializing the ${r.default.bold.cyanBright(e)} Babel plugin`);let u=a({log:l,name:e,api:i,options:s,context:o,dirname:c});return u.name=e,l(n.LogLevelLabel.TRACE,`Completed initialization of the ${r.default.bold.cyanBright(e)} Babel plugin`),u});return o.$$name=e,o}exports.createBabelPlugin=a;
@@ -1 +0,0 @@
1
- import{extendLog as e}from"../../../powerlines/src/lib/logger.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import n from"chalk";import{declare as r}from"@babel/helper-plugin-utils";function i(i,a){let o=o=>r((r,s,c)=>{r.cache.using(()=>o.meta.checksum),r.assertVersion(`^7.0.0-0`);let l=e(o.log,i);l(t.TRACE,`Initializing the ${n.bold.cyanBright(i)} Babel plugin`);let u=a({log:l,name:i,api:r,options:s,context:o,dirname:c});return u.name=i,l(t.TRACE,`Completed initialization of the ${n.bold.cyanBright(i)} Babel plugin`),u});return o.$$name=i,o}export{i as createBabelPlugin};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-set-string`),n=require(`@stryke/type-checks/is-function`);require(`@stryke/type-checks/is-object`);function r(e){return(0,t.isSetString)(e)?e:Array.isArray(e)&&e.length>0?r(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function i(e,t){return!!(r(t)&&e.some(e=>Array.isArray(e)&&r(e[0])===r(t)))}exports.getPluginName=r,exports.isDuplicatePlugin=i;
@@ -1 +0,0 @@
1
- import{isSetString as e}from"@stryke/type-checks/is-set-string";import{isFunction as t}from"@stryke/type-checks/is-function";import"@stryke/type-checks/is-object";function n(t){return e(t)?t:Array.isArray(t)&&t.length>0?n(t[0]):t.$$name||t.name?t.$$name||t.name:void 0}function r(e,t){return!!(n(t)&&e.some(e=>Array.isArray(e)&&n(e[0])===n(t)))}export{n as getPluginName,r as isDuplicatePlugin};
@@ -1 +0,0 @@
1
- const e=require(`./filters.cjs`),t=require(`./options.cjs`);require(`./ast-utils.cjs`);const n=require(`./create-plugin.cjs`),r=require(`./module-helpers.cjs`);
@@ -1 +0,0 @@
1
- import{getPluginName as e,isDuplicatePlugin as t}from"./filters.mjs";import{resolveBabelPlugin as n,resolvePluginFunction as r}from"./options.mjs";import"./ast-utils.mjs";import{createBabelPlugin as i}from"./create-plugin.mjs";import{addImport as a,addImportsToProgram as o}from"./module-helpers.mjs";export{};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);require(`./ast-utils.cjs`);let t=require(`@stryke/type-checks/is-string`),n=require(`@babel/types`);n=e.__toESM(n);function r(e,t){o(e.scope.getProgramParent().path,t)}function i(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function a(e){let t=new Map;return e.traverse({ImportDeclaration(e){i(e)&&t.set(e.node.source.value,e)}}),t}function o(e,t){a(e).get(t.module)||e.unshiftContainer(`body`,n.importDeclaration([n.importSpecifier(n.identifier(t.name||t.imported),n.identifier(t.imported))],n.stringLiteral(t.module)))}exports.addImport=r,exports.addImportsToProgram=o;
@@ -1 +0,0 @@
1
- import"./ast-utils.mjs";import{isString as e}from"@stryke/type-checks/is-string";import*as t from"@babel/types";function n(e,t){a(e.scope.getProgramParent().path,t)}function r(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function i(e){let t=new Map;return e.traverse({ImportDeclaration(e){r(e)&&t.set(e.node.source.value,e)}}),t}function a(e,n){i(e).get(n.module)||e.unshiftContainer(`body`,t.importDeclaration([t.importSpecifier(t.identifier(n.name||n.imported),t.identifier(n.imported))],t.stringLiteral(n.module)))}export{n as addImport,a as addImportsToProgram};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`./filters.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`@stryke/type-checks/is-function`),i=require(`chalk`);i=e.__toESM(i);function a(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?(0,r.isFunction)(t[0])?t[0](e):t[0]:(0,r.isFunction)(t)?t(e):t}catch{return t[0]}}function o(e,o,s,c){if(Array.isArray(c)&&c.length>0&&c[0]){if(c.length>2&&c[2]&&(0,r.isFunction)(c[2])&&!c[2](o,s)){e.log(n.LogLevelLabel.TRACE,`Skipping filtered Babel plugin ${i.default.bold.cyanBright(t.getPluginName(c)||`unnamed`)} for ${s}`);return}return c.length>2?[a(e,c),c[1],c[2]]:[a(e,c),c[1],null]}return[a(e,c),{},null]}exports.resolveBabelPlugin=o,exports.resolvePluginFunction=a;
@@ -1 +0,0 @@
1
- import{getPluginName as e}from"./filters.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import{isFunction as n}from"@stryke/type-checks/is-function";import r from"chalk";function i(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?n(t[0])?t[0](e):t[0]:n(t)?t(e):t}catch{return t[0]}}function a(a,o,s,c){if(Array.isArray(c)&&c.length>0&&c[0]){if(c.length>2&&c[2]&&n(c[2])&&!c[2](o,s)){a.log(t.TRACE,`Skipping filtered Babel plugin ${r.bold.cyanBright(e(c)||`unnamed`)} for ${s}`);return}return c.length>2?[i(a,c),c[1],c[2]]:[i(a,c),c[1],null]}return[i(a,c),{},null]}export{a as resolveBabelPlugin,i as resolvePluginFunction};
@@ -1 +0,0 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./helpers/filters.cjs`),n=require(`./helpers/options.cjs`),r=require(`./helpers/create-plugin.cjs`),i=require(`./helpers/module-helpers.cjs`);require(`./helpers/index.cjs`);let a=require(`defu`);a=e.__toESM(a);let o=require(`@storm-software/config-tools/types`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/type-checks/is-set-object`),l=require(`@babel/core`),u=require(`@stryke/path/file-path-fns`);const d=(e={})=>({name:`babel`,config(){if((0,c.isSetObject)(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=(0,a.default)(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(r,i){if((0,s.isParentPath)(i,this.powerlinesPath)||r.includes(`/* @storm-ignore */`)||r.includes(`/* @storm-disable */`))return this.log(o.LogLevelLabel.TRACE,`Skipping Babel transformation for: ${i}`),{code:r,id:i};this.log(o.LogLevelLabel.TRACE,`Babel transforming file: ${i}`);let c=this.config.transform.babel.plugins.map(e=>n.resolveBabelPlugin(this,r,i,e)).filter((e,n,r)=>e&&!t.isDuplicatePlugin(r,e)),d=this.config.transform.babel.presets.map(e=>n.resolveBabelPlugin(this,r,i,e)).filter((e,n,r)=>e&&!t.isDuplicatePlugin(r,e));if(Array.isArray(c)&&c.length===0&&Array.isArray(d)&&d.length===0)return{code:r,id:i};[`ts`,`cts`,`mts`,`tsx`].includes((0,u.findFileExtensionSafe)(i))&&!t.isDuplicatePlugin(c,`@babel/plugin-syntax-typescript`)&&!t.isDuplicatePlugin(d,`@babel/preset-typescript`)&&c.unshift([`@babel/plugin-syntax-typescript`,{isTSX:(0,u.findFileExtension)(i)===`.tsx`}]);let f=await(0,l.transformAsync)(r,{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:i,plugins:c.map(t=>Array.isArray(t)&&t.length>=2?[t[0],(0,a.default)(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:d.map(t=>Array.isArray(t)&&t.length>=2?[t[0],(0,a.default)(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean)});if(!f?.code)throw Error(`Powerlines - Babel plugin failed to compile ${i}`);return{code:f.code,id:i}}});var f=d;exports.default=f;
@@ -1 +0,0 @@
1
- import{getPluginName as e,isDuplicatePlugin as t}from"./helpers/filters.mjs";import{resolveBabelPlugin as n,resolvePluginFunction as r}from"./helpers/options.mjs";import{createBabelPlugin as i}from"./helpers/create-plugin.mjs";import{addImport as a,addImportsToProgram as o}from"./helpers/module-helpers.mjs";import"./helpers/index.mjs";import s from"defu";import{LogLevelLabel as c}from"@storm-software/config-tools/types";import{isParentPath as l}from"@stryke/path/is-parent-path";import{isSetObject as u}from"@stryke/type-checks/is-set-object";import{transformAsync as d}from"@babel/core";import{findFileExtension as f,findFileExtensionSafe as p}from"@stryke/path/file-path-fns";var m=(e={})=>({name:`babel`,config(){if(u(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=s(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(r,i){if(l(i,this.powerlinesPath)||r.includes(`/* @storm-ignore */`)||r.includes(`/* @storm-disable */`))return this.log(c.TRACE,`Skipping Babel transformation for: ${i}`),{code:r,id:i};this.log(c.TRACE,`Babel transforming file: ${i}`);let a=this.config.transform.babel.plugins.map(e=>n(this,r,i,e)).filter((e,n,r)=>e&&!t(r,e)),o=this.config.transform.babel.presets.map(e=>n(this,r,i,e)).filter((e,n,r)=>e&&!t(r,e));if(Array.isArray(a)&&a.length===0&&Array.isArray(o)&&o.length===0)return{code:r,id:i};[`ts`,`cts`,`mts`,`tsx`].includes(p(i))&&!t(a,`@babel/plugin-syntax-typescript`)&&!t(o,`@babel/preset-typescript`)&&a.unshift([`@babel/plugin-syntax-typescript`,{isTSX:f(i)===`.tsx`}]);let u=await d(r,{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:i,plugins:a.map(t=>Array.isArray(t)&&t.length>=2?[t[0],s(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:o.map(t=>Array.isArray(t)&&t.length>=2?[t[0],s(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean)});if(!u?.code)throw Error(`Powerlines - Babel plugin failed to compile ${i}`);return{code:u.code,id:i}}});export{m as default};
@@ -1 +0,0 @@
1
- import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "./plugin.mjs";
@@ -1,15 +0,0 @@
1
- import { PluginContext } from "../../../powerlines/src/types/context.cjs";
2
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.cjs";
3
- import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
4
-
5
- //#region ../plugin-babel/src/types/plugin.d.ts
6
- type BabelPluginOptions = Partial<BabelUserConfig>;
7
- type BabelPluginUserConfig = UserConfig;
8
- interface BabelPluginResolvedConfig extends ResolvedConfig {
9
- transform: {
10
- babel: BabelResolvedConfig;
11
- };
12
- }
13
- type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
- //#endregion
15
- export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
@@ -1,15 +0,0 @@
1
- import { PluginContext } from "../../../powerlines/src/types/context.mjs";
2
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.mjs";
3
- import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
4
-
5
- //#region ../plugin-babel/src/types/plugin.d.ts
6
- type BabelPluginOptions = Partial<BabelUserConfig>;
7
- type BabelPluginUserConfig = UserConfig;
8
- interface BabelPluginResolvedConfig extends ResolvedConfig {
9
- transform: {
10
- babel: BabelResolvedConfig;
11
- };
12
- }
13
- type BabelPluginContext<TResolvedConfig extends BabelPluginResolvedConfig = BabelPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
- //#endregion
15
- export { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig };
@@ -1 +0,0 @@
1
- const e=require(`./plugin.cjs`);
@@ -1 +0,0 @@
1
- import{envBabelPlugin as e}from"./plugin.mjs";export{};
@@ -1,5 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../deepkit/src/vendor/type.cjs`),n=require(`../../../deepkit/src/utilities.cjs`),r=require(`../../../plugin-babel/src/helpers/create-plugin.cjs`),i=require(`../../../plugin-babel/src/helpers/module-helpers.cjs`),a=require(`../../../deepkit/src/capnp.cjs`),o=require(`../../../deepkit/schemas/reflection2.cjs`),s=require(`../helpers/persistence.cjs`);let c=require(`@storm-software/config-tools/types`),l=require(`@stryke/capnp`);l=e.__toESM(l);let u=require(`@stryke/fs/buffer`),d=require(`node:fs`);const f=r.createBabelPlugin(`env`,({log:e,context:r})=>{function f(t,i,a=!1){let o=r.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(t.name){let s=r.config.env.prefix.find(e=>t.name&&t.name.startsWith(e)&&(r.env.types.env?.hasProperty(t.name.replace(`${e}_`,``))||o.some(n=>n.getAlias().includes(t.name.replace(`${e}_`,``))))),l=t.name;if(s&&(l=t.name.replace(`${s}_`,``)),e(c.LogLevelLabel.TRACE,`Environment variable ${l} found in ${i.filename||`unknown file`}.`),r.env.types.env?.hasProperty(l)||o.some(e=>e.getAlias().includes(l))){let e=r.env.types.env.hasProperty(l)?r.env.types.env.getProperty(l):o.find(e=>e.getAlias().includes(l));if(!e||e.isIgnored())return;if(r.env.used.env.hasProperty(l)||r.env.used.env.addProperty(e.property),r.config.env.inject&&a){let t=r.env.parsed?.[l];if(t===void 0){let e=r.config.env.prefix.find(e=>r.env.parsed[`${e.replace(/_$/g,``)}_${l}`]);e&&(t=r.env.parsed[`${e.replace(/_$/g,``)}_${l}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${l}\` is not defined in the .env configuration files`);return n.stringifyDefaultValue(e,t)}}else throw Error(`The "${l}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${i.filename?i.filename:`unknown`}.
2
-
3
- The following environment configuration names are defined in the \`env\` type definition: \n${r.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${o.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${o?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
- `)} \n\nUsing the following env prefix: \n${r.config.env.prefix.map(e=>` - ${e}`).join(`
5
- `)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),i.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isCallExpression({callee:{name:`useStorm`,type:`Identifier`}})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),i.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`process`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),i.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isMetaProperty()&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),i.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){e(c.LogLevelLabel.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let n=t.type_exports.ReflectionClass.from({kind:t.type_exports.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),i=s.getEnvReflectionsPath(r,`env`);i&&(0,d.existsSync)(i)&&(e(c.LogLevelLabel.TRACE,`Environment reflection file found at ${i}, reading existing reflection.`),n=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(a.convertFromCapnp(new l.Message((0,u.readFileBufferSync)(i),!1).getRoot(o.SerializedTypes).types)))),e(c.LogLevelLabel.TRACE,`Adding new variables to env reflection at ${i}.`),n.getProperties().filter(e=>e.getNameAsString()&&!r.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{r.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}});exports.envBabelPlugin=f;
@@ -1,5 +0,0 @@
1
- import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{stringifyDefaultValue as t}from"../../../deepkit/src/utilities.mjs";import{createBabelPlugin as n}from"../../../plugin-babel/src/helpers/create-plugin.mjs";import{addImport as r}from"../../../plugin-babel/src/helpers/module-helpers.mjs";import{convertFromCapnp as i}from"../../../deepkit/src/capnp.mjs";import{SerializedTypes as a}from"../../../deepkit/schemas/reflection2.mjs";import{getEnvReflectionsPath as o}from"../helpers/persistence.mjs";import{LogLevelLabel as s}from"@storm-software/config-tools/types";import*as c from"@stryke/capnp";import{readFileBufferSync as l}from"@stryke/fs/buffer";import{existsSync as u}from"node:fs";const d=n(`env`,({log:n,context:d})=>{function f(e,r,i=!1){let a=d.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(e.name){let o=d.config.env.prefix.find(t=>e.name&&e.name.startsWith(t)&&(d.env.types.env?.hasProperty(e.name.replace(`${t}_`,``))||a.some(n=>n.getAlias().includes(e.name.replace(`${t}_`,``))))),c=e.name;if(o&&(c=e.name.replace(`${o}_`,``)),n(s.TRACE,`Environment variable ${c} found in ${r.filename||`unknown file`}.`),d.env.types.env?.hasProperty(c)||a.some(e=>e.getAlias().includes(c))){let e=d.env.types.env.hasProperty(c)?d.env.types.env.getProperty(c):a.find(e=>e.getAlias().includes(c));if(!e||e.isIgnored())return;if(d.env.used.env.hasProperty(c)||d.env.used.env.addProperty(e.property),d.config.env.inject&&i){let n=d.env.parsed?.[c];if(n===void 0){let e=d.config.env.prefix.find(e=>d.env.parsed[`${e.replace(/_$/g,``)}_${c}`]);e&&(n=d.env.parsed[`${e.replace(/_$/g,``)}_${c}`])}if(n??=e.getDefaultValue(),e.isValueRequired()&&n===void 0)throw Error(`Environment variable \`${c}\` is not defined in the .env configuration files`);return t(e,n)}}else throw Error(`The "${c}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${r.filename?r.filename:`unknown`}.
2
-
3
- The following environment configuration names are defined in the \`env\` type definition: \n${d.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${a.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${a?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
- `)} \n\nUsing the following env prefix: \n${d.config.env.prefix.map(e=>` - ${e}`).join(`
5
- `)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isCallExpression({callee:{name:`useStorm`,type:`Identifier`}})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`process`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isMetaProperty()&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){n(s.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let t=e.ReflectionClass.from({kind:e.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),r=o(d,`env`);r&&u(r)&&(n(s.TRACE,`Environment reflection file found at ${r}, reading existing reflection.`),t=(0,e.resolveClassType)((0,e.deserializeType)(i(new c.Message(l(r),!1).getRoot(a).types)))),n(s.TRACE,`Adding new variables to env reflection at ${r}.`),t.getProperties().filter(e=>e.getNameAsString()&&!d.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{d.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}});export{d as envBabelPlugin};
@@ -1 +0,0 @@
1
- require(`../../../alloy/src/core/contexts/context.cjs`),require(`../../../deepkit/src/vendor/type.cjs`),require(`../helpers/create-reflection-resource.cjs`),require(`../../../alloy/src/markdown/components/markdown-file.cjs`),require(`../../../alloy/src/markdown/components/markdown-table.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/path/join`);require(`@alloy-js/markdown`);
@@ -1 +0,0 @@
1
- import"../../../alloy/src/core/contexts/context.mjs";import"../../../deepkit/src/vendor/type.mjs";import"../helpers/create-reflection-resource.mjs";import"../../../alloy/src/markdown/components/markdown-file.mjs";import"../../../alloy/src/markdown/components/markdown-table.mjs";import{createComponent as e,createIntrinsic as t}from"@alloy-js/core/jsx-runtime";import{Show as n,code as r}from"@alloy-js/core";import{joinPaths as i}from"@stryke/path/join";import"@alloy-js/markdown";export{};
@@ -1,34 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../alloy/src/core/contexts/context.cjs`),n=require(`../../../alloy/src/helpers/refkey.cjs`),r=require(`../../../deepkit/src/vendor/type.cjs`),i=require(`../../../alloy/src/typescript/components/tsdoc.cjs`),a=require(`../../../alloy/src/typescript/components/builtin-file.cjs`),o=require(`../../../alloy/src/typescript/components/typescript-interface.cjs`),s=require(`../../../alloy/src/typescript/components/typescript-object.cjs`),c=require(`../helpers/load.cjs`),l=require(`../helpers/create-reflection-resource.cjs`);let u=require(`@alloy-js/core/jsx-runtime`),d=require(`@alloy-js/core`),f=require(`@alloy-js/typescript`),p=require(`@stryke/type-checks/is-null`),m=require(`@stryke/string-format/title-case`),h=require(`defu`);h=e.__toESM(h);function g(e){let[{defaultValue:n,reflection:r}]=(0,d.splitProps)(e,[`defaultValue`,`reflection`]),i=t.usePowerlines();return[(0,u.createComponent)(o.TypeScriptInterface,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:n,reflection:r,export:!0}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(f.TypeDeclaration,{name:`Env`,export:!0,get children(){return d.code` {
2
- [Key in keyof EnvBase as Key ${i?.config.env.prefix.map(e=>`| \`${e.replace(/_$/g,``)}_\${Key}\``).join(` `)}]: EnvBase[Key];
3
- }
4
- `}})]}function _(e){let[{context:t,name:n}]=(0,d.splitProps)(e,[`context`,`name`]);return t?d.code`propertyName === "${n}" || propertyName.replace(/^(${t.config.env.prefix.sort((e,t)=>e.startsWith(t)?-1:t.startsWith(e)?1:e.localeCompare(t)).map(e=>`${e.replace(/_$/,``)}_`).join(`|`)})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${n.toLowerCase().replace(/[\s\-_]+/g,``)}"`:null}function v(e){let[{context:t,property:n,index:r}]=(0,d.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,u.createComponent)(f.IfStatement,{get condition(){return[(0,u.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,u.createComponent)(d.Show,{get when(){return(0,u.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[d.code` || `,(0,u.createComponent)(d.For,{get each(){return n.getAlias()},joiner:d.code` || `,children:e=>(0,u.createComponent)(_,{name:e,context:t})})]}})]},get children(){return d.code`return target["${n.getNameAsString()}"];`}}):(0,u.createComponent)(f.ElseIfClause,{get condition(){return[(0,u.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,u.createComponent)(d.Show,{get when(){return(0,u.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[d.code` || `,(0,u.createComponent)(d.For,{get each(){return n.getAlias()},joiner:d.code` || `,children:e=>(0,u.createComponent)(_,{name:e,context:t})})]}})]},get children(){return d.code`return target["${n.getNameAsString()}"];`}})]:null}function y(e){let[{context:t,property:n,index:r}]=(0,d.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,u.createComponent)(f.IfStatement,{get condition(){return[(0,u.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,u.createComponent)(d.Show,{get when(){return(0,u.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[d.code` || `,(0,u.createComponent)(d.For,{get each(){return n.getAlias()},joiner:d.code` || `,children:e=>(0,u.createComponent)(_,{name:e,context:t})})]}})]},get children(){return d.code`
5
- target["${n.getNameAsString()}"] = newValue;
6
- return true;
7
- `}}):(0,u.createComponent)(f.ElseIfClause,{get condition(){return[(0,u.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,u.createComponent)(d.Show,{get when(){return(0,u.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[d.code` || `,(0,u.createComponent)(d.For,{get each(){return n.getAlias()},joiner:d.code` || `,children:e=>(0,u.createComponent)(_,{name:e,context:t})})]}})]},get children(){return d.code`
8
- target["${n.getNameAsString()}"] = newValue;
9
- return true;
10
- `}})]:null}const b=n.refkey(`createEnv`),x=n.refkey(`env`),S=n.refkey(`EnvSerializer`);function C(e){let[{defaultConfig:n},o]=(0,d.splitProps)(e,[`defaultConfig`]),_=t.usePowerlines(),C=(0,d.computed)(()=>_&&c.loadEnvFromContext(_,process.env)),w=l.createReflectionResource(_),T=(0,d.computed)(()=>new r.type_exports.ReflectionClass({kind:r.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${(0,m.titleCase)(_?.config?.name)} project.`,types:[]},w.data??void 0)),E=(0,d.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),D=(0,d.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return(0,u.createComponent)(a.BuiltinFile,(0,u.mergeProps)(o,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return(0,h.default)({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},o.imports??{})},get children(){return[(0,u.createComponent)(d.Show,{get when(){return!(0,p.isNull)(w.data)},get children(){return[(0,u.createComponent)(g,{get defaultValue(){return C.value},get reflection(){return w.data}}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{})]}}),(0,u.createComponent)(s.TypescriptObject,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:C,reflection:T,export:!0,const:!0}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(i.TSDoc,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[(0,u.createComponent)(i.TSDocLink,{children:`https://deepkit.io/docs/serialization/serializers`}),(0,u.createComponent)(i.TSDocLink,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),(0,u.createComponent)(i.TSDocRemarks,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),(0,u.createComponent)(f.ClassDeclaration,{refkey:S,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return(0,u.createComponent)(f.ClassMethod,{name:`constructor`,public:!0,children:d.code`
11
- super("env");
12
-
13
- this.deserializeRegistry.register(
14
- ReflectionKind.boolean,
15
- (type: Type, state: TemplateState) => {
16
- state.addSetter(
17
- \`typeof \${state.accessor.toString()} !== "boolean" ? \${state.accessor.toString()} === 1 || \${state.accessor.toString()} === "1" || \${state.accessor.toString()}.toLowerCase() === "t" || \${state.accessor.toString()}.toLowerCase() === "true" || \${state.accessor.toString()}.toLowerCase() === "y" || \${state.accessor.toString()}.toLowerCase() === "yes" : \${state.accessor.toString()}\`
18
- );
19
- }
20
- );
21
- `})}}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(i.TSDoc,{heading:`A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.`,get children(){return[(0,u.createComponent)(i.TSDocLink,{children:`https://deepkit.io/docs/serialization/serializers`}),(0,u.createComponent)(i.TSDocLink,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),(0,u.createComponent)(i.TSDocRemarks,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),(0,u.createComponent)(f.VarDeclaration,{name:`envSerializer`,export:!1,const:!0,get initializer(){return(0,u.createComponent)(f.NewExpression,{args:[],target:`EnvSerializer`})}}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(i.TSDoc,{heading:`Serialize a environment configuration object to JSON data objects (not a JSON string).`,get children(){return[(0,u.createComponent)(i.TSDocRemarks,{children:`The resulting JSON object can be stringified using JSON.stringify().`}),(0,u.createComponent)(i.TSDocExample,{children:`const json = serializeEnv(env);`}),(0,u.createComponent)(i.TSDocThrows,{children:`ValidationError when serialization or validation fails.`})]}}),(0,u.createComponent)(f.VarDeclaration,{name:`serializeEnv`,export:!0,const:!0,initializer:`serializeFunction<EnvBase>(envSerializer)`}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(i.TSDoc,{heading:`Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.`,get children(){return[(0,u.createComponent)(i.TSDocRemarks,{children:`Types that are already correct will be used as-is.`}),(0,u.createComponent)(i.TSDocExample,{children:`const env = deserializeEnv(json);`}),(0,u.createComponent)(i.TSDocThrows,{children:`ValidationError when deserialization fails.`})]}}),(0,u.createComponent)(f.VarDeclaration,{name:`deserializeEnv`,export:!0,const:!0,initializer:`deserializeFunction<EnvBase>(envSerializer)`}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(i.TSDoc,{heading:`Initializes the Powerlines environment configuration module.`,get children(){return[(0,u.createComponent)(i.TSDocRemarks,{children:`This function initializes the Powerlines environment configuration object.`}),(0,u.createComponent)(i.TSDocParam,{name:`environmentConfig`,children:`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}),(0,u.createComponent)(i.TSDocReturns,{children:`The initialized Powerlines configuration object.`})]}}),(0,u.createComponent)(d.Show,{get when(){return!!_?.entryPath},get children(){return(0,u.createComponent)(f.FunctionDeclaration,{refkey:b,async:!1,export:!0,name:`createEnv`,parameters:[{name:`environmentConfig`,type:`Partial<Env>`,optional:!1,default:`{}`}],returnType:`Env`,get children(){return[d.code`
22
- return new Proxy<Env>(
23
- deserializeEnv({
24
- ...initialEnv,
25
- ...environmentConfig
26
- }) as Env,
27
- {
28
- get: (target: EnvBase, propertyName: string) => { `,(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(d.For,{each:E,children:(e,t)=>(0,u.createComponent)(v,{index:t,context:_,property:e})}),d.code`
29
- return undefined;
30
- }, `,(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),d.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(d.For,{each:D,ender:d.code` else `,children:(e,t)=>(0,u.createComponent)(y,{index:t,context:_,property:e})}),(0,u.createIntrinsic)(`hbr`,{}),d.code`return false;
31
- }
32
- }
33
- );
34
- `]}})}}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createIntrinsic)(`hbr`,{}),(0,u.createComponent)(f.VarDeclaration,{refkey:x,name:`env`,type:`Env`,export:!0,const:!0,get initializer(){return[d.code`createEnv(`,n||`{}`,d.code` as Partial<Env>)`]}})]}}))}exports.EnvBuiltin=C,exports.EnvTypeDefinition=g;
@@ -1,31 +0,0 @@
1
- import{usePowerlines as e}from"../../../alloy/src/core/contexts/context.mjs";import{refkey as t}from"../../../alloy/src/helpers/refkey.mjs";import{type_exports as n}from"../../../deepkit/src/vendor/type.mjs";import{TSDoc as r,TSDocExample as i,TSDocLink as a,TSDocParam as o,TSDocRemarks as s,TSDocReturns as c,TSDocThrows as l}from"../../../alloy/src/typescript/components/tsdoc.mjs";import{BuiltinFile as u}from"../../../alloy/src/typescript/components/builtin-file.mjs";import{TypeScriptInterface as d}from"../../../alloy/src/typescript/components/typescript-interface.mjs";import{TypescriptObject as f}from"../../../alloy/src/typescript/components/typescript-object.mjs";import{loadEnvFromContext as p}from"../helpers/load.mjs";import{createReflectionResource as m}from"../helpers/create-reflection-resource.mjs";import{createComponent as h,createIntrinsic as g,memo as _,mergeProps as v}from"@alloy-js/core/jsx-runtime";import{For as y,Show as b,code as x,computed as S,splitProps as C}from"@alloy-js/core";import{ClassDeclaration as w,ClassMethod as T,ElseIfClause as E,FunctionDeclaration as D,IfStatement as O,NewExpression as k,TypeDeclaration as A,VarDeclaration as j}from"@alloy-js/typescript";import{isNull as M}from"@stryke/type-checks/is-null";import{titleCase as N}from"@stryke/string-format/title-case";import P from"defu";function F(t){let[{defaultValue:n,reflection:r}]=C(t,[`defaultValue`,`reflection`]),i=e();return[h(d,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:n,reflection:r,export:!0}),g(`hbr`,{}),g(`hbr`,{}),h(A,{name:`Env`,export:!0,get children(){return x` {
2
- [Key in keyof EnvBase as Key ${i?.config.env.prefix.map(e=>`| \`${e.replace(/_$/g,``)}_\${Key}\``).join(` `)}]: EnvBase[Key];
3
- }
4
- `}})]}function I(e){let[{context:t,name:n}]=C(e,[`context`,`name`]);return t?x`propertyName === "${n}" || propertyName.replace(/^(${t.config.env.prefix.sort((e,t)=>e.startsWith(t)?-1:t.startsWith(e)?1:e.localeCompare(t)).map(e=>`${e.replace(/_$/,``)}_`).join(`|`)})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${n.toLowerCase().replace(/[\s\-_]+/g,``)}"`:null}function L(e){let[{context:t,property:n,index:r}]=C(e,[`context`,`property`,`index`]);return t?[h(r===0?O:E,{get condition(){return[h(I,{get name(){return n.getNameAsString()},context:t}),h(b,{get when(){return _(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[x` || `,h(y,{get each(){return n.getAlias()},joiner:x` || `,children:e=>h(I,{name:e,context:t})})]}})]},get children(){return x`return target["${n.getNameAsString()}"];`}})]:null}function R(e){let[{context:t,property:n,index:r}]=C(e,[`context`,`property`,`index`]);return t?[h(r===0?O:E,{get condition(){return[h(I,{get name(){return n.getNameAsString()},context:t}),h(b,{get when(){return _(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[x` || `,h(y,{get each(){return n.getAlias()},joiner:x` || `,children:e=>h(I,{name:e,context:t})})]}})]},get children(){return x`
5
- target["${n.getNameAsString()}"] = newValue;
6
- return true;
7
- `}})]:null}const z=t(`createEnv`),B=t(`env`),V=t(`EnvSerializer`);function H(t){let[{defaultConfig:d},_]=C(t,[`defaultConfig`]),E=e(),O=S(()=>E&&p(E,process.env)),A=m(E),I=S(()=>new n.ReflectionClass({kind:n.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${N(E?.config?.name)} project.`,types:[]},A.data??void 0)),H=S(()=>A.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),U=S(()=>A.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return h(u,v(_,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return P({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},_.imports??{})},get children(){return[h(b,{get when(){return!M(A.data)},get children(){return[h(F,{get defaultValue(){return O.value},get reflection(){return A.data}}),g(`hbr`,{}),g(`hbr`,{})]}}),h(f,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:O,reflection:I,export:!0,const:!0}),g(`hbr`,{}),g(`hbr`,{}),h(r,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[h(a,{children:`https://deepkit.io/docs/serialization/serializers`}),h(a,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),h(s,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),h(w,{refkey:V,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return h(T,{name:`constructor`,public:!0,children:x`
8
- super("env");
9
-
10
- this.deserializeRegistry.register(
11
- ReflectionKind.boolean,
12
- (type: Type, state: TemplateState) => {
13
- state.addSetter(
14
- \`typeof \${state.accessor.toString()} !== "boolean" ? \${state.accessor.toString()} === 1 || \${state.accessor.toString()} === "1" || \${state.accessor.toString()}.toLowerCase() === "t" || \${state.accessor.toString()}.toLowerCase() === "true" || \${state.accessor.toString()}.toLowerCase() === "y" || \${state.accessor.toString()}.toLowerCase() === "yes" : \${state.accessor.toString()}\`
15
- );
16
- }
17
- );
18
- `})}}),g(`hbr`,{}),g(`hbr`,{}),h(r,{heading:`A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.`,get children(){return[h(a,{children:`https://deepkit.io/docs/serialization/serializers`}),h(a,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),h(s,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),h(j,{name:`envSerializer`,export:!1,const:!0,get initializer(){return h(k,{args:[],target:`EnvSerializer`})}}),g(`hbr`,{}),g(`hbr`,{}),h(r,{heading:`Serialize a environment configuration object to JSON data objects (not a JSON string).`,get children(){return[h(s,{children:`The resulting JSON object can be stringified using JSON.stringify().`}),h(i,{children:`const json = serializeEnv(env);`}),h(l,{children:`ValidationError when serialization or validation fails.`})]}}),h(j,{name:`serializeEnv`,export:!0,const:!0,initializer:`serializeFunction<EnvBase>(envSerializer)`}),g(`hbr`,{}),g(`hbr`,{}),h(r,{heading:`Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.`,get children(){return[h(s,{children:`Types that are already correct will be used as-is.`}),h(i,{children:`const env = deserializeEnv(json);`}),h(l,{children:`ValidationError when deserialization fails.`})]}}),h(j,{name:`deserializeEnv`,export:!0,const:!0,initializer:`deserializeFunction<EnvBase>(envSerializer)`}),g(`hbr`,{}),g(`hbr`,{}),h(r,{heading:`Initializes the Powerlines environment configuration module.`,get children(){return[h(s,{children:`This function initializes the Powerlines environment configuration object.`}),h(o,{name:`environmentConfig`,children:`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}),h(c,{children:`The initialized Powerlines configuration object.`})]}}),h(b,{get when(){return!!E?.entryPath},get children(){return h(D,{refkey:z,async:!1,export:!0,name:`createEnv`,parameters:[{name:`environmentConfig`,type:`Partial<Env>`,optional:!1,default:`{}`}],returnType:`Env`,get children(){return[x`
19
- return new Proxy<Env>(
20
- deserializeEnv({
21
- ...initialEnv,
22
- ...environmentConfig
23
- }) as Env,
24
- {
25
- get: (target: EnvBase, propertyName: string) => { `,g(`hbr`,{}),h(y,{each:H,children:(e,t)=>h(L,{index:t,context:E,property:e})}),x`
26
- return undefined;
27
- }, `,g(`hbr`,{}),g(`hbr`,{}),x` set: (target: EnvBase, propertyName: string, newValue: any) => { `,g(`hbr`,{}),h(y,{each:U,ender:x` else `,children:(e,t)=>h(R,{index:t,context:E,property:e})}),g(`hbr`,{}),x`return false;
28
- }
29
- }
30
- );
31
- `]}})}}),g(`hbr`,{}),g(`hbr`,{}),g(`hbr`,{}),h(j,{refkey:B,name:`env`,type:`Env`,export:!0,const:!0,get initializer(){return[x`createEnv(`,d||`{}`,x` as Partial<Env>)`]}})]}}))}export{H as EnvBuiltin,F as EnvTypeDefinition};
@@ -1 +0,0 @@
1
- const e=require(`./env.cjs`);require(`./docs.cjs`);
@@ -1 +0,0 @@
1
- import{EnvBuiltin as e,EnvTypeDefinition as t}from"./env.mjs";import"./docs.mjs";export{};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`automd`);const r=e=>(0,n.defineGenerator)({name:`env`,async generate(){let n=(0,t.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(n)?{contents:await e.fs.read(n)||``}:{contents:``}}});exports.env=r;
@@ -1 +0,0 @@
1
- import{joinPaths as e}from"@stryke/path/join-paths";import{defineGenerator as t}from"automd";const n=n=>t({name:`env`,async generate(){let t=e(n.config.projectRoot,`docs`,`generated`,`env.md`);return n.fs.existsSync(t)?{contents:await n.fs.read(t)||``}:{contents:``}}});export{n as env};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../deepkit/src/vendor/type.cjs`),n=require(`./persistence.cjs`),r=require(`./load.cjs`);let i=require(`@alloy-js/core`),a=require(`@stryke/string-format/title-case`);function o(e){let o=(0,i.computed)(()=>e&&r.loadEnvFromContext(e,process.env));return(0,i.createResource)(async()=>{if(!e)return new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the Powerlines project.`,types:[]});let r=await n.readEnvTypeReflection(e,`env`);return r.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{r.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(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||(0,a.titleCase)(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),r.getProperties().forEach(e=>{e.setDefaultValue(o.value?.[e.getNameAsString()]??e.getAlias().reduce((e,t)=>e??o.value?.[t],void 0)??e.getDefaultValue())}),r})}exports.createReflectionResource=o;
@@ -1 +0,0 @@
1
- import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{readEnvTypeReflection as t}from"./persistence.mjs";import{loadEnvFromContext as n}from"./load.mjs";import{computed as r,createResource as i}from"@alloy-js/core";import{titleCase as a}from"@stryke/string-format/title-case";function o(o){let s=r(()=>o&&n(o,process.env));return i(async()=>{if(!o)return new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the Powerlines project.`,types:[]});let n=await t(o,`env`);return n.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{n.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(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||a(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),n.getProperties().forEach(e=>{e.setDefaultValue(s.value?.[e.getNameAsString()]??e.getAlias().reduce((e,t)=>e??s.value?.[t],void 0)??e.getDefaultValue())}),n})}export{o as createReflectionResource};
@@ -1 +0,0 @@
1
- const e=require(`./reflect.cjs`),t=require(`./persistence.cjs`),n=require(`./source-file-env.cjs`),r=require(`./load.cjs`),i=require(`./create-reflection-resource.cjs`);require(`./template-helpers.cjs`);
@@ -1 +0,0 @@
1
- import{BaseEnv as e,BaseSecrets as t,createEnvReflection as n,createSecretsReflection as r,mergeEnvReflections as i,mergeSecretsReflections as a,reflectEnv as o,reflectSecrets as s}from"./reflect.mjs";import{getEnvDefaultTypeDefinition as c,getEnvReflectionsPath as l,getEnvTypeReflectionsPath as u,getSecretsDefaultTypeDefinition as d,readEnvReflection as f,readEnvTypeReflection as p,readSecretsReflection as m,resolveRuntimeTypeFile as h,writeEnvReflection as g,writeEnvTypeReflection as _}from"./persistence.mjs";import{removeEnvPrefix as v}from"./source-file-env.mjs";import{loadEnv as y,loadEnvFromContext as b}from"./load.mjs";import{createReflectionResource as x}from"./create-reflection-resource.mjs";import"./template-helpers.mjs";export{};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`./source-file-env.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`defu`);r=e.__toESM(r);let i=require(`@stryke/type-checks/is-set-object`),a=require(`@stryke/path/join-paths`),o=require(`c12`),s=require(`@stryke/env/load-env`),c=require(`@stryke/string-format/kebab-case`);async function l(e,n,i){let a=await(0,s.loadEnv)(i,n);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(async e=>(0,s.loadEnvFile)(e,i)));for(let e of t)a=(0,r.default)(e,a)}return t.removeEnvPrefix(a)}async function u(e,t,n,i,s,c){let[u,d]=await Promise.all([l(e,n,t),(0,o.loadConfig)({cwd:t,name:`storm`,envName:n,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:n,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:(0,a.joinPaths)(i,`jiti`),moduleCache:!0}})]);return(0,r.default)(u,d.config,c)}function d(e,t){return(0,r.default)({APP_NAME:(0,c.kebabCase)(e.config.name||e.packageJson.name?.replace(`/${e.workspaceConfig.namespace}`,``)),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${(0,c.kebabCase)(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:(0,n.isSetString)(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},(0,i.isSetObject)(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,n)=>(e[n.name]=t[n.name]??n.getDefaultValue(),e),{}):{})}async function f(e,t){let[n,i,a]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return(0,r.default)(d(e,process.env),n,i,a)}exports.loadEnv=f,exports.loadEnvFromContext=d;
@@ -1 +0,0 @@
1
- import{removeEnvPrefix as e}from"./source-file-env.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import n from"defu";import{isSetObject as r}from"@stryke/type-checks/is-set-object";import{joinPaths as i}from"@stryke/path/join-paths";import{loadConfig as a}from"c12";import{loadEnv as o,loadEnvFile as s}from"@stryke/env/load-env";import{kebabCase as c}from"@stryke/string-format/kebab-case";async function l(t,r,i){let a=await o(i,r);if(t.additionalFiles&&t.additionalFiles?.length>0){let e=await Promise.all(t.additionalFiles.map(async e=>s(e,i)));for(let t of e)a=n(t,a)}return e(a)}async function u(e,t,r,o,s,c){let[u,d]=await Promise.all([l(e,r,t),a({cwd:t,name:`storm`,envName:r,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:r,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:i(o,`jiti`),moduleCache:!0}})]);return n(u,d.config,c)}function d(e,i){return n({APP_NAME:c(e.config.name||e.packageJson.name?.replace(`/${e.workspaceConfig.namespace}`,``)),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${c(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:t(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},r(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,t)=>(e[t.name]=i[t.name]??t.getDefaultValue(),e),{}):{})}async function f(e,t){let[r,i,a]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return n(d(e,process.env),r,i,a)}export{f as loadEnv,d as loadEnvFromContext};
@@ -1 +0,0 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../deepkit/src/vendor/type.cjs`),n=require(`../../../deepkit/src/capnp.cjs`),r=require(`../../../deepkit/schemas/reflection2.cjs`),i=require(`../../../deepkit/src/resolve-reflections.cjs`),a=require(`./reflect.cjs`);let o=require(`@stryke/path/join-paths`),s=require(`@stryke/capnp`);s=e.__toESM(s);let c=require(`@stryke/fs/buffer`),l=require(`node:fs`),u=require(`@stryke/fs/resolve`),d=require(`@stryke/type-checks/is-empty-object`);async function f(e){return(0,u.resolvePackage)(`@powerlines/plugin-env/types/runtime`,{paths:[e.workspaceConfig.workspaceRoot,(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot)]})}async function p(e){return{file:await f(e),name:`EnvInterface`}}async function m(e){return{file:await f(e),name:`SecretsInterface`}}function h(e,t=`env`){return(0,o.joinPaths)(i.getReflectionsPath(e),`env`,`${t}-types.bin`)}async function g(e,i=`env`){let o=h(e,i);if(!(0,l.existsSync)(o)){if(!e.env.types.env||(0,d.isEmptyObject)(e.env.types.env)){let t=a.createEnvReflection(e),n=new s.Message;t.messageRoot=n.initRoot(r.SerializedTypes),t.dataBuffer=n.toArrayBuffer(),e.env.types.env=t,await _(e,e.env.types.env,i)}return e.env.types.env}let u=await(0,c.readFileBuffer)(o),f=new s.Message(u,!1).getRoot(r.SerializedTypes),p=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(f.types)));return e.env.types[i]=p,e.env.types[i].messageRoot=f,e.env.types[i].dataBuffer=u,p}async function _(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n.convertToCapnp(a,o.initRoot(r.SerializedTypes)._initTypes(a.length)),await(0,c.writeFileBuffer)(h(e,i),o.toArrayBuffer())}function v(e,t){return(0,o.joinPaths)(i.getReflectionsPath(e),`env`,`${t}.bin`)}async function y(e){let i=v(e,`env`);if(!(0,l.existsSync)(i)){if(e.env.types.env||(e.env.types.env=await g(e,`env`)),!e.env.used.env||(0,d.isEmptyObject)(e.env.used.env)){let n=a.createEnvReflection(e,{type:{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.env});n.name=`Env`;let i=new s.Message;n.messageRoot=i.initRoot(r.SerializedTypes),n.dataBuffer=i.toArrayBuffer(),e.env.used.env=n,await x(e,e.env.used.env,`env`)}return e.env.used.env}let o=await(0,c.readFileBuffer)(i),u=new s.Message(o,!1).getRoot(r.SerializedTypes),f=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(u.types)));return e.env.used.env=f,e.env.used.env.messageRoot=u,e.env.used.env.dataBuffer=o,f}async function b(e){let i=v(e,`secrets`);if(!(0,l.existsSync)(i)){if(e.env.types.secrets||(e.env.types.secrets=await g(e,`secrets`)),!e.env.used.secrets||(0,d.isEmptyObject)(e.env.used.secrets)){let n=a.createEnvReflection(e,{type:{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.secrets});n.name=`Secrets`;let i=new s.Message;n.messageRoot=i.initRoot(r.SerializedTypes),n.dataBuffer=i.toArrayBuffer(),e.env.used.secrets=n,await x(e,e.env.used.secrets,`secrets`)}return e.env.used.secrets}let o=await(0,c.readFileBuffer)(i),u=new s.Message(o,!1).getRoot(r.SerializedTypes),f=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(u.types)));return e.env.used.secrets=f,e.env.used.secrets.messageRoot=u,e.env.used.secrets.dataBuffer=o,f}async function x(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n.convertToCapnp(a,o.initRoot(r.SerializedTypes)._initTypes(a.length)),await(0,c.writeFileBuffer)(v(e,i),o.toArrayBuffer())}exports.getEnvDefaultTypeDefinition=p,exports.getEnvReflectionsPath=v,exports.getEnvTypeReflectionsPath=h,exports.getSecretsDefaultTypeDefinition=m,exports.readEnvReflection=y,exports.readEnvTypeReflection=g,exports.readSecretsReflection=b,exports.resolveRuntimeTypeFile=f,exports.writeEnvReflection=x,exports.writeEnvTypeReflection=_;
@@ -1 +0,0 @@
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{joinPaths as o}from"@stryke/path/join-paths";import*as s from"@stryke/capnp";import{readFileBuffer as c,writeFileBuffer as l}from"@stryke/fs/buffer";import{existsSync as u}from"node:fs";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,o(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 o(i(e),`env`,`${t}-types.bin`)}async function _(n,i=`env`){let o=g(n,i);if(!u(o)){if(!n.env.types.env||f(n.env.types.env)){let e=a(n),t=new s.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 l=await c(o),d=new s.Message(l,!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=l,p}async function v(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n(a,o.initRoot(r)._initTypes(a.length)),await l(g(e,i),o.toArrayBuffer())}function y(e,t){return o(i(e),`env`,`${t}.bin`)}async function b(n){let i=y(n,`env`);if(!u(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 s.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 o=await c(i),l=new s.Message(o,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(l.types)));return n.env.used.env=d,n.env.used.env.messageRoot=l,n.env.used.env.dataBuffer=o,d}async function x(n){let i=y(n,`secrets`);if(!u(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 s.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 o=await c(i),l=new s.Message(o,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(l.types)));return n.env.used.secrets=d,n.env.used.secrets.messageRoot=l,n.env.used.secrets.dataBuffer=o,d}async function S(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n(a,o.initRoot(r)._initTypes(a.length)),await l(y(e,i),o.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};
@@ -1 +0,0 @@
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/string-format/title-case`),a=require(`@stryke/path/is-parent-path`),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,i.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,i.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Env`;let a=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,i.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return a.name=`Env`,a}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,i.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,i.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Secrets`;let a=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,i.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return a.name=`Secrets`,a}async function p(e,i,c){let l;i&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,a.isParentPath)(i,e.workspaceConfig.workspaceRoot)?i:(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,i),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,i,s){let l;i&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,a.isParentPath)(i,e.workspaceConfig.workspaceRoot)?i:(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,i),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;
@@ -1 +0,0 @@
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{titleCase as o}from"@stryke/string-format/title-case";import{isParentPath as s}from"@stryke/path/is-parent-path";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 ${o(t.config.name)} project.`,classType:d,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${o(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?`${o(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 ${o(t.config.name)} project.`,classType:f,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${o(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?`${o(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function h(r,a,o){let u;a&&(u=(0,e.resolveClassType)(await t(r,{file:s(a,r.workspaceConfig.workspaceRoot)?a:c(r.workspaceConfig.workspaceRoot,a),name:o},{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,o){let l;i&&(l=(0,e.resolveClassType)(await t(n,{file:s(i,n.workspaceConfig.workspaceRoot)?i:c(n.workspaceConfig.workspaceRoot,i),name:o},{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};
@@ -1 +0,0 @@
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;
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
1
- require(`./persistence.cjs`);let e=require(`@stryke/string-format/title-case`);
@@ -1 +0,0 @@
1
- import"./persistence.mjs";import{titleCase as e}from"@stryke/string-format/title-case";export{};
@@ -1,10 +0,0 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../deepkit/src/vendor/type.cjs`),n=require(`../../alloy/src/create-plugin.cjs`),r=require(`../../plugin-babel/src/index.cjs`),i=require(`../../plugin-automd/src/index.cjs`),a=require(`./helpers/reflect.cjs`),o=require(`./helpers/persistence.cjs`),s=require(`./babel/plugin.cjs`),c=require(`./helpers/source-file-env.cjs`),l=require(`./helpers/load.cjs`),u=require(`./helpers/create-reflection-resource.cjs`),d=require(`./components/env.cjs`),f=require(`./helpers/automd-generator.cjs`);require(`./babel/index.cjs`),require(`./components/index.cjs`),require(`./helpers/index.cjs`);let p=require(`@alloy-js/core/jsx-runtime`),m=require(`@stryke/string-format/title-case`),h=require(`defu`);h=e.__toESM(h);let g=require(`@storm-software/config-tools/types`),_=require(`@stryke/path/is-parent-path`),v=require(`@stryke/convert/to-array`),y=require(`@stryke/convert/parse-type-definition`),b=require(`@stryke/env/types`),x=require(`@stryke/fs/exists`),S=require(`@stryke/fs/helpers`),C=require(`@stryke/path/join`),w=require(`@stryke/string-format/constant-case`);const T=n.createAlloyPlugin((e={})=>({name:`env`,async config(){this.log(g.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,h.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[s.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,y.parseTypeDefinition)(t.env.types);else{this.log(g.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await o.getEnvDefaultTypeDefinition(this);t.env.types=(0,y.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,y.parseTypeDefinition)(t.env.secrets);else{let e=await o.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,y.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,v.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,w.constantCase)(t);return e.includes(n)||e.push(n),e},[...b.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(g.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,h.default)({parsed:await l.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,x.existsSync)(o.getEnvTypeReflectionsPath(this,`env`)))this.log(g.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await o.readEnvTypeReflection(this,`env`),(0,x.existsSync)(o.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await o.readEnvReflection(this)),(0,x.existsSync)(o.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await o.readEnvTypeReflection(this,`secrets`)),(0,x.existsSync)(o.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await o.readSecretsReflection(this));else{if(this.env.types.env=await a.reflectEnv(this,this.config.env.types?.file?(0,_.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,C.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 o.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await a.reflectSecrets(this,this.config.env.secrets?.file?(0,_.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,C.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 o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.log(g.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 l.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 t.type_exports.ReflectionClass({kind:t.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 o.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.type_exports.ReflectionClass({kind:t.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 o.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},render(){let e=this;return this.log(g.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),(0,p.createComponent)(d.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(g.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=(0,C.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,x.existsSync)(e)||await(0,S.createDirectory)(e);let n=await o.readEnvTypeReflection(this,`env`),r=(0,C.joinPaths)(e,`env.md`);this.log(g.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,m.titleCase)(this.config.framework)||`Powerlines`} -->
2
-
3
- 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. The variables in the list below 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.
4
-
5
- | Name | Description | Type | Default Value | Required |
6
- | ---- | ----------- | ---- | ------------- | :------: |
7
- ${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>`| ${e.getNameAsString().trim()} | ${(e.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
8
- `,``)??``).trim()} | ${(0,t.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `)} | ${e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``} | ${e.isValueRequired()?``:`✔`} |`).join(`
9
- `)}
10
- `)},async buildEnd(){let e=o.getEnvReflectionsPath(this,`env`);this.log(g.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await o.writeEnvReflection(this,this.env.used.env,`env`)}})),E=(e={})=>[r.default(e.babel),T(e),{name:`env:automd-generator`,config(){return{automd:(0,h.default)(e.automd??{},{generators:{env:f.env(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},i.default(e.automd)];var D=E;exports.default=D;