@powerlines/plugin-env 0.16.179 → 0.16.181
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 +7 -7
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./types/plugin.cjs`),n=require(`./helpers/reflect.cjs`),
|
|
2
|
-
`)}`}),(0,
|
|
3
|
-
`)}`})),(0,
|
|
4
|
-
`)}`})),(0,
|
|
5
|
-
`)}`}));else{if(this.debug(`Starting environment configuration reflection initialization.`),this.env.types.env=await
|
|
6
|
-
`)}`}),await
|
|
7
|
-
`)}`}),await
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./types/plugin.cjs`),n=require(`./types/env.cjs`),r=require(`./helpers/reflect.cjs`),i=require(`./helpers/persistence.cjs`),a=require(`./helpers/load.cjs`),o=require(`./helpers/automd-generator.cjs`),s=require(`./components/docs.cjs`),c=require(`./components/env-builtin.cjs`),l=require(`./babel/plugin.cjs`);let u=require(`@powerlines/deepkit/vendor/type`),d=require(`defu`);d=e.__toESM(d);let f=require(`powerlines/constants`),p=require(`powerlines/plugin-utils`),m=require(`@alloy-js/core/jsx-runtime`),h=require(`@stryke/path/join`),g=require(`@stryke/helpers/get-unique`),_=require(`@powerlines/plugin-alloy/render`),v=require(`@powerlines/plugin-automd`);v=e.__toESM(v);let y=require(`@powerlines/plugin-babel`);y=e.__toESM(y);let b=require(`@powerlines/plugin-deepkit`);b=e.__toESM(b);let x=require(`@stryke/convert/parse-type-definition`),S=require(`@stryke/convert/to-array`),C=require(`@stryke/fs/exists`),w=require(`@stryke/string-format/constant-case`),T=require(`@stryke/type-checks/is-set-string`);function E(e,t){return e.__type=t,e}const D=E((e={})=>[(0,b.default)(e.deepkit),(0,y.default)(e.babel),{name:`env`,async config(){this.debug("Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,d.default)(e,{types:{},validate:!1,inject:!1,prefix:[]}),babel:{plugins:[l.envBabelPlugin]},deepkit:{reflection:`default`,level:`all`},tsc:{}};if((0,T.isSetString)(t.env.types)||t.env.types&&(0,T.isSetString)(t.env.types.file)){t.env.types=(0,x.parseTypeDefinition)(t.env.types);let e=await this.fs.resolve(t.env.types.file);e&&(t.env.types.file=e)}else{this.warn("The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await i.getEnvDefaultTypeDefinition(this),n=await this.fs.resolve(e.file);n&&(t.env.types=(0,x.parseTypeDefinition)(`${n}#${e.name}`))}if((0,T.isSetString)(t.env.secrets)||t.env.secrets&&(0,T.isSetString)(t.env.secrets.file)){t.env.secrets=(0,x.parseTypeDefinition)(t.env.secrets);let e=await this.fs.resolve(t.env.secrets.file);e&&(t.env.secrets.file=e)}else{let e=await i.getSecretsDefaultTypeDefinition(this),n=await this.fs.resolve(e.file);n&&(t.env.secrets=(0,x.parseTypeDefinition)(`${n}#${e.name}`))}return(t.env.types||t.env.secrets)&&(t.tsc.filter={id:[RegExp(`^(${f.VIRTUAL_MODULE_PREFIX})?${(0,h.joinPaths)(this.builtinsPath,`env.ts`).replace(/\\/g,`\\\\`).replace(/\//g,`\\/`).replace(/\./g,`\\.`).replace(/\$/g,`\\$`)}$`)]}),t.env.prefix=(0,S.toArray)(t.env.prefix??[]).reduce(E((e,t)=>{let n=(0,w.constantCase)(t);return e.includes(n)||e.push(n),e},[`ret`,`prefix`,``,`P&F2!&2""/#`]),[`POWERLINES_`,this.config.framework&&this.config.framework!==`powerlines`&&`${(0,w.constantCase)(this.config.framework)}_`].filter(Boolean)),t.env.prefix=(0,g.getUnique)((0,S.toArray)(t.env.prefix).reduce(E((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[`ret`,`prefix`,``,`P"2!"2""/#`]),[])),this.info({meta:{category:`env`},message:`Environment configuration definition file: ${t.env.types.file}${t.env.types.name?`#${t.env.types.name}`:``}${t.env.secrets?`\nSecrets configuration definition file: ${t.env.secrets?.file}${t.env.secrets?.name?`#${t.env.secrets?.name}`:``}`:``}\nEnvironment variable Prefixes: ${t.env.prefix.join(`, `)}\nShould inject values: ${t.env.inject?`Yes`:`No`}\nShould validate configuration: ${t.env.validate?`Yes`:`No`}`}),t},async configResolved(){if(this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`),this.env=(0,d.default)({parsed:await a.loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&!this.config.skipCache&&this.persistedMeta?.checksum===this.meta.checksum&&(0,C.existsSync)(i.getEnvTypeReflectionsPath(this,`env`)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await i.readEnvTypeReflection(this,`env`),this.debug({meta:{category:`env`},message:`Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(E(e=>`- ${e.getNameAsString()}${e.getAlias().length>0?` (aliases: ${e.getAlias().join(`, `)})`:``}`,[`prop`,``,`P"2!"/"`])).join(`
|
|
2
|
+
`)}`}),(0,C.existsSync)(i.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await i.readEnvReflection(this),this.debug({meta:{category:`env`},message:`Found the following environment configuration parameters used in project: \n${this.env.used.env.getProperties().map(E(e=>`- ${e.getNameAsString()}${e.getAlias().length>0?` (aliases: ${e.getAlias().join(`, `)})`:``}`,[`prop`,``,`P"2!"/"`])).join(`
|
|
3
|
+
`)}`})),(0,C.existsSync)(i.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await i.readEnvTypeReflection(this,`secrets`),this.env.types.secrets.getProperties().length>0&&this.debug({meta:{category:`env`},message:`Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(E(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
4
|
+
`)}`})),(0,C.existsSync)(i.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await i.readSecretsReflection(this),this.env.used.secrets.getProperties().length>0&&this.debug({meta:{category:`env`},message:`Found the following secret configuration parameters used in project: \n${this.env.used.secrets.getProperties().map(E(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
5
|
+
`)}`}));else{if(this.debug(`Starting environment configuration reflection initialization.`),this.env.types.env=await r.reflectEnv(this,this.config.env.types?.file,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(this.debug({meta:{category:`env`},message:`Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(E(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
6
|
+
`)}`}),await i.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await r.reflectSecrets(this,this.config.env.secrets?.file,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);this.env.types.secrets.getProperties().length>0&&this.debug({meta:{category:`env`},message:`Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(E(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
7
|
+
`)}`}),await i.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.info({meta:{category:`env`},message:`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=>e.getAlias().length>0,[`prop`,``,`P"2!"/"`]));Object.entries(await a.loadEnv(this,this.config.env)).forEach(E(([t,n])=>{let r=this.config.env.prefix.reduce(E((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,[`ret`,`prefix`,``,`P"2!"2""/#`]),t),i=e.find(E(e=>e?.getAlias().reverse().includes(r),[`prop`,``,`P"2!"/"`]));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)},[`param0`,``,`P"2!"/"`])),this.env.used.env=new u.ReflectionClass({kind:u.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 i.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await i.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new u.ReflectionClass({kind:u.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 i.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},prepare:E(async function(){let e=this;this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);let t=await i.readEnvTypeReflection(this,`env`);return(0,_.render)(this,(0,m.createComponent)(c.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig},reflection:t}))},[`prepare`,`P"/!`]),transform:{order:`post`,handler:E(async function(){this.env.used.env.getProperties().length>0&&(this.trace(`Persisting used environment configuration reflections to ${i.getEnvReflectionsPath(this,`env`)}.`),await i.writeEnvReflection(this,this.env.used.env,`env`)),this.env.used.secrets.getProperties().length>0&&(this.trace(`Persisting used secret configuration reflections to ${i.getEnvReflectionsPath(this,`secrets`)}.`),await i.writeEnvReflection(this,this.env.used.secrets,`secrets`))},[`handler`,`P"/!`])},docs:E(async function(){this.debug(`Documenting environment variables configuration values in "${(0,h.joinPaths)((0,p.getDocsOutputPath)(this.config.root),`env.md`)}"`);let e=await i.readEnvTypeReflection(this,`env`);return(0,_.render)(this,(0,m.createComponent)(s.EnvDocsFile,{levelOffset:0,reflection:e}))},[`docs`,`P"/!`]),buildEnd:E(async function(){let e=i.getEnvReflectionsPath(this,`env`);this.debug(`Writing env reflection types to ${e}.`),await i.writeEnvReflection(this,this.env.used.env,`env`)},[`buildEnd`,`P"/!`])},{name:`env:automd-generator`,config:E(function(){return{automd:(0,d.default)(e.automd??{},{generators:{env:o.env(this)}})}},[`config`,`P"/!`])},{name:`env:vite`,vite:{configResolved:E(function(){return{envPrefix:this.config?.env?.prefix}},[()=>t.__ΩEnvPluginContext,`this`,`configResolved`,`Pn!2""/#`])}},(0,v.default)(e.automd)],[()=>t.__ΩEnvPluginOptions,`options`,()=>({}),``,`Pn!2">#"/$`]);exports.__ΩEnvInterface=n.__ΩEnvInterface,exports.__ΩEnvPluginContext=t.__ΩEnvPluginContext,exports.__ΩEnvPluginOptions=t.__ΩEnvPluginOptions,exports.__ΩEnvPluginResolvedConfig=t.__ΩEnvPluginResolvedConfig,exports.__ΩEnvPluginUserConfig=t.__ΩEnvPluginUserConfig,exports.__ΩEnvType=t.__ΩEnvType,exports.__ΩSecretsInterface=n.__ΩSecretsInterface,exports.default=D,exports.plugin=D;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{__ΩEnvPluginContext as e,__ΩEnvPluginOptions as t}from"./types/plugin.mjs";import{reflectEnv as
|
|
2
|
-
`)}`}),
|
|
3
|
-
`)}`})),
|
|
4
|
-
`)}`})),
|
|
5
|
-
`)}`}));else{if(this.debug(`Starting environment configuration reflection initialization.`),this.env.types.env=await
|
|
6
|
-
`)}`}),await
|
|
7
|
-
`)}`}),await
|
|
1
|
+
import{__ΩEnvPluginContext as e,__ΩEnvPluginOptions as t,__ΩEnvPluginResolvedConfig as n,__ΩEnvPluginUserConfig as r,__ΩEnvType as i}from"./types/plugin.mjs";import{__ΩEnvInterface as a,__ΩSecretsInterface as o}from"./types/env.mjs";import{reflectEnv as s,reflectSecrets as c}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as l,getEnvReflectionsPath as u,getEnvTypeReflectionsPath as d,getSecretsDefaultTypeDefinition as f,readEnvReflection as p,readEnvTypeReflection as m,readSecretsReflection as h,writeEnvReflection as g,writeEnvTypeReflection as _}from"./helpers/persistence.mjs";import{loadEnv as v}from"./helpers/load.mjs";import{env as y}from"./helpers/automd-generator.mjs";import{EnvDocsFile as b}from"./components/docs.mjs";import{EnvBuiltin as x}from"./components/env-builtin.mjs";import{envBabelPlugin as S}from"./babel/plugin.mjs";import{ReflectionClass as C,ReflectionKind as w}from"@powerlines/deepkit/vendor/type";import T from"defu";import{VIRTUAL_MODULE_PREFIX as E}from"powerlines/constants";import{getDocsOutputPath as D}from"powerlines/plugin-utils";import{createComponent as O}from"@alloy-js/core/jsx-runtime";import{joinPaths as k}from"@stryke/path/join";import{getUnique as A}from"@stryke/helpers/get-unique";import{render as j}from"@powerlines/plugin-alloy/render";import M from"@powerlines/plugin-automd";import N from"@powerlines/plugin-babel";import P from"@powerlines/plugin-deepkit";import{parseTypeDefinition as F}from"@stryke/convert/parse-type-definition";import{toArray as I}from"@stryke/convert/to-array";import{existsSync as L}from"@stryke/fs/exists";import{constantCase as R}from"@stryke/string-format/constant-case";import{isSetString as z}from"@stryke/type-checks/is-set-string";function B(e,t){return e.__type=t,e}const V=B((t={})=>[P(t.deepkit),N(t.babel),{name:`env`,async config(){this.debug("Providing default configuration for the Powerlines `env` build plugin.");let e={env:T(t,{types:{},validate:!1,inject:!1,prefix:[]}),babel:{plugins:[S]},deepkit:{reflection:`default`,level:`all`},tsc:{}};if(z(e.env.types)||e.env.types&&z(e.env.types.file)){e.env.types=F(e.env.types);let t=await this.fs.resolve(e.env.types.file);t&&(e.env.types.file=t)}else{this.warn("The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await l(this),n=await this.fs.resolve(t.file);n&&(e.env.types=F(`${n}#${t.name}`))}if(z(e.env.secrets)||e.env.secrets&&z(e.env.secrets.file)){e.env.secrets=F(e.env.secrets);let t=await this.fs.resolve(e.env.secrets.file);t&&(e.env.secrets.file=t)}else{let t=await f(this),n=await this.fs.resolve(t.file);n&&(e.env.secrets=F(`${n}#${t.name}`))}return(e.env.types||e.env.secrets)&&(e.tsc.filter={id:[RegExp(`^(${E})?${k(this.builtinsPath,`env.ts`).replace(/\\/g,`\\\\`).replace(/\//g,`\\/`).replace(/\./g,`\\.`).replace(/\$/g,`\\$`)}$`)]}),e.env.prefix=I(e.env.prefix??[]).reduce(B((e,t)=>{let n=R(t);return e.includes(n)||e.push(n),e},[`ret`,`prefix`,``,`P&F2!&2""/#`]),[`POWERLINES_`,this.config.framework&&this.config.framework!==`powerlines`&&`${R(this.config.framework)}_`].filter(Boolean)),e.env.prefix=A(I(e.env.prefix).reduce(B((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[`ret`,`prefix`,``,`P"2!"2""/#`]),[])),this.info({meta:{category:`env`},message:`Environment configuration definition file: ${e.env.types.file}${e.env.types.name?`#${e.env.types.name}`:``}${e.env.secrets?`\nSecrets configuration definition file: ${e.env.secrets?.file}${e.env.secrets?.name?`#${e.env.secrets?.name}`:``}`:``}\nEnvironment variable Prefixes: ${e.env.prefix.join(`, `)}\nShould inject values: ${e.env.inject?`Yes`:`No`}\nShould validate configuration: ${e.env.validate?`Yes`:`No`}`}),e},async configResolved(){if(this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`),this.env=T({parsed:await v(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&!this.config.skipCache&&this.persistedMeta?.checksum===this.meta.checksum&&L(d(this,`env`)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await m(this,`env`),this.debug({meta:{category:`env`},message:`Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(B(e=>`- ${e.getNameAsString()}${e.getAlias().length>0?` (aliases: ${e.getAlias().join(`, `)})`:``}`,[`prop`,``,`P"2!"/"`])).join(`
|
|
2
|
+
`)}`}),L(u(this,`env`))&&(this.env.used.env=await p(this),this.debug({meta:{category:`env`},message:`Found the following environment configuration parameters used in project: \n${this.env.used.env.getProperties().map(B(e=>`- ${e.getNameAsString()}${e.getAlias().length>0?` (aliases: ${e.getAlias().join(`, `)})`:``}`,[`prop`,``,`P"2!"/"`])).join(`
|
|
3
|
+
`)}`})),L(d(this,`secrets`))&&(this.env.types.secrets=await m(this,`secrets`),this.env.types.secrets.getProperties().length>0&&this.debug({meta:{category:`env`},message:`Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(B(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
4
|
+
`)}`})),L(u(this,`secrets`))&&(this.env.used.secrets=await h(this),this.env.used.secrets.getProperties().length>0&&this.debug({meta:{category:`env`},message:`Found the following secret configuration parameters used in project: \n${this.env.used.secrets.getProperties().map(B(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
5
|
+
`)}`}));else{if(this.debug(`Starting environment configuration reflection initialization.`),this.env.types.env=await s(this,this.config.env.types?.file,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(this.debug({meta:{category:`env`},message:`Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(B(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
6
|
+
`)}`}),await _(this,this.env.types.env,`env`),this.env.types.secrets=await c(this,this.config.env.secrets?.file,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);this.env.types.secrets.getProperties().length>0&&this.debug({meta:{category:`env`},message:`Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(B(e=>`- ${e.getNameAsString()} (aliases: ${e.getAlias().join(`, `)})`,[`prop`,``,`P"2!"/"`])).join(`
|
|
7
|
+
`)}`}),await _(this,this.env.types.secrets,`secrets`),this.info({meta:{category:`env`},message:`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(B(e=>e.getAlias().length>0,[`prop`,``,`P"2!"/"`]));Object.entries(await v(this,this.config.env)).forEach(B(([t,n])=>{let r=this.config.env.prefix.reduce(B((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,[`ret`,`prefix`,``,`P"2!"2""/#`]),t),i=e.find(B(e=>e?.getAlias().reverse().includes(r),[`prop`,``,`P"2!"/"`]));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)},[`param0`,``,`P"2!"/"`])),this.env.used.env=new C({kind:w.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 g(this,this.env.used.env,`env`),this.env.types.secrets&&(await _(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new C({kind:w.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 g(this,this.env.used.secrets,`secrets`))}},prepare:B(async function(){let e=this;this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);let t=await m(this,`env`);return j(this,O(x,{get defaultConfig(){return e.config.env.defaultConfig},reflection:t}))},[`prepare`,`P"/!`]),transform:{order:`post`,handler:B(async function(){this.env.used.env.getProperties().length>0&&(this.trace(`Persisting used environment configuration reflections to ${u(this,`env`)}.`),await g(this,this.env.used.env,`env`)),this.env.used.secrets.getProperties().length>0&&(this.trace(`Persisting used secret configuration reflections to ${u(this,`secrets`)}.`),await g(this,this.env.used.secrets,`secrets`))},[`handler`,`P"/!`])},docs:B(async function(){this.debug(`Documenting environment variables configuration values in "${k(D(this.config.root),`env.md`)}"`);let e=await m(this,`env`);return j(this,O(b,{levelOffset:0,reflection:e}))},[`docs`,`P"/!`]),buildEnd:B(async function(){let e=u(this,`env`);this.debug(`Writing env reflection types to ${e}.`),await g(this,this.env.used.env,`env`)},[`buildEnd`,`P"/!`])},{name:`env:automd-generator`,config:B(function(){return{automd:T(t.automd??{},{generators:{env:y(this)}})}},[`config`,`P"/!`])},{name:`env:vite`,vite:{configResolved:B(function(){return{envPrefix:this.config?.env?.prefix}},[()=>e,`this`,`configResolved`,`Pn!2""/#`])}},M(t.automd)],[()=>t,`options`,()=>({}),``,`Pn!2">#"/$`]);export{a as __ΩEnvInterface,e as __ΩEnvPluginContext,t as __ΩEnvPluginOptions,n as __ΩEnvPluginResolvedConfig,r as __ΩEnvPluginUserConfig,i as __ΩEnvType,o as __ΩSecretsInterface,V as default,V as plugin};
|
|
8
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { VIRTUAL_MODULE_PREFIX } from \"powerlines/constants\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n deepkit(options.deepkit),\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n isSetString(config.env.types) ||\n (config.env.types && isSetString(config.env.types.file))\n ) {\n config.env.types = parseTypeDefinition(\n config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(config.env.types.file);\n if (file) {\n config.env.types.file = file;\n }\n } else {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n const envDefaultTypeDefinition =\n await getEnvDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(envDefaultTypeDefinition.file);\n if (file) {\n config.env.types = parseTypeDefinition(\n `${file}#${envDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\n }\n\n if (\n isSetString(config.env.secrets) ||\n (config.env.secrets && isSetString(config.env.secrets.file))\n ) {\n config.env.secrets = parseTypeDefinition(config.env.secrets);\n\n const file = await this.fs.resolve(config.env.secrets!.file);\n if (file) {\n config.env.secrets!.file = file;\n }\n } else {\n const secretsDefaultTypeDefinition =\n await getSecretsDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(secretsDefaultTypeDefinition.file);\n if (file) {\n config.env.secrets = parseTypeDefinition(\n `${file}#${secretsDefaultTypeDefinition.name}`\n );\n }\n }\n\n if (config.env.types || config.env.secrets) {\n config.tsc.filter = {\n id: [\n new RegExp(\n `^(${VIRTUAL_MODULE_PREFIX})?${joinPaths(\n this.builtinsPath,\n \"env.ts\"\n )\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\//g, \"\\\\/\")\n .replace(/\\./g, \"\\\\.\")\n .replace(/\\$/g, \"\\\\$\")}$`\n )\n ]\n };\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework &&\n this.config.framework !== \"powerlines\" &&\n `${constantCase(this.config.framework)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Environment configuration definition file: ${\n config.env.types.file\n }${config.env.types.name ? `#${config.env.types.name}` : \"\"}${\n config.env.secrets\n ? `\\nSecrets configuration definition file: ${config.env.secrets?.file}${\n config.env.secrets?.name ? `#${config.env.secrets?.name}` : \"\"\n }`\n : \"\"\n }\\nEnvironment variable Prefixes: ${config.env.prefix.join(\", \")}\\nShould inject values: ${\n config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameters used in project: \\n${this.env.used.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameters used in project: \\n${this.env.used.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n });\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"+iDAKA,SAAI,EAAc,EAAM,EAAQ,CAE/B,MADA,GAAI,OAAK,EACL,EA4CL,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CAAC,OAAM,OAAM,CAAA,CAChB,SAAU,EAAa,gBAAG,CACxB,IAAM,EAAG,EAAA,KAAA,MAAA,CACT,KAAK,MAAG,mCAA8B,EAAY,GAAc,CAChE,MAAM,EAAmB,KAAA,KAAA,IAAA,KAAA,IAAA,MAAA,EACxB,CAAC,WAAY,OAAA,CAAA,CACjB,CAAE,CACD,KAAM,uBACN,OAAQ,EAAU,UAAgB,CAChC,MAAO,CACL,OAAQ,EAAK,EAAM,QAAA,EAAA,CAAA,CACjB,WAAW,CACT,IAAI,EAAA,KAAA,CACL,CACF,CAAC,CACH,qBAEJ,CAAE,CACD,KAAM,WACN,KAAM,CACJ,eAAgB,EAAA,UAAA,CACd,MAAK,CAAA,UAAA,KAAA,QAAA,KAAA,OAEJ,EACA,KAAK,EAAW,OAAA,iBAAA,WAAA,CAAA,CACpB,CACF,CAAE,EAAO,EAAM,OAAS,CAAC,CACzB,KAAO,EAAO,eAAA,EAAA,EAAA,GAAA,aAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { VIRTUAL_MODULE_PREFIX } from \"powerlines/constants\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n deepkit(options.deepkit),\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n isSetString(config.env.types) ||\n (config.env.types && isSetString(config.env.types.file))\n ) {\n config.env.types = parseTypeDefinition(\n config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(config.env.types.file);\n if (file) {\n config.env.types.file = file;\n }\n } else {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n const envDefaultTypeDefinition =\n await getEnvDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(envDefaultTypeDefinition.file);\n if (file) {\n config.env.types = parseTypeDefinition(\n `${file}#${envDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\n }\n\n if (\n isSetString(config.env.secrets) ||\n (config.env.secrets && isSetString(config.env.secrets.file))\n ) {\n config.env.secrets = parseTypeDefinition(config.env.secrets);\n\n const file = await this.fs.resolve(config.env.secrets!.file);\n if (file) {\n config.env.secrets!.file = file;\n }\n } else {\n const secretsDefaultTypeDefinition =\n await getSecretsDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(secretsDefaultTypeDefinition.file);\n if (file) {\n config.env.secrets = parseTypeDefinition(\n `${file}#${secretsDefaultTypeDefinition.name}`\n );\n }\n }\n\n if (config.env.types || config.env.secrets) {\n config.tsc.filter = {\n id: [\n new RegExp(\n `^(${VIRTUAL_MODULE_PREFIX})?${joinPaths(\n this.builtinsPath,\n \"env.ts\"\n )\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\//g, \"\\\\/\")\n .replace(/\\./g, \"\\\\.\")\n .replace(/\\$/g, \"\\\\$\")}$`\n )\n ]\n };\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework &&\n this.config.framework !== \"powerlines\" &&\n `${constantCase(this.config.framework)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Environment configuration definition file: ${\n config.env.types.file\n }${config.env.types.name ? `#${config.env.types.name}` : \"\"}${\n config.env.secrets\n ? `\\nSecrets configuration definition file: ${config.env.secrets?.file}${\n config.env.secrets?.name ? `#${config.env.secrets?.name}` : \"\"\n }`\n : \"\"\n }\\nEnvironment variable Prefixes: ${config.env.prefix.join(\", \")}\\nShould inject values: ${\n config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameters used in project: \\n${this.env.used.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameters used in project: \\n${this.env.used.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n });\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"ssDAKA,SAAI,EAAc,EAAM,EAAQ,CAE/B,MADA,GAAI,OAAK,EACL,EA6CL,MAAE,EAAA,GAA+B,EAAA,EAAA,GAC/B,CAAA,EAA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CACF,CAAC,CAAA,EAEH,CAAC,SAAM,OAAW,CAAA,CACtB,CAAE,CACD,KAAM,WACN,KAAM,CACJ,eAAO,EAAA,UAAA,QAEH,UAAW,KAAI,QAAM,KAAQ,OAC9B,EACA,KAAO,EAAM,OAAA,iBAAA,WAAA,CAAA,CACjB,CACF,CAAE,EAAO,EAAK,OAAA,CAAA,CACd,KAAO,EAAqB,eAAe,EAAA,EAAO,GAAA,aAAc,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.181",
|
|
4
4
|
"private": false,
|
|
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
|
"keywords": ["dotenv", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -292,12 +292,12 @@
|
|
|
292
292
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
293
293
|
"@babel/core": "8.0.0-rc.4",
|
|
294
294
|
"@babel/types": "8.0.0-rc.4",
|
|
295
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
296
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
297
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
298
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
299
|
-
"@powerlines/deepkit": "^0.8.
|
|
300
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
295
|
+
"@powerlines/plugin-alloy": "^0.26.74",
|
|
296
|
+
"@powerlines/plugin-automd": "^0.1.455",
|
|
297
|
+
"@powerlines/plugin-babel": "^0.12.448",
|
|
298
|
+
"@powerlines/plugin-plugin": "^0.12.406",
|
|
299
|
+
"@powerlines/deepkit": "^0.8.56",
|
|
300
|
+
"@powerlines/plugin-deepkit": "^0.11.337",
|
|
301
301
|
"@storm-software/config-tools": "^1.190.1",
|
|
302
302
|
"@stryke/capnp": "^0.12.96",
|
|
303
303
|
"@stryke/convert": "^0.7.3",
|
|
@@ -311,10 +311,10 @@
|
|
|
311
311
|
"@stryke/types": "^0.12.0",
|
|
312
312
|
"automd": "^0.4.3",
|
|
313
313
|
"defu": "^6.1.7",
|
|
314
|
-
"powerlines": "^0.46.
|
|
314
|
+
"powerlines": "^0.46.2",
|
|
315
315
|
"c12": "^3.3.4"
|
|
316
316
|
},
|
|
317
317
|
"devDependencies": { "@types/node": "^25.6.0", "vite": "^8.0.10" },
|
|
318
318
|
"publishConfig": { "access": "public" },
|
|
319
|
-
"gitHead": "
|
|
319
|
+
"gitHead": "e2eca169a851d2b144bfc7c677e7047cedf4b6a0"
|
|
320
320
|
}
|