@powerlines/plugin-env 0.14.7 → 0.14.8

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.
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./create-reflection-resource-CdrQyUuT.cjs`),t=require(`./env-mhFQyGk4.cjs`),n=require(`./docs-DWXbRrEK.cjs`);require(`./components-C9bYrQVK.cjs`),require(`./plugin-D5qyQPqC.cjs`),require(`./runtime-Bisl_1Ja.cjs`),require(`./types-MYBaygjr.cjs`);let r=require(`@stryke/convert/to-array`),i=require(`@stryke/fs/is-file`),a=require(`@stryke/fs/list-files`),o=require(`@stryke/path/append`),s=require(`@stryke/path/is-type`),c=require(`@stryke/path/join-paths`),l=require(`@stryke/path/replace`),u=require(`automd`),d=require(`c12`),f=require(`defu`);f=e.O(f);let p=require(`markdown-toc`);p=e.O(p);let m=require(`@babel/core`),h=require(`@storm-software/config-tools/types`),g=require(`@stryke/path/file-path-fns`),_=require(`@stryke/path/is-parent-path`),v=require(`@stryke/type-checks/is-set-object`),y=require(`@stryke/type-checks/is-function`);require(`@stryke/type-checks/is-object`);let b=require(`@stryke/type-checks/is-set-string`),x=require(`chalk`);x=e.O(x);let S=require(`@babel/generator`);S=e.O(S),require(`@babel/parser`);let C=require(`@babel/helper-plugin-utils`);require(`@storm-software/config-tools/logger`),require(`@storm-software/config-tools/utilities/colors`),require(`@stryke/helpers/noop`);let ee=require(`@stryke/string-format/kebab-case`),w=require(`@stryke/string-format/title-case`),T=require(`@babel/types`);T=e.O(T);let E=require(`@stryke/type-checks/is-string`),D=require(`@stryke/convert/parse-type-definition`),O=require(`@stryke/env/types`),k=require(`@stryke/fs/exists`),te=require(`@stryke/fs/helpers`),A=require(`@stryke/path/join`),j=require(`@stryke/string-format/constant-case`),M=require(`@stryke/capnp`);M=e.O(M);let N=require(`@stryke/helpers/get-unique`),P=require(`@stryke/json/storm-json`),ne=require(`@stryke/type-checks/is-null`),re=require(`@stryke/type-checks/is-undefined`),ie=require(`@stryke/fs/buffer`),F=require(`node:fs`),I=require(`@alloy-js/core/jsx-runtime`);const L=(e={})=>({name:`automd`,async config(){let t=await(0,u.loadConfig)((0,c.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=(0,r.toArray)(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:(0,f.default)(t??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!(0,r.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,r.toArray)(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await(0,d.loadConfig)({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=(0,u.resolveConfig)((0,f.default)(this.config.automd,{...e,prefix:(0,r.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,r.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,a.listFiles)((0,s.isAbsolutePath)(e)?e:(0,o.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,s.isAbsolutePath)(e)?e:(0,o.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,s.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,o.appendPath)(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:(0,p.default)(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all((0,r.toArray)(this.config.automd.input).map(async e=>{let t=await this.fs.read(e);if(t){let n=await(0,u.transform)(t,this.config.automd);if(n.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);n.hasChanged&&await this.fs.write((0,o.appendPath)(this.config.automd.output?(0,i.isDirectory)(this.config.automd.output)?(0,l.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),n.contents)}}))}});var R=L;function z(e){return(0,b.isSetString)(e)?e:Array.isArray(e)&&e.length>0?z(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function B(e,t){return!!(z(t)&&e.some(e=>Array.isArray(e)&&z(e[0])===z(t)))}function V(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?(0,y.isFunction)(t[0])?t[0](e):t[0]:(0,y.isFunction)(t)?t(e):t}catch{return t[0]}}function H(e,t,n,r){if(Array.isArray(r)&&r.length>0&&r[0]){if(r.length>2&&r[2]&&(0,y.isFunction)(r[2])&&!r[2](t,n)){e.log(h.LogLevelLabel.TRACE,`Skipping filtered Babel plugin ${x.default.bold.cyanBright(z(r)||`unnamed`)} for ${n}`);return}return r.length>2?[V(e,r),r[1],r[2]]:[V(e,r),r[1],null]}return[V(e,r),{},null]}let U=S.default;`default`in U&&(U=U.default);const W=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],G=(e,t)=>(n,...r)=>e(n,` ${x.default.inverse.hex(W[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%W.length]||W[0])(` ${(0,w.titleCase)(t)} `)} ${r.join(` `)} `);function K(e,t){let n=n=>(0,C.declare)((r,i,a)=>{r.cache.using(()=>n.meta.checksum),r.assertVersion(`^7.0.0-0`);let o=G(n.log,e);o(h.LogLevelLabel.TRACE,`Initializing the ${x.default.bold.cyanBright(e)} Babel plugin`);let s=t({log:o,name:e,api:r,options:i,context:n,dirname:a});return s.name=e,o(h.LogLevelLabel.TRACE,`Completed initialization of the ${x.default.bold.cyanBright(e)} Babel plugin`),s});return n.$$name=e,n}function q(e,t){ae(e.scope.getProgramParent().path,t)}function J(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function Y(e){let t=new Map;return e.traverse({ImportDeclaration(e){J(e)&&t.set(e.node.source.value,e)}}),t}function ae(e,t){Y(e).get(t.module)||e.unshiftContainer(`body`,T.importDeclaration([T.importSpecifier(T.identifier(t.name||t.imported),T.identifier(t.imported))],T.stringLiteral(t.module)))}const oe=(e={})=>({name:`babel`,config(){if((0,v.isSetObject)(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=(0,f.default)(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(t,n){if((0,_.isParentPath)(n,this.powerlinesPath)||t.includes(`/* @storm-ignore */`)||t.includes(`/* @storm-disable */`))return this.log(h.LogLevelLabel.TRACE,`Skipping Babel transformation for: ${n}`),{code:t,id:n};this.log(h.LogLevelLabel.TRACE,`Babel transforming file: ${n}`);let r=this.config.transform.babel.plugins.map(e=>H(this,t,n,e)).filter((e,t,n)=>e&&!B(n,e)),i=this.config.transform.babel.presets.map(e=>H(this,t,n,e)).filter((e,t,n)=>e&&!B(n,e));if(Array.isArray(r)&&r.length===0&&Array.isArray(i)&&i.length===0)return{code:t,id:n};[`ts`,`cts`,`mts`,`tsx`].includes((0,g.findFileExtensionSafe)(n))&&!B(r,`@babel/plugin-syntax-typescript`)&&!B(i,`@babel/preset-typescript`)&&r.unshift([`@babel/plugin-syntax-typescript`,{isTSX:(0,g.findFileExtension)(n)===`.tsx`}]);let a=await(0,m.transformAsync)(t,{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:n,plugins:r.map(t=>Array.isArray(t)&&t.length>=2?[t[0],(0,f.default)(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:i.map(t=>Array.isArray(t)&&t.length>=2?[t[0],(0,f.default)(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean)});if(!a?.code)throw Error(`Powerlines - Babel plugin failed to compile ${n}`);return{code:a.code,id:n}}});var se=oe;function ce(e,t){return Z(e.type,t??e.getDefaultValue())}function X(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function Z(t,n){return(0,re.isUndefined)(n)?`undefined`:(0,ne.isNull)(n)?`null`:t.kind===e.D.ReflectionKind.boolean?String(n).trim().toLowerCase()===`true`?`true`:`false`:t.kind===e.D.ReflectionKind.string||t.kind===e.D.ReflectionKind.literal&&(0,E.isString)(t.literal)?X(n):t.kind===e.D.ReflectionKind.enum?le(t).kind===e.D.ReflectionKind.string?X(n):`${String(n)}`:t.kind===e.D.ReflectionKind.union?de(t)?X(n):`${String(n)}`:t.kind===e.D.ReflectionKind.array?X(P.StormJSON.stringify(n)):t.kind===e.D.ReflectionKind.object||t.kind===e.D.ReflectionKind.objectLiteral?P.StormJSON.stringify(n):t.kind===e.D.ReflectionKind.property||t.kind===e.D.ReflectionKind.parameter?Z(t.type,n):String(n)}function le(t){if(t.kind!==e.D.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${t.kind}.`);let n=(0,N.getUniqueBy)(t.values.filter(e=>e!=null),t=>(0,E.isString)(t)?{kind:e.D.ReflectionKind.string}:{kind:e.D.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&(0,E.isString)(n[0])?{kind:e.D.ReflectionKind.string}:{kind:e.D.ReflectionKind.number}}function ue(t){if(t.kind===e.D.ReflectionKind.union&&t.types.length>0)return(0,N.getUniqueBy)(t.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${t.kind}.`)}function de(t){return ue(t).some(t=>t.kind===e.D.ReflectionKind.string||t.kind===e.D.ReflectionKind.literal&&(0,E.isString)(t.literal))}const Q=K(`env`,({log:t,context:n})=>{function r(e,r,i=!1){let a=n.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(e.name){let o=n.config.env.prefix.find(t=>e.name&&e.name.startsWith(t)&&(n.env.types.env?.hasProperty(e.name.replace(`${t}_`,``))||a.some(n=>n.getAlias().includes(e.name.replace(`${t}_`,``))))),s=e.name;if(o&&(s=e.name.replace(`${o}_`,``)),t(h.LogLevelLabel.TRACE,`Environment variable ${s} found in ${r.filename||`unknown file`}.`),n.env.types.env?.hasProperty(s)||a.some(e=>e.getAlias().includes(s))){let e=n.env.types.env.hasProperty(s)?n.env.types.env.getProperty(s):a.find(e=>e.getAlias().includes(s));if(!e||e.isIgnored())return;if(n.env.used.env.hasProperty(s)||n.env.used.env.addProperty(e.property),n.config.env.inject&&i){let t=n.env.parsed?.[s];if(t===void 0){let e=n.config.env.prefix.find(e=>n.env.parsed[`${e.replace(/_$/g,``)}_${s}`]);e&&(t=n.env.parsed[`${e.replace(/_$/g,``)}_${s}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${s}\` is not defined in the .env configuration files`);return ce(e,t)}}else throw Error(`The "${s}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${r.filename?r.filename:`unknown`}.
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./create-reflection-resource-BEDScc6f.cjs`),t=require(`./env-k_8Sz-kF.cjs`),n=require(`./docs--ddXDQBx.cjs`);require(`./components-C9bYrQVK.cjs`),require(`./plugin-D5qyQPqC.cjs`),require(`./runtime-Bisl_1Ja.cjs`),require(`./types-MYBaygjr.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/fs/is-file`),o=require(`@stryke/fs/list-files`),s=require(`@stryke/path/append`),c=require(`@stryke/path/is-type`),l=require(`@stryke/path/join-paths`),ee=require(`@stryke/path/replace`),u=require(`automd`),d=require(`c12`),f=require(`defu`);f=e.O(f);let p=require(`markdown-toc`);p=e.O(p);let m=require(`@babel/core`),h=require(`@storm-software/config-tools/types`),g=require(`@stryke/path/file-path-fns`),_=require(`@stryke/path/is-parent-path`),te=require(`@stryke/type-checks/is-set-object`),v=require(`@stryke/type-checks/is-function`);require(`@stryke/type-checks/is-object`);let y=require(`@stryke/type-checks/is-set-string`),b=require(`chalk`);b=e.O(b);let x=require(`@babel/generator`);x=e.O(x),require(`@babel/parser`);let S=require(`@babel/helper-plugin-utils`);require(`@storm-software/config-tools/logger`),require(`@storm-software/config-tools/utilities/colors`),require(`@stryke/helpers/noop`);let ne=require(`@stryke/string-format/kebab-case`),C=require(`@stryke/string-format/title-case`),w=require(`@babel/types`);w=e.O(w);let T=require(`@stryke/type-checks/is-string`),E=require(`@stryke/convert/parse-type-definition`),D=require(`@stryke/env/types`),O=require(`@stryke/fs/exists`),k=require(`@stryke/fs/helpers`),A=require(`@stryke/path/join`),j=require(`@stryke/string-format/constant-case`),M=require(`@stryke/capnp`);M=e.O(M);let N=require(`@stryke/helpers/get-unique`),P=require(`@stryke/json/storm-json`),re=require(`@stryke/type-checks/is-null`),ie=require(`@stryke/type-checks/is-undefined`),F=require(`@stryke/fs/buffer`),I=require(`node:fs`);const L=(e={})=>({name:`automd`,async config(){let t=await(0,u.loadConfig)((0,l.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=(0,i.toArray)(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:(0,f.default)(t??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!(0,i.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,i.toArray)(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await(0,d.loadConfig)({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=(0,u.resolveConfig)((0,f.default)(this.config.automd,{...e,prefix:(0,i.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,o.listFiles)((0,c.isAbsolutePath)(e)?e:(0,s.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,c.isAbsolutePath)(e)?e:(0,s.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,c.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,s.appendPath)(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:(0,p.default)(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>{let t=await this.fs.read(e);if(t){let n=await(0,u.transform)(t,this.config.automd);if(n.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);n.hasChanged&&await this.fs.write((0,s.appendPath)(this.config.automd.output?(0,a.isDirectory)(this.config.automd.output)?(0,ee.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),n.contents)}}))}});var R=L;function z(e){return(0,y.isSetString)(e)?e:Array.isArray(e)&&e.length>0?z(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function B(e,t){return!!(z(t)&&e.some(e=>Array.isArray(e)&&z(e[0])===z(t)))}function V(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?(0,v.isFunction)(t[0])?t[0](e):t[0]:(0,v.isFunction)(t)?t(e):t}catch{return t[0]}}function H(e,t,n,r){if(Array.isArray(r)&&r.length>0&&r[0]){if(r.length>2&&r[2]&&(0,v.isFunction)(r[2])&&!r[2](t,n)){e.log(h.LogLevelLabel.TRACE,`Skipping filtered Babel plugin ${b.default.bold.cyanBright(z(r)||`unnamed`)} for ${n}`);return}return r.length>2?[V(e,r),r[1],r[2]]:[V(e,r),r[1],null]}return[V(e,r),{},null]}let U=x.default;`default`in U&&(U=U.default);const W=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],G=(e,t)=>(n,...r)=>e(n,` ${b.default.inverse.hex(W[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%W.length]||W[0])(` ${(0,C.titleCase)(t)} `)} ${r.join(` `)} `);function K(e,t){let n=n=>(0,S.declare)((r,i,a)=>{r.cache.using(()=>n.meta.checksum),r.assertVersion(`^7.0.0-0`);let o=G(n.log,e);o(h.LogLevelLabel.TRACE,`Initializing the ${b.default.bold.cyanBright(e)} Babel plugin`);let s=t({log:o,name:e,api:r,options:i,context:n,dirname:a});return s.name=e,o(h.LogLevelLabel.TRACE,`Completed initialization of the ${b.default.bold.cyanBright(e)} Babel plugin`),s});return n.$$name=e,n}function q(e,t){oe(e.scope.getProgramParent().path,t)}function J(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function ae(e){let t=new Map;return e.traverse({ImportDeclaration(e){J(e)&&t.set(e.node.source.value,e)}}),t}function oe(e,t){ae(e).get(t.module)||e.unshiftContainer(`body`,w.importDeclaration([w.importSpecifier(w.identifier(t.name||t.imported),w.identifier(t.imported))],w.stringLiteral(t.module)))}const se=(e={})=>({name:`babel`,config(){if((0,te.isSetObject)(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=(0,f.default)(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(t,n){if((0,_.isParentPath)(n,this.powerlinesPath)||t.includes(`/* @storm-ignore */`)||t.includes(`/* @storm-disable */`))return this.log(h.LogLevelLabel.TRACE,`Skipping Babel transformation for: ${n}`),{code:t,id:n};this.log(h.LogLevelLabel.TRACE,`Babel transforming file: ${n}`);let r=this.config.transform.babel.plugins.map(e=>H(this,t,n,e)).filter((e,t,n)=>e&&!B(n,e)),i=this.config.transform.babel.presets.map(e=>H(this,t,n,e)).filter((e,t,n)=>e&&!B(n,e));if(Array.isArray(r)&&r.length===0&&Array.isArray(i)&&i.length===0)return{code:t,id:n};[`ts`,`cts`,`mts`,`tsx`].includes((0,g.findFileExtensionSafe)(n))&&!B(r,`@babel/plugin-syntax-typescript`)&&!B(i,`@babel/preset-typescript`)&&r.unshift([`@babel/plugin-syntax-typescript`,{isTSX:(0,g.findFileExtension)(n)===`.tsx`}]);let a=await(0,m.transformAsync)(t,{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:n,plugins:r.map(t=>Array.isArray(t)&&t.length>=2?[t[0],(0,f.default)(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:i.map(t=>Array.isArray(t)&&t.length>=2?[t[0],(0,f.default)(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean)});if(!a?.code)throw Error(`Powerlines - Babel plugin failed to compile ${n}`);return{code:a.code,id:n}}});var ce=se;function le(e,t){return X(e.type,t??e.getDefaultValue())}function Y(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function X(t,n){return(0,ie.isUndefined)(n)?`undefined`:(0,re.isNull)(n)?`null`:t.kind===e.D.ReflectionKind.boolean?String(n).trim().toLowerCase()===`true`?`true`:`false`:t.kind===e.D.ReflectionKind.string||t.kind===e.D.ReflectionKind.literal&&(0,T.isString)(t.literal)?Y(n):t.kind===e.D.ReflectionKind.enum?ue(t).kind===e.D.ReflectionKind.string?Y(n):`${String(n)}`:t.kind===e.D.ReflectionKind.union?Z(t)?Y(n):`${String(n)}`:t.kind===e.D.ReflectionKind.array?Y(P.StormJSON.stringify(n)):t.kind===e.D.ReflectionKind.object||t.kind===e.D.ReflectionKind.objectLiteral?P.StormJSON.stringify(n):t.kind===e.D.ReflectionKind.property||t.kind===e.D.ReflectionKind.parameter?X(t.type,n):String(n)}function ue(t){if(t.kind!==e.D.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${t.kind}.`);let n=(0,N.getUniqueBy)(t.values.filter(e=>e!=null),t=>(0,T.isString)(t)?{kind:e.D.ReflectionKind.string}:{kind:e.D.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&(0,T.isString)(n[0])?{kind:e.D.ReflectionKind.string}:{kind:e.D.ReflectionKind.number}}function de(t){if(t.kind===e.D.ReflectionKind.union&&t.types.length>0)return(0,N.getUniqueBy)(t.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${t.kind}.`)}function Z(t){return de(t).some(t=>t.kind===e.D.ReflectionKind.string||t.kind===e.D.ReflectionKind.literal&&(0,T.isString)(t.literal))}const Q=K(`env`,({log:t,context:n})=>{function r(e,r,i=!1){let a=n.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(e.name){let o=n.config.env.prefix.find(t=>e.name&&e.name.startsWith(t)&&(n.env.types.env?.hasProperty(e.name.replace(`${t}_`,``))||a.some(n=>n.getAlias().includes(e.name.replace(`${t}_`,``))))),s=e.name;if(o&&(s=e.name.replace(`${o}_`,``)),t(h.LogLevelLabel.TRACE,`Environment variable ${s} found in ${r.filename||`unknown file`}.`),n.env.types.env?.hasProperty(s)||a.some(e=>e.getAlias().includes(s))){let e=n.env.types.env.hasProperty(s)?n.env.types.env.getProperty(s):a.find(e=>e.getAlias().includes(s));if(!e||e.isIgnored())return;if(n.env.used.env.hasProperty(s)||n.env.used.env.addProperty(e.property),n.config.env.inject&&i){let t=n.env.parsed?.[s];if(t===void 0){let e=n.config.env.prefix.find(e=>n.env.parsed[`${e.replace(/_$/g,``)}_${s}`]);e&&(t=n.env.parsed[`${e.replace(/_$/g,``)}_${s}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${s}\` is not defined in the .env configuration files`);return le(e,t)}}else throw Error(`The "${s}" 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
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
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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){t(h.LogLevelLabel.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let r=e.D.ReflectionClass.from({kind:e.D.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),i=e.s(n,`env`);i&&(0,F.existsSync)(i)&&(t(h.LogLevelLabel.TRACE,`Environment reflection file found at ${i}, reading existing reflection.`),r=(0,e.D.resolveClassType)((0,e.D.deserializeType)(e.E(new M.Message((0,ie.readFileBufferSync)(i),!1).getRoot(e.T).types)))),t(h.LogLevelLabel.TRACE,`Adding new variables to env reflection at ${i}.`),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()})})}}}),fe=e=>(0,u.defineGenerator)({name:`env`,async generate(){let t=(0,c.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(t)?{contents:await e.fs.read(t)||``}:{contents:``}}});async function pe(t,n){let r=await e.d(t,n);return r.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{r.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||(0,w.titleCase)(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),r}const $=(n={})=>[se(n.babel),{name:`env`,async config(){this.log(h.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,f.default)(n,{types:{},prefix:[]}),transform:{babel:{plugins:[Q]}}};if(t.env.types)t.env.types=(0,D.parseTypeDefinition)(t.env.types);else{this.log(h.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let n=await e.o(this);t.env.types=(0,D.parseTypeDefinition)(`${n.file}#${n.name}`)}if(t.env.secrets)t.env.secrets=(0,D.parseTypeDefinition)(t.env.secrets);else{let n=await e.l(this);t.env.secrets=(0,D.parseTypeDefinition)(`${n.file}#${n.name}`)}return t.env.prefix=(0,r.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,j.constantCase)(t);return e.includes(n)||e.push(n),e},[...O.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(h.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,f.default)({parsed:await e.n(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&(0,k.existsSync)(e.c(this,`env`)))this.log(h.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await e.d(this,`env`),(0,k.existsSync)(e.s(this,`env`))&&(this.env.used.env=await e.u(this)),(0,k.existsSync)(e.c(this,`secrets`))&&(this.env.types.secrets=await e.d(this,`secrets`)),(0,k.existsSync)(e.s(this,`secrets`))&&(this.env.used.secrets=await e.f(this));else{if(this.env.types.env=await e.C(this,this.config.env.types?.file?(0,_.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,A.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 e.g(this,this.env.types.env,`env`),this.env.types.secrets=await e.w(this,this.config.env.secrets?.file?(0,_.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,A.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 e.g(this,this.env.types.secrets,`secrets`),this.log(h.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 t=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await e.n(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.D.ReflectionClass({kind:e.D.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 e.m(this,this.env.used.env,`env`),this.env.types.secrets&&(await e.g(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.D.ReflectionClass({kind:e.D.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 e.m(this,this.env.used.secrets,`secrets`))}},async prepare(){return this.log(h.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render((0,I.jsx)(t.t,{defaultConfig:this.config.env.defaultConfig}))},async docs(){this.log(h.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=(0,A.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,k.existsSync)(t)||await(0,te.createDirectory)(t);let n=await e.d(this,`env`),r=(0,A.joinPaths)(t,`env.md`);this.log(h.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,w.titleCase)(this.config.framework)||`Powerlines`} -->
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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){t(h.LogLevelLabel.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let r=e.D.ReflectionClass.from({kind:e.D.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),i=e.s(n,`env`);i&&(0,I.existsSync)(i)&&(t(h.LogLevelLabel.TRACE,`Environment reflection file found at ${i}, reading existing reflection.`),r=(0,e.D.resolveClassType)((0,e.D.deserializeType)(e.E(new M.Message((0,F.readFileBufferSync)(i),!1).getRoot(e.T).types)))),t(h.LogLevelLabel.TRACE,`Adding new variables to env reflection at ${i}.`),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()})})}}}),fe=e=>(0,u.defineGenerator)({name:`env`,async generate(){let t=(0,l.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(t)?{contents:await e.fs.read(t)||``}:{contents:``}}});async function pe(t,n){let r=await e.d(t,n);return r.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{r.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||(0,C.titleCase)(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),r}const $=(n={})=>[ce(n.babel),{name:`env`,async config(){this.log(h.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,f.default)(n,{types:{},prefix:[]}),transform:{babel:{plugins:[Q]}}};if(t.env.types)t.env.types=(0,E.parseTypeDefinition)(t.env.types);else{this.log(h.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let n=await e.o(this);t.env.types=(0,E.parseTypeDefinition)(`${n.file}#${n.name}`)}if(t.env.secrets)t.env.secrets=(0,E.parseTypeDefinition)(t.env.secrets);else{let n=await e.l(this);t.env.secrets=(0,E.parseTypeDefinition)(`${n.file}#${n.name}`)}return t.env.prefix=(0,i.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,j.constantCase)(t);return e.includes(n)||e.push(n),e},[...D.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(h.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,f.default)({parsed:await e.n(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&(0,O.existsSync)(e.c(this,`env`)))this.log(h.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await e.d(this,`env`),(0,O.existsSync)(e.s(this,`env`))&&(this.env.used.env=await e.u(this)),(0,O.existsSync)(e.c(this,`secrets`))&&(this.env.types.secrets=await e.d(this,`secrets`)),(0,O.existsSync)(e.s(this,`secrets`))&&(this.env.used.secrets=await e.f(this));else{if(this.env.types.env=await e.C(this,this.config.env.types?.file?(0,_.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,A.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 e.g(this,this.env.types.env,`env`),this.env.types.secrets=await e.w(this,this.config.env.secrets?.file?(0,_.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,A.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 e.g(this,this.env.types.secrets,`secrets`),this.log(h.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 t=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await e.n(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.D.ReflectionClass({kind:e.D.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 e.m(this,this.env.used.env,`env`),this.env.types.secrets&&(await e.g(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.D.ReflectionClass({kind:e.D.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 e.m(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(h.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render((0,r.createComponent)(t.t,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(h.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=(0,A.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,O.existsSync)(t)||await(0,k.createDirectory)(t);let n=await e.d(this,`env`),r=(0,A.joinPaths)(t,`env.md`);this.log(h.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,C.titleCase)(this.config.framework)||`Powerlines`} -->
6
6
 
7
7
  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.
8
8
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as EnvDocs } from "./docs-CKCRAUnO.mjs";
2
2
  import { i as __ΩEnvBuiltinProps, n as EnvBuiltinProps, r as EnvTypeDefinition, t as EnvBuiltin } from "./env-DqPOEUEu.mjs";
3
3
  import "./index-CW2WHUXP.mjs";
4
- import { a as EnvType, c as __ΩEnvPluginResolvedConfig, d as type_d_exports, i as EnvPluginUserConfig, l as __ΩEnvPluginUserConfig, n as EnvPluginOptions, o as __ΩEnvPluginContext, r as EnvPluginResolvedConfig, s as __ΩEnvPluginOptions, t as EnvPluginContext, u as __ΩEnvType } from "./plugin-CuDS8_K8.mjs";
4
+ import { a as EnvType, c as __ΩEnvPluginResolvedConfig, d as type_d_exports, i as EnvPluginUserConfig, l as __ΩEnvPluginUserConfig, n as EnvPluginOptions, o as __ΩEnvPluginContext, r as EnvPluginResolvedConfig, s as __ΩEnvPluginOptions, t as EnvPluginContext, u as __ΩEnvType } from "./plugin-D9GLc9S_.mjs";
5
5
  import { d as UnresolvedContext, i as __ΩSecretsInterface, l as Context, n as SecretsInterface, r as __ΩEnvInterface, t as EnvInterface } from "./runtime-CRLPiOqf.mjs";
6
6
  import "./index-DCQ5Y2ED.mjs";
7
7
  import { DotenvParseOutput } from "@stryke/env/types";
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import{C as e,D as t,E as n,S as r,T as i,_ as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as ee,l as p,m,n as h,o as g,p as te,r as ne,s as _,t as re,u as v,v as ie,w as y,x as ae,y as oe}from"./create-reflection-resource-BtYlphp1.mjs";import{n as se,t as b}from"./env-Bwys2dqb.mjs";import{t as x}from"./docs-CMoOO30q.mjs";import"./components-ByVHjWXF.mjs";import"./plugin-CyRU_Pln.mjs";import"./runtime-g_eXGBBi.mjs";import"./types-DMh7K7VC.mjs";import{toArray as S}from"@stryke/convert/to-array";import{isDirectory as ce}from"@stryke/fs/is-file";import{listFiles as le}from"@stryke/fs/list-files";import{appendPath as C}from"@stryke/path/append";import{isAbsolutePath as w}from"@stryke/path/is-type";import{joinPaths as T}from"@stryke/path/join-paths";import{replacePath as ue}from"@stryke/path/replace";import{defineGenerator as de,loadConfig as fe,resolveConfig as pe,transform as me}from"automd";import{loadConfig as he}from"c12";import E from"defu";import ge from"markdown-toc";import{transformAsync as _e}from"@babel/core";import{LogLevelLabel as D}from"@storm-software/config-tools/types";import{findFileExtension as ve,findFileExtensionSafe as ye}from"@stryke/path/file-path-fns";import{isParentPath as O}from"@stryke/path/is-parent-path";import{isSetObject as be}from"@stryke/type-checks/is-set-object";import{isFunction as k}from"@stryke/type-checks/is-function";import"@stryke/type-checks/is-object";import{isSetString as A}from"@stryke/type-checks/is-set-string";import j from"chalk";import M from"@babel/generator";import"@babel/parser";import{declare as N}from"@babel/helper-plugin-utils";import"@storm-software/config-tools/logger";import"@storm-software/config-tools/utilities/colors";import"@stryke/helpers/noop";import{kebabCase as xe}from"@stryke/string-format/kebab-case";import{titleCase as P}from"@stryke/string-format/title-case";import*as F from"@babel/types";import{isString as I}from"@stryke/type-checks/is-string";import{parseTypeDefinition as L}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as Se}from"@stryke/env/types";import{existsSync as R}from"@stryke/fs/exists";import{createDirectory as Ce}from"@stryke/fs/helpers";import{joinPaths as z}from"@stryke/path/join";import{constantCase as we}from"@stryke/string-format/constant-case";import*as Te from"@stryke/capnp";import{getUniqueBy as B}from"@stryke/helpers/get-unique";import{StormJSON as V}from"@stryke/json/storm-json";import{isNull as Ee}from"@stryke/type-checks/is-null";import{isUndefined as De}from"@stryke/type-checks/is-undefined";import{readFileBufferSync as Oe}from"@stryke/fs/buffer";import{existsSync as ke}from"node:fs";import{jsx as Ae}from"@alloy-js/core/jsx-runtime";var je=(e={})=>({name:`automd`,async config(){let t=await fe(T(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=S(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:E(t??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!S(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=S(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await he({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=pe(E(this.config.automd,{...e,prefix:S(e.prefix??[])}))}this.config.automd.input=(await Promise.all(S(this.config.automd.input).map(async e=>e.includes(`*`)?le(w(e)?e:C(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):w(e)?e:C(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!w(this.config.automd.output)&&(this.config.automd.output=C(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:ge(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all(S(this.config.automd.input).map(async e=>{let t=await this.fs.read(e);if(t){let n=await me(t,this.config.automd);if(n.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);n.hasChanged&&await this.fs.write(C(this.config.automd.output?ce(this.config.automd.output)?ue(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),n.contents)}}))}});function H(e){return A(e)?e:Array.isArray(e)&&e.length>0?H(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function U(e,t){return!!(H(t)&&e.some(e=>Array.isArray(e)&&H(e[0])===H(t)))}function W(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?k(t[0])?t[0](e):t[0]:k(t)?t(e):t}catch{return t[0]}}function G(e,t,n,r){if(Array.isArray(r)&&r.length>0&&r[0]){if(r.length>2&&r[2]&&k(r[2])&&!r[2](t,n)){e.log(D.TRACE,`Skipping filtered Babel plugin ${j.bold.cyanBright(H(r)||`unnamed`)} for ${n}`);return}return r.length>2?[W(e,r),r[1],r[2]]:[W(e,r),r[1],null]}return[W(e,r),{},null]}let K=M;`default`in K&&(K=K.default);const q=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],Me=(e,t)=>(n,...r)=>e(n,` ${j.inverse.hex(q[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%q.length]||q[0])(` ${P(t)} `)} ${r.join(` `)} `);function Ne(e,t){let n=n=>N((r,i,a)=>{r.cache.using(()=>n.meta.checksum),r.assertVersion(`^7.0.0-0`);let o=Me(n.log,e);o(D.TRACE,`Initializing the ${j.bold.cyanBright(e)} Babel plugin`);let s=t({log:o,name:e,api:r,options:i,context:n,dirname:a});return s.name=e,o(D.TRACE,`Completed initialization of the ${j.bold.cyanBright(e)} Babel plugin`),s});return n.$$name=e,n}function J(e,t){Ie(e.scope.getProgramParent().path,t)}function Pe(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function Fe(e){let t=new Map;return e.traverse({ImportDeclaration(e){Pe(e)&&t.set(e.node.source.value,e)}}),t}function Ie(e,t){Fe(e).get(t.module)||e.unshiftContainer(`body`,F.importDeclaration([F.importSpecifier(F.identifier(t.name||t.imported),F.identifier(t.imported))],F.stringLiteral(t.module)))}var Le=(e={})=>({name:`babel`,config(){if(be(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=E(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(t,n){if(O(n,this.powerlinesPath)||t.includes(`/* @storm-ignore */`)||t.includes(`/* @storm-disable */`))return this.log(D.TRACE,`Skipping Babel transformation for: ${n}`),{code:t,id:n};this.log(D.TRACE,`Babel transforming file: ${n}`);let r=this.config.transform.babel.plugins.map(e=>G(this,t,n,e)).filter((e,t,n)=>e&&!U(n,e)),i=this.config.transform.babel.presets.map(e=>G(this,t,n,e)).filter((e,t,n)=>e&&!U(n,e));if(Array.isArray(r)&&r.length===0&&Array.isArray(i)&&i.length===0)return{code:t,id:n};[`ts`,`cts`,`mts`,`tsx`].includes(ye(n))&&!U(r,`@babel/plugin-syntax-typescript`)&&!U(i,`@babel/preset-typescript`)&&r.unshift([`@babel/plugin-syntax-typescript`,{isTSX:ve(n)===`.tsx`}]);let a=await _e(t,{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:n,plugins:r.map(t=>Array.isArray(t)&&t.length>=2?[t[0],E(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:i.map(t=>Array.isArray(t)&&t.length>=2?[t[0],E(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean)});if(!a?.code)throw Error(`Powerlines - Babel plugin failed to compile ${n}`);return{code:a.code,id:n}}});function Y(e,t){return Z(e.type,t??e.getDefaultValue())}function X(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function Z(e,n){return De(n)?`undefined`:Ee(n)?`null`:e.kind===t.ReflectionKind.boolean?String(n).trim().toLowerCase()===`true`?`true`:`false`:e.kind===t.ReflectionKind.string||e.kind===t.ReflectionKind.literal&&I(e.literal)?X(n):e.kind===t.ReflectionKind.enum?Re(e).kind===t.ReflectionKind.string?X(n):`${String(n)}`:e.kind===t.ReflectionKind.union?Be(e)?X(n):`${String(n)}`:e.kind===t.ReflectionKind.array?X(V.stringify(n)):e.kind===t.ReflectionKind.object||e.kind===t.ReflectionKind.objectLiteral?V.stringify(n):e.kind===t.ReflectionKind.property||e.kind===t.ReflectionKind.parameter?Z(e.type,n):String(n)}function Re(e){if(e.kind!==t.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${e.kind}.`);let n=B(e.values.filter(e=>e!=null),e=>I(e)?{kind:t.ReflectionKind.string}:{kind:t.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&I(n[0])?{kind:t.ReflectionKind.string}:{kind:t.ReflectionKind.number}}function ze(e){if(e.kind===t.ReflectionKind.union&&e.types.length>0)return B(e.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${e.kind}.`)}function Be(e){return ze(e).some(e=>e.kind===t.ReflectionKind.string||e.kind===t.ReflectionKind.literal&&I(e.literal))}const Q=Ne(`env`,({log:e,context:r})=>{function a(t,n,i=!1){let a=r.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(t.name){let o=r.config.env.prefix.find(e=>t.name&&t.name.startsWith(e)&&(r.env.types.env?.hasProperty(t.name.replace(`${e}_`,``))||a.some(n=>n.getAlias().includes(t.name.replace(`${e}_`,``))))),s=t.name;if(o&&(s=t.name.replace(`${o}_`,``)),e(D.TRACE,`Environment variable ${s} found in ${n.filename||`unknown file`}.`),r.env.types.env?.hasProperty(s)||a.some(e=>e.getAlias().includes(s))){let e=r.env.types.env.hasProperty(s)?r.env.types.env.getProperty(s):a.find(e=>e.getAlias().includes(s));if(!e||e.isIgnored())return;if(r.env.used.env.hasProperty(s)||r.env.used.env.addProperty(e.property),r.config.env.inject&&i){let t=r.env.parsed?.[s];if(t===void 0){let e=r.config.env.prefix.find(e=>r.env.parsed[`${e.replace(/_$/g,``)}_${s}`]);e&&(t=r.env.parsed[`${e.replace(/_$/g,``)}_${s}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${s}\` is not defined in the .env configuration files`);return Y(e,t)}}else throw Error(`The "${s}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${n.filename?n.filename:`unknown`}.
1
+ import{C as e,D as t,E as n,S as r,T as i,_ as a,a as o,b as s,c,d as l,f as u,g as d,h as ee,i as te,l as f,m as p,n as m,o as h,p as ne,r as g,s as _,t as re,u as v,v as ie,w as y,x as ae,y as oe}from"./create-reflection-resource-B9d8LEWF.mjs";import{n as b,t as x}from"./env-CdR46Bis.mjs";import{t as se}from"./docs-DwPacakH.mjs";import"./components-ByVHjWXF.mjs";import"./plugin-CyRU_Pln.mjs";import"./runtime-g_eXGBBi.mjs";import"./types-DMh7K7VC.mjs";import{createComponent as ce}from"@alloy-js/core/jsx-runtime";import{toArray as S}from"@stryke/convert/to-array";import{isDirectory as le}from"@stryke/fs/is-file";import{listFiles as ue}from"@stryke/fs/list-files";import{appendPath as C}from"@stryke/path/append";import{isAbsolutePath as w}from"@stryke/path/is-type";import{joinPaths as T}from"@stryke/path/join-paths";import{replacePath as de}from"@stryke/path/replace";import{defineGenerator as fe,loadConfig as pe,resolveConfig as me,transform as he}from"automd";import{loadConfig as ge}from"c12";import E from"defu";import _e from"markdown-toc";import{transformAsync as ve}from"@babel/core";import{LogLevelLabel as D}from"@storm-software/config-tools/types";import{findFileExtension as ye,findFileExtensionSafe as be}from"@stryke/path/file-path-fns";import{isParentPath as O}from"@stryke/path/is-parent-path";import{isSetObject as k}from"@stryke/type-checks/is-set-object";import{isFunction as A}from"@stryke/type-checks/is-function";import"@stryke/type-checks/is-object";import{isSetString as j}from"@stryke/type-checks/is-set-string";import M from"chalk";import N from"@babel/generator";import"@babel/parser";import{declare as xe}from"@babel/helper-plugin-utils";import"@storm-software/config-tools/logger";import"@storm-software/config-tools/utilities/colors";import"@stryke/helpers/noop";import{kebabCase as Se}from"@stryke/string-format/kebab-case";import{titleCase as P}from"@stryke/string-format/title-case";import*as F from"@babel/types";import{isString as I}from"@stryke/type-checks/is-string";import{parseTypeDefinition as L}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as Ce}from"@stryke/env/types";import{existsSync as R}from"@stryke/fs/exists";import{createDirectory as we}from"@stryke/fs/helpers";import{joinPaths as z}from"@stryke/path/join";import{constantCase as Te}from"@stryke/string-format/constant-case";import*as Ee from"@stryke/capnp";import{getUniqueBy as B}from"@stryke/helpers/get-unique";import{StormJSON as V}from"@stryke/json/storm-json";import{isNull as De}from"@stryke/type-checks/is-null";import{isUndefined as Oe}from"@stryke/type-checks/is-undefined";import{readFileBufferSync as ke}from"@stryke/fs/buffer";import{existsSync as Ae}from"node:fs";var je=(e={})=>({name:`automd`,async config(){let t=await pe(T(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=S(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:E(t??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!S(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=S(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await ge({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=me(E(this.config.automd,{...e,prefix:S(e.prefix??[])}))}this.config.automd.input=(await Promise.all(S(this.config.automd.input).map(async e=>e.includes(`*`)?ue(w(e)?e:C(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):w(e)?e:C(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!w(this.config.automd.output)&&(this.config.automd.output=C(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:_e(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all(S(this.config.automd.input).map(async e=>{let t=await this.fs.read(e);if(t){let n=await he(t,this.config.automd);if(n.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);n.hasChanged&&await this.fs.write(C(this.config.automd.output?le(this.config.automd.output)?de(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),n.contents)}}))}});function H(e){return j(e)?e:Array.isArray(e)&&e.length>0?H(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function U(e,t){return!!(H(t)&&e.some(e=>Array.isArray(e)&&H(e[0])===H(t)))}function W(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?A(t[0])?t[0](e):t[0]:A(t)?t(e):t}catch{return t[0]}}function G(e,t,n,r){if(Array.isArray(r)&&r.length>0&&r[0]){if(r.length>2&&r[2]&&A(r[2])&&!r[2](t,n)){e.log(D.TRACE,`Skipping filtered Babel plugin ${M.bold.cyanBright(H(r)||`unnamed`)} for ${n}`);return}return r.length>2?[W(e,r),r[1],r[2]]:[W(e,r),r[1],null]}return[W(e,r),{},null]}let K=N;`default`in K&&(K=K.default);const q=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],Me=(e,t)=>(n,...r)=>e(n,` ${M.inverse.hex(q[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%q.length]||q[0])(` ${P(t)} `)} ${r.join(` `)} `);function Ne(e,t){let n=n=>xe((r,i,a)=>{r.cache.using(()=>n.meta.checksum),r.assertVersion(`^7.0.0-0`);let o=Me(n.log,e);o(D.TRACE,`Initializing the ${M.bold.cyanBright(e)} Babel plugin`);let s=t({log:o,name:e,api:r,options:i,context:n,dirname:a});return s.name=e,o(D.TRACE,`Completed initialization of the ${M.bold.cyanBright(e)} Babel plugin`),s});return n.$$name=e,n}function J(e,t){Ie(e.scope.getProgramParent().path,t)}function Pe(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function Fe(e){let t=new Map;return e.traverse({ImportDeclaration(e){Pe(e)&&t.set(e.node.source.value,e)}}),t}function Ie(e,t){Fe(e).get(t.module)||e.unshiftContainer(`body`,F.importDeclaration([F.importSpecifier(F.identifier(t.name||t.imported),F.identifier(t.imported))],F.stringLiteral(t.module)))}var Le=(e={})=>({name:`babel`,config(){if(k(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=E(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(t,n){if(O(n,this.powerlinesPath)||t.includes(`/* @storm-ignore */`)||t.includes(`/* @storm-disable */`))return this.log(D.TRACE,`Skipping Babel transformation for: ${n}`),{code:t,id:n};this.log(D.TRACE,`Babel transforming file: ${n}`);let r=this.config.transform.babel.plugins.map(e=>G(this,t,n,e)).filter((e,t,n)=>e&&!U(n,e)),i=this.config.transform.babel.presets.map(e=>G(this,t,n,e)).filter((e,t,n)=>e&&!U(n,e));if(Array.isArray(r)&&r.length===0&&Array.isArray(i)&&i.length===0)return{code:t,id:n};[`ts`,`cts`,`mts`,`tsx`].includes(be(n))&&!U(r,`@babel/plugin-syntax-typescript`)&&!U(i,`@babel/preset-typescript`)&&r.unshift([`@babel/plugin-syntax-typescript`,{isTSX:ye(n)===`.tsx`}]);let a=await ve(t,{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:n,plugins:r.map(t=>Array.isArray(t)&&t.length>=2?[t[0],E(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:i.map(t=>Array.isArray(t)&&t.length>=2?[t[0],E(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean)});if(!a?.code)throw Error(`Powerlines - Babel plugin failed to compile ${n}`);return{code:a.code,id:n}}});function Re(e,t){return X(e.type,t??e.getDefaultValue())}function Y(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function X(e,n){return Oe(n)?`undefined`:De(n)?`null`:e.kind===t.ReflectionKind.boolean?String(n).trim().toLowerCase()===`true`?`true`:`false`:e.kind===t.ReflectionKind.string||e.kind===t.ReflectionKind.literal&&I(e.literal)?Y(n):e.kind===t.ReflectionKind.enum?ze(e).kind===t.ReflectionKind.string?Y(n):`${String(n)}`:e.kind===t.ReflectionKind.union?Be(e)?Y(n):`${String(n)}`:e.kind===t.ReflectionKind.array?Y(V.stringify(n)):e.kind===t.ReflectionKind.object||e.kind===t.ReflectionKind.objectLiteral?V.stringify(n):e.kind===t.ReflectionKind.property||e.kind===t.ReflectionKind.parameter?X(e.type,n):String(n)}function ze(e){if(e.kind!==t.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${e.kind}.`);let n=B(e.values.filter(e=>e!=null),e=>I(e)?{kind:t.ReflectionKind.string}:{kind:t.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&I(n[0])?{kind:t.ReflectionKind.string}:{kind:t.ReflectionKind.number}}function Z(e){if(e.kind===t.ReflectionKind.union&&e.types.length>0)return B(e.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${e.kind}.`)}function Be(e){return Z(e).some(e=>e.kind===t.ReflectionKind.string||e.kind===t.ReflectionKind.literal&&I(e.literal))}const Q=Ne(`env`,({log:e,context:r})=>{function a(t,n,i=!1){let a=r.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(t.name){let o=r.config.env.prefix.find(e=>t.name&&t.name.startsWith(e)&&(r.env.types.env?.hasProperty(t.name.replace(`${e}_`,``))||a.some(n=>n.getAlias().includes(t.name.replace(`${e}_`,``))))),s=t.name;if(o&&(s=t.name.replace(`${o}_`,``)),e(D.TRACE,`Environment variable ${s} found in ${n.filename||`unknown file`}.`),r.env.types.env?.hasProperty(s)||a.some(e=>e.getAlias().includes(s))){let e=r.env.types.env.hasProperty(s)?r.env.types.env.getProperty(s):a.find(e=>e.getAlias().includes(s));if(!e||e.isIgnored())return;if(r.env.used.env.hasProperty(s)||r.env.used.env.addProperty(e.property),r.config.env.inject&&i){let t=r.env.parsed?.[s];if(t===void 0){let e=r.config.env.prefix.find(e=>r.env.parsed[`${e.replace(/_$/g,``)}_${s}`]);e&&(t=r.env.parsed[`${e.replace(/_$/g,``)}_${s}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${s}\` is not defined in the .env configuration files`);return Re(e,t)}}else throw Error(`The "${s}" 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
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)} ${a.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${a?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){e(D.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let a=t.ReflectionClass.from({kind:t.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),o=_(r,`env`);o&&ke(o)&&(e(D.TRACE,`Environment reflection file found at ${o}, reading existing reflection.`),a=(0,t.resolveClassType)((0,t.deserializeType)(n(new Te.Message(Oe(o),!1).getRoot(i).types)))),e(D.TRACE,`Adding new variables to env reflection at ${o}.`),a.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()})})}}}),Ve=e=>de({name:`env`,async generate(){let t=T(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(t)?{contents:await e.fs.read(t)||``}:{contents:``}}});async function He(e,t){let n=await l(e,t);return n.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{n.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||P(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),n}const $=(n={})=>[Le(n.babel),{name:`env`,async config(){this.log(D.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:E(n,{types:{},prefix:[]}),transform:{babel:{plugins:[Q]}}};if(e.env.types)e.env.types=L(e.env.types);else{this.log(D.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await g(this);e.env.types=L(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=L(e.env.secrets);else{let t=await p(this);e.env.secrets=L(`${t.file}#${t.name}`)}return e.env.prefix=S(e.env.prefix??[]).reduce((e,t)=>{let n=we(t);return e.includes(n)||e.push(n),e},[...Se,`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(D.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=E({parsed:await h(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&R(c(this,`env`)))this.log(D.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await l(this,`env`),R(_(this,`env`))&&(this.env.used.env=await v(this)),R(c(this,`secrets`))&&(this.env.types.secrets=await l(this,`secrets`)),R(_(this,`secrets`))&&(this.env.used.secrets=await u(this));else{if(this.env.types.env=await e(this,this.config.env.types?.file?O(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 d(this,this.env.types.env,`env`),this.env.types.secrets=await y(this,this.config.env.secrets?.file?O(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 d(this,this.env.types.secrets,`secrets`),this.log(D.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let n=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await h(this,this.config.env)).forEach(([e,t])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=n.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(t)}),this.env.used.env=new t.ReflectionClass({kind:t.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await m(this,this.env.used.env,`env`),this.env.types.secrets&&(await d(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.ReflectionClass({kind:t.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await m(this,this.env.used.secrets,`secrets`))}},async prepare(){return this.log(D.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(Ae(b,{defaultConfig:this.config.env.defaultConfig}))},async docs(){this.log(D.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=z(this.config.projectRoot,`docs`,`generated`);R(e)||await Ce(e);let n=await l(this,`env`),r=z(e,`env.md`);this.log(D.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${P(this.config.framework)||`Powerlines`} -->
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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(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;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){e(D.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let a=t.ReflectionClass.from({kind:t.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),o=_(r,`env`);o&&Ae(o)&&(e(D.TRACE,`Environment reflection file found at ${o}, reading existing reflection.`),a=(0,t.resolveClassType)((0,t.deserializeType)(n(new Ee.Message(ke(o),!1).getRoot(i).types)))),e(D.TRACE,`Adding new variables to env reflection at ${o}.`),a.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()})})}}}),Ve=e=>fe({name:`env`,async generate(){let t=T(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(t)?{contents:await e.fs.read(t)||``}:{contents:``}}});async function He(e,t){let n=await l(e,t);return n.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{n.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||P(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),n}const $=(n={})=>[Le(n.babel),{name:`env`,async config(){this.log(D.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:E(n,{types:{},prefix:[]}),transform:{babel:{plugins:[Q]}}};if(e.env.types)e.env.types=L(e.env.types);else{this.log(D.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await h(this);e.env.types=L(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=L(e.env.secrets);else{let t=await f(this);e.env.secrets=L(`${t.file}#${t.name}`)}return e.env.prefix=S(e.env.prefix??[]).reduce((e,t)=>{let n=Te(t);return e.includes(n)||e.push(n),e},[...Ce,`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(D.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=E({parsed:await m(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&R(c(this,`env`)))this.log(D.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await l(this,`env`),R(_(this,`env`))&&(this.env.used.env=await v(this)),R(c(this,`secrets`))&&(this.env.types.secrets=await l(this,`secrets`)),R(_(this,`secrets`))&&(this.env.used.secrets=await u(this));else{if(this.env.types.env=await e(this,this.config.env.types?.file?O(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 d(this,this.env.types.env,`env`),this.env.types.secrets=await y(this,this.config.env.secrets?.file?O(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 d(this,this.env.types.secrets,`secrets`),this.log(D.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let n=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await m(this,this.config.env)).forEach(([e,t])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=n.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(t)}),this.env.used.env=new t.ReflectionClass({kind:t.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await p(this,this.env.used.env,`env`),this.env.types.secrets&&(await d(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.ReflectionClass({kind:t.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await p(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(D.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(ce(x,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(D.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=z(this.config.projectRoot,`docs`,`generated`);R(e)||await we(e);let n=await l(this,`env`),r=z(e,`env.md`);this.log(D.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${P(this.config.framework)||`Powerlines`} -->
6
6
 
7
7
  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.
8
8
 
@@ -11,4 +11,4 @@ Below is a list of environment variables used by the [${this.packageJson.name}](
11
11
  ${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(`
12
12
  `,``)??``).trim()} | ${(0,t.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `)} | ${e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``} | ${e.isValueRequired()?``:`✔`} |`).join(`
13
13
  `)}
14
- `)},async buildEnd(){let e=_(this,`env`);this.log(D.TRACE,`Writing env reflection types to ${e}.`),await m(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:E(n.automd??{},{generators:{env:Ve(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},je(n.automd)];var Ue=$;export{a as BaseEnv,ie as BaseSecrets,b as EnvBuiltin,x as EnvDocs,se as EnvTypeDefinition,oe as createEnvReflection,re as createReflectionResource,s as createSecretsReflection,He as createTemplateReflection,Ue as default,Q as envBabelPlugin,ee as formatEnvField,g as getEnvDefaultTypeDefinition,_ as getEnvReflectionsPath,c as getEnvTypeReflectionsPath,p as getSecretsDefaultTypeDefinition,h as loadEnv,ne as loadEnvFromContext,ae as mergeEnvReflections,r as mergeSecretsReflections,$ as plugin,v as readEnvReflection,l as readEnvTypeReflection,u as readSecretsReflection,e as reflectEnv,y as reflectSecrets,o as removeEnvPrefix,te as resolveRuntimeTypeFile,m as writeEnvReflection,f as writeEnvReflectionSync,d as writeEnvTypeReflection};
14
+ `)},async buildEnd(){let e=_(this,`env`);this.log(D.TRACE,`Writing env reflection types to ${e}.`),await p(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:E(n.automd??{},{generators:{env:Ve(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},je(n.automd)];var Ue=$;export{a as BaseEnv,ie as BaseSecrets,x as EnvBuiltin,se as EnvDocs,b as EnvTypeDefinition,oe as createEnvReflection,re as createReflectionResource,s as createSecretsReflection,He as createTemplateReflection,Ue as default,Q as envBabelPlugin,te as formatEnvField,h as getEnvDefaultTypeDefinition,_ as getEnvReflectionsPath,c as getEnvTypeReflectionsPath,f as getSecretsDefaultTypeDefinition,m as loadEnv,g as loadEnvFromContext,ae as mergeEnvReflections,r as mergeSecretsReflections,$ as plugin,v as readEnvReflection,l as readEnvTypeReflection,u as readSecretsReflection,e as reflectEnv,y as reflectSecrets,o as removeEnvPrefix,ne as resolveRuntimeTypeFile,p as writeEnvReflection,ee as writeEnvReflectionSync,d as writeEnvTypeReflection};
@@ -1,10 +1,10 @@
1
1
  import { a as BabelResolvedConfig, c as UserConfig, n as SecretsInterface, o as ResolvedConfig, s as BabelUserConfig, t as EnvInterface, u as PluginContext } from "./runtime-CRLPiOqf.mjs";
2
+ import { Children } from "@alloy-js/core/jsx-runtime";
2
3
  import { Config } from "automd";
3
4
  import { DotenvParseOutput } from "@stryke/env/types";
4
5
  import * as $ from "@stryke/capnp";
5
6
  import { PrintTreeOptions } from "@alloy-js/core";
6
7
  import "@alloy-js/typescript";
7
- import { Children as Children$1 } from "@alloy-js/core/jsx-runtime";
8
8
  import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
9
9
 
10
10
  //#region ../deepkit/src/vendor/type.d.ts
@@ -1599,7 +1599,7 @@ type AlloyPluginResolvedConfig = ResolvedConfig & {
1599
1599
  alloy: AlloyPluginOptions;
1600
1600
  };
1601
1601
  type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
1602
- render: <TContext extends AlloyPluginContext>(this: TContext, children: Children$1) => Promise<void>;
1602
+ render: <TContext extends AlloyPluginContext>(this: TContext, children: Children) => Promise<void>;
1603
1603
  };
1604
1604
  //#endregion
1605
1605
  //#region ../plugin-automd/src/types/toc.d.ts
@@ -1710,7 +1710,7 @@ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
1710
1710
  * @remarks
1711
1711
  * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.
1712
1712
  */
1713
- defaultConfig?: Children$1;
1713
+ defaultConfig?: Children;
1714
1714
  /**
1715
1715
  * Babel configuration options to use when injecting environment variables into the source code.
1716
1716
  *
@@ -1,4 +1,4 @@
1
- import { a as EnvType, c as __ΩEnvPluginResolvedConfig, i as EnvPluginUserConfig, l as __ΩEnvPluginUserConfig, n as EnvPluginOptions, o as __ΩEnvPluginContext, r as EnvPluginResolvedConfig, s as __ΩEnvPluginOptions, t as EnvPluginContext, u as __ΩEnvType } from "../plugin-CuDS8_K8.mjs";
1
+ import { a as EnvType, c as __ΩEnvPluginResolvedConfig, i as EnvPluginUserConfig, l as __ΩEnvPluginUserConfig, n as EnvPluginOptions, o as __ΩEnvPluginContext, r as EnvPluginResolvedConfig, s as __ΩEnvPluginOptions, t as EnvPluginContext, u as __ΩEnvType } from "../plugin-D9GLc9S_.mjs";
2
2
  import { i as __ΩSecretsInterface, n as SecretsInterface, r as __ΩEnvInterface, t as EnvInterface } from "../runtime-CRLPiOqf.mjs";
3
3
  import "../index-DCQ5Y2ED.mjs";
4
4
  export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface };
@@ -1,3 +1,3 @@
1
- import { a as EnvType, c as __ΩEnvPluginResolvedConfig, i as EnvPluginUserConfig, l as __ΩEnvPluginUserConfig, n as EnvPluginOptions, o as __ΩEnvPluginContext, r as EnvPluginResolvedConfig, s as __ΩEnvPluginOptions, t as EnvPluginContext, u as __ΩEnvType } from "../plugin-CuDS8_K8.mjs";
1
+ import { a as EnvType, c as __ΩEnvPluginResolvedConfig, i as EnvPluginUserConfig, l as __ΩEnvPluginUserConfig, n as EnvPluginOptions, o as __ΩEnvPluginContext, r as EnvPluginResolvedConfig, s as __ΩEnvPluginOptions, t as EnvPluginContext, u as __ΩEnvType } from "../plugin-D9GLc9S_.mjs";
2
2
  import "../runtime-CRLPiOqf.mjs";
3
3
  export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.14.7",
3
+ "version": "0.14.8",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
6
6
  "repository": {
@@ -188,15 +188,15 @@
188
188
  "keywords": ["powerlines", "storm-software", "powerlines-plugin"],
189
189
  "dependencies": {
190
190
  "automd": "^0.4.2",
191
- "@alloy-js/core": "^0.21.0",
192
- "@alloy-js/typescript": "^0.21.0",
193
- "@alloy-js/markdown": "^0.21.0",
191
+ "@alloy-js/core": "^0.22.0",
192
+ "@alloy-js/typescript": "^0.22.0",
193
+ "@alloy-js/markdown": "^0.22.0",
194
194
  "@babel/core": "^7.28.5",
195
195
  "@babel/types": "^7.28.5",
196
- "@powerlines/plugin-alloy": "^0.15.1",
197
- "@powerlines/plugin-automd": "^0.1.104",
198
- "@powerlines/plugin-babel": "^0.12.113",
199
- "@powerlines/plugin-plugin": "^0.12.56",
196
+ "@powerlines/plugin-alloy": "^0.15.2",
197
+ "@powerlines/plugin-automd": "^0.1.105",
198
+ "@powerlines/plugin-babel": "^0.12.114",
199
+ "@powerlines/plugin-plugin": "^0.12.57",
200
200
  "@storm-software/config-tools": "^1.188.74",
201
201
  "@stryke/capnp": "^0.12.51",
202
202
  "@stryke/env": "^0.20.43",
@@ -205,18 +205,18 @@
205
205
  "@stryke/string-format": "^0.12.29",
206
206
  "@stryke/type-checks": "^0.5.14",
207
207
  "@stryke/types": "^0.10.28",
208
- "powerlines": "^0.36.9"
208
+ "powerlines": "^0.36.10"
209
209
  },
210
210
  "devDependencies": {
211
211
  "@alloy-js/babel-preset": "^0.2.1",
212
212
  "@babel/preset-typescript": "^7.28.5",
213
- "@powerlines/plugin-alloy": "^0.15.1",
214
- "@powerlines/plugin-plugin": "^0.12.56",
215
- "@powerlines/nx": "^0.11.35",
213
+ "@powerlines/plugin-alloy": "^0.15.2",
214
+ "@powerlines/plugin-plugin": "^0.12.57",
215
+ "@powerlines/nx": "^0.11.36",
216
216
  "@types/node": "^24.10.4",
217
217
  "typescript": "^5.9.3",
218
218
  "vite": "8.0.0-beta.2"
219
219
  },
220
220
  "publishConfig": { "access": "public" },
221
- "gitHead": "e9fb959df894f1aa67074af9fbb126978a450a45"
221
+ "gitHead": "ab50afb5bed1d2d55072e7375c6425980e3d03ad"
222
222
  }