@powerlines/plugin-env 0.14.12 → 0.14.14

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 (104) hide show
  1. package/dist/babel/plugin.cjs +4 -4
  2. package/dist/babel/plugin.mjs +3 -3
  3. package/dist/components/docs.cjs +1 -1
  4. package/dist/components/docs.mjs +1 -1
  5. package/dist/components/env.cjs +2 -2
  6. package/dist/components/env.mjs +2 -2
  7. package/dist/deepkit/src/utilities.cjs +1 -1
  8. package/dist/deepkit/src/utilities.mjs +1 -1
  9. package/dist/helpers/load.cjs +1 -1
  10. package/dist/helpers/load.mjs +1 -1
  11. package/dist/helpers/reflect.cjs +1 -1
  12. package/dist/helpers/reflect.mjs +1 -1
  13. package/dist/helpers/source-file-env.cjs +1 -1
  14. package/dist/helpers/source-file-env.mjs +1 -1
  15. package/dist/index.cjs +2 -2
  16. package/dist/index.d.cts +0 -2
  17. package/dist/index.mjs +2 -2
  18. package/dist/plugin-alloy/src/core/components/output.cjs +1 -1
  19. package/dist/plugin-alloy/src/core/components/output.mjs +1 -1
  20. package/dist/plugin-alloy/src/core/contexts/context.cjs +1 -1
  21. package/dist/plugin-alloy/src/core/contexts/context.mjs +1 -1
  22. package/dist/plugin-alloy/src/index.cjs +2 -2
  23. package/dist/plugin-alloy/src/index.mjs +2 -2
  24. package/dist/plugin-alloy/src/types/components.d.mts +1 -2
  25. package/dist/plugin-alloy/src/types/plugin.d.cts +3 -4
  26. package/dist/plugin-alloy/src/types/plugin.d.mts +3 -4
  27. package/dist/plugin-alloy/src/vendor.cjs +1 -0
  28. package/dist/plugin-alloy/src/vendor.d.cts +7 -0
  29. package/dist/plugin-alloy/src/vendor.d.mts +7 -0
  30. package/dist/plugin-alloy/src/vendor.mjs +1 -0
  31. package/dist/plugin-automd/src/index.cjs +1 -1
  32. package/dist/plugin-automd/src/index.mjs +1 -1
  33. package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -1
  34. package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -1
  35. package/dist/powerlines/src/lib/build/esbuild.cjs +9 -9
  36. package/dist/powerlines/src/lib/build/esbuild.mjs +9 -9
  37. package/dist/powerlines/src/lib/entry.cjs +1 -1
  38. package/dist/powerlines/src/lib/entry.mjs +1 -1
  39. package/dist/powerlines/src/lib/logger.cjs +1 -1
  40. package/dist/powerlines/src/lib/logger.mjs +1 -1
  41. package/dist/types/plugin.d.cts +0 -1
  42. package/package.json +8 -8
  43. package/dist/deepkit/src/vendor/core.cjs +0 -1
  44. package/dist/deepkit/src/vendor/core.mjs +0 -1
  45. package/dist/plugin-alloy/src/core/components/index.cjs +0 -1
  46. package/dist/plugin-alloy/src/core/components/index.mjs +0 -1
  47. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -1
  48. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -1
  49. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -1
  50. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -1
  51. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -1
  52. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -1
  53. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -1
  54. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -1
  55. package/dist/plugin-alloy/src/core/index.cjs +0 -1
  56. package/dist/plugin-alloy/src/core/index.mjs +0 -1
  57. package/dist/plugin-alloy/src/helpers/capnp.cjs +0 -1
  58. package/dist/plugin-alloy/src/helpers/capnp.mjs +0 -1
  59. package/dist/plugin-alloy/src/helpers/create-builtin.cjs +0 -1
  60. package/dist/plugin-alloy/src/helpers/create-builtin.mjs +0 -1
  61. package/dist/plugin-alloy/src/helpers/index.cjs +0 -1
  62. package/dist/plugin-alloy/src/helpers/index.mjs +0 -1
  63. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -1
  64. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -1
  65. package/dist/plugin-alloy/src/helpers/typescript.cjs +0 -1
  66. package/dist/plugin-alloy/src/helpers/typescript.mjs +0 -1
  67. package/dist/plugin-alloy/src/markdown/components/index.cjs +0 -1
  68. package/dist/plugin-alloy/src/markdown/components/index.mjs +0 -1
  69. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -1
  70. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -1
  71. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -1
  72. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -1
  73. package/dist/plugin-alloy/src/markdown/contexts/index.cjs +0 -1
  74. package/dist/plugin-alloy/src/markdown/contexts/index.mjs +0 -1
  75. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -1
  76. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -1
  77. package/dist/plugin-alloy/src/markdown/index.cjs +0 -1
  78. package/dist/plugin-alloy/src/markdown/index.mjs +0 -1
  79. package/dist/plugin-alloy/src/types/components.d.cts +0 -2
  80. package/dist/plugin-alloy/src/types/index.d.cts +0 -2
  81. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -1
  82. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -1
  83. package/dist/plugin-alloy/src/typescript/components/dynamic-import-statement.cjs +0 -1
  84. package/dist/plugin-alloy/src/typescript/components/dynamic-import-statement.mjs +0 -1
  85. package/dist/plugin-alloy/src/typescript/components/entry-file.cjs +0 -1
  86. package/dist/plugin-alloy/src/typescript/components/entry-file.mjs +0 -1
  87. package/dist/plugin-alloy/src/typescript/components/index.cjs +0 -1
  88. package/dist/plugin-alloy/src/typescript/components/index.mjs +0 -1
  89. package/dist/plugin-alloy/src/typescript/components/record-expression.cjs +0 -1
  90. package/dist/plugin-alloy/src/typescript/components/record-expression.mjs +0 -1
  91. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -1
  92. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -1
  93. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -1
  94. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -1
  95. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -1
  96. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -1
  97. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -1
  98. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -1
  99. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -1
  100. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -1
  101. package/dist/plugin-alloy/src/typescript/index.cjs +0 -1
  102. package/dist/plugin-alloy/src/typescript/index.mjs +0 -1
  103. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -1
  104. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -1
