@powerlines/plugin-env 0.14.11 → 0.14.13
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/babel/plugin.cjs +4 -4
- package/dist/babel/plugin.mjs +3 -3
- package/dist/components/docs.cjs +1 -1
- package/dist/components/docs.mjs +1 -1
- package/dist/components/env.cjs +2 -2
- package/dist/components/env.mjs +2 -2
- package/dist/deepkit/src/utilities.cjs +1 -1
- package/dist/deepkit/src/utilities.mjs +1 -1
- package/dist/helpers/load.cjs +1 -1
- package/dist/helpers/load.mjs +1 -1
- package/dist/helpers/reflect.cjs +1 -1
- package/dist/helpers/reflect.mjs +1 -1
- package/dist/helpers/source-file-env.cjs +1 -1
- package/dist/helpers/source-file-env.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +0 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin-alloy/src/index.cjs +2 -2
- package/dist/plugin-alloy/src/index.mjs +2 -2
- package/dist/plugin-automd/src/index.cjs +1 -1
- package/dist/plugin-automd/src/index.mjs +1 -1
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -1
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -1
- package/dist/powerlines/src/lib/build/esbuild.cjs +9 -9
- package/dist/powerlines/src/lib/build/esbuild.mjs +9 -9
- package/dist/powerlines/src/lib/entry.cjs +1 -1
- package/dist/powerlines/src/lib/entry.mjs +1 -1
- package/dist/powerlines/src/lib/logger.cjs +1 -1
- package/dist/powerlines/src/lib/logger.mjs +1 -1
- package/dist/types/plugin.d.cts +0 -1
- package/package.json +8 -8
- package/dist/deepkit/src/vendor/core.cjs +0 -1
- package/dist/deepkit/src/vendor/core.mjs +0 -1
- package/dist/plugin-alloy/src/core/components/index.cjs +0 -1
- package/dist/plugin-alloy/src/core/components/index.mjs +0 -1
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -1
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -1
- package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -1
- package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -1
- package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -1
- package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -1
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -1
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -1
- package/dist/plugin-alloy/src/core/index.cjs +0 -1
- package/dist/plugin-alloy/src/core/index.mjs +0 -1
- package/dist/plugin-alloy/src/helpers/capnp.cjs +0 -1
- package/dist/plugin-alloy/src/helpers/capnp.mjs +0 -1
- package/dist/plugin-alloy/src/helpers/create-builtin.cjs +0 -1
- package/dist/plugin-alloy/src/helpers/create-builtin.mjs +0 -1
- package/dist/plugin-alloy/src/helpers/index.cjs +0 -1
- package/dist/plugin-alloy/src/helpers/index.mjs +0 -1
- package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -1
- package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -1
- package/dist/plugin-alloy/src/helpers/typescript.cjs +0 -1
- package/dist/plugin-alloy/src/helpers/typescript.mjs +0 -1
- package/dist/plugin-alloy/src/markdown/components/index.cjs +0 -1
- package/dist/plugin-alloy/src/markdown/components/index.mjs +0 -1
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -1
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -1
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -1
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -1
- package/dist/plugin-alloy/src/markdown/contexts/index.cjs +0 -1
- package/dist/plugin-alloy/src/markdown/contexts/index.mjs +0 -1
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -1
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -1
- package/dist/plugin-alloy/src/markdown/index.cjs +0 -1
- package/dist/plugin-alloy/src/markdown/index.mjs +0 -1
- package/dist/plugin-alloy/src/types/components.d.cts +0 -2
- package/dist/plugin-alloy/src/types/index.d.cts +0 -2
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/dynamic-import-statement.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/dynamic-import-statement.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/entry-file.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/entry-file.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/index.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/index.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/record-expression.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/record-expression.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -1
- package/dist/plugin-alloy/src/typescript/index.cjs +0 -1
- package/dist/plugin-alloy/src/typescript/index.mjs +0 -1
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -1
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -1
package/dist/babel/plugin.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../plugin-babel/src/helpers/create-plugin.cjs`),r=require(`../plugin-babel/src/helpers/module-helpers.cjs`),i=require(`../deepkit/src/capnp.cjs`),a=require(`../deepkit/schemas/reflection2.cjs`),o=require(`../deepkit/src/utilities.cjs`),s=require(`../helpers/persistence.cjs`);let c=require(`@storm-software/config-tools/types`),l=require(`@stryke/capnp`);l=e.__toESM(l);let u=require(`@stryke/fs/buffer`),d=require(`node:fs`);const f=n.createBabelPlugin(`env`,({log:e,context:n})=>{function f(t,r,i=!1){let a=n.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(t.name){let s=n.config.env.prefix.find(e=>t.name&&t.name.startsWith(e)&&(n.env.types.env?.hasProperty(t.name.replace(`${e}_`,``))||a.some(n=>n.getAlias().includes(t.name.replace(`${e}_`,``))))),l=t.name;if(s&&(l=t.name.replace(`${s}_`,``)),e(c.LogLevelLabel.TRACE,`Environment variable ${l} found in ${r.filename||`unknown file`}.`),n.env.types.env?.hasProperty(l)||a.some(e=>e.getAlias().includes(l))){let e=n.env.types.env.hasProperty(l)?n.env.types.env.getProperty(l):a.find(e=>e.getAlias().includes(l));if(!e||e.isIgnored())return;if(n.env.used.env.hasProperty(l)||n.env.used.env.addProperty(e.property),n.config.env.inject&&i){let t=n.env.parsed?.[l];if(t===void 0){let e=n.config.env.prefix.find(e=>n.env.parsed[`${e.replace(/_$/g,``)}_${l}`]);e&&(t=n.env.parsed[`${e.replace(/_$/g,``)}_${l}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${l}\` is not defined in the .env configuration files`);return o.stringifyDefaultValue(e,t)}}else throw Error(`The "${l}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${r.filename?r.filename:`unknown`}.
|
|
2
2
|
|
|
3
|
-
The following environment configuration names are defined in the \`env\` type definition: \n${
|
|
4
|
-
`)} \n\nUsing the following env prefix: \n${
|
|
5
|
-
`)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),
|
|
3
|
+
The following environment configuration names are defined in the \`env\` type definition: \n${n.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${a.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${a?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
|
|
4
|
+
`)} \n\nUsing the following env prefix: \n${n.config.env.prefix.map(e=>` - ${e}`).join(`
|
|
5
|
+
`)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isCallExpression({callee:{name:`useStorm`,type:`Identifier`}})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`process`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isMetaProperty()&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){e(c.LogLevelLabel.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let r=t.type_exports.ReflectionClass.from({kind:t.type_exports.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),o=s.getEnvReflectionsPath(n,`env`);o&&(0,d.existsSync)(o)&&(e(c.LogLevelLabel.TRACE,`Environment reflection file found at ${o}, reading existing reflection.`),r=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(i.convertFromCapnp(new l.Message((0,u.readFileBufferSync)(o),!1).getRoot(a.SerializedTypes).types)))),e(c.LogLevelLabel.TRACE,`Adding new variables to env reflection at ${o}.`),r.getProperties().filter(e=>e.getNameAsString()&&!n.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{n.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}});exports.envBabelPlugin=f;
|
package/dist/babel/plugin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{
|
|
1
|
+
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createBabelPlugin as t}from"../plugin-babel/src/helpers/create-plugin.mjs";import{addImport as n}from"../plugin-babel/src/helpers/module-helpers.mjs";import{convertFromCapnp as r}from"../deepkit/src/capnp.mjs";import{SerializedTypes as i}from"../deepkit/schemas/reflection2.mjs";import{stringifyDefaultValue as a}from"../deepkit/src/utilities.mjs";import{getEnvReflectionsPath as o}from"../helpers/persistence.mjs";import{LogLevelLabel as s}from"@storm-software/config-tools/types";import*as c from"@stryke/capnp";import{readFileBufferSync as l}from"@stryke/fs/buffer";import{existsSync as u}from"node:fs";const d=t(`env`,({log:t,context:d})=>{function f(e,n,r=!1){let i=d.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(e.name){let o=d.config.env.prefix.find(t=>e.name&&e.name.startsWith(t)&&(d.env.types.env?.hasProperty(e.name.replace(`${t}_`,``))||i.some(n=>n.getAlias().includes(e.name.replace(`${t}_`,``))))),c=e.name;if(o&&(c=e.name.replace(`${o}_`,``)),t(s.TRACE,`Environment variable ${c} found in ${n.filename||`unknown file`}.`),d.env.types.env?.hasProperty(c)||i.some(e=>e.getAlias().includes(c))){let e=d.env.types.env.hasProperty(c)?d.env.types.env.getProperty(c):i.find(e=>e.getAlias().includes(c));if(!e||e.isIgnored())return;if(d.env.used.env.hasProperty(c)||d.env.used.env.addProperty(e.property),d.config.env.inject&&r){let t=d.env.parsed?.[c];if(t===void 0){let e=d.config.env.prefix.find(e=>d.env.parsed[`${e.replace(/_$/g,``)}_${c}`]);e&&(t=d.env.parsed[`${e.replace(/_$/g,``)}_${c}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${c}\` is not defined in the .env configuration files`);return a(e,t)}}else throw Error(`The "${c}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${n.filename?n.filename:`unknown`}.
|
|
2
2
|
|
|
3
|
-
The following environment configuration names are defined in the \`env\` type definition: \n${d.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${
|
|
3
|
+
The following environment configuration names are defined in the \`env\` type definition: \n${d.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${i.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${i?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
|
|
4
4
|
`)} \n\nUsing the following env prefix: \n${d.config.env.prefix.map(e=>` - ${e}`).join(`
|
|
5
|
-
`)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let
|
|
5
|
+
`)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isCallExpression({callee:{name:`useStorm`,type:`Identifier`}})&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`process`})&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;if(!r.name)return;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isMetaProperty()&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;if(!r.name)return;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){t(s.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let n=e.ReflectionClass.from({kind:e.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),a=o(d,`env`);a&&u(a)&&(t(s.TRACE,`Environment reflection file found at ${a}, reading existing reflection.`),n=(0,e.resolveClassType)((0,e.deserializeType)(r(new c.Message(l(a),!1).getRoot(i).types)))),t(s.TRACE,`Adding new variables to env reflection at ${a}.`),n.getProperties().filter(e=>e.getNameAsString()&&!d.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{d.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}});export{d as envBabelPlugin};
|
package/dist/components/docs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/create-reflection-resource.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@stryke/path/join`),o=require(`@alloy
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/create-reflection-resource.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@stryke/path/join`),o=require(`@powerlines/alloy/core/contexts/context`),s=require(`@alloy-js/markdown`),c=require(`@powerlines/alloy/markdown/components/markdown-file`),l=require(`@powerlines/alloy/markdown/components/markdown-table`);function u(){let e=(0,o.usePowerlines)();if(!e)return null;let u=n.createReflectionResource(e);return(0,r.createComponent)(c.MarkdownFile,{get path(){return(0,a.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[(0,r.createComponent)(s.Heading,{level:1,children:`Environment Configuration`}),i.code`Below is a list of environment variables used by the`,(0,r.createComponent)(i.Show,{get when(){return!!e?.packageJson.name},get children(){return(0,r.createComponent)(s.Link,{get href(){return`https://www.npmjs.com/package/${e?.packageJson.name}`},get title(){return e.packageJson.name}})}}),i.code`package. These values can be updated in the \`.env\` file in the root of the project.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(s.Heading,{level:2,children:`Environment Variables`}),i.code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(l.MarkdownTable,{get data(){return u.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>({name:e.getNameAsString().trim(),description:(e.getDescription()??``).trim(),type:(0,t.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `),defaultValue:e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``,required:e.isValueRequired()?``:`✔`}))??[]}})]}})}exports.EnvDocs=u;
|
package/dist/components/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createReflectionResource as t}from"../helpers/create-reflection-resource.mjs";import{createComponent as n,createIntrinsic as r}from"@alloy-js/core/jsx-runtime";import{Show as i,code as a}from"@alloy-js/core";import{joinPaths as o}from"@stryke/path/join";import{
|
|
1
|
+
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createReflectionResource as t}from"../helpers/create-reflection-resource.mjs";import{createComponent as n,createIntrinsic as r}from"@alloy-js/core/jsx-runtime";import{Show as i,code as a}from"@alloy-js/core";import{joinPaths as o}from"@stryke/path/join";import{usePowerlines as s}from"@powerlines/alloy/core/contexts/context";import{Heading as c,Link as l}from"@alloy-js/markdown";import{MarkdownFile as u}from"@powerlines/alloy/markdown/components/markdown-file";import{MarkdownTable as d}from"@powerlines/alloy/markdown/components/markdown-table";function f(){let f=s();if(!f)return null;let p=t(f);return n(u,{get path(){return o(f.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[n(c,{level:1,children:`Environment Configuration`}),a`Below is a list of environment variables used by the`,n(i,{get when(){return!!f?.packageJson.name},get children(){return n(l,{get href(){return`https://www.npmjs.com/package/${f?.packageJson.name}`},get title(){return f.packageJson.name}})}}),a`package. These values can be updated in the \`.env\` file in the root of the project.`,r(`hbr`,{}),n(c,{level:2,children:`Environment Variables`}),a`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,r(`hbr`,{}),n(d,{get data(){return p.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>({name:t.getNameAsString().trim(),description:(t.getDescription()??``).trim(),type:(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `),defaultValue:t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``,required:t.isValueRequired()?``:`✔`}))??[]}})]}})}export{f as EnvDocs};
|
package/dist/components/env.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/load.cjs`),r=require(`../helpers/create-reflection-resource.cjs`);let i=require(`@alloy-js/core/jsx-runtime`),a=require(`@alloy-js/core`),o=require(`defu`);o=e.__toESM(o);let s=require(`@stryke/
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/load.cjs`),r=require(`../helpers/create-reflection-resource.cjs`);let i=require(`@alloy-js/core/jsx-runtime`),a=require(`@alloy-js/core`),o=require(`defu`);o=e.__toESM(o);let s=require(`@stryke/string-format/title-case`),c=require(`@stryke/type-checks/is-null`),l=require(`@alloy-js/typescript`),u=require(`@powerlines/alloy/core/contexts/context`),d=require(`@powerlines/alloy/helpers/refkey`),f=require(`@powerlines/alloy/typescript/components/builtin-file`),p=require(`@powerlines/alloy/typescript/components/tsdoc`),m=require(`@powerlines/alloy/typescript/components/typescript-interface`),h=require(`@powerlines/alloy/typescript/components/typescript-object`);function g(e){let[{defaultValue:t,reflection:n}]=(0,a.splitProps)(e,[`defaultValue`,`reflection`]),r=(0,u.usePowerlines)();return[(0,i.createComponent)(m.TypeScriptInterface,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(l.TypeDeclaration,{name:`Env`,export:!0,get children(){return a.code` {
|
|
2
2
|
[Key in keyof EnvBase as Key ${r?.config.env.prefix.map(e=>`| \`${e.replace(/_$/g,``)}_\${Key}\``).join(` `)}]: EnvBase[Key];
|
|
3
3
|
}
|
|
4
4
|
`}})]}function _(e){let[{context:t,name:n}]=(0,a.splitProps)(e,[`context`,`name`]);return t?a.code`propertyName === "${n}" || propertyName.replace(/^(${t.config.env.prefix.sort((e,t)=>e.startsWith(t)?-1:t.startsWith(e)?1:e.localeCompare(t)).map(e=>`${e.replace(/_$/,``)}_`).join(`|`)})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${n.toLowerCase().replace(/[\s\-_]+/g,``)}"`:null}function v(e){let[{context:t,property:n,index:r}]=(0,a.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,i.createComponent)(l.IfStatement,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`return target["${n.getNameAsString()}"];`}}):(0,i.createComponent)(l.ElseIfClause,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`return target["${n.getNameAsString()}"];`}})]:null}function y(e){let[{context:t,property:n,index:r}]=(0,a.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,i.createComponent)(l.IfStatement,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`
|
|
@@ -7,7 +7,7 @@ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/ve
|
|
|
7
7
|
`}}):(0,i.createComponent)(l.ElseIfClause,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`
|
|
8
8
|
target["${n.getNameAsString()}"] = newValue;
|
|
9
9
|
return true;
|
|
10
|
-
`}})]:null}const b=(0,d.refkey)(`createEnv`),x=(0,d.refkey)(`env`),S=(0,d.refkey)(`EnvSerializer`);function C(e){let[{defaultConfig:d},m]=(0,a.splitProps)(e,[`defaultConfig`]),_=(0,u.usePowerlines)(),C=(0,a.computed)(()=>_&&n.loadEnvFromContext(_,process.env)),w=r.createReflectionResource(_),T=(0,a.computed)(()=>new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${(0,
|
|
10
|
+
`}})]:null}const b=(0,d.refkey)(`createEnv`),x=(0,d.refkey)(`env`),S=(0,d.refkey)(`EnvSerializer`);function C(e){let[{defaultConfig:d},m]=(0,a.splitProps)(e,[`defaultConfig`]),_=(0,u.usePowerlines)(),C=(0,a.computed)(()=>_&&n.loadEnvFromContext(_,process.env)),w=r.createReflectionResource(_),T=(0,a.computed)(()=>new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${(0,s.titleCase)(_?.config?.name)} project.`,types:[]},w.data??void 0)),E=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),D=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return(0,i.createComponent)(f.BuiltinFile,(0,i.mergeProps)(m,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return(0,o.default)({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},m.imports??{})},get children(){return[(0,i.createComponent)(a.Show,{get when(){return!(0,c.isNull)(w.data)},get children(){return[(0,i.createComponent)(g,{get defaultValue(){return C.value},get reflection(){return w.data}}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{})]}}),(0,i.createComponent)(h.TypescriptObject,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:C,reflection:T,export:!0,const:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[(0,i.createComponent)(p.TSDocLink,{children:`https://deepkit.io/docs/serialization/serializers`}),(0,i.createComponent)(p.TSDocLink,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),(0,i.createComponent)(p.TSDocRemarks,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),(0,i.createComponent)(l.ClassDeclaration,{refkey:S,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return(0,i.createComponent)(l.ClassMethod,{name:`constructor`,public:!0,children:a.code`
|
|
11
11
|
super("env");
|
|
12
12
|
|
|
13
13
|
this.deserializeRegistry.register(
|
package/dist/components/env.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{loadEnvFromContext as t}from"../helpers/load.mjs";import{createReflectionResource as n}from"../helpers/create-reflection-resource.mjs";import{createComponent as r,createIntrinsic as i,memo as a,mergeProps as o}from"@alloy-js/core/jsx-runtime";import{For as s,Show as c,code as l,computed as u,splitProps as d}from"@alloy-js/core";import f from"defu";import{
|
|
1
|
+
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{loadEnvFromContext as t}from"../helpers/load.mjs";import{createReflectionResource as n}from"../helpers/create-reflection-resource.mjs";import{createComponent as r,createIntrinsic as i,memo as a,mergeProps as o}from"@alloy-js/core/jsx-runtime";import{For as s,Show as c,code as l,computed as u,splitProps as d}from"@alloy-js/core";import f from"defu";import{titleCase as p}from"@stryke/string-format/title-case";import{isNull as m}from"@stryke/type-checks/is-null";import{ClassDeclaration as h,ClassMethod as g,ElseIfClause as _,FunctionDeclaration as v,IfStatement as y,NewExpression as b,TypeDeclaration as x,VarDeclaration as S}from"@alloy-js/typescript";import{usePowerlines as C}from"@powerlines/alloy/core/contexts/context";import{refkey as w}from"@powerlines/alloy/helpers/refkey";import{BuiltinFile as T}from"@powerlines/alloy/typescript/components/builtin-file";import{TSDoc as E,TSDocExample as D,TSDocLink as O,TSDocParam as k,TSDocRemarks as A,TSDocReturns as j,TSDocThrows as M}from"@powerlines/alloy/typescript/components/tsdoc";import{TypeScriptInterface as N}from"@powerlines/alloy/typescript/components/typescript-interface";import{TypescriptObject as P}from"@powerlines/alloy/typescript/components/typescript-object";function F(e){let[{defaultValue:t,reflection:n}]=d(e,[`defaultValue`,`reflection`]),a=C();return[r(N,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),i(`hbr`,{}),i(`hbr`,{}),r(x,{name:`Env`,export:!0,get children(){return l` {
|
|
2
2
|
[Key in keyof EnvBase as Key ${a?.config.env.prefix.map(e=>`| \`${e.replace(/_$/g,``)}_\${Key}\``).join(` `)}]: EnvBase[Key];
|
|
3
3
|
}
|
|
4
4
|
`}})]}function I(e){let[{context:t,name:n}]=d(e,[`context`,`name`]);return t?l`propertyName === "${n}" || propertyName.replace(/^(${t.config.env.prefix.sort((e,t)=>e.startsWith(t)?-1:t.startsWith(e)?1:e.localeCompare(t)).map(e=>`${e.replace(/_$/,``)}_`).join(`|`)})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${n.toLowerCase().replace(/[\s\-_]+/g,``)}"`:null}function L(e){let[{context:t,property:n,index:i}]=d(e,[`context`,`property`,`index`]);return t?[r(i===0?y:_,{get condition(){return[r(I,{get name(){return n.getNameAsString()},context:t}),r(c,{get when(){return a(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[l` || `,r(s,{get each(){return n.getAlias()},joiner:l` || `,children:e=>r(I,{name:e,context:t})})]}})]},get children(){return l`return target["${n.getNameAsString()}"];`}})]:null}function R(e){let[{context:t,property:n,index:i}]=d(e,[`context`,`property`,`index`]);return t?[r(i===0?y:_,{get condition(){return[r(I,{get name(){return n.getNameAsString()},context:t}),r(c,{get when(){return a(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[l` || `,r(s,{get each(){return n.getAlias()},joiner:l` || `,children:e=>r(I,{name:e,context:t})})]}})]},get children(){return l`
|
|
5
5
|
target["${n.getNameAsString()}"] = newValue;
|
|
6
6
|
return true;
|
|
7
|
-
`}})]:null}const z=w(`createEnv`),B=w(`env`),V=w(`EnvSerializer`);function H(a){let[{defaultConfig:_},y]=d(a,[`defaultConfig`]),x=C(),w=u(()=>x&&t(x,process.env)),N=n(x),I=u(()=>new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${
|
|
7
|
+
`}})]:null}const z=w(`createEnv`),B=w(`env`),V=w(`EnvSerializer`);function H(a){let[{defaultConfig:_},y]=d(a,[`defaultConfig`]),x=C(),w=u(()=>x&&t(x,process.env)),N=n(x),I=u(()=>new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${p(x?.config?.name)} project.`,types:[]},N.data??void 0)),H=u(()=>N.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),U=u(()=>N.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return r(T,o(y,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return f({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},y.imports??{})},get children(){return[r(c,{get when(){return!m(N.data)},get children(){return[r(F,{get defaultValue(){return w.value},get reflection(){return N.data}}),i(`hbr`,{}),i(`hbr`,{})]}}),r(P,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:w,reflection:I,export:!0,const:!0}),i(`hbr`,{}),i(`hbr`,{}),r(E,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[r(O,{children:`https://deepkit.io/docs/serialization/serializers`}),r(O,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),r(A,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),r(h,{refkey:V,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return r(g,{name:`constructor`,public:!0,children:l`
|
|
8
8
|
super("env");
|
|
9
9
|
|
|
10
10
|
this.deserializeRegistry.register(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor/type.cjs`);let n=require(`@stryke/json/storm-json`),r=require(`@stryke/
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./vendor/type.cjs`);let n=require(`@stryke/json/storm-json`),r=require(`@stryke/type-checks/is-string`),i=require(`@stryke/helpers/get-unique`),a=require(`@stryke/type-checks/is-null`),o=require(`@stryke/type-checks/is-undefined`);function s(e,t){return l(e.type,t??e.getDefaultValue())}function c(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function l(e,i){return(0,o.isUndefined)(i)?`undefined`:(0,a.isNull)(i)?`null`:e.kind===t.type_exports.ReflectionKind.boolean?String(i).trim().toLowerCase()===`true`?`true`:`false`:e.kind===t.type_exports.ReflectionKind.string||e.kind===t.type_exports.ReflectionKind.literal&&(0,r.isString)(e.literal)?c(i):e.kind===t.type_exports.ReflectionKind.enum?u(e).kind===t.type_exports.ReflectionKind.string?c(i):`${String(i)}`:e.kind===t.type_exports.ReflectionKind.union?f(e)?c(i):`${String(i)}`:e.kind===t.type_exports.ReflectionKind.array?c(n.StormJSON.stringify(i)):e.kind===t.type_exports.ReflectionKind.object||e.kind===t.type_exports.ReflectionKind.objectLiteral?n.StormJSON.stringify(i):e.kind===t.type_exports.ReflectionKind.property||e.kind===t.type_exports.ReflectionKind.parameter?l(e.type,i):String(i)}function u(e){if(e.kind!==t.type_exports.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${e.kind}.`);let n=(0,i.getUniqueBy)(e.values.filter(e=>e!=null),e=>(0,r.isString)(e)?{kind:t.type_exports.ReflectionKind.string}:{kind:t.type_exports.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&(0,r.isString)(n[0])?{kind:t.type_exports.ReflectionKind.string}:{kind:t.type_exports.ReflectionKind.number}}function d(e){if(e.kind===t.type_exports.ReflectionKind.union&&e.types.length>0)return(0,i.getUniqueBy)(e.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${e.kind}.`)}function f(e){return d(e).some(e=>e.kind===t.type_exports.ReflectionKind.string||e.kind===t.type_exports.ReflectionKind.literal&&(0,r.isString)(e.literal))}exports.stringifyDefaultValue=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{type_exports as e}from"./vendor/type.mjs";import{StormJSON as t}from"@stryke/json/storm-json";import{
|
|
1
|
+
import{type_exports as e}from"./vendor/type.mjs";import{StormJSON as t}from"@stryke/json/storm-json";import{isString as n}from"@stryke/type-checks/is-string";import{getUniqueBy as r}from"@stryke/helpers/get-unique";import{isNull as i}from"@stryke/type-checks/is-null";import{isUndefined as a}from"@stryke/type-checks/is-undefined";function o(e,t){return c(e.type,t??e.getDefaultValue())}function s(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function c(r,o){return a(o)?`undefined`:i(o)?`null`:r.kind===e.ReflectionKind.boolean?String(o).trim().toLowerCase()===`true`?`true`:`false`:r.kind===e.ReflectionKind.string||r.kind===e.ReflectionKind.literal&&n(r.literal)?s(o):r.kind===e.ReflectionKind.enum?l(r).kind===e.ReflectionKind.string?s(o):`${String(o)}`:r.kind===e.ReflectionKind.union?d(r)?s(o):`${String(o)}`:r.kind===e.ReflectionKind.array?s(t.stringify(o)):r.kind===e.ReflectionKind.object||r.kind===e.ReflectionKind.objectLiteral?t.stringify(o):r.kind===e.ReflectionKind.property||r.kind===e.ReflectionKind.parameter?c(r.type,o):String(o)}function l(t){if(t.kind!==e.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${t.kind}.`);let i=r(t.values.filter(e=>e!=null),t=>n(t)?{kind:e.ReflectionKind.string}:{kind:e.ReflectionKind.number});if(i.length===0)throw Error(`No valid enum members could be found.`);return i[0]&&n(i[0])?{kind:e.ReflectionKind.string}:{kind:e.ReflectionKind.number}}function u(t){if(t.kind===e.ReflectionKind.union&&t.types.length>0)return r(t.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${t.kind}.`)}function d(t){return u(t).some(t=>t.kind===e.ReflectionKind.string||t.kind===e.ReflectionKind.literal&&n(t.literal))}export{o as stringifyDefaultValue};
|
package/dist/helpers/load.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./source-file-env.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./source-file-env.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/path/join-paths`),i=require(`c12`),a=require(`defu`);a=e.__toESM(a);let o=require(`@stryke/type-checks/is-set-object`),s=require(`@stryke/string-format/kebab-case`),c=require(`@stryke/env/load-env`);async function l(e,n,r){let i=await(0,c.loadEnv)(r,n);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(async e=>(0,c.loadEnvFile)(e,r)));for(let e of t)i=(0,a.default)(e,i)}return t.removeEnvPrefix(i)}async function u(e,t,n,o,s,c){let[u,d]=await Promise.all([l(e,n,t),(0,i.loadConfig)({cwd:t,name:`storm`,envName:n,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:n,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:(0,r.joinPaths)(o,`jiti`),moduleCache:!0}})]);return(0,a.default)(u,d.config,c)}function d(e,t){return(0,a.default)({APP_NAME:(0,s.kebabCase)(e.config.name||e.packageJson.name?.replace(`/${e.workspaceConfig.namespace}`,``)),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${(0,s.kebabCase)(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:(0,n.isSetString)(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},(0,o.isSetObject)(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,n)=>(e[n.name]=t[n.name]??n.getDefaultValue(),e),{}):{})}async function f(e,t){let[n,r,i]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return(0,a.default)(d(e,process.env),n,r,i)}exports.loadEnv=f,exports.loadEnvFromContext=d;
|
package/dist/helpers/load.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeEnvPrefix as e}from"./source-file-env.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import
|
|
1
|
+
import{removeEnvPrefix as e}from"./source-file-env.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{joinPaths as n}from"@stryke/path/join-paths";import{loadConfig as r}from"c12";import i from"defu";import{isSetObject as a}from"@stryke/type-checks/is-set-object";import{kebabCase as o}from"@stryke/string-format/kebab-case";import{loadEnv as s,loadEnvFile as c}from"@stryke/env/load-env";async function l(t,n,r){let a=await s(r,n);if(t.additionalFiles&&t.additionalFiles?.length>0){let e=await Promise.all(t.additionalFiles.map(async e=>c(e,r)));for(let t of e)a=i(t,a)}return e(a)}async function u(e,t,a,o,s,c){let[u,d]=await Promise.all([l(e,a,t),r({cwd:t,name:`storm`,envName:a,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:a,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:n(o,`jiti`),moduleCache:!0}})]);return i(u,d.config,c)}function d(e,n){return i({APP_NAME:o(e.config.name||e.packageJson.name?.replace(`/${e.workspaceConfig.namespace}`,``)),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${o(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:t(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},a(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,t)=>(e[t.name]=n[t.name]??t.getDefaultValue(),e),{}):{})}async function f(e,t){let[n,r,a]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return i(d(e,process.env),n,r,a)}export{f as loadEnv,d as loadEnvFromContext};
|
package/dist/helpers/reflect.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../deepkit/src/reflect-type.cjs`),r=require(`./persistence.cjs`);let i=require(`@stryke/path/is-parent-path`),a=require(`@stryke/
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../deepkit/src/reflect-type.cjs`),r=require(`./persistence.cjs`);let i=require(`@stryke/path/is-parent-path`),a=require(`@stryke/path/join-paths`),o=require(`@stryke/string-format/title-case`);function s(e,n){return d(e,{type:(0,t.type_exports.merge)(n.map(e=>e.type))})}function c(e,n){return f(e,{type:(0,t.type_exports.merge)(n.map(e=>e.type))})}var l=class{PLATFORM=`neutral`;MODE=`production`;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;CI=!1},u=class{};function d(e,n={}){let r=n.superReflection??new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.class,description:`The base environment configuration definition for the ${(0,o.titleCase)(e.config.name)} project.`,classType:l,types:[],implements:[{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${(0,o.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${(0,o.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function f(e,n={}){let r=n.superReflection??new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.class,description:`The base secrets configuration definition for the ${(0,o.titleCase)(e.config.name)} project.`,classType:u,types:[],implements:[{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${(0,o.titleCase)(e.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new t.type_exports.ReflectionClass(n.type??{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${(0,o.titleCase)(e.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function p(e,o,c){let l;o&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(o,e.workspaceConfig.workspaceRoot)?o:(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,o),name:c},{skipNodeModulesBundle:!0})));let u=await n.reflectType(e,await r.getEnvDefaultTypeDefinition(e));return s(e,[await r.readEnvTypeReflection(e,`env`),l,(0,t.type_exports.resolveClassType)(u)].filter(Boolean))}async function m(e,o,s){let l;o&&(l=(0,t.type_exports.resolveClassType)(await n.reflectType(e,{file:(0,i.isParentPath)(o,e.workspaceConfig.workspaceRoot)?o:(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,o),name:s},{skipNodeModulesBundle:!0})));let u=await n.reflectType(e,await r.getSecretsDefaultTypeDefinition(e));return c(e,[await r.readSecretsReflection(e),l,(0,t.type_exports.resolveClassType)(u)].filter(Boolean))}exports.BaseEnv=l,exports.BaseSecrets=u,exports.createEnvReflection=d,exports.createSecretsReflection=f,exports.mergeEnvReflections=s,exports.mergeSecretsReflections=c,exports.reflectEnv=p,exports.reflectSecrets=m;
|
package/dist/helpers/reflect.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{reflectType as t}from"../deepkit/src/reflect-type.mjs";import{getEnvDefaultTypeDefinition as n,getSecretsDefaultTypeDefinition as r,readEnvTypeReflection as i,readSecretsReflection as a}from"./persistence.mjs";import{isParentPath as o}from"@stryke/path/is-parent-path";import{
|
|
1
|
+
import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{reflectType as t}from"../deepkit/src/reflect-type.mjs";import{getEnvDefaultTypeDefinition as n,getSecretsDefaultTypeDefinition as r,readEnvTypeReflection as i,readSecretsReflection as a}from"./persistence.mjs";import{isParentPath as o}from"@stryke/path/is-parent-path";import{joinPaths as s}from"@stryke/path/join-paths";import{titleCase as c}from"@stryke/string-format/title-case";function l(t,n){return p(t,{type:(0,e.merge)(n.map(e=>e.type))})}function u(t,n){return m(t,{type:(0,e.merge)(n.map(e=>e.type))})}var d=class{PLATFORM=`neutral`;MODE=`production`;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;CI=!1},f=class{};function p(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base environment configuration definition for the ${c(t.config.name)} project.`,classType:d,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${c(t.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${t.config.name?`${c(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function m(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base secrets configuration definition for the ${c(t.config.name)} project.`,classType:f,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${c(t.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${t.config.name?`${c(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function h(r,a,c){let u;a&&(u=(0,e.resolveClassType)(await t(r,{file:o(a,r.workspaceConfig.workspaceRoot)?a:s(r.workspaceConfig.workspaceRoot,a),name:c},{skipNodeModulesBundle:!0})));let d=await t(r,await n(r));return l(r,[await i(r,`env`),u,(0,e.resolveClassType)(d)].filter(Boolean))}async function g(n,i,c){let l;i&&(l=(0,e.resolveClassType)(await t(n,{file:o(i,n.workspaceConfig.workspaceRoot)?i:s(n.workspaceConfig.workspaceRoot,i),name:c},{skipNodeModulesBundle:!0})));let d=await t(n,await r(n));return u(n,[await a(n),l,(0,e.resolveClassType)(d)].filter(Boolean))}export{d as BaseEnv,f as BaseSecrets,p as createEnvReflection,m as createSecretsReflection,l as mergeEnvReflections,u as mergeSecretsReflections,h as reflectEnv,g as reflectSecrets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/env/types`),r=require(`@stryke/string-format/camel-case`);function i(e){if((0,t.isString)(e)){let t=n.ENV_PREFIXES.reduce((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),e.toUpperCase());for(;t.startsWith(`_`);)t=t.slice(1);return t}return Object.keys(e).reduce((t,n)=>{let r=i(n);return r&&(t[r]=e[n]),t},{})}function a(e){return(0,r.camelCase)(i(e))}exports.formatEnvField=a,exports.removeEnvPrefix=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isString as e}from"@stryke/type-checks/is-string";import{
|
|
1
|
+
import{isString as e}from"@stryke/type-checks/is-string";import{ENV_PREFIXES as t}from"@stryke/env/types";import{camelCase as n}from"@stryke/string-format/camel-case";function r(n){if(e(n)){let e=t.reduce((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),n.toUpperCase());for(;e.startsWith(`_`);)e=e.slice(1);return e}return Object.keys(n).reduce((e,t)=>{let i=r(t);return i&&(e[i]=n[t]),e},{})}function i(e){return n(r(e))}export{i as formatEnvField,r as removeEnvPrefix};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./deepkit/src/vendor/type.cjs`),n=require(`./plugin-alloy/src/index.cjs`),r=require(`./plugin-automd/src/index.cjs`),i=require(`./plugin-babel/src/index.cjs`),a=require(`./helpers/reflect.cjs`),o=require(`./helpers/persistence.cjs`),s=require(`./babel/plugin.cjs`),c=require(`./helpers/source-file-env.cjs`),l=require(`./helpers/load.cjs`),u=require(`./helpers/create-reflection-resource.cjs`),d=require(`./components/env.cjs`),f=require(`./helpers/automd-generator.cjs`);require(`./babel/index.cjs`);const p=require(`./components/docs.cjs`);require(`./components/index.cjs`);const m=require(`./helpers/template-helpers.cjs`);require(`./helpers/index.cjs`);let h=require(`@alloy-js/core/jsx-runtime`),g=require(`@storm-software/config-tools/types`),_=require(`@stryke/path/is-parent-path`),v=require(
|
|
1
|
+
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./deepkit/src/vendor/type.cjs`),n=require(`./plugin-alloy/src/index.cjs`),r=require(`./plugin-automd/src/index.cjs`),i=require(`./plugin-babel/src/index.cjs`),a=require(`./helpers/reflect.cjs`),o=require(`./helpers/persistence.cjs`),s=require(`./babel/plugin.cjs`),c=require(`./helpers/source-file-env.cjs`),l=require(`./helpers/load.cjs`),u=require(`./helpers/create-reflection-resource.cjs`),d=require(`./components/env.cjs`),f=require(`./helpers/automd-generator.cjs`);require(`./babel/index.cjs`);const p=require(`./components/docs.cjs`);require(`./components/index.cjs`);const m=require(`./helpers/template-helpers.cjs`);require(`./helpers/index.cjs`);let h=require(`@alloy-js/core/jsx-runtime`),g=require(`@storm-software/config-tools/types`),_=require(`@stryke/path/is-parent-path`),v=require(`@stryke/convert/to-array`),y=require(`defu`);y=e.__toESM(y);let b=require(`@stryke/string-format/title-case`),x=require(`@stryke/convert/parse-type-definition`),S=require(`@stryke/env/types`),C=require(`@stryke/fs/exists`),w=require(`@stryke/fs/helpers`),T=require(`@stryke/path/join`),E=require(`@stryke/string-format/constant-case`);const D=(e={})=>[n.default(e.alloy),i.default(e.babel),{name:`env`,async config(){this.log(g.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,y.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[s.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,x.parseTypeDefinition)(t.env.types);else{this.log(g.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await o.getEnvDefaultTypeDefinition(this);t.env.types=(0,x.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,x.parseTypeDefinition)(t.env.secrets);else{let e=await o.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,x.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,v.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,E.constantCase)(t);return e.includes(n)||e.push(n),e},[...S.ENV_PREFIXES,`POWERLINES_`]),t.env.prefix=t.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),t},async configResolved(){if(this.log(g.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,y.default)({parsed:await l.loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&(0,C.existsSync)(o.getEnvTypeReflectionsPath(this,`env`)))this.log(g.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await o.readEnvTypeReflection(this,`env`),(0,C.existsSync)(o.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await o.readEnvReflection(this)),(0,C.existsSync)(o.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await o.readEnvTypeReflection(this,`secrets`)),(0,C.existsSync)(o.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await o.readSecretsReflection(this));else{if(this.env.types.env=await a.reflectEnv(this,this.config.env.types?.file?(0,_.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,T.joinPaths)(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await o.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await a.reflectSecrets(this,this.config.env.secrets?.file?(0,_.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,T.joinPaths)(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.log(g.LogLevelLabel.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let e=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await l.loadEnv(this,this.config.env)).forEach(([t,n])=>{let r=this.config.env.prefix.reduce((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,t),i=e.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)}),this.env.used.env=new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await o.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await o.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(g.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render((0,h.createComponent)(d.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(g.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=(0,T.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,C.existsSync)(e)||await(0,w.createDirectory)(e);let n=await o.readEnvTypeReflection(this,`env`),r=(0,T.joinPaths)(e,`env.md`);this.log(g.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,b.titleCase)(this.config.framework)||`Powerlines`} -->
|
|
2
2
|
|
|
3
3
|
Below is a list of environment variables used by the [${this.packageJson.name}](https://www.npmjs.com/package/${this.packageJson.name}) package. These values can be updated in the \`.env\` file in the root of the project. The variables in the list below are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.
|
|
4
4
|
|
|
@@ -7,4 +7,4 @@ Below is a list of environment variables used by the [${this.packageJson.name}](
|
|
|
7
7
|
${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>`| ${e.getNameAsString().trim()} | ${(e.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
|
|
8
8
|
`,``)??``).trim()} | ${(0,t.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `)} | ${e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``} | ${e.isValueRequired()?``:`✔`} |`).join(`
|
|
9
9
|
`)}
|
|
10
|
-
`)},async buildEnd(){let e=o.getEnvReflectionsPath(this,`env`);this.log(g.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await o.writeEnvReflection(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:(0,
|
|
10
|
+
`)},async buildEnd(){let e=o.getEnvReflectionsPath(this,`env`);this.log(g.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await o.writeEnvReflection(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:(0,y.default)(e.automd??{},{generators:{env:f.env(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},r.default(e.automd)];var O=D;exports.BaseEnv=a.BaseEnv,exports.BaseSecrets=a.BaseSecrets,exports.EnvBuiltin=d.EnvBuiltin,exports.EnvDocs=p.EnvDocs,exports.EnvTypeDefinition=d.EnvTypeDefinition,exports.createEnvReflection=a.createEnvReflection,exports.createReflectionResource=u.createReflectionResource,exports.createSecretsReflection=a.createSecretsReflection,exports.createTemplateReflection=m.createTemplateReflection,exports.default=O,exports.envBabelPlugin=s.envBabelPlugin,exports.formatEnvField=c.formatEnvField,exports.getEnvDefaultTypeDefinition=o.getEnvDefaultTypeDefinition,exports.getEnvReflectionsPath=o.getEnvReflectionsPath,exports.getEnvTypeReflectionsPath=o.getEnvTypeReflectionsPath,exports.getSecretsDefaultTypeDefinition=o.getSecretsDefaultTypeDefinition,exports.loadEnv=l.loadEnv,exports.loadEnvFromContext=l.loadEnvFromContext,exports.mergeEnvReflections=a.mergeEnvReflections,exports.mergeSecretsReflections=a.mergeSecretsReflections,exports.plugin=D,exports.readEnvReflection=o.readEnvReflection,exports.readEnvTypeReflection=o.readEnvTypeReflection,exports.readSecretsReflection=o.readSecretsReflection,exports.reflectEnv=a.reflectEnv,exports.reflectSecrets=a.reflectSecrets,exports.removeEnvPrefix=c.removeEnvPrefix,exports.resolveRuntimeTypeFile=o.resolveRuntimeTypeFile,exports.writeEnvReflection=o.writeEnvReflection,exports.writeEnvReflectionSync=o.writeEnvReflectionSync,exports.writeEnvTypeReflection=o.writeEnvTypeReflection;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EnvDocs } from "./components/docs.cjs";
|
|
2
2
|
import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./components/env.cjs";
|
|
3
|
-
import "./components/index.cjs";
|
|
4
3
|
import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.cjs";
|
|
5
4
|
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.cjs";
|
|
6
5
|
import { envBabelPlugin } from "./babel/plugin.cjs";
|
|
@@ -12,7 +11,6 @@ import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflecti
|
|
|
12
11
|
import { formatEnvField, removeEnvPrefix } from "./helpers/source-file-env.cjs";
|
|
13
12
|
import { createTemplateReflection } from "./helpers/template-helpers.cjs";
|
|
14
13
|
import "./helpers/index.cjs";
|
|
15
|
-
import "./types/index.cjs";
|
|
16
14
|
import { Plugin } from "powerlines";
|
|
17
15
|
|
|
18
16
|
//#region src/index.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type_exports as e}from"./deepkit/src/vendor/type.mjs";import t from"./plugin-alloy/src/index.mjs";import n from"./plugin-automd/src/index.mjs";import r from"./plugin-babel/src/index.mjs";import{BaseEnv as i,BaseSecrets as a,createEnvReflection as o,createSecretsReflection as s,mergeEnvReflections as c,mergeSecretsReflections as l,reflectEnv as u,reflectSecrets as d}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as f,getEnvReflectionsPath as p,getEnvTypeReflectionsPath as m,getSecretsDefaultTypeDefinition as h,readEnvReflection as g,readEnvTypeReflection as _,readSecretsReflection as v,resolveRuntimeTypeFile as y,writeEnvReflection as b,writeEnvReflectionSync as x,writeEnvTypeReflection as S}from"./helpers/persistence.mjs";import{envBabelPlugin as C}from"./babel/plugin.mjs";import{formatEnvField as w,removeEnvPrefix as T}from"./helpers/source-file-env.mjs";import{loadEnv as E,loadEnvFromContext as D}from"./helpers/load.mjs";import{createReflectionResource as O}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as k,EnvTypeDefinition as A}from"./components/env.mjs";import{env as j}from"./helpers/automd-generator.mjs";import"./babel/index.mjs";import{EnvDocs as M}from"./components/docs.mjs";import"./components/index.mjs";import{createTemplateReflection as N}from"./helpers/template-helpers.mjs";import"./helpers/index.mjs";import{createComponent as P}from"@alloy-js/core/jsx-runtime";import{LogLevelLabel as F}from"@storm-software/config-tools/types";import{isParentPath as I}from"@stryke/path/is-parent-path";import
|
|
1
|
+
import{type_exports as e}from"./deepkit/src/vendor/type.mjs";import t from"./plugin-alloy/src/index.mjs";import n from"./plugin-automd/src/index.mjs";import r from"./plugin-babel/src/index.mjs";import{BaseEnv as i,BaseSecrets as a,createEnvReflection as o,createSecretsReflection as s,mergeEnvReflections as c,mergeSecretsReflections as l,reflectEnv as u,reflectSecrets as d}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as f,getEnvReflectionsPath as p,getEnvTypeReflectionsPath as m,getSecretsDefaultTypeDefinition as h,readEnvReflection as g,readEnvTypeReflection as _,readSecretsReflection as v,resolveRuntimeTypeFile as y,writeEnvReflection as b,writeEnvReflectionSync as x,writeEnvTypeReflection as S}from"./helpers/persistence.mjs";import{envBabelPlugin as C}from"./babel/plugin.mjs";import{formatEnvField as w,removeEnvPrefix as T}from"./helpers/source-file-env.mjs";import{loadEnv as E,loadEnvFromContext as D}from"./helpers/load.mjs";import{createReflectionResource as O}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as k,EnvTypeDefinition as A}from"./components/env.mjs";import{env as j}from"./helpers/automd-generator.mjs";import"./babel/index.mjs";import{EnvDocs as M}from"./components/docs.mjs";import"./components/index.mjs";import{createTemplateReflection as N}from"./helpers/template-helpers.mjs";import"./helpers/index.mjs";import{createComponent as P}from"@alloy-js/core/jsx-runtime";import{LogLevelLabel as F}from"@storm-software/config-tools/types";import{isParentPath as I}from"@stryke/path/is-parent-path";import{toArray as L}from"@stryke/convert/to-array";import R from"defu";import{titleCase as z}from"@stryke/string-format/title-case";import{parseTypeDefinition as B}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as V}from"@stryke/env/types";import{existsSync as H}from"@stryke/fs/exists";import{createDirectory as U}from"@stryke/fs/helpers";import{joinPaths as W}from"@stryke/path/join";import{constantCase as G}from"@stryke/string-format/constant-case";const K=(i={})=>[t(i.alloy),r(i.babel),{name:`env`,async config(){this.log(F.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:R(i,{types:{},prefix:[]}),transform:{babel:{plugins:[C]}}};if(e.env.types)e.env.types=B(e.env.types);else{this.log(F.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await f(this);e.env.types=B(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=B(e.env.secrets);else{let t=await h(this);e.env.secrets=B(`${t.file}#${t.name}`)}return e.env.prefix=L(e.env.prefix??[]).reduce((e,t)=>{let n=G(t);return e.includes(n)||e.push(n),e},[...V,`POWERLINES_`]),e.env.prefix=e.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),e},async configResolved(){if(this.log(F.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=R({parsed:await E(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&H(m(this,`env`)))this.log(F.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await _(this,`env`),H(p(this,`env`))&&(this.env.used.env=await g(this)),H(m(this,`secrets`))&&(this.env.types.secrets=await _(this,`secrets`)),H(p(this,`secrets`))&&(this.env.used.secrets=await v(this));else{if(this.env.types.env=await u(this,this.config.env.types?.file?I(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:W(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await S(this,this.env.types.env,`env`),this.env.types.secrets=await d(this,this.config.env.secrets?.file?I(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:W(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await S(this,this.env.types.secrets,`secrets`),this.log(F.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let t=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await E(this,this.config.env)).forEach(([e,n])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=t.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)}),this.env.used.env=new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await b(this,this.env.used.env,`env`),this.env.types.secrets&&(await S(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await b(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(F.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(P(k,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(F.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=W(this.config.projectRoot,`docs`,`generated`);H(t)||await U(t);let n=await _(this,`env`),r=W(t,`env.md`);this.log(F.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${z(this.config.framework)||`Powerlines`} -->
|
|
2
2
|
|
|
3
3
|
Below is a list of environment variables used by the [${this.packageJson.name}](https://www.npmjs.com/package/${this.packageJson.name}) package. These values can be updated in the \`.env\` file in the root of the project. The variables in the list below are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.
|
|
4
4
|
|
|
@@ -7,4 +7,4 @@ Below is a list of environment variables used by the [${this.packageJson.name}](
|
|
|
7
7
|
${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
|
|
8
8
|
`,``)??``).trim()} | ${(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `)} | ${t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``} | ${t.isValueRequired()?``:`✔`} |`).join(`
|
|
9
9
|
`)}
|
|
10
|
-
`)},async buildEnd(){let e=p(this,`env`);this.log(F.TRACE,`Writing env reflection types to ${e}.`),await b(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:
|
|
10
|
+
`)},async buildEnd(){let e=p(this,`env`);this.log(F.TRACE,`Writing env reflection types to ${e}.`),await b(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:R(i.automd??{},{generators:{env:j(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},n(i.automd)];var q=K;export{i as BaseEnv,a as BaseSecrets,k as EnvBuiltin,M as EnvDocs,A as EnvTypeDefinition,o as createEnvReflection,O as createReflectionResource,s as createSecretsReflection,N as createTemplateReflection,q as default,C as envBabelPlugin,w as formatEnvField,f as getEnvDefaultTypeDefinition,p as getEnvReflectionsPath,m as getEnvTypeReflectionsPath,h as getSecretsDefaultTypeDefinition,E as loadEnv,D as loadEnvFromContext,c as mergeEnvReflections,l as mergeSecretsReflections,K as plugin,g as readEnvReflection,_ as readEnvTypeReflection,v as readSecretsReflection,u as reflectEnv,d as reflectSecrets,T as removeEnvPrefix,y as resolveRuntimeTypeFile,b as writeEnvReflection,x as writeEnvReflectionSync,S as writeEnvTypeReflection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./core/
|
|
2
|
-
`)?`${
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./core/components/output.cjs`);let n=require(`@alloy-js/core/jsx-runtime`),r=require(`@alloy-js/core`),i=require(`@alloy-js/rollup-plugin`);i=e.__toESM(i);let a=require(`@storm-software/config-tools/types`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/path/replace`),l=require(`@stryke/type-checks/is-set-string`),u=require(`prettier/doc.js`);const d=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[(0,i.default)()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,o.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let i=this,a=(0,r.renderTree)((0,n.createComponent)(t.Output,{context:i,get basePath(){return i.workspaceConfig.workspaceRoot},children:e}));await p(this,a,this.config.alloy)}}}}];var f=d;async function p(e,t,n={}){await(0,r.flushJobsAsync)();let i,o=async(t,l)=>{if(!Array.isArray(l))return;let u=async e=>{for(let t of l)await o(e,t)},d=(0,r.getContextForRenderNode)(l);if(!d)return u(t);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};t?t.contents.push(e):i=e,await u(e)}else if(d.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let r;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(a.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),r={kind:`builtin`,id:d.meta.builtin.id,path:(0,c.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,n)}}else d.meta?.entry||(0,s.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(a.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),r={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,n)}):(e.log(a.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),r={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await m(e,l,n)});t.contents.push(r)}else if(d.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(a.LogLevelLabel.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");t.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(t)};await o(void 0,t);let u=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await u(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!(0,l.isSetString)(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&(0,l.isSetString)(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await u(e,i)}async function m(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await(0,r.flushJobsAsync)();let i=u.printer.printDocToString(h(t),n).formatted;return n.insertFinalNewLine&&!i.endsWith(`
|
|
2
|
+
`)?`${i}\n`:i}function h(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else (0,r.isPrintHook)(n)?t.push(n.print(n.subtree,h)):t.push(h(n));return t}exports.default=f,Object.keys(r).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)?`${i}\n`:i}function
|
|
1
|
+
import{Output as e}from"./core/components/output.mjs";import{createComponent as t}from"@alloy-js/core/jsx-runtime";import{flushJobsAsync as n,getContextForRenderNode as r,isPrintHook as i,renderTree as a}from"@alloy-js/core";import o from"@alloy-js/rollup-plugin";import{LogLevelLabel as s}from"@storm-software/config-tools/types";import{StormJSON as c}from"@stryke/json/storm-json";import{isParentPath as l}from"@stryke/path/is-parent-path";import{replacePath as u}from"@stryke/path/replace";import{isSetString as d}from"@stryke/type-checks/is-set-string";import{printer as f}from"prettier/doc.js";export*from"@alloy-js/core";var p=(n={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...n},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[o()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,c.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)},resolveId(e){return e===`@alloy-js/core`?{id:`@powerlines/plugin-alloy`,external:!0}:null}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async n=>{let r=this,i=a(t(e,{context:r,get basePath(){return r.workspaceConfig.workspaceRoot},children:n}));await m(this,i,this.config.alloy)}}}}];async function m(e,t,i={}){await n();let a,o=async(t,n)=>{if(!Array.isArray(n))return;let c=async e=>{for(let t of n)await o(e,t)},d=r(n);if(!d)return c(t);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};t?t.contents.push(e):a=e,await c(e)}else if(d.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let r;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(s.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),r={kind:`builtin`,id:d.meta.builtin.id,path:u(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,n,i)}}else d.meta?.entry||l(e.entryPath,d.meta.sourceFile.path)?(e.log(s.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),r={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,n,i)}):(e.log(s.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),r={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,n,i)});t.contents.push(r)}else if(d.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(s.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");t.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await c(t)};await o(void 0,t);let c=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await c(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!d(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&d(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await c(e,a)}async function h(e,t,r={}){r.printWidth??=160,r.tabWidth??=2,r.useTabs??=!1,r.insertFinalNewLine??=!0,await n();let i=f.printDocToString(g(t),r).formatted;return r.insertFinalNewLine&&!i.endsWith(`
|
|
2
|
+
`)?`${i}\n`:i}function g(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else i(n)?t.push(n.print(n.subtree,g)):t.push(g(n));return t}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/replace`),n=require(`@stryke/
|
|
1
|
+
const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/replace`),n=require(`@stryke/convert/to-array`),r=require(`@stryke/fs/is-file`),i=require(`@stryke/fs/list-files`),a=require(`@stryke/path/append`),o=require(`@stryke/path/is-type`),s=require(`@stryke/path/join-paths`),c=require(`automd`),l=require(`c12`),u=require(`defu`);u=e.__toESM(u);let d=require(`markdown-toc`);d=e.__toESM(d);const f=(e={})=>({name:`automd`,async config(){let t=await(0,c.loadConfig)((0,s.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=(0,n.toArray)(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:(0,u.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,n.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,n.toArray)(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await(0,l.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,c.resolveConfig)((0,u.default)(this.config.automd,{...e,prefix:(0,n.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,n.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,i.listFiles)((0,o.isAbsolutePath)(e)?e:(0,a.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,o.isAbsolutePath)(e)?e:(0,a.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,o.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,a.appendPath)(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:(0,d.default)(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all((0,n.toArray)(this.config.automd.input).map(async e=>{let n=await this.fs.read(e);if(n){let i=await(0,c.transform)(n,this.config.automd);if(i.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);i.hasChanged&&await this.fs.write((0,a.appendPath)(this.config.automd.output?(0,r.isDirectory)(this.config.automd.output)?(0,t.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),i.contents)}}))}});var p=f;exports.default=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{replacePath as e}from"@stryke/path/replace";import{
|
|
1
|
+
import{replacePath as e}from"@stryke/path/replace";import{toArray as t}from"@stryke/convert/to-array";import{isDirectory as n}from"@stryke/fs/is-file";import{listFiles as r}from"@stryke/fs/list-files";import{appendPath as i}from"@stryke/path/append";import{isAbsolutePath as a}from"@stryke/path/is-type";import{joinPaths as o}from"@stryke/path/join-paths";import{loadConfig as s,resolveConfig as c,transform as l}from"automd";import{loadConfig as u}from"c12";import d from"defu";import f from"markdown-toc";var p=(p={})=>({name:`automd`,async config(){let e=await s(o(this.workspaceConfig.workspaceRoot,this.config.projectRoot),p);return(!e.prefix||!Array.isArray(e.prefix))&&(e.prefix=t(e.prefix??[])),e.prefix.includes(`automd`)||e.prefix.push(`automd`),e.prefix.includes(`powerlines`)||e.prefix.push(`powerlines`),{automd:d(e??{},{configFile:p.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!t(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=t(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await u({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=c(d(this.config.automd,{...e,prefix:t(e.prefix??[])}))}this.config.automd.input=(await Promise.all(t(this.config.automd.input).map(async e=>e.includes(`*`)?r(a(e)?e:i(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):a(e)?e:i(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!a(this.config.automd.output)&&(this.config.automd.output=i(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:f(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all(t(this.config.automd.input).map(async t=>{let r=await this.fs.read(t);if(r){let a=await l(r,this.config.automd);if(a.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${t}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);a.hasChanged&&await this.fs.write(i(this.config.automd.output?n(this.config.automd.output)?e(t,this.config.automd.output):this.config.automd.output:t,this.config.projectRoot),a.contents)}}))}});export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../_virtual/rolldown_runtime.cjs`);require(`./ast-utils.cjs`);let t=require(`@
|
|
1
|
+
const e=require(`../../../_virtual/rolldown_runtime.cjs`);require(`./ast-utils.cjs`);let t=require(`@babel/types`);t=e.__toESM(t);let n=require(`@stryke/type-checks/is-string`);function r(e,t){o(e.scope.getProgramParent().path,t)}function i(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function a(e){let t=new Map;return e.traverse({ImportDeclaration(e){i(e)&&t.set(e.node.source.value,e)}}),t}function o(e,n){a(e).get(n.module)||e.unshiftContainer(`body`,t.importDeclaration([t.importSpecifier(t.identifier(n.name||n.imported),t.identifier(n.imported))],t.stringLiteral(n.module)))}exports.addImport=r,exports.addImportsToProgram=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./ast-utils.mjs";import{isString as
|
|
1
|
+
import"./ast-utils.mjs";import*as e from"@babel/types";import{isString as t}from"@stryke/type-checks/is-string";function n(e,t){a(e.scope.getProgramParent().path,t)}function r(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function i(e){let t=new Map;return e.traverse({ImportDeclaration(e){r(e)&&t.set(e.node.source.value,e)}}),t}function a(t,n){i(t).get(n.module)||t.unshiftContainer(`body`,e.importDeclaration([e.importSpecifier(e.identifier(n.name||n.imported),e.identifier(n.imported))],e.stringLiteral(n.module)))}export{n as addImport,a as addImportsToProgram};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);require(`../entry.cjs`);let t=require(`@stryke/path/replace`),n=require(`defu`);
|
|
2
|
-
import ${(0,
|
|
3
|
-
export { ${(0,
|
|
4
|
-
import ${t[1]===`*`?`* as ${(0,
|
|
5
|
-
export { ${(0,
|
|
1
|
+
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);require(`../entry.cjs`);let t=require(`@stryke/path/replace`),n=require(`@stryke/path/join-paths`),r=require(`defu`);r=e.__toESM(r);let i=require(`@stryke/type-checks/is-string`),a=require(`@stryke/helpers/omit`),o=require(`@stryke/string-format/camel-case`);const s={target:`esnext`,platform:`neutral`,format:`esm`,write:!0,minify:!0,sourcemap:!1,bundle:!0,treeShaking:!0,keepNames:!0,splitting:!0,logLevel:`silent`};function c(e){let t=e.config.build.override.inject??e.config.build.inject;return t&&Object.keys(t).length>0&&e.fs.writeSync((0,n.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`),Object.entries(t).map(([e,t])=>{if(t)if(Array.isArray(t)){if((0,o.camelCase)(e)!==e){if(t.length===1)return`
|
|
2
|
+
import ${(0,o.camelCase)(e)} from "${t[0]}";
|
|
3
|
+
export { ${(0,o.camelCase)(e)} as "${e}" }`;if(t.length>1)return`
|
|
4
|
+
import ${t[1]===`*`?`* as ${(0,o.camelCase)(e)}`:`{ ${t[1]} as ${(0,o.camelCase)(e)} }`} from "${t[0]}";
|
|
5
|
+
export { ${(0,o.camelCase)(e)} as "${e}" }`}else if(t.length===1)return`
|
|
6
6
|
import ${e} from "${t[0]}";
|
|
7
7
|
export { ${e} };`;else if(t.length>1)return`
|
|
8
8
|
import ${t[1]===`*`?`* as ${e}`:`{ ${t[1]} as ${e} }`} from "${t[0]}";
|
|
9
|
-
export { ${e} };`}else if((0,
|
|
10
|
-
import ${(0,
|
|
11
|
-
export { ${(0,
|
|
9
|
+
export { ${e} };`}else if((0,o.camelCase)(e)!==e)return`
|
|
10
|
+
import ${(0,o.camelCase)(e)} from "${t[0]}";
|
|
11
|
+
export { ${(0,o.camelCase)(e)} as "${e}" }`;else return`
|
|
12
12
|
import ${e} from "${t}";
|
|
13
13
|
export { ${e} };`;return``}).join(`
|
|
14
|
-
`)),(0,
|
|
14
|
+
`)),(0,r.default)({alias:e.builtins.reduce((t,n)=>{if(!t[n]){let r=e.fs.ids[n];r&&(t[n]=r)}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias.reduce((e,t)=>(e[t.find.toString()]||(e[t.find.toString()]=t.replacement),e),{}):e.config.build.alias:{}),inject:t&&Object.keys(t).length>0?[(0,n.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`)]:void 0},e.config.build.variant===`esbuild`?(0,a.omit)(e.config.build.override,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`]):{},e.config.build.variant===`esbuild`?(0,a.omit)(e.config.build,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`,`variant`,`override`]):{},{mainFields:e.config.build.mainFields,conditions:e.config.build.conditions,define:e.config.build.define,resolveExtensions:e.config.build.extensions,packages:e.config.build.skipNodeModulesBundle?`external`:e.config.build.variant===`esbuild`?e.config.build.packages:void 0,format:Array.isArray(e.config.output.format)?e.config.output.format[0]:e.config.output.format,platform:e.config.build.platform,treeShaking:!!e.config.build?.treeshake||e.config.build?.treeShaking,outdir:e.config.output.buildPath,tsconfig:e.tsconfig.tsconfigFilePath,minify:e.config.mode!==`development`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`},s)}exports.extractESBuildConfig=c;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import"../entry.mjs";import{replacePath as e}from"@stryke/path/replace";import
|
|
2
|
-
import ${
|
|
3
|
-
export { ${
|
|
4
|
-
import ${t[1]===`*`?`* as ${
|
|
5
|
-
export { ${
|
|
1
|
+
import"../entry.mjs";import{replacePath as e}from"@stryke/path/replace";import{joinPaths as t}from"@stryke/path/join-paths";import n from"defu";import{isString as r}from"@stryke/type-checks/is-string";import{omit as i}from"@stryke/helpers/omit";import{camelCase as a}from"@stryke/string-format/camel-case";const o={target:`esnext`,platform:`neutral`,format:`esm`,write:!0,minify:!0,sourcemap:!1,bundle:!0,treeShaking:!0,keepNames:!0,splitting:!0,logLevel:`silent`};function s(e){let r=e.config.build.override.inject??e.config.build.inject;return r&&Object.keys(r).length>0&&e.fs.writeSync(t(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`),Object.entries(r).map(([e,t])=>{if(t)if(Array.isArray(t)){if(a(e)!==e){if(t.length===1)return`
|
|
2
|
+
import ${a(e)} from "${t[0]}";
|
|
3
|
+
export { ${a(e)} as "${e}" }`;if(t.length>1)return`
|
|
4
|
+
import ${t[1]===`*`?`* as ${a(e)}`:`{ ${t[1]} as ${a(e)} }`} from "${t[0]}";
|
|
5
|
+
export { ${a(e)} as "${e}" }`}else if(t.length===1)return`
|
|
6
6
|
import ${e} from "${t[0]}";
|
|
7
7
|
export { ${e} };`;else if(t.length>1)return`
|
|
8
8
|
import ${t[1]===`*`?`* as ${e}`:`{ ${t[1]} as ${e} }`} from "${t[0]}";
|
|
9
|
-
export { ${e} };`}else if(
|
|
10
|
-
import ${
|
|
11
|
-
export { ${
|
|
9
|
+
export { ${e} };`}else if(a(e)!==e)return`
|
|
10
|
+
import ${a(e)} from "${t[0]}";
|
|
11
|
+
export { ${a(e)} as "${e}" }`;else return`
|
|
12
12
|
import ${e} from "${t}";
|
|
13
13
|
export { ${e} };`;return``}).join(`
|
|
14
|
-
`)),
|
|
14
|
+
`)),n({alias:e.builtins.reduce((t,n)=>{if(!t[n]){let r=e.fs.ids[n];r&&(t[n]=r)}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias.reduce((e,t)=>(e[t.find.toString()]||(e[t.find.toString()]=t.replacement),e),{}):e.config.build.alias:{}),inject:r&&Object.keys(r).length>0?[t(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`)]:void 0},e.config.build.variant===`esbuild`?i(e.config.build.override,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`]):{},e.config.build.variant===`esbuild`?i(e.config.build,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`,`variant`,`override`]):{},{mainFields:e.config.build.mainFields,conditions:e.config.build.conditions,define:e.config.build.define,resolveExtensions:e.config.build.extensions,packages:e.config.build.skipNodeModulesBundle?`external`:e.config.build.variant===`esbuild`?e.config.build.packages:void 0,format:Array.isArray(e.config.output.format)?e.config.output.format[0]:e.config.output.format,platform:e.config.build.platform,treeShaking:!!e.config.build?.treeshake||e.config.build?.treeShaking,outdir:e.config.output.buildPath,tsconfig:e.tsconfig.tsconfigFilePath,minify:e.config.mode!==`development`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`},o)}export{s as extractESBuildConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../plugin-utils/paths.cjs`);let e=require(`@stryke/path/replace`),t=require(`@stryke/type-checks/is-set-string`),n=require(`@stryke/
|
|
1
|
+
require(`../plugin-utils/paths.cjs`);let e=require(`@stryke/path/replace`),t=require(`@stryke/type-checks/is-set-string`),n=require(`@stryke/convert/to-array`),r=require(`@stryke/fs/is-file`),i=require(`@stryke/fs/list-files`),a=require(`@stryke/path/append`),o=require(`@stryke/path/join-paths`),s=require(`@stryke/type-checks/is-string`),c=require(`@stryke/convert/parse-type-definition`),l=require(`@stryke/helpers/get-unique`);require(`@stryke/hash/murmurhash`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../plugin-utils/paths.mjs";import{replacePath as e}from"@stryke/path/replace";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{
|
|
1
|
+
import"../plugin-utils/paths.mjs";import{replacePath as e}from"@stryke/path/replace";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{toArray as n}from"@stryke/convert/to-array";import"@stryke/fs/is-file";import{listFiles as r}from"@stryke/fs/list-files";import{appendPath as i}from"@stryke/path/append";import{joinPaths as a}from"@stryke/path/join-paths";import{isString as o}from"@stryke/type-checks/is-string";import{parseTypeDefinition as s}from"@stryke/convert/parse-type-definition";import{getUniqueBy as c}from"@stryke/helpers/get-unique";import"@stryke/hash/murmurhash";export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(
|
|
1
|
+
const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`chalk`);n=e.__toESM(n),require(`@storm-software/config-tools/logger`),require(`@storm-software/config-tools/utilities/colors`),require(`@stryke/helpers/noop`);let r=require(`@stryke/string-format/kebab-case`),i=require(`@stryke/string-format/title-case`);const a=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],o=(e,t)=>(r,...o)=>e(r,` ${n.default.inverse.hex(a[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%a.length]||a[0])(` ${(0,i.titleCase)(t)} `)} ${o.join(` `)} `);exports.extendLog=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LogLevelLabel as e}from"@storm-software/config-tools/types";import
|
|
1
|
+
import{LogLevelLabel as e}from"@storm-software/config-tools/types";import t from"chalk";import"@storm-software/config-tools/logger";import"@storm-software/config-tools/utilities/colors";import"@stryke/helpers/noop";import{kebabCase as n}from"@stryke/string-format/kebab-case";import{titleCase as r}from"@stryke/string-format/title-case";const i=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],a=(e,n)=>(a,...o)=>e(a,` ${t.inverse.hex(i[n.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%i.length]||i[0])(` ${r(n)} `)} ${o.join(` `)} `);export{a as extendLog};
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Reflection } from "../deepkit/src/types.cjs";
|
|
2
2
|
import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "../plugin-alloy/src/types/plugin.cjs";
|
|
3
|
-
import "../plugin-alloy/src/types/index.cjs";
|
|
4
3
|
import { AutoMDPluginOptions } from "../plugin-automd/src/types/plugin.cjs";
|
|
5
4
|
import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../plugin-babel/src/types/plugin.cjs";
|
|
6
5
|
import { EnvInterface, SecretsInterface } from "./runtime.cjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.13",
|
|
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": {
|
|
@@ -193,11 +193,11 @@
|
|
|
193
193
|
"@alloy-js/json": "^0.22.0",
|
|
194
194
|
"@babel/core": "^7.28.5",
|
|
195
195
|
"@babel/types": "^7.28.5",
|
|
196
|
-
"@powerlines/deepkit": "^0.5.
|
|
197
|
-
"@powerlines/plugin-alloy": "^0.15.
|
|
198
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
199
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
200
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
196
|
+
"@powerlines/deepkit": "^0.5.25",
|
|
197
|
+
"@powerlines/plugin-alloy": "^0.15.7",
|
|
198
|
+
"@powerlines/plugin-automd": "^0.1.110",
|
|
199
|
+
"@powerlines/plugin-babel": "^0.12.119",
|
|
200
|
+
"@powerlines/plugin-plugin": "^0.12.62",
|
|
201
201
|
"@storm-software/config-tools": "^1.188.74",
|
|
202
202
|
"@stryke/capnp": "^0.12.51",
|
|
203
203
|
"@stryke/env": "^0.20.43",
|
|
@@ -207,9 +207,9 @@
|
|
|
207
207
|
"@stryke/type-checks": "^0.5.14",
|
|
208
208
|
"@stryke/types": "^0.10.28",
|
|
209
209
|
"automd": "^0.4.2",
|
|
210
|
-
"powerlines": "^0.36.
|
|
210
|
+
"powerlines": "^0.36.15"
|
|
211
211
|
},
|
|
212
212
|
"devDependencies": { "@types/node": "^24.10.4", "vite": "8.0.0-beta.2" },
|
|
213
213
|
"publishConfig": { "access": "public" },
|
|
214
|
-
"gitHead": "
|
|
214
|
+
"gitHead": "7e415f360c9011a40e8ae2a0b8b7cc92ba94076f"
|
|
215
215
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=require(`@deepkit/core`);Object.keys(e).forEach(function(t){t!==`default`&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"@deepkit/core";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./output.cjs`);require(`./single-line-comment.cjs`),require(`./source-file.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Output as e}from"./output.mjs";import"./single-line-comment.mjs";import"./source-file.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createComponent as e,createIntrinsic as t}from"@alloy-js/core/jsx-runtime";import"@alloy-js/core";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@alloy-js/core`),r=require(`@stryke/path/append`),i=require(`defu`);i=e.__toESM(i);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createComponent as e,createIntrinsic as t}from"@alloy-js/core/jsx-runtime";import{Show as n,splitProps as r}from"@alloy-js/core";import{appendPath as i}from"@stryke/path/append";import a from"defu";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./context.cjs`);require(`./reflection.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{PowerlinesContext as e}from"./context.mjs";import"./reflection.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core`);const n=(0,t.createContext)(),r=(0,t.createNamedContext)(`reflection-property`),i=(0,t.createNamedContext)(`reflection-method`),a=(0,t.createNamedContext)(`reflection-parameter`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createContext as e,createNamedContext as t}from"@alloy-js/core";e(),t(`reflection-property`),t(`reflection-method`),t(`reflection-parameter`);export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./contexts/context.cjs`),t=require(`./components/output.cjs`);require(`./components/index.cjs`),require(`./contexts/index.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{PowerlinesContext as e}from"./contexts/context.mjs";import{Output as t}from"./components/output.mjs";import"./components/index.mjs";import"./contexts/index.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../../_virtual/rolldown_runtime.cjs`);require(`../../../deepkit/src/vendor/type.cjs`),require(`../../../deepkit/src/utilities.cjs`),require(`../../../deepkit/src/vendor/core.cjs`),require(`../../../powerlines/src/lib/utilities/file-header.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/helpers/get-unique`),r=require(`@stryke/type-checks/is-null`),i=require(`@stryke/type-checks/is-string`),a=require(`@stryke/type-checks/is-undefined`);require(`@stryke/capnp/compile`),require(`@stryke/capnp/helpers`);let o=require(`@stryke/convert/to-array`);require(`@stryke/json`);let s=require(`@stryke/path/join`),c=require(`@stryke/string-format/camel-case`);require(`@stryke/string-format/get-words`),require(`@stryke/string-format/pascal-case`);let l=require(`@stryke/string-format/title-case`);require(`@stryke/type-checks/is-bigint`),require(`@stryke/type-checks/is-number`);let u=require(`node:child_process`),d=require(`node:util`);const f=1024*1e6,p=(0,d.promisify)(u.exec);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../../deepkit/src/vendor/type.mjs";import"../../../deepkit/src/utilities.mjs";import"../../../deepkit/src/vendor/core.mjs";import"../../../powerlines/src/lib/utilities/file-header.mjs";import e from"defu";import{getUniqueBy as t}from"@stryke/helpers/get-unique";import{isNull as n}from"@stryke/type-checks/is-null";import{isString as r}from"@stryke/type-checks/is-string";import{isUndefined as i}from"@stryke/type-checks/is-undefined";import"@stryke/capnp/compile";import"@stryke/capnp/helpers";import{toArray as a}from"@stryke/convert/to-array";import"@stryke/json";import{joinPaths as o}from"@stryke/path/join";import{camelCase as s}from"@stryke/string-format/camel-case";import"@stryke/string-format/get-words";import"@stryke/string-format/pascal-case";import{titleCase as c}from"@stryke/string-format/title-case";import"@stryke/type-checks/is-bigint";import"@stryke/type-checks/is-number";import{exec as l}from"node:child_process";import{promisify as u}from"node:util";u(l);export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require(`@alloy-js/typescript`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"@alloy-js/typescript";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./capnp.cjs`),require(`./create-builtin.cjs`),require(`./refkey.cjs`),require(`./typescript.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./capnp.mjs";import"./create-builtin.mjs";import"./refkey.mjs";import"./typescript.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require(`@alloy-js/core`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"@alloy-js/core";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../deepkit/src/utilities.cjs`);let e=require(`@stryke/type-checks/is-undefined`),t=require(`@stryke/string-format/camel-case`),n=require(`@stryke/string-format/title-case`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../../deepkit/src/utilities.mjs";import{isUndefined as e}from"@stryke/type-checks/is-undefined";import{camelCase as t}from"@stryke/string-format/camel-case";import{titleCase as n}from"@stryke/string-format/title-case";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./markdown-file.cjs`),require(`./markdown-table.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./markdown-file.mjs";import"./markdown-table.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../core/contexts/context.cjs`),require(`../../core/components/single-line-comment.cjs`),require(`../../core/components/source-file.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/string-format/title-case`),r=require(`@alloy-js/markdown`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../core/contexts/context.mjs";import"../../core/components/single-line-comment.mjs";import"../../core/components/source-file.mjs";import{createComponent as e,createIntrinsic as t,mergeProps as n}from"@alloy-js/core/jsx-runtime";import{Show as r,code as i,splitProps as a}from"@alloy-js/core";import{titleCase as o}from"@stryke/string-format/title-case";import{Link as s}from"@alloy-js/markdown";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../contexts/markdown-table.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-undefined`),r=require(`@stryke/string-format/title-case`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../contexts/markdown-table.mjs";import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{Show as n,code as r,computed as i,splitProps as a}from"@alloy-js/core";import{isUndefined as o}from"@stryke/type-checks/is-undefined";import{titleCase as s}from"@stryke/string-format/title-case";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./markdown-table.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./markdown-table.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core`);const n=(0,t.createNamedContext)(`markdown-table-column`,{}),r=(0,t.createContext)({columns:[],data:[]});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createContext as e,createNamedContext as t}from"@alloy-js/core";t(`markdown-table-column`,{}),e({columns:[],data:[]});export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./components/index.cjs`),require(`./contexts/index.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./components/index.mjs";import"./contexts/index.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./tsdoc.cjs`),require(`./typescript-file.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./tsdoc.mjs";import"./typescript-file.mjs";import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{splitProps as n}from"@alloy-js/core";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@alloy-js/typescript`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{code as n}from"@alloy-js/core";import{VarDeclaration as r}from"@alloy-js/typescript";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);require(`../../core/contexts/context.cjs`),require(`./typescript-file.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@alloy-js/core`),r=require(`defu`);r=e.__toESM(r);let i=require(`@stryke/path/join-paths`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../core/contexts/context.mjs";import"./typescript-file.mjs";import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{computed as n,splitProps as r}from"@alloy-js/core";import i from"defu";import{joinPaths as a}from"@stryke/path/join-paths";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./tsdoc.cjs`),require(`./typescript-file.cjs`),require(`./builtin-file.cjs`),require(`./dynamic-import-statement.cjs`),require(`./entry-file.cjs`),require(`./record-expression.cjs`),require(`./tsdoc-reflection.cjs`),require(`./typescript-interface.cjs`),require(`./typescript-object.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./tsdoc.mjs";import"./typescript-file.mjs";import"./builtin-file.mjs";import"./dynamic-import-statement.mjs";import"./entry-file.mjs";import"./record-expression.mjs";import"./tsdoc-reflection.mjs";import"./typescript-interface.mjs";import"./typescript-object.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require(`@alloy-js/core`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{code as e}from"@alloy-js/core";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../core/contexts/reflection.cjs`),require(`./tsdoc.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/type-checks/is-string`),i=require(`@stryke/type-checks/is-undefined`),a=require(`@stryke/string-format/title-case`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../core/contexts/reflection.mjs";import"./tsdoc.mjs";import{createComponent as e,memo as t,mergeProps as n}from"@alloy-js/core/jsx-runtime";import{Show as r,code as i,computed as a,splitProps as o}from"@alloy-js/core";import{isSetString as s}from"@stryke/type-checks/is-set-string";import{isString as c}from"@stryke/type-checks/is-string";import{isUndefined as l}from"@stryke/type-checks/is-undefined";import{titleCase as u}from"@stryke/string-format/title-case";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../core/contexts/context.cjs`),require(`../../../../deepkit/src/utilities.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/type-checks/is-undefined`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../core/contexts/context.mjs";import"../../../../deepkit/src/utilities.mjs";import{createComponent as e,createIntrinsic as t,memo as n,mergeProps as r}from"@alloy-js/core/jsx-runtime";import{For as i,Show as a,splitProps as o}from"@alloy-js/core";import{isSetString as s}from"@stryke/type-checks/is-set-string";import{isUndefined as c}from"@stryke/type-checks/is-undefined";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../core/contexts/context.cjs`),require(`../../core/components/single-line-comment.cjs`),require(`../../core/components/source-file.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/path/append`),r=require(`@stryke/type-checks/is-string`),i=require(`@stryke/string-format/title-case`),a=require(`@alloy-js/typescript`);require(`@stryke/type-checks/is-boolean`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../core/contexts/context.mjs";import"../../core/components/single-line-comment.mjs";import"../../core/components/source-file.mjs";import{createComponent as e,createIntrinsic as t,memo as n,mergeProps as r}from"@alloy-js/core/jsx-runtime";import{Show as i,code as a,splitProps as o}from"@alloy-js/core";import{appendPath as s}from"@stryke/path/append";import{isString as c}from"@stryke/type-checks/is-string";import{titleCase as l}from"@stryke/string-format/title-case";import"@alloy-js/typescript";import"@stryke/type-checks/is-boolean";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../../../deepkit/src/vendor/type.cjs`),require(`../../core/contexts/reflection.cjs`),require(`./tsdoc-reflection.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-string`);require(`@stryke/string-format/pascal-case`);let r=require(`@alloy-js/typescript`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../../../deepkit/src/vendor/type.mjs";import"../../core/contexts/reflection.mjs";import"./tsdoc-reflection.mjs";import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{For as n,computed as r,splitProps as i}from"@alloy-js/core";import{isString as a}from"@stryke/type-checks/is-string";import"@stryke/string-format/pascal-case";import"@alloy-js/typescript";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`../../core/contexts/reflection.cjs`),require(`../../../../deepkit/src/utilities.cjs`),require(`./tsdoc-reflection.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-string`),r=require(`@stryke/type-checks/is-undefined`),i=require(`@stryke/string-format/camel-case`);require(`@stryke/string-format/pascal-case`);let a=require(`@alloy-js/typescript`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../core/contexts/reflection.mjs";import"../../../../deepkit/src/utilities.mjs";import"./tsdoc-reflection.mjs";import{createComponent as e,createIntrinsic as t,memo as n}from"@alloy-js/core/jsx-runtime";import{For as r,Show as i,computed as a,splitProps as o}from"@alloy-js/core";import{isString as s}from"@stryke/type-checks/is-string";import{isUndefined as c}from"@stryke/type-checks/is-undefined";import{camelCase as l}from"@stryke/string-format/camel-case";import"@stryke/string-format/pascal-case";import"@alloy-js/typescript";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./components/index.cjs`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./components/index.mjs";export{};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require(`@stryke/string-format/title-case`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{titleCase as e}from"@stryke/string-format/title-case";export{};
|