@@ -1,5 +1,5 @@
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`}.
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../plugin-babel/src/helpers/create-plugin.cjs`),r=require(`../plugin-babel/src/helpers/module-helpers.cjs`),i=require(`../deepkit/src/capnp.cjs`),a=require(`../deepkit/schemas/reflection2.cjs`),o=require(`../deepkit/src/utilities.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=n.createBabelPlugin(`env`,({log:e,context:n})=>{function f(t,r,i=!1){let a=n.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(t.name){let s=n.config.env.prefix.find(e=>t.name&&t.name.startsWith(e)&&(n.env.types.env?.hasProperty(t.name.replace(`${e}_`,``))||a.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 ${r.filename||`unknown file`}.`),n.env.types.env?.hasProperty(l)||a.some(e=>e.getAlias().includes(l))){let e=n.env.types.env.hasProperty(l)?n.env.types.env.getProperty(l):a.find(e=>e.getAlias().includes(l));if(!e||e.isIgnored())return;if(n.env.used.env.hasProperty(l)||n.env.used.env.addProperty(e.property),n.config.env.inject&&i){let t=n.env.parsed?.[l];if(t===void 0){let e=n.config.env.prefix.find(e=>n.env.parsed[`${e.replace(/_$/g,``)}_${l}`]);e&&(t=n.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 o.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 ${r.filename?r.filename:`unknown`}.
2
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;
3
+ The following environment configuration names are defined in the \`env\` type definition: \n${n.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${n.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.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}`),r.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}`),r.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}`),r.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 r=t.type_exports.ReflectionClass.from({kind:t.type_exports.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),o=s.getEnvReflectionsPath(n,`env`);o&&(0,d.existsSync)(o)&&(e(c.LogLevelLabel.TRACE,`Environment reflection file found at ${o}, reading existing reflection.`),r=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(i.convertFromCapnp(new l.Message((0,u.readFileBufferSync)(o),!1).getRoot(a.SerializedTypes).types)))),e(c.LogLevelLabel.TRACE,`Adding new variables to env reflection at ${o}.`),r.getProperties().filter(e=>e.getNameAsString()&&!n.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{n.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 +1,5 @@
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`}.
1
+ import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createBabelPlugin as t}from"../plugin-babel/src/helpers/create-plugin.mjs";import{addImport as n}from"../plugin-babel/src/helpers/module-helpers.mjs";import{convertFromCapnp as r}from"../deepkit/src/capnp.mjs";import{SerializedTypes as i}from"../deepkit/schemas/reflection2.mjs";import{stringifyDefaultValue as a}from"../deepkit/src/utilities.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=t(`env`,({log:t,context:d})=>{function f(e,n,r=!1){let i=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}_`,``))||i.some(n=>n.getAlias().includes(e.name.replace(`${t}_`,``))))),c=e.name;if(o&&(c=e.name.replace(`${o}_`,``)),t(s.TRACE,`Environment variable ${c} found in ${n.filename||`unknown file`}.`),d.env.types.env?.hasProperty(c)||i.some(e=>e.getAlias().includes(c))){let e=d.env.types.env.hasProperty(c)?d.env.types.env.getProperty(c):i.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&&r){let t=d.env.parsed?.[c];if(t===void 0){let e=d.config.env.prefix.find(e=>d.env.parsed[`${e.replace(/_$/g,``)}_${c}`]);e&&(t=d.env.parsed[`${e.replace(/_$/g,``)}_${c}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${c}\` is not defined in the .env configuration files`);return a(e,t)}}else throw Error(`The "${c}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${n.filename?n.filename:`unknown`}.
2
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(`
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)} ${i.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${i?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
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};
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 r=e.get(`property`)?.node;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(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 r=e.get(`property`)?.node;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(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 r=e.get(`property`)?.node;if(!r.name)return;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(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 r=e.get(`property`)?.node;if(!r.name)return;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){t(s.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let n=e.ReflectionClass.from({kind:e.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),a=o(d,`env`);a&&u(a)&&(t(s.TRACE,`Environment reflection file found at ${a}, reading existing reflection.`),n=(0,e.resolveClassType)((0,e.deserializeType)(r(new c.Message(l(a),!1).getRoot(i).types)))),t(s.TRACE,`Adding new variables to env reflection at ${a}.`),n.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 +1 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/create-reflection-resource.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@stryke/path/join`),o=require(`@alloy-js/markdown`),s=require(`@powerlines/alloy/core/contexts/context`),c=require(`@powerlines/alloy/markdown/components/markdown-file`),l=require(`@powerlines/alloy/markdown/components/markdown-table`);function u(){let e=(0,s.usePowerlines)();if(!e)return null;let u=n.createReflectionResource(e);return(0,r.createComponent)(c.MarkdownFile,{get path(){return(0,a.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[(0,r.createComponent)(o.Heading,{level:1,children:`Environment Configuration`}),i.code`Below is a list of environment variables used by the`,(0,r.createComponent)(i.Show,{get when(){return!!e?.packageJson.name},get children(){return(0,r.createComponent)(o.Link,{get href(){return`https://www.npmjs.com/package/${e?.packageJson.name}`},get title(){return e.packageJson.name}})}}),i.code`package. These values can be updated in the \`.env\` file in the root of the project.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(o.Heading,{level:2,children:`Environment Variables`}),i.code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(l.MarkdownTable,{get data(){return u.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>({name:e.getNameAsString().trim(),description:(e.getDescription()??``).trim(),type:(0,t.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `),defaultValue:e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``,required:e.isValueRequired()?``:`✔`}))??[]}})]}})}exports.EnvDocs=u;
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/create-reflection-resource.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@stryke/path/join`),o=require(`@powerlines/alloy/core/contexts/context`),s=require(`@alloy-js/markdown`),c=require(`@powerlines/alloy/markdown/components/markdown-file`),l=require(`@powerlines/alloy/markdown/components/markdown-table`);function u(){let e=(0,o.usePowerlines)();if(!e)return null;let u=n.createReflectionResource(e);return(0,r.createComponent)(c.MarkdownFile,{get path(){return(0,a.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[(0,r.createComponent)(s.Heading,{level:1,children:`Environment Configuration`}),i.code`Below is a list of environment variables used by the`,(0,r.createComponent)(i.Show,{get when(){return!!e?.packageJson.name},get children(){return(0,r.createComponent)(s.Link,{get href(){return`https://www.npmjs.com/package/${e?.packageJson.name}`},get title(){return e.packageJson.name}})}}),i.code`package. These values can be updated in the \`.env\` file in the root of the project.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(s.Heading,{level:2,children:`Environment Variables`}),i.code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(l.MarkdownTable,{get data(){return u.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>({name:e.getNameAsString().trim(),description:(e.getDescription()??``).trim(),type:(0,t.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `),defaultValue:e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``,required:e.isValueRequired()?``:`✔`}))??[]}})]}})}exports.EnvDocs=u;
@@ -1 +1 @@
1
- import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createReflectionResource as t}from"../helpers/create-reflection-resource.mjs";import{createComponent as n,createIntrinsic as r}from"@alloy-js/core/jsx-runtime";import{Show as i,code as a}from"@alloy-js/core";import{joinPaths as o}from"@stryke/path/join";import{Heading as s,Link as c}from"@alloy-js/markdown";import{usePowerlines as l}from"@powerlines/alloy/core/contexts/context";import{MarkdownFile as u}from"@powerlines/alloy/markdown/components/markdown-file";import{MarkdownTable as d}from"@powerlines/alloy/markdown/components/markdown-table";function f(){let f=l();if(!f)return null;let p=t(f);return n(u,{get path(){return o(f.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[n(s,{level:1,children:`Environment Configuration`}),a`Below is a list of environment variables used by the`,n(i,{get when(){return!!f?.packageJson.name},get children(){return n(c,{get href(){return`https://www.npmjs.com/package/${f?.packageJson.name}`},get title(){return f.packageJson.name}})}}),a`package. These values can be updated in the \`.env\` file in the root of the project.`,r(`hbr`,{}),n(s,{level:2,children:`Environment Variables`}),a`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,r(`hbr`,{}),n(d,{get data(){return p.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>({name:t.getNameAsString().trim(),description:(t.getDescription()??``).trim(),type:(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `),defaultValue:t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``,required:t.isValueRequired()?``:`✔`}))??[]}})]}})}export{f as EnvDocs};
1
+ import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createReflectionResource as t}from"../helpers/create-reflection-resource.mjs";import{createComponent as n,createIntrinsic as r}from"@alloy-js/core/jsx-runtime";import{Show as i,code as a}from"@alloy-js/core";import{joinPaths as o}from"@stryke/path/join";import{usePowerlines as s}from"@powerlines/alloy/core/contexts/context";import{Heading as c,Link as l}from"@alloy-js/markdown";import{MarkdownFile as u}from"@powerlines/alloy/markdown/components/markdown-file";import{MarkdownTable as d}from"@powerlines/alloy/markdown/components/markdown-table";function f(){let f=s();if(!f)return null;let p=t(f);return n(u,{get path(){return o(f.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[n(c,{level:1,children:`Environment Configuration`}),a`Below is a list of environment variables used by the`,n(i,{get when(){return!!f?.packageJson.name},get children(){return n(l,{get href(){return`https://www.npmjs.com/package/${f?.packageJson.name}`},get title(){return f.packageJson.name}})}}),a`package. These values can be updated in the \`.env\` file in the root of the project.`,r(`hbr`,{}),n(c,{level:2,children:`Environment Variables`}),a`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,r(`hbr`,{}),n(d,{get data(){return p.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>({name:t.getNameAsString().trim(),description:(t.getDescription()??``).trim(),type:(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `),defaultValue:t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``,required:t.isValueRequired()?``:`✔`}))??[]}})]}})}export{f as EnvDocs};
@@ -1,4 +1,4 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/load.cjs`),r=require(`../helpers/create-reflection-resource.cjs`);let i=require(`@alloy-js/core/jsx-runtime`),a=require(`@alloy-js/core`),o=require(`defu`);o=e.__toESM(o);let s=require(`@stryke/type-checks/is-null`),c=require(`@stryke/string-format/title-case`),l=require(`@alloy-js/typescript`),u=require(`@powerlines/alloy/core/contexts/context`),d=require(`@powerlines/alloy/helpers/refkey`),f=require(`@powerlines/alloy/typescript/components/builtin-file`),p=require(`@powerlines/alloy/typescript/components/tsdoc`),m=require(`@powerlines/alloy/typescript/components/typescript-interface`),h=require(`@powerlines/alloy/typescript/components/typescript-object`);function g(e){let[{defaultValue:t,reflection:n}]=(0,a.splitProps)(e,[`defaultValue`,`reflection`]),r=(0,u.usePowerlines)();return[(0,i.createComponent)(m.TypeScriptInterface,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(l.TypeDeclaration,{name:`Env`,export:!0,get children(){return a.code` {
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/load.cjs`),r=require(`../helpers/create-reflection-resource.cjs`);let i=require(`@alloy-js/core/jsx-runtime`),a=require(`@alloy-js/core`),o=require(`defu`);o=e.__toESM(o);let s=require(`@stryke/string-format/title-case`),c=require(`@stryke/type-checks/is-null`),l=require(`@alloy-js/typescript`),u=require(`@powerlines/alloy/core/contexts/context`),d=require(`@powerlines/alloy/helpers/refkey`),f=require(`@powerlines/alloy/typescript/components/builtin-file`),p=require(`@powerlines/alloy/typescript/components/tsdoc`),m=require(`@powerlines/alloy/typescript/components/typescript-interface`),h=require(`@powerlines/alloy/typescript/components/typescript-object`);function g(e){let[{defaultValue:t,reflection:n}]=(0,a.splitProps)(e,[`defaultValue`,`reflection`]),r=(0,u.usePowerlines)();return[(0,i.createComponent)(m.TypeScriptInterface,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(l.TypeDeclaration,{name:`Env`,export:!0,get children(){return a.code` {
2
2
  [Key in keyof EnvBase as Key ${r?.config.env.prefix.map(e=>`| \`${e.replace(/_$/g,``)}_\${Key}\``).join(` `)}]: EnvBase[Key];
3
3
  }
4
4
  `}})]}function _(e){let[{context:t,name:n}]=(0,a.splitProps)(e,[`context`,`name`]);return t?a.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,a.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,i.createComponent)(l.IfStatement,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`return target["${n.getNameAsString()}"];`}}):(0,i.createComponent)(l.ElseIfClause,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`return target["${n.getNameAsString()}"];`}})]:null}function y(e){let[{context:t,property:n,index:r}]=(0,a.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,i.createComponent)(l.IfStatement,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`
@@ -7,7 +7,7 @@ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/ve
7
7
  `}}):(0,i.createComponent)(l.ElseIfClause,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`
8
8
  target["${n.getNameAsString()}"] = newValue;
9
9
  return true;
10
- `}})]:null}const b=(0,d.refkey)(`createEnv`),x=(0,d.refkey)(`env`),S=(0,d.refkey)(`EnvSerializer`);function C(e){let[{defaultConfig:d},m]=(0,a.splitProps)(e,[`defaultConfig`]),_=(0,u.usePowerlines)(),C=(0,a.computed)(()=>_&&n.loadEnvFromContext(_,process.env)),w=r.createReflectionResource(_),T=(0,a.computed)(()=>new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${(0,c.titleCase)(_?.config?.name)} project.`,types:[]},w.data??void 0)),E=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),D=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return(0,i.createComponent)(f.BuiltinFile,(0,i.mergeProps)(m,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return(0,o.default)({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},m.imports??{})},get children(){return[(0,i.createComponent)(a.Show,{get when(){return!(0,s.isNull)(w.data)},get children(){return[(0,i.createComponent)(g,{get defaultValue(){return C.value},get reflection(){return w.data}}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{})]}}),(0,i.createComponent)(h.TypescriptObject,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:C,reflection:T,export:!0,const:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[(0,i.createComponent)(p.TSDocLink,{children:`https://deepkit.io/docs/serialization/serializers`}),(0,i.createComponent)(p.TSDocLink,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),(0,i.createComponent)(p.TSDocRemarks,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),(0,i.createComponent)(l.ClassDeclaration,{refkey:S,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return(0,i.createComponent)(l.ClassMethod,{name:`constructor`,public:!0,children:a.code`
10
+ `}})]:null}const b=(0,d.refkey)(`createEnv`),x=(0,d.refkey)(`env`),S=(0,d.refkey)(`EnvSerializer`);function C(e){let[{defaultConfig:d},m]=(0,a.splitProps)(e,[`defaultConfig`]),_=(0,u.usePowerlines)(),C=(0,a.computed)(()=>_&&n.loadEnvFromContext(_,process.env)),w=r.createReflectionResource(_),T=(0,a.computed)(()=>new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${(0,s.titleCase)(_?.config?.name)} project.`,types:[]},w.data??void 0)),E=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),D=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return(0,i.createComponent)(f.BuiltinFile,(0,i.mergeProps)(m,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return(0,o.default)({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},m.imports??{})},get children(){return[(0,i.createComponent)(a.Show,{get when(){return!(0,c.isNull)(w.data)},get children(){return[(0,i.createComponent)(g,{get defaultValue(){return C.value},get reflection(){return w.data}}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{})]}}),(0,i.createComponent)(h.TypescriptObject,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:C,reflection:T,export:!0,const:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[(0,i.createComponent)(p.TSDocLink,{children:`https://deepkit.io/docs/serialization/serializers`}),(0,i.createComponent)(p.TSDocLink,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),(0,i.createComponent)(p.TSDocRemarks,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),(0,i.createComponent)(l.ClassDeclaration,{refkey:S,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return(0,i.createComponent)(l.ClassMethod,{name:`constructor`,public:!0,children:a.code`
11
11
  super("env");
12
12
 
13
13
  this.deserializeRegistry.register(
@@ -1,10 +1,10 @@
1
- import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{loadEnvFromContext as t}from"../helpers/load.mjs";import{createReflectionResource as n}from"../helpers/create-reflection-resource.mjs";import{createComponent as r,createIntrinsic as i,memo as a,mergeProps as o}from"@alloy-js/core/jsx-runtime";import{For as s,Show as c,code as l,computed as u,splitProps as d}from"@alloy-js/core";import f from"defu";import{isNull as p}from"@stryke/type-checks/is-null";import{titleCase as m}from"@stryke/string-format/title-case";import{ClassDeclaration as h,ClassMethod as g,ElseIfClause as _,FunctionDeclaration as v,IfStatement as y,NewExpression as b,TypeDeclaration as x,VarDeclaration as S}from"@alloy-js/typescript";import{usePowerlines as C}from"@powerlines/alloy/core/contexts/context";import{refkey as w}from"@powerlines/alloy/helpers/refkey";import{BuiltinFile as T}from"@powerlines/alloy/typescript/components/builtin-file";import{TSDoc as E,TSDocExample as D,TSDocLink as O,TSDocParam as k,TSDocRemarks as A,TSDocReturns as j,TSDocThrows as M}from"@powerlines/alloy/typescript/components/tsdoc";import{TypeScriptInterface as N}from"@powerlines/alloy/typescript/components/typescript-interface";import{TypescriptObject as P}from"@powerlines/alloy/typescript/components/typescript-object";function F(e){let[{defaultValue:t,reflection:n}]=d(e,[`defaultValue`,`reflection`]),a=C();return[r(N,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),i(`hbr`,{}),i(`hbr`,{}),r(x,{name:`Env`,export:!0,get children(){return l` {
1
+ import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{loadEnvFromContext as t}from"../helpers/load.mjs";import{createReflectionResource as n}from"../helpers/create-reflection-resource.mjs";import{createComponent as r,createIntrinsic as i,memo as a,mergeProps as o}from"@alloy-js/core/jsx-runtime";import{For as s,Show as c,code as l,computed as u,splitProps as d}from"@alloy-js/core";import f from"defu";import{titleCase as p}from"@stryke/string-format/title-case";import{isNull as m}from"@stryke/type-checks/is-null";import{ClassDeclaration as h,ClassMethod as g,ElseIfClause as _,FunctionDeclaration as v,IfStatement as y,NewExpression as b,TypeDeclaration as x,VarDeclaration as S}from"@alloy-js/typescript";import{usePowerlines as C}from"@powerlines/alloy/core/contexts/context";import{refkey as w}from"@powerlines/alloy/helpers/refkey";import{BuiltinFile as T}from"@powerlines/alloy/typescript/components/builtin-file";import{TSDoc as E,TSDocExample as D,TSDocLink as O,TSDocParam as k,TSDocRemarks as A,TSDocReturns as j,TSDocThrows as M}from"@powerlines/alloy/typescript/components/tsdoc";import{TypeScriptInterface as N}from"@powerlines/alloy/typescript/components/typescript-interface";import{TypescriptObject as P}from"@powerlines/alloy/typescript/components/typescript-object";function F(e){let[{defaultValue:t,reflection:n}]=d(e,[`defaultValue`,`reflection`]),a=C();return[r(N,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),i(`hbr`,{}),i(`hbr`,{}),r(x,{name:`Env`,export:!0,get children(){return l` {
2
2
  [Key in keyof EnvBase as Key ${a?.config.env.prefix.map(e=>`| \`${e.replace(/_$/g,``)}_\${Key}\``).join(` `)}]: EnvBase[Key];
3
3
  }
4
4
  `}})]}function I(e){let[{context:t,name:n}]=d(e,[`context`,`name`]);return t?l`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:i}]=d(e,[`context`,`property`,`index`]);return t?[r(i===0?y:_,{get condition(){return[r(I,{get name(){return n.getNameAsString()},context:t}),r(c,{get when(){return a(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[l` || `,r(s,{get each(){return n.getAlias()},joiner:l` || `,children:e=>r(I,{name:e,context:t})})]}})]},get children(){return l`return target["${n.getNameAsString()}"];`}})]:null}function R(e){let[{context:t,property:n,index:i}]=d(e,[`context`,`property`,`index`]);return t?[r(i===0?y:_,{get condition(){return[r(I,{get name(){return n.getNameAsString()},context:t}),r(c,{get when(){return a(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[l` || `,r(s,{get each(){return n.getAlias()},joiner:l` || `,children:e=>r(I,{name:e,context:t})})]}})]},get children(){return l`
5
5
  target["${n.getNameAsString()}"] = newValue;
6
6
  return true;
7
- `}})]:null}const z=w(`createEnv`),B=w(`env`),V=w(`EnvSerializer`);function H(a){let[{defaultConfig:_},y]=d(a,[`defaultConfig`]),x=C(),w=u(()=>x&&t(x,process.env)),N=n(x),I=u(()=>new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${m(x?.config?.name)} project.`,types:[]},N.data??void 0)),H=u(()=>N.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),U=u(()=>N.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return r(T,o(y,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return f({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},y.imports??{})},get children(){return[r(c,{get when(){return!p(N.data)},get children(){return[r(F,{get defaultValue(){return w.value},get reflection(){return N.data}}),i(`hbr`,{}),i(`hbr`,{})]}}),r(P,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:w,reflection:I,export:!0,const:!0}),i(`hbr`,{}),i(`hbr`,{}),r(E,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[r(O,{children:`https://deepkit.io/docs/serialization/serializers`}),r(O,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),r(A,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),r(h,{refkey:V,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return r(g,{name:`constructor`,public:!0,children:l`
7
+ `}})]:null}const z=w(`createEnv`),B=w(`env`),V=w(`EnvSerializer`);function H(a){let[{defaultConfig:_},y]=d(a,[`defaultConfig`]),x=C(),w=u(()=>x&&t(x,process.env)),N=n(x),I=u(()=>new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${p(x?.config?.name)} project.`,types:[]},N.data??void 0)),H=u(()=>N.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),U=u(()=>N.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return r(T,o(y,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return f({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},y.imports??{})},get children(){return[r(c,{get when(){return!m(N.data)},get children(){return[r(F,{get defaultValue(){return w.value},get reflection(){return N.data}}),i(`hbr`,{}),i(`hbr`,{})]}}),r(P,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:w,reflection:I,export:!0,const:!0}),i(`hbr`,{}),i(`hbr`,{}),r(E,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[r(O,{children:`https://deepkit.io/docs/serialization/serializers`}),r(O,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),r(A,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),r(h,{refkey:V,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return r(g,{name:`constructor`,public:!0,children:l`
8
8
  super("env");
9
9
 
10
10
  this.deserializeRegistry.register(
@@ -1 +1 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor/type.cjs`);let n=require(`@stryke/json/storm-json`),r=require(`@stryke/helpers/get-unique`),i=require(`@stryke/type-checks/is-null`),a=require(`@stryke/type-checks/is-string`),o=require(`@stryke/type-checks/is-undefined`);function s(e,t){return l(e.type,t??e.getDefaultValue())}function c(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function l(e,r){return(0,o.isUndefined)(r)?`undefined`:(0,i.isNull)(r)?`null`:e.kind===t.type_exports.ReflectionKind.boolean?String(r).trim().toLowerCase()===`true`?`true`:`false`:e.kind===t.type_exports.ReflectionKind.string||e.kind===t.type_exports.ReflectionKind.literal&&(0,a.isString)(e.literal)?c(r):e.kind===t.type_exports.ReflectionKind.enum?u(e).kind===t.type_exports.ReflectionKind.string?c(r):`${String(r)}`:e.kind===t.type_exports.ReflectionKind.union?f(e)?c(r):`${String(r)}`:e.kind===t.type_exports.ReflectionKind.array?c(n.StormJSON.stringify(r)):e.kind===t.type_exports.ReflectionKind.object||e.kind===t.type_exports.ReflectionKind.objectLiteral?n.StormJSON.stringify(r):e.kind===t.type_exports.ReflectionKind.property||e.kind===t.type_exports.ReflectionKind.parameter?l(e.type,r):String(r)}function u(e){if(e.kind!==t.type_exports.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${e.kind}.`);let n=(0,r.getUniqueBy)(e.values.filter(e=>e!=null),e=>(0,a.isString)(e)?{kind:t.type_exports.ReflectionKind.string}:{kind:t.type_exports.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&(0,a.isString)(n[0])?{kind:t.type_exports.ReflectionKind.string}:{kind:t.type_exports.ReflectionKind.number}}function d(e){if(e.kind===t.type_exports.ReflectionKind.union&&e.types.length>0)return(0,r.getUniqueBy)(e.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${e.kind}.`)}function f(e){return d(e).some(e=>e.kind===t.type_exports.ReflectionKind.string||e.kind===t.type_exports.ReflectionKind.literal&&(0,a.isString)(e.literal))}exports.stringifyDefaultValue=s;
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor/type.cjs`);let n=require(`@stryke/json/storm-json`),r=require(`@stryke/type-checks/is-string`),i=require(`@stryke/helpers/get-unique`),a=require(`@stryke/type-checks/is-null`),o=require(`@stryke/type-checks/is-undefined`);function s(e,t){return l(e.type,t??e.getDefaultValue())}function c(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function l(e,i){return(0,o.isUndefined)(i)?`undefined`:(0,a.isNull)(i)?`null`:e.kind===t.type_exports.ReflectionKind.boolean?String(i).trim().toLowerCase()===`true`?`true`:`false`:e.kind===t.type_exports.ReflectionKind.string||e.kind===t.type_exports.ReflectionKind.literal&&(0,r.isString)(e.literal)?c(i):e.kind===t.type_exports.ReflectionKind.enum?u(e).kind===t.type_exports.ReflectionKind.string?c(i):`${String(i)}`:e.kind===t.type_exports.ReflectionKind.union?f(e)?c(i):`${String(i)}`:e.kind===t.type_exports.ReflectionKind.array?c(n.StormJSON.stringify(i)):e.kind===t.type_exports.ReflectionKind.object||e.kind===t.type_exports.ReflectionKind.objectLiteral?n.StormJSON.stringify(i):e.kind===t.type_exports.ReflectionKind.property||e.kind===t.type_exports.ReflectionKind.parameter?l(e.type,i):String(i)}function u(e){if(e.kind!==t.type_exports.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${e.kind}.`);let n=(0,i.getUniqueBy)(e.values.filter(e=>e!=null),e=>(0,r.isString)(e)?{kind:t.type_exports.ReflectionKind.string}:{kind:t.type_exports.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&(0,r.isString)(n[0])?{kind:t.type_exports.ReflectionKind.string}:{kind:t.type_exports.ReflectionKind.number}}function d(e){if(e.kind===t.type_exports.ReflectionKind.union&&e.types.length>0)return(0,i.getUniqueBy)(e.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${e.kind}.`)}function f(e){return d(e).some(e=>e.kind===t.type_exports.ReflectionKind.string||e.kind===t.type_exports.ReflectionKind.literal&&(0,r.isString)(e.literal))}exports.stringifyDefaultValue=s;
@@ -1 +1 @@
1
- import{type_exports as e}from"./vendor/type.mjs";import{StormJSON as t}from"@stryke/json/storm-json";import{getUniqueBy as n}from"@stryke/helpers/get-unique";import{isNull as r}from"@stryke/type-checks/is-null";import{isString as i}from"@stryke/type-checks/is-string";import{isUndefined as a}from"@stryke/type-checks/is-undefined";function o(e,t){return c(e.type,t??e.getDefaultValue())}function s(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function c(n,o){return a(o)?`undefined`:r(o)?`null`:n.kind===e.ReflectionKind.boolean?String(o).trim().toLowerCase()===`true`?`true`:`false`:n.kind===e.ReflectionKind.string||n.kind===e.ReflectionKind.literal&&i(n.literal)?s(o):n.kind===e.ReflectionKind.enum?l(n).kind===e.ReflectionKind.string?s(o):`${String(o)}`:n.kind===e.ReflectionKind.union?d(n)?s(o):`${String(o)}`:n.kind===e.ReflectionKind.array?s(t.stringify(o)):n.kind===e.ReflectionKind.object||n.kind===e.ReflectionKind.objectLiteral?t.stringify(o):n.kind===e.ReflectionKind.property||n.kind===e.ReflectionKind.parameter?c(n.type,o):String(o)}function l(t){if(t.kind!==e.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${t.kind}.`);let r=n(t.values.filter(e=>e!=null),t=>i(t)?{kind:e.ReflectionKind.string}:{kind:e.ReflectionKind.number});if(r.length===0)throw Error(`No valid enum members could be found.`);return r[0]&&i(r[0])?{kind:e.ReflectionKind.string}:{kind:e.ReflectionKind.number}}function u(t){if(t.kind===e.ReflectionKind.union&&t.types.length>0)return n(t.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${t.kind}.`)}function d(t){return u(t).some(t=>t.kind===e.ReflectionKind.string||t.kind===e.ReflectionKind.literal&&i(t.literal))}export{o as stringifyDefaultValue};
1
+ import{type_exports as e}from"./vendor/type.mjs";import{StormJSON as t}from"@stryke/json/storm-json";import{isString as n}from"@stryke/type-checks/is-string";import{getUniqueBy as r}from"@stryke/helpers/get-unique";import{isNull as i}from"@stryke/type-checks/is-null";import{isUndefined as a}from"@stryke/type-checks/is-undefined";function o(e,t){return c(e.type,t??e.getDefaultValue())}function s(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function c(r,o){return a(o)?`undefined`:i(o)?`null`:r.kind===e.ReflectionKind.boolean?String(o).trim().toLowerCase()===`true`?`true`:`false`:r.kind===e.ReflectionKind.string||r.kind===e.ReflectionKind.literal&&n(r.literal)?s(o):r.kind===e.ReflectionKind.enum?l(r).kind===e.ReflectionKind.string?s(o):`${String(o)}`:r.kind===e.ReflectionKind.union?d(r)?s(o):`${String(o)}`:r.kind===e.ReflectionKind.array?s(t.stringify(o)):r.kind===e.ReflectionKind.object||r.kind===e.ReflectionKind.objectLiteral?t.stringify(o):r.kind===e.ReflectionKind.property||r.kind===e.ReflectionKind.parameter?c(r.type,o):String(o)}function l(t){if(t.kind!==e.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${t.kind}.`);let i=r(t.values.filter(e=>e!=null),t=>n(t)?{kind:e.ReflectionKind.string}:{kind:e.ReflectionKind.number});if(i.length===0)throw Error(`No valid enum members could be found.`);return i[0]&&n(i[0])?{kind:e.ReflectionKind.string}:{kind:e.ReflectionKind.number}}function u(t){if(t.kind===e.ReflectionKind.union&&t.types.length>0)return r(t.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${t.kind}.`)}function d(t){return u(t).some(t=>t.kind===e.ReflectionKind.string||t.kind===e.ReflectionKind.literal&&n(t.literal))}export{o as stringifyDefaultValue};
@@ -1 +1 @@
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/path/join-paths`),a=require(`c12`),o=require(`@stryke/type-checks/is-set-object`),s=require(`@stryke/string-format/kebab-case`),c=require(`@stryke/env/load-env`);async function l(e,n,i){let a=await(0,c.loadEnv)(i,n);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(async e=>(0,c.loadEnvFile)(e,i)));for(let e of t)a=(0,r.default)(e,a)}return t.removeEnvPrefix(a)}async function u(e,t,n,o,s,c){let[u,d]=await Promise.all([l(e,n,t),(0,a.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,i.joinPaths)(o,`jiti`),moduleCache:!0}})]);return(0,r.default)(u,d.config,c)}function d(e,t){return(0,r.default)({APP_NAME:(0,s.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,s.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,o.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
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./source-file-env.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/path/join-paths`),i=require(`c12`),a=require(`defu`);a=e.__toESM(a);let o=require(`@stryke/type-checks/is-set-object`),s=require(`@stryke/string-format/kebab-case`),c=require(`@stryke/env/load-env`);async function l(e,n,r){let i=await(0,c.loadEnv)(r,n);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(async e=>(0,c.loadEnvFile)(e,r)));for(let e of t)i=(0,a.default)(e,i)}return t.removeEnvPrefix(i)}async function u(e,t,n,o,s,c){let[u,d]=await Promise.all([l(e,n,t),(0,i.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,r.joinPaths)(o,`jiti`),moduleCache:!0}})]);return(0,a.default)(u,d.config,c)}function d(e,t){return(0,a.default)({APP_NAME:(0,s.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,s.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,o.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,r,i]=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,a.default)(d(e,process.env),n,r,i)}exports.loadEnv=f,exports.loadEnvFromContext=d;
@@ -1 +1 @@
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{joinPaths as r}from"@stryke/path/join-paths";import{loadConfig as i}from"c12";import{isSetObject as a}from"@stryke/type-checks/is-set-object";import{kebabCase as o}from"@stryke/string-format/kebab-case";import{loadEnv as s,loadEnvFile as c}from"@stryke/env/load-env";async function l(t,r,i){let a=await s(i,r);if(t.additionalFiles&&t.additionalFiles?.length>0){let e=await Promise.all(t.additionalFiles.map(async e=>c(e,i)));for(let t of e)a=n(t,a)}return e(a)}async function u(e,t,a,o,s,c){let[u,d]=await Promise.all([l(e,a,t),i({cwd:t,name:`storm`,envName:a,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:a,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:r(o,`jiti`),moduleCache:!0}})]);return n(u,d.config,c)}function d(e,r){return n({APP_NAME:o(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:`${o(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},a(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,t)=>(e[t.name]=r[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
+ import{removeEnvPrefix as e}from"./source-file-env.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{joinPaths as n}from"@stryke/path/join-paths";import{loadConfig as r}from"c12";import i from"defu";import{isSetObject as a}from"@stryke/type-checks/is-set-object";import{kebabCase as o}from"@stryke/string-format/kebab-case";import{loadEnv as s,loadEnvFile as c}from"@stryke/env/load-env";async function l(t,n,r){let a=await s(r,n);if(t.additionalFiles&&t.additionalFiles?.length>0){let e=await Promise.all(t.additionalFiles.map(async e=>c(e,r)));for(let t of e)a=i(t,a)}return e(a)}async function u(e,t,a,o,s,c){let[u,d]=await Promise.all([l(e,a,t),r({cwd:t,name:`storm`,envName:a,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:a,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:n(o,`jiti`),moduleCache:!0}})]);return i(u,d.config,c)}function d(e,n){return i({APP_NAME:o(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:`${o(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},a(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,t)=>(e[t.name]=n[t.name]??t.getDefaultValue(),e),{}):{})}async function f(e,t){let[n,r,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 i(d(e,process.env),n,r,a)}export{f as loadEnv,d as loadEnvFromContext};
@@ -1 +1 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../deepkit/src/reflect-type.cjs`),r=require(`./persistence.cjs`);let i=require(`@stryke/path/is-parent-path`),a=require(`@stryke/string-format/title-case`),o=require(`@stryke/path/join-paths`);function s(e,n){return d(e,{type:(0,t.type_exports.merge)(n.map(e=>e.type))})}function c(e,n){return f(e,{type:(0,t.type_exports.merge)(n.map(e=>e.type))})}var l=class{PLATFORM=`neutral`;MODE=`production`;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;CI=!1},u=class{};function d(e,n={}){let r=n.superReflection??new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.class,description:`The base environment configuration definition for the ${(0,a.titleCase)(e.config.name)} project.`,classType:l,types:[],implements:[{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${(0,a.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${(0,a.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function f(e,n={}){let r=n.superReflection??new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.class,description:`The base secrets configuration definition for the ${(0,a.titleCase)(e.config.name)} project.`,classType:u,types:[],implements:[{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${(0,a.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${(0,a.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function p(e,a,c){let l;a&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(a,e.workspaceConfig.workspaceRoot)?a:(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,a),name:c},{skipNodeModulesBundle:!0})));let u=await n.reflectType(e,await r.getEnvDefaultTypeDefinition(e));return s(e,[await r.readEnvTypeReflection(e,`env`),l,(0,t.type_exports.resolveClassType)(u)].filter(Boolean))}async function m(e,a,s){let l;a&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(a,e.workspaceConfig.workspaceRoot)?a:(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,a),name:s},{skipNodeModulesBundle:!0})));let u=await n.reflectType(e,await r.getSecretsDefaultTypeDefinition(e));return c(e,[await r.readSecretsReflection(e),l,(0,t.type_exports.resolveClassType)(u)].filter(Boolean))}exports.BaseEnv=l,exports.BaseSecrets=u,exports.createEnvReflection=d,exports.createSecretsReflection=f,exports.mergeEnvReflections=s,exports.mergeSecretsReflections=c,exports.reflectEnv=p,exports.reflectSecrets=m;
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../deepkit/src/reflect-type.cjs`),r=require(`./persistence.cjs`);let i=require(`@stryke/path/is-parent-path`),a=require(`@stryke/path/join-paths`),o=require(`@stryke/string-format/title-case`);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,o.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,o.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${(0,o.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function f(e,n={}){let r=n.superReflection??new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.class,description:`The base secrets configuration definition for the ${(0,o.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,o.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${(0,o.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function p(e,o,c){let l;o&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(o,e.workspaceConfig.workspaceRoot)?o:(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,o),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,o,s){let l;o&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(o,e.workspaceConfig.workspaceRoot)?o:(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,o),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 +1 @@
1
- import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{reflectType as t}from"../deepkit/src/reflect-type.mjs";import{getEnvDefaultTypeDefinition as n,getSecretsDefaultTypeDefinition as r,readEnvTypeReflection as i,readSecretsReflection as a}from"./persistence.mjs";import{isParentPath as o}from"@stryke/path/is-parent-path";import{titleCase as s}from"@stryke/string-format/title-case";import{joinPaths as c}from"@stryke/path/join-paths";function l(t,n){return p(t,{type:(0,e.merge)(n.map(e=>e.type))})}function u(t,n){return m(t,{type:(0,e.merge)(n.map(e=>e.type))})}var d=class{PLATFORM=`neutral`;MODE=`production`;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;CI=!1},f=class{};function p(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base environment configuration definition for the ${s(t.config.name)} project.`,classType:d,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${s(t.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${t.config.name?`${s(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function m(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base secrets configuration definition for the ${s(t.config.name)} project.`,classType:f,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${s(t.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${t.config.name?`${s(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function h(r,a,s){let u;a&&(u=(0,e.resolveClassType)(await t(r,{file:o(a,r.workspaceConfig.workspaceRoot)?a:c(r.workspaceConfig.workspaceRoot,a),name:s},{skipNodeModulesBundle:!0})));let d=await t(r,await n(r));return l(r,[await i(r,`env`),u,(0,e.resolveClassType)(d)].filter(Boolean))}async function g(n,i,s){let l;i&&(l=(0,e.resolveClassType)(await t(n,{file:o(i,n.workspaceConfig.workspaceRoot)?i:c(n.workspaceConfig.workspaceRoot,i),name:s},{skipNodeModulesBundle:!0})));let d=await t(n,await r(n));return u(n,[await a(n),l,(0,e.resolveClassType)(d)].filter(Boolean))}export{d as BaseEnv,f as BaseSecrets,p as createEnvReflection,m as createSecretsReflection,l as mergeEnvReflections,u as mergeSecretsReflections,h as reflectEnv,g as reflectSecrets};
1
+ import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{reflectType as t}from"../deepkit/src/reflect-type.mjs";import{getEnvDefaultTypeDefinition as n,getSecretsDefaultTypeDefinition as r,readEnvTypeReflection as i,readSecretsReflection as a}from"./persistence.mjs";import{isParentPath as o}from"@stryke/path/is-parent-path";import{joinPaths as s}from"@stryke/path/join-paths";import{titleCase as c}from"@stryke/string-format/title-case";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 ${c(t.config.name)} project.`,classType:d,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${c(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?`${c(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 ${c(t.config.name)} project.`,classType:f,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${c(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?`${c(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function h(r,a,c){let u;a&&(u=(0,e.resolveClassType)(await t(r,{file:o(a,r.workspaceConfig.workspaceRoot)?a:s(r.workspaceConfig.workspaceRoot,a),name:c},{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,c){let l;i&&(l=(0,e.resolveClassType)(await t(n,{file:o(i,n.workspaceConfig.workspaceRoot)?i:s(n.workspaceConfig.workspaceRoot,i),name:c},{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 +1 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/string-format/camel-case`),r=require(`@stryke/env/types`);function i(e){if((0,t.isString)(e)){let t=r.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},{})}function a(e){return(0,n.camelCase)(i(e))}exports.formatEnvField=a,exports.removeEnvPrefix=i;
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},{})}function a(e){return(0,r.camelCase)(i(e))}exports.formatEnvField=a,exports.removeEnvPrefix=i;
@@ -1 +1 @@
1
- import{isString as e}from"@stryke/type-checks/is-string";import{camelCase as t}from"@stryke/string-format/camel-case";import{ENV_PREFIXES as n}from"@stryke/env/types";function r(t){if(e(t)){let e=n.reduce((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),t.toUpperCase());for(;e.startsWith(`_`);)e=e.slice(1);return e}return Object.keys(t).reduce((e,n)=>{let i=r(n);return i&&(e[i]=t[n]),e},{})}function i(e){return t(r(e))}export{i as formatEnvField,r as removeEnvPrefix};
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},{})}function i(e){return n(r(e))}export{i as formatEnvField,r as removeEnvPrefix};
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./deepkit/src/vendor/type.cjs`),n=require(`./plugin-alloy/src/index.cjs`),r=require(`./plugin-automd/src/index.cjs`),i=require(`./plugin-babel/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`);const p=require(`./components/docs.cjs`);require(`./components/index.cjs`);const m=require(`./helpers/template-helpers.cjs`);require(`./helpers/index.cjs`);let h=require(`@alloy-js/core/jsx-runtime`),g=require(`@storm-software/config-tools/types`),_=require(`@stryke/path/is-parent-path`),v=require(`defu`);v=e.__toESM(v);let y=require(`@stryke/convert/to-array`),b=require(`@stryke/path/join`),x=require(`@stryke/string-format/title-case`),S=require(`@stryke/convert/parse-type-definition`),C=require(`@stryke/env/types`),w=require(`@stryke/fs/exists`),T=require(`@stryke/fs/helpers`),E=require(`@stryke/string-format/constant-case`);const D=(e={})=>[n.default(e.alloy),i.default(e.babel),{name:`env`,async config(){this.log(g.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,v.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[s.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,S.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,S.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,S.parseTypeDefinition)(t.env.secrets);else{let e=await o.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,S.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,y.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,E.constantCase)(t);return e.includes(n)||e.push(n),e},[...C.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,v.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,w.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,w.existsSync)(o.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await o.readEnvReflection(this)),(0,w.existsSync)(o.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await o.readEnvTypeReflection(this,`secrets`)),(0,w.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,b.joinPaths)(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await 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,b.joinPaths)(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await 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`))}},async prepare(){let e=this;return this.log(g.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render((0,h.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,b.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,w.existsSync)(e)||await(0,T.createDirectory)(e);let n=await o.readEnvTypeReflection(this,`env`),r=(0,b.joinPaths)(e,`env.md`);this.log(g.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,x.titleCase)(this.config.framework)||`Powerlines`} -->
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./deepkit/src/vendor/type.cjs`),n=require(`./plugin-alloy/src/index.cjs`),r=require(`./plugin-automd/src/index.cjs`),i=require(`./plugin-babel/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`);const p=require(`./components/docs.cjs`);require(`./components/index.cjs`);const m=require(`./helpers/template-helpers.cjs`);require(`./helpers/index.cjs`);let h=require(`@alloy-js/core/jsx-runtime`),g=require(`@storm-software/config-tools/types`),_=require(`@stryke/path/is-parent-path`),v=require(`@stryke/convert/to-array`),y=require(`defu`);y=e.__toESM(y);let b=require(`@stryke/string-format/title-case`),x=require(`@stryke/convert/parse-type-definition`),S=require(`@stryke/env/types`),C=require(`@stryke/fs/exists`),w=require(`@stryke/fs/helpers`),T=require(`@stryke/path/join`),E=require(`@stryke/string-format/constant-case`);const D=(e={})=>[n.default(e.alloy),i.default(e.babel),{name:`env`,async config(){this.log(g.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,y.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[s.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,x.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,x.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,x.parseTypeDefinition)(t.env.secrets);else{let e=await o.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,x.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,v.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,E.constantCase)(t);return e.includes(n)||e.push(n),e},[...S.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,y.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,C.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,C.existsSync)(o.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await o.readEnvReflection(this)),(0,C.existsSync)(o.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await o.readEnvTypeReflection(this,`secrets`)),(0,C.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,T.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,T.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`))}},async prepare(){let e=this;return this.log(g.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render((0,h.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,T.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,C.existsSync)(e)||await(0,w.createDirectory)(e);let n=await o.readEnvTypeReflection(this,`env`),r=(0,T.joinPaths)(e,`env.md`);this.log(g.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,b.titleCase)(this.config.framework)||`Powerlines`} -->
2
2
 
3
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
4
 
@@ -7,4 +7,4 @@ Below is a list of environment variables used by the [${this.packageJson.name}](
7
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
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
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`)}},{name:`env:automd-generator`,config(){return{automd:(0,v.default)(e.automd??{},{generators:{env:f.env(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},r.default(e.automd)];var O=D;exports.BaseEnv=a.BaseEnv,exports.BaseSecrets=a.BaseSecrets,exports.EnvBuiltin=d.EnvBuiltin,exports.EnvDocs=p.EnvDocs,exports.EnvTypeDefinition=d.EnvTypeDefinition,exports.createEnvReflection=a.createEnvReflection,exports.createReflectionResource=u.createReflectionResource,exports.createSecretsReflection=a.createSecretsReflection,exports.createTemplateReflection=m.createTemplateReflection,exports.default=O,exports.envBabelPlugin=s.envBabelPlugin,exports.formatEnvField=c.formatEnvField,exports.getEnvDefaultTypeDefinition=o.getEnvDefaultTypeDefinition,exports.getEnvReflectionsPath=o.getEnvReflectionsPath,exports.getEnvTypeReflectionsPath=o.getEnvTypeReflectionsPath,exports.getSecretsDefaultTypeDefinition=o.getSecretsDefaultTypeDefinition,exports.loadEnv=l.loadEnv,exports.loadEnvFromContext=l.loadEnvFromContext,exports.mergeEnvReflections=a.mergeEnvReflections,exports.mergeSecretsReflections=a.mergeSecretsReflections,exports.plugin=D,exports.readEnvReflection=o.readEnvReflection,exports.readEnvTypeReflection=o.readEnvTypeReflection,exports.readSecretsReflection=o.readSecretsReflection,exports.reflectEnv=a.reflectEnv,exports.reflectSecrets=a.reflectSecrets,exports.removeEnvPrefix=c.removeEnvPrefix,exports.resolveRuntimeTypeFile=o.resolveRuntimeTypeFile,exports.writeEnvReflection=o.writeEnvReflection,exports.writeEnvReflectionSync=o.writeEnvReflectionSync,exports.writeEnvTypeReflection=o.writeEnvTypeReflection;
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`)}},{name:`env:automd-generator`,config(){return{automd:(0,y.default)(e.automd??{},{generators:{env:f.env(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},r.default(e.automd)];var O=D;exports.BaseEnv=a.BaseEnv,exports.BaseSecrets=a.BaseSecrets,exports.EnvBuiltin=d.EnvBuiltin,exports.EnvDocs=p.EnvDocs,exports.EnvTypeDefinition=d.EnvTypeDefinition,exports.createEnvReflection=a.createEnvReflection,exports.createReflectionResource=u.createReflectionResource,exports.createSecretsReflection=a.createSecretsReflection,exports.createTemplateReflection=m.createTemplateReflection,exports.default=O,exports.envBabelPlugin=s.envBabelPlugin,exports.formatEnvField=c.formatEnvField,exports.getEnvDefaultTypeDefinition=o.getEnvDefaultTypeDefinition,exports.getEnvReflectionsPath=o.getEnvReflectionsPath,exports.getEnvTypeReflectionsPath=o.getEnvTypeReflectionsPath,exports.getSecretsDefaultTypeDefinition=o.getSecretsDefaultTypeDefinition,exports.loadEnv=l.loadEnv,exports.loadEnvFromContext=l.loadEnvFromContext,exports.mergeEnvReflections=a.mergeEnvReflections,exports.mergeSecretsReflections=a.mergeSecretsReflections,exports.plugin=D,exports.readEnvReflection=o.readEnvReflection,exports.readEnvTypeReflection=o.readEnvTypeReflection,exports.readSecretsReflection=o.readSecretsReflection,exports.reflectEnv=a.reflectEnv,exports.reflectSecrets=a.reflectSecrets,exports.removeEnvPrefix=c.removeEnvPrefix,exports.resolveRuntimeTypeFile=o.resolveRuntimeTypeFile,exports.writeEnvReflection=o.writeEnvReflection,exports.writeEnvReflectionSync=o.writeEnvReflectionSync,exports.writeEnvTypeReflection=o.writeEnvTypeReflection;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { EnvDocs } from "./components/docs.cjs";
2
2
  import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./components/env.cjs";
3
- import "./components/index.cjs";
4
3
  import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.cjs";
5
4
  import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.cjs";
6
5
  import { envBabelPlugin } from "./babel/plugin.cjs";
@@ -12,7 +11,6 @@ import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflecti
12
11
  import { formatEnvField, removeEnvPrefix } from "./helpers/source-file-env.cjs";
13
12
  import { createTemplateReflection } from "./helpers/template-helpers.cjs";
14
13
  import "./helpers/index.cjs";
15
- import "./types/index.cjs";
16
14
  import { Plugin } from "powerlines";
17
15
 
18
16
  //#region src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{type_exports as e}from"./deepkit/src/vendor/type.mjs";import t from"./plugin-alloy/src/index.mjs";import n from"./plugin-automd/src/index.mjs";import r from"./plugin-babel/src/index.mjs";import{BaseEnv as i,BaseSecrets as a,createEnvReflection as o,createSecretsReflection as s,mergeEnvReflections as c,mergeSecretsReflections as l,reflectEnv as u,reflectSecrets as d}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as f,getEnvReflectionsPath as p,getEnvTypeReflectionsPath as m,getSecretsDefaultTypeDefinition as h,readEnvReflection as g,readEnvTypeReflection as _,readSecretsReflection as v,resolveRuntimeTypeFile as y,writeEnvReflection as b,writeEnvReflectionSync as x,writeEnvTypeReflection as S}from"./helpers/persistence.mjs";import{envBabelPlugin as C}from"./babel/plugin.mjs";import{formatEnvField as w,removeEnvPrefix as T}from"./helpers/source-file-env.mjs";import{loadEnv as E,loadEnvFromContext as D}from"./helpers/load.mjs";import{createReflectionResource as O}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as k,EnvTypeDefinition as A}from"./components/env.mjs";import{env as j}from"./helpers/automd-generator.mjs";import"./babel/index.mjs";import{EnvDocs as M}from"./components/docs.mjs";import"./components/index.mjs";import{createTemplateReflection as N}from"./helpers/template-helpers.mjs";import"./helpers/index.mjs";import{createComponent as P}from"@alloy-js/core/jsx-runtime";import{LogLevelLabel as F}from"@storm-software/config-tools/types";import{isParentPath as I}from"@stryke/path/is-parent-path";import L from"defu";import{toArray as R}from"@stryke/convert/to-array";import{joinPaths as z}from"@stryke/path/join";import{titleCase as B}from"@stryke/string-format/title-case";import{parseTypeDefinition as V}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as H}from"@stryke/env/types";import{existsSync as U}from"@stryke/fs/exists";import{createDirectory as W}from"@stryke/fs/helpers";import{constantCase as G}from"@stryke/string-format/constant-case";const K=(i={})=>[t(i.alloy),r(i.babel),{name:`env`,async config(){this.log(F.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:L(i,{types:{},prefix:[]}),transform:{babel:{plugins:[C]}}};if(e.env.types)e.env.types=V(e.env.types);else{this.log(F.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await f(this);e.env.types=V(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=V(e.env.secrets);else{let t=await h(this);e.env.secrets=V(`${t.file}#${t.name}`)}return e.env.prefix=R(e.env.prefix??[]).reduce((e,t)=>{let n=G(t);return e.includes(n)||e.push(n),e},[...H,`POWERLINES_`]),e.env.prefix=e.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),e},async configResolved(){if(this.log(F.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=L({parsed:await E(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&U(m(this,`env`)))this.log(F.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await _(this,`env`),U(p(this,`env`))&&(this.env.used.env=await g(this)),U(m(this,`secrets`))&&(this.env.types.secrets=await _(this,`secrets`)),U(p(this,`secrets`))&&(this.env.used.secrets=await v(this));else{if(this.env.types.env=await u(this,this.config.env.types?.file?I(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:z(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 S(this,this.env.types.env,`env`),this.env.types.secrets=await d(this,this.config.env.secrets?.file?I(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:z(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 S(this,this.env.types.secrets,`secrets`),this.log(F.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let t=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await E(this,this.config.env)).forEach(([e,n])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=t.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 e.ReflectionClass({kind:e.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 b(this,this.env.used.env,`env`),this.env.types.secrets&&(await S(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.ReflectionClass({kind:e.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 b(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(F.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(P(k,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(F.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=z(this.config.projectRoot,`docs`,`generated`);U(t)||await W(t);let n=await _(this,`env`),r=z(t,`env.md`);this.log(F.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${B(this.config.framework)||`Powerlines`} -->
1
+ import{type_exports as e}from"./deepkit/src/vendor/type.mjs";import t from"./plugin-alloy/src/index.mjs";import n from"./plugin-automd/src/index.mjs";import r from"./plugin-babel/src/index.mjs";import{BaseEnv as i,BaseSecrets as a,createEnvReflection as o,createSecretsReflection as s,mergeEnvReflections as c,mergeSecretsReflections as l,reflectEnv as u,reflectSecrets as d}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as f,getEnvReflectionsPath as p,getEnvTypeReflectionsPath as m,getSecretsDefaultTypeDefinition as h,readEnvReflection as g,readEnvTypeReflection as _,readSecretsReflection as v,resolveRuntimeTypeFile as y,writeEnvReflection as b,writeEnvReflectionSync as x,writeEnvTypeReflection as S}from"./helpers/persistence.mjs";import{envBabelPlugin as C}from"./babel/plugin.mjs";import{formatEnvField as w,removeEnvPrefix as T}from"./helpers/source-file-env.mjs";import{loadEnv as E,loadEnvFromContext as D}from"./helpers/load.mjs";import{createReflectionResource as O}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as k,EnvTypeDefinition as A}from"./components/env.mjs";import{env as j}from"./helpers/automd-generator.mjs";import"./babel/index.mjs";import{EnvDocs as M}from"./components/docs.mjs";import"./components/index.mjs";import{createTemplateReflection as N}from"./helpers/template-helpers.mjs";import"./helpers/index.mjs";import{createComponent as P}from"@alloy-js/core/jsx-runtime";import{LogLevelLabel as F}from"@storm-software/config-tools/types";import{isParentPath as I}from"@stryke/path/is-parent-path";import{toArray as L}from"@stryke/convert/to-array";import R from"defu";import{titleCase as z}from"@stryke/string-format/title-case";import{parseTypeDefinition as B}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as V}from"@stryke/env/types";import{existsSync as H}from"@stryke/fs/exists";import{createDirectory as U}from"@stryke/fs/helpers";import{joinPaths as W}from"@stryke/path/join";import{constantCase as G}from"@stryke/string-format/constant-case";const K=(i={})=>[t(i.alloy),r(i.babel),{name:`env`,async config(){this.log(F.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:R(i,{types:{},prefix:[]}),transform:{babel:{plugins:[C]}}};if(e.env.types)e.env.types=B(e.env.types);else{this.log(F.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await f(this);e.env.types=B(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=B(e.env.secrets);else{let t=await h(this);e.env.secrets=B(`${t.file}#${t.name}`)}return e.env.prefix=L(e.env.prefix??[]).reduce((e,t)=>{let n=G(t);return e.includes(n)||e.push(n),e},[...V,`POWERLINES_`]),e.env.prefix=e.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),e},async configResolved(){if(this.log(F.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=R({parsed:await E(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&H(m(this,`env`)))this.log(F.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await _(this,`env`),H(p(this,`env`))&&(this.env.used.env=await g(this)),H(m(this,`secrets`))&&(this.env.types.secrets=await _(this,`secrets`)),H(p(this,`secrets`))&&(this.env.used.secrets=await v(this));else{if(this.env.types.env=await u(this,this.config.env.types?.file?I(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:W(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 S(this,this.env.types.env,`env`),this.env.types.secrets=await d(this,this.config.env.secrets?.file?I(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:W(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 S(this,this.env.types.secrets,`secrets`),this.log(F.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let t=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await E(this,this.config.env)).forEach(([e,n])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=t.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 e.ReflectionClass({kind:e.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 b(this,this.env.used.env,`env`),this.env.types.secrets&&(await S(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.ReflectionClass({kind:e.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 b(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(F.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(P(k,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(F.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=W(this.config.projectRoot,`docs`,`generated`);H(t)||await U(t);let n=await _(this,`env`),r=W(t,`env.md`);this.log(F.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${z(this.config.framework)||`Powerlines`} -->
2
2
 
3
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
4
 
@@ -7,4 +7,4 @@ Below is a list of environment variables used by the [${this.packageJson.name}](
7
7
  ${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
8
8
  `,``)??``).trim()} | ${(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `)} | ${t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``} | ${t.isValueRequired()?``:`✔`} |`).join(`
9
9
  `)}
10
- `)},async buildEnd(){let e=p(this,`env`);this.log(F.TRACE,`Writing env reflection types to ${e}.`),await b(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:L(i.automd??{},{generators:{env:j(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},n(i.automd)];var q=K;export{i as BaseEnv,a as BaseSecrets,k as EnvBuiltin,M as EnvDocs,A as EnvTypeDefinition,o as createEnvReflection,O as createReflectionResource,s as createSecretsReflection,N as createTemplateReflection,q as default,C as envBabelPlugin,w as formatEnvField,f as getEnvDefaultTypeDefinition,p as getEnvReflectionsPath,m as getEnvTypeReflectionsPath,h as getSecretsDefaultTypeDefinition,E as loadEnv,D as loadEnvFromContext,c as mergeEnvReflections,l as mergeSecretsReflections,K as plugin,g as readEnvReflection,_ as readEnvTypeReflection,v as readSecretsReflection,u as reflectEnv,d as reflectSecrets,T as removeEnvPrefix,y as resolveRuntimeTypeFile,b as writeEnvReflection,x as writeEnvReflectionSync,S as writeEnvTypeReflection};
10
+ `)},async buildEnd(){let e=p(this,`env`);this.log(F.TRACE,`Writing env reflection types to ${e}.`),await b(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:R(i.automd??{},{generators:{env:j(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},n(i.automd)];var q=K;export{i as BaseEnv,a as BaseSecrets,k as EnvBuiltin,M as EnvDocs,A as EnvTypeDefinition,o as createEnvReflection,O as createReflectionResource,s as createSecretsReflection,N as createTemplateReflection,q as default,C as envBabelPlugin,w as formatEnvField,f as getEnvDefaultTypeDefinition,p as getEnvReflectionsPath,m as getEnvTypeReflectionsPath,h as getSecretsDefaultTypeDefinition,E as loadEnv,D as loadEnvFromContext,c as mergeEnvReflections,l as mergeSecretsReflections,K as plugin,g as readEnvReflection,_ as readEnvTypeReflection,v as readSecretsReflection,u as reflectEnv,d as reflectSecrets,T as removeEnvPrefix,y as resolveRuntimeTypeFile,b as writeEnvReflection,x as writeEnvReflectionSync,S as writeEnvTypeReflection};
@@ -1 +1 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../contexts/context.cjs`);let n=require(`@alloy-js/core/jsx-runtime`),r=require(`@alloy-js/core`),i=require(`@stryke/path/replace`);function a(e){let[{children:a,context:o,basePath:s},c]=(0,r.splitProps)(e,[`children`,`context`,`basePath`]),l=(0,r.ref)(o),u=(0,r.computed)(()=>s?(0,i.replacePath)(s,l.value.workspaceConfig.workspaceRoot):l.value.workspaceConfig.workspaceRoot);return(0,n.createComponent)(r.Output,(0,n.mergeProps)(c,{get basePath(){return u.value},get children(){return(0,n.createComponent)(t.PowerlinesContext.Provider,{value:{ref:l},get children(){return(0,n.createComponent)(r.Show,{get when(){return!!l.value},children:a})}})}}))}exports.Output=a;
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../vendor.cjs`),n=require(`../contexts/context.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@stryke/path/replace`);function a(e){let[{children:a,context:o,basePath:s},c]=(0,t.vendor_exports.splitProps)(e,[`children`,`context`,`basePath`]),l=(0,t.vendor_exports.ref)(o),u=(0,t.vendor_exports.computed)(()=>s?(0,i.replacePath)(s,l.value.workspaceConfig.workspaceRoot):l.value.workspaceConfig.workspaceRoot);return(0,r.createComponent)(t.vendor_exports.Output,(0,r.mergeProps)(c,{get basePath(){return u.value},get children(){return(0,r.createComponent)(n.PowerlinesContext.Provider,{value:{ref:l},get children(){return(0,r.createComponent)(t.vendor_exports.Show,{get when(){return!!l.value},children:a})}})}}))}exports.Output=a;
@@ -1 +1 @@
1
- import{PowerlinesContext as e}from"../contexts/context.mjs";import{createComponent as t,mergeProps as n}from"@alloy-js/core/jsx-runtime";import{Output as r,Show as i,computed as a,ref as o,splitProps as s}from"@alloy-js/core";import{replacePath as c}from"@stryke/path/replace";function l(l){let[{children:u,context:d,basePath:f},p]=s(l,[`children`,`context`,`basePath`]),m=o(d),h=a(()=>f?c(f,m.value.workspaceConfig.workspaceRoot):m.value.workspaceConfig.workspaceRoot);return t(r,n(p,{get basePath(){return h.value},get children(){return t(e.Provider,{value:{ref:m},get children(){return t(i,{get when(){return!!m.value},children:u})}})}}))}export{l as Output};
1
+ import{vendor_exports as e}from"../../vendor.mjs";import{PowerlinesContext as t}from"../contexts/context.mjs";import{createComponent as n,mergeProps as r}from"@alloy-js/core/jsx-runtime";import{replacePath as i}from"@stryke/path/replace";function a(a){let[{children:o,context:s,basePath:c},l]=(0,e.splitProps)(a,[`children`,`context`,`basePath`]),u=(0,e.ref)(s),d=(0,e.computed)(()=>c?i(c,u.value.workspaceConfig.workspaceRoot):u.value.workspaceConfig.workspaceRoot);return n(e.Output,r(l,{get basePath(){return d.value},get children(){return n(t.Provider,{value:{ref:u},get children(){return n(e.Show,{get when(){return!!u.value},children:o})}})}}))}export{a as Output};
@@ -1 +1 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core`);const n=(0,t.createContext)();exports.PowerlinesContext=n;
1
+ const e=require(`../../vendor.cjs`),t=(0,e.vendor_exports.createContext)();exports.PowerlinesContext=t;
@@ -1 +1 @@
1
- import{createContext as e}from"@alloy-js/core";const t=e();export{t as PowerlinesContext};
1
+ import{vendor_exports as e}from"../../vendor.mjs";const t=(0,e.createContext)();export{t as PowerlinesContext};
@@ -1,2 +1,2 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./core/contexts/context.cjs`),n=require(`./core/components/output.cjs`);require(`./core/index.cjs`),require(`./helpers/index.cjs`),require(`./markdown/index.cjs`),require(`./typescript/index.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@alloy-js/rollup-plugin`);a=e.__toESM(a);let o=require(`@storm-software/config-tools/types`),s=require(`@stryke/json/storm-json`),c=require(`@stryke/path/is-parent-path`),l=require(`@stryke/path/replace`),u=require(`@stryke/type-checks/is-set-string`),d=require(`prettier/doc.js`);const f=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[(0,a.default)()],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`},external:[`@alloy-js/core`,`@vue/reactivity`,`@vue/shared`]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,s.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let t=this,a=(0,i.renderTree)((0,r.createComponent)(n.Output,{context:t,get basePath(){return t.workspaceConfig.workspaceRoot},children:e}));await m(this,a,this.config.alloy)}}}}];var p=f;async function m(e,t,n={}){await(0,i.flushJobsAsync)();let r,a=async(t,s)=>{if(!Array.isArray(s))return;let u=async e=>{for(let t of s)await a(e,t)},d=(0,i.getContextForRenderNode)(s);if(!d)return u(t);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};t?t.contents.push(e):r=e,await u(e)}else if(d.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let r;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(o.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),r={kind:`builtin`,id:d.meta.builtin.id,path:(0,l.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)}}else d.meta?.entry||(0,c.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(o.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),r={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)}):(e.log(o.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),r={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)});t.contents.push(r)}else if(d.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(o.LogLevelLabel.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");t.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(t)};await a(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!(0,u.isSetString)(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&(0,u.isSetString)(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await s(e,r)}async function h(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await(0,i.flushJobsAsync)();let r=d.printer.printDocToString(g(t),n).formatted;return n.insertFinalNewLine&&!r.endsWith(`
2
- `)?`${r}\n`:r}function g(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else (0,i.isPrintHook)(n)?t.push(n.print(n.subtree,g)):t.push(g(n));return t}exports.default=p;
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor.cjs`),n=require(`./core/components/output.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/rollup-plugin`);i=e.__toESM(i);let a=require(`@storm-software/config-tools/types`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/path/replace`),l=require(`@stryke/type-checks/is-set-string`),u=require(`prettier/doc.js`);const d=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[(0,i.default)()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,o.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let i=this,a=(0,t.vendor_exports.renderTree)((0,r.createComponent)(n.Output,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:e}));await p(this,a,this.config.alloy)}}}}];var f=d;async function p(e,n,r={}){await(0,t.vendor_exports.flushJobsAsync)();let i,o=async(n,l)=>{if(!Array.isArray(l))return;let u=async e=>{for(let t of l)await o(e,t)},d=(0,t.vendor_exports.getContextForRenderNode)(l);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):i=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let t;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(a.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),t={kind:`builtin`,id:d.meta.builtin.id,path:(0,c.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)}}else d.meta?.entry||(0,s.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(a.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),t={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)}):(e.log(a.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),t={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,r)});n.contents.push(t)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(a.LogLevelLabel.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await o(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!(0,l.isSetString)(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&(0,l.isSetString)(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(e,i)}async function m(e,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,t.vendor_exports.flushJobsAsync)();let i=u.printer.printDocToString(h(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
2
+ `)?`${i}\n`:i}function h(e){let n=[];for(let r of e)if(typeof r==`string`){let e=r.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));n.push(e)}else (0,t.vendor_exports.isPrintHook)(r)?n.push(r.print(r.subtree,h)):n.push(h(r));return n}exports.default=f;
@@ -1,2 +1,2 @@
1
- import{PowerlinesContext as e}from"./core/contexts/context.mjs";import{Output as t}from"./core/components/output.mjs";import"./core/index.mjs";import"./helpers/index.mjs";import"./markdown/index.mjs";import"./typescript/index.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import{flushJobsAsync as r,getContextForRenderNode as i,isPrintHook as a,renderTree as o}from"@alloy-js/core";import s from"@alloy-js/rollup-plugin";import{LogLevelLabel as c}from"@storm-software/config-tools/types";import{StormJSON as l}from"@stryke/json/storm-json";import{isParentPath as u}from"@stryke/path/is-parent-path";import{replacePath as d}from"@stryke/path/replace";import{isSetString as f}from"@stryke/type-checks/is-set-string";import{printer as p}from"prettier/doc.js";var m=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[s()],alias:{"@alloy-js/core":`@powerlines/plugin-alloy/vendor`},external:[`@alloy-js/core`,`@vue/reactivity`,`@vue/shared`]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,l.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let r=this,i=o(n(t,{context:r,get basePath(){return r.workspaceConfig.workspaceRoot},children:e}));await h(this,i,this.config.alloy)}}}}];async function h(e,t,n={}){await r();let a,o=async(t,r)=>{if(!Array.isArray(r))return;let s=async e=>{for(let t of r)await o(e,t)},l=i(r);if(!l)return s(t);if(l.meta?.directory){let e={kind:`directory`,path:l.meta.directory.path,contents:[]};t?t.contents.push(e):a=e,await s(e)}else if(l.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let i;if(l.meta?.builtin){if(!l.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(c.TRACE,`Rendering built-in runtime module with ID: ${l.meta.builtin.id}`),i={kind:`builtin`,id:l.meta.builtin.id,path:d(l.meta.sourceFile.path,e.builtinsPath),filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}}else l.meta?.entry||u(e.entryPath,l.meta.sourceFile.path)?(e.log(c.TRACE,`Rendering entry module at path: ${l.meta.sourceFile.path}`),i={kind:`entry`,typeDefinition:l.meta.entry?.typeDefinition,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}):(e.log(c.TRACE,`Rendering source file at path: ${l.meta.sourceFile.path}`),i={kind:`file`,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)});t.contents.push(i)}else if(l.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(c.TRACE,`Processing copy file operation from "${l.meta.copyFile.sourcePath}" to "${l.meta.copyFile.path}"`),!l.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!l.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");t.contents.push({kind:`file`,path:l.meta.copyFile.path,sourcePath:l.meta.copyFile.sourcePath,preset:l.meta.output?.preset})}else await s(t)};await o(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!f(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&f(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await s(e,a)}async function g(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await r();let i=p.printDocToString(_(t),n).formatted;return n.insertFinalNewLine&&!i.endsWith(`
2
- `)?`${i}\n`:i}function _(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else a(n)?t.push(n.print(n.subtree,_)):t.push(_(n));return t}export{m as default};
1
+ import{vendor_exports as e}from"./vendor.mjs";import{Output as t}from"./core/components/output.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import r from"@alloy-js/rollup-plugin";import{LogLevelLabel as i}from"@storm-software/config-tools/types";import{StormJSON as a}from"@stryke/json/storm-json";import{isParentPath as o}from"@stryke/path/is-parent-path";import{replacePath as s}from"@stryke/path/replace";import{isSetString as c}from"@stryke/type-checks/is-set-string";import{printer as l}from"prettier/doc.js";var u=(i={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...i},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[r()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,a.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy/vendor`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async r=>{let i=this,a=(0,e.renderTree)(n(t,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:r}));await d(this,a,this.config.alloy)}}}}];async function d(t,n,r={}){await(0,e.flushJobsAsync)();let a,l=async(n,c)=>{if(!Array.isArray(c))return;let u=async e=>{for(let t of c)await l(e,t)},d=(0,e.getContextForRenderNode)(c);if(!d)return u(n);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};n?n.contents.push(e):a=e,await u(e)}else if(d.meta?.sourceFile){if(!n)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let e;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");t.log(i.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),e={kind:`builtin`,id:d.meta.builtin.id,path:s(d.meta.sourceFile.path,t.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)}}else d.meta?.entry||o(t.entryPath,d.meta.sourceFile.path)?(t.log(i.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),e={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)}):(t.log(i.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),e={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await f(t,c,r)});n.contents.push(e)}else if(d.meta?.copyFile){if(!n)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(t.log(i.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");n.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(n)};await l(void 0,n);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!c(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&c(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(t,a)}async function f(t,n,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await(0,e.flushJobsAsync)();let i=l.printDocToString(p(n),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
2
+ `)?`${i}\n`:i}function p(t){let n=[];for(let r of t)if(typeof r==`string`){let e=r.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));n.push(e)}else (0,e.isPrintHook)(r)?n.push(r.print(r.subtree,p)):n.push(p(r));return n}export{u as default};
@@ -1,5 +1,4 @@
1
+ import "../vendor.mjs";
1
2
  import "../../../powerlines/src/types/fs.mjs";
2
3
  import "../../../powerlines/src/types/resolved.mjs";
3
- import { Children } from "@alloy-js/core/jsx-runtime";
4
- import "@alloy-js/core";
5
4
  import "@alloy-js/typescript";
@@ -1,11 +1,10 @@
1
+ import { vendor_d_exports } from "../vendor.cjs";
1
2
  import { PluginContext } from "../../../powerlines/src/types/context.cjs";
2
3
  import { UserConfig } from "../../../powerlines/src/types/config.cjs";
3
4
  import { ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
4
- import { PrintTreeOptions } from "@alloy-js/core";
5
- import { Children as Children$1 } from "@alloy-js/core/jsx-runtime";
6
5
 
7
6
  //#region ../plugin-alloy/src/types/plugin.d.ts
8
- type AlloyPluginOptions = Partial<PrintTreeOptions> & {
7
+ type AlloyPluginOptions = Partial<vendor_d_exports.PrintTreeOptions> & {
9
8
  /**
10
9
  * If true, the Alloy framework is used to generate Typescript output files.
11
10
  *
@@ -32,7 +31,7 @@ type AlloyPluginResolvedConfig = ResolvedConfig & {
32
31
  alloy: AlloyPluginOptions;
33
32
  };
34
33
  type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
35
- render: <TContext extends AlloyPluginContext>(this: TContext, children: Children$1) => Promise<void>;
34
+ render: <TContext extends AlloyPluginContext>(this: TContext, children: vendor_d_exports.Children) => Promise<void>;
36
35
  };
37
36
  //#endregion
38
37
  export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig };
@@ -1,11 +1,10 @@
1
+ import { vendor_d_exports } from "../vendor.mjs";
1
2
  import { PluginContext } from "../../../powerlines/src/types/context.mjs";
2
3
  import { UserConfig } from "../../../powerlines/src/types/config.mjs";
3
4
  import { ResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
4
- import { Children } from "@alloy-js/core/jsx-runtime";
5
- import { PrintTreeOptions } from "@alloy-js/core";
6
5
 
7
6
  //#region ../plugin-alloy/src/types/plugin.d.ts
8
- type AlloyPluginOptions = Partial<PrintTreeOptions> & {
7
+ type AlloyPluginOptions = Partial<vendor_d_exports.PrintTreeOptions> & {
9
8
  /**
10
9
  * If true, the Alloy framework is used to generate Typescript output files.
11
10
  *
@@ -32,7 +31,7 @@ type AlloyPluginResolvedConfig = ResolvedConfig & {
32
31
  alloy: AlloyPluginOptions;
33
32
  };
34
33
  type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
35
- render: <TContext extends AlloyPluginContext>(this: TContext, children: Children) => Promise<void>;
34
+ render: <TContext extends AlloyPluginContext>(this: TContext, children: vendor_d_exports.Children) => Promise<void>;
36
35
  };
37
36
  //#endregion
38
37
  export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig };
@@ -0,0 +1 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`);var t={};e.__reExport(t,require(`@alloy-js/core`)),Object.defineProperty(exports,`vendor_exports`,{enumerable:!0,get:function(){return t}});var n=require(`@alloy-js/core`);Object.keys(n).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})});
@@ -0,0 +1,7 @@
1
+ export * from "@alloy-js/core";
2
+
3
+ //#region ../plugin-alloy/src/vendor.d.ts
4
+
5
+ import * as import___alloy_js_core from "@alloy-js/core";
6
+ //#endregion
7
+ export { import___alloy_js_core as vendor_d_exports };