@powerlines/plugin-react 0.1.100 → 0.1.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/index.d.mts +1 -1
  2. package/dist/plugin-automd/src/index.cjs +1 -0
  3. package/dist/plugin-automd/src/index.mjs +1 -0
  4. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  5. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  6. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  7. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  8. package/dist/plugin-env/src/helpers/automd-generator.cjs +1 -0
  9. package/dist/plugin-env/src/helpers/automd-generator.mjs +1 -0
  10. package/dist/plugin-env/src/helpers/load.cjs +1 -1
  11. package/dist/plugin-env/src/helpers/load.mjs +1 -1
  12. package/dist/plugin-env/src/helpers/persistence.cjs +1 -1
  13. package/dist/plugin-env/src/helpers/persistence.mjs +1 -1
  14. package/dist/plugin-env/src/index.cjs +6 -12
  15. package/dist/plugin-env/src/index.mjs +6 -12
  16. package/dist/plugin-env/src/types/plugin.d.cts +8 -0
  17. package/dist/plugin-env/src/types/plugin.d.mts +8 -0
  18. package/dist/plugin-plugin/src/types/plugin.d.mts +1 -0
  19. package/dist/powerlines/schemas/fs.d.mts +1 -0
  20. package/dist/powerlines/src/api.d.mts +7 -0
  21. package/dist/powerlines/src/index.d.mts +12 -0
  22. package/dist/powerlines/src/lib/entry.cjs +1 -1
  23. package/dist/powerlines/src/lib/entry.mjs +1 -1
  24. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +1 -1
  25. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +1 -1
  26. package/dist/powerlines/src/types/build.d.mts +2 -0
  27. package/dist/powerlines/src/types/resolved.d.mts +1 -0
  28. package/dist/powerlines/src/types/unplugin.d.mts +1 -0
  29. package/package.json +8 -8
package/dist/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPlug
5
5
  import { ReactEnvInterface, __ΩReactEnvInterface } from "./types/runtime.mjs";
6
6
  import "./types/index.mjs";
7
7
  import { AlloyPluginBuilder, AlloyPluginOptions } from "./alloy/src/types/plugin.mjs";
8
- import "./powerlines/src/types/index.mjs";
8
+ import "./powerlines/src/index.mjs";
9
9
 
10
10
  //#region src/index.d.ts
11
11
  /**
@@ -0,0 +1 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/append`),n=require(`defu`);n=e.__toESM(n);let r=require(`@stryke/path/replace`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/fs/is-file`),o=require(`@stryke/fs/list-files`),s=require(`@stryke/path/is-type`),c=require(`@stryke/path/join-paths`),l=require(`automd`),u=require(`c12`),d=require(`markdown-toc`);d=e.__toESM(d);const f=(e={})=>({name:`automd`,async config(){let t=await(0,l.loadConfig)((0,c.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=(0,i.toArray)(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:(0,n.default)(t??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!(0,i.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,i.toArray)(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await(0,u.loadConfig)({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=(0,l.resolveConfig)((0,n.default)(this.config.automd,{...e,prefix:(0,i.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,o.listFiles)((0,s.isAbsolutePath)(e)?e:(0,t.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,s.isAbsolutePath)(e)?e:(0,t.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,s.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,t.appendPath)(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:(0,d.default)(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>{let n=await this.fs.read(e);if(n){let i=await(0,l.transform)(n,this.config.automd);if(i.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);i.hasChanged&&await this.fs.write((0,t.appendPath)(this.config.automd.output?(0,a.isDirectory)(this.config.automd.output)?(0,r.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),i.contents)}}))}});var p=f;exports.default=p;
@@ -0,0 +1 @@
1
+ import{appendPath as e}from"@stryke/path/append";import t from"defu";import{replacePath as n}from"@stryke/path/replace";import{toArray as r}from"@stryke/convert/to-array";import{isDirectory as i}from"@stryke/fs/is-file";import{listFiles as a}from"@stryke/fs/list-files";import{isAbsolutePath as o}from"@stryke/path/is-type";import{joinPaths as s}from"@stryke/path/join-paths";import{loadConfig as c,resolveConfig as l,transform as u}from"automd";import{loadConfig as d}from"c12";import f from"markdown-toc";var p=(p={})=>({name:`automd`,async config(){let e=await c(s(this.workspaceConfig.workspaceRoot,this.config.projectRoot),p);return(!e.prefix||!Array.isArray(e.prefix))&&(e.prefix=r(e.prefix??[])),e.prefix.includes(`automd`)||e.prefix.push(`automd`),e.prefix.includes(`powerlines`)||e.prefix.push(`powerlines`),{automd:t(e??{},{configFile:p.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!r(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=r(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await d({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=l(t(this.config.automd,{...e,prefix:r(e.prefix??[])}))}this.config.automd.input=(await Promise.all(r(this.config.automd.input).map(async t=>t.includes(`*`)?a(o(t)?t:e(t,this.config.projectRoot),{ignore:this.config.automd.ignore}):o(t)?t:e(t,this.config.projectRoot)))).flat(),this.config.automd.output&&!o(this.config.automd.output)&&(this.config.automd.output=e(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:f(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all(r(this.config.automd.input).map(async t=>{let r=await this.fs.read(t);if(r){let a=await u(r,this.config.automd);if(a.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${t}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);a.hasChanged&&await this.fs.write(e(this.config.automd.output?i(this.config.automd.output)?n(t,this.config.automd.output):this.config.automd.output:t,this.config.projectRoot),a.contents)}}))}});export{p as default};
@@ -0,0 +1,38 @@
1
+ import { TOCOptions } from "./toc.cjs";
2
+ import { Config } from "automd";
3
+
4
+ //#region ../plugin-automd/src/types/plugin.d.ts
5
+
6
+ type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
7
+ /**
8
+ * Path to the AutoMD configuration file.
9
+ *
10
+ * @remarks
11
+ * If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
12
+ */
13
+ configFile?: string;
14
+ /**
15
+ * An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
16
+ *
17
+ * @defaultValue true
18
+ */
19
+ allowIssues?: boolean;
20
+ /**
21
+ * Alternate prefix strings to use for finding generators
22
+ *
23
+ * @remarks
24
+ * By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
25
+ *
26
+ * @defaultValue ["automd", "powerlines", "\{framework\}"]
27
+ */
28
+ prefix?: string | string[];
29
+ /**
30
+ * Table of Contents generator options
31
+ *
32
+ * @remarks
33
+ * If set to `false`, the built-in Table of Contents generator will be disabled.
34
+ */
35
+ toc?: false | TOCOptions;
36
+ };
37
+ //#endregion
38
+ export { AutoMDPluginOptions };
@@ -0,0 +1,40 @@
1
+ import "../../../powerlines/src/types/context.mjs";
2
+ import "../../../powerlines/src/types/config.mjs";
3
+ import "../../../powerlines/src/types/resolved.mjs";
4
+ import { TOCOptions } from "./toc.mjs";
5
+ import { Config } from "automd";
6
+
7
+ //#region ../plugin-automd/src/types/plugin.d.ts
8
+ type AutoMDPluginOptions = Omit<Config, "dir" | "watch" | "onWatch" | "prefix"> & {
9
+ /**
10
+ * Path to the AutoMD configuration file.
11
+ *
12
+ * @remarks
13
+ * If not provided, the plugin will use the default AutoMD configuration resolution mechanism.
14
+ */
15
+ configFile?: string;
16
+ /**
17
+ * An indicator specifying whether or not issues found by AutoMD during the prepare task are considered fatal.
18
+ *
19
+ * @defaultValue true
20
+ */
21
+ allowIssues?: boolean;
22
+ /**
23
+ * Alternate prefix strings to use for finding generators
24
+ *
25
+ * @remarks
26
+ * By default, AutoMD looks for generators with the "automd" prefix, so that any `<!-- automd:generator [...args] --> ... <!-- /automd -->` comments will be picked up. If you want to use different prefixes (for example, to avoid conflicts with other tools), you would provide a value like "myPrefix" and AutoMD would also look for `<!-- myPrefix:generator [...args] --> ... <!-- /myPrefix -->` comments.
27
+ *
28
+ * @defaultValue ["automd", "powerlines", "\{framework\}"]
29
+ */
30
+ prefix?: string | string[];
31
+ /**
32
+ * Table of Contents generator options
33
+ *
34
+ * @remarks
35
+ * If set to `false`, the built-in Table of Contents generator will be disabled.
36
+ */
37
+ toc?: false | TOCOptions;
38
+ };
39
+ //#endregion
40
+ export { AutoMDPluginOptions };
@@ -0,0 +1,33 @@
1
+ //#region ../plugin-automd/src/types/toc.d.ts
2
+ interface TOCOptions {
3
+ /**
4
+ * A slugify function to generate slugs for the headings.
5
+ */
6
+ slugify?: (str: string) => string;
7
+ /**
8
+ * The maximum depth of headings to include in the TOC.
9
+ *
10
+ * @defaultValue 6
11
+ */
12
+ maxDepth?: number;
13
+ /**
14
+ * Whether to include the first H1 heading in the TOC.
15
+ */
16
+ firstH1?: boolean;
17
+ /**
18
+ * The bullet character to use for list items in the TOC.
19
+ *
20
+ * @defaultValue "-"
21
+ */
22
+ bullets?: string;
23
+ /**
24
+ * A prefix to add to each heading in the TOC.
25
+ */
26
+ prefix?: string;
27
+ /**
28
+ * A filter function to determine which headings to include in the TOC.
29
+ */
30
+ filter?: (str: string, level: number) => boolean;
31
+ }
32
+ //#endregion
33
+ export { TOCOptions };
@@ -0,0 +1,33 @@
1
+ //#region ../plugin-automd/src/types/toc.d.ts
2
+ interface TOCOptions {
3
+ /**
4
+ * A slugify function to generate slugs for the headings.
5
+ */
6
+ slugify?: (str: string) => string;
7
+ /**
8
+ * The maximum depth of headings to include in the TOC.
9
+ *
10
+ * @defaultValue 6
11
+ */
12
+ maxDepth?: number;
13
+ /**
14
+ * Whether to include the first H1 heading in the TOC.
15
+ */
16
+ firstH1?: boolean;
17
+ /**
18
+ * The bullet character to use for list items in the TOC.
19
+ *
20
+ * @defaultValue "-"
21
+ */
22
+ bullets?: string;
23
+ /**
24
+ * A prefix to add to each heading in the TOC.
25
+ */
26
+ prefix?: string;
27
+ /**
28
+ * A filter function to determine which headings to include in the TOC.
29
+ */
30
+ filter?: (str: string, level: number) => boolean;
31
+ }
32
+ //#endregion
33
+ export { TOCOptions };
@@ -0,0 +1 @@
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`automd`);const r=e=>(0,n.defineGenerator)({name:`env`,async generate(){let n=(0,t.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(n)?{contents:await e.fs.read(n)||``}:{contents:``}}});exports.env=r;
@@ -0,0 +1 @@
1
+ import{joinPaths as e}from"@stryke/path/join-paths";import{defineGenerator as t}from"automd";const n=n=>t({name:`env`,async generate(){let t=e(n.config.projectRoot,`docs`,`generated`,`env.md`);return n.fs.existsSync(t)?{contents:await n.fs.read(t)||``}:{contents:``}}});export{n as env};
@@ -1 +1 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`./source-file-env.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`defu`);r=e.__toESM(r);let i=require(`@stryke/type-checks/is-set-object`),a=require(`@stryke/path/join-paths`),o=require(`@stryke/env/load-env`),s=require(`@stryke/string-format/kebab-case`),c=require(`c12`);async function l(e,n,i){let a=await(0,o.loadEnv)(i,n);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(async e=>(0,o.loadEnvFile)(e,i)));for(let e of t)a=(0,r.default)(e,a)}return t.removeEnvPrefix(a)}async function u(e,t,n,i,o,s){let[u,d]=await Promise.all([l(e,n,t),(0,c.loadConfig)({cwd:t,name:`storm`,envName:n,defaults:{NAME:o.name?.replace(`@${s.namespace}/`,``),MODE:n,ORG:s.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:(0,a.joinPaths)(i,`jiti`),moduleCache:!0}})]);return(0,r.default)(u,d.config,s)}function d(e,t){return(0,r.default)({APP_NAME:(0,s.kebabCase)(e.config.name||e.packageJson.name?.replace(`/${e.workspaceConfig.namespace}`,``)),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${(0,s.kebabCase)(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:(0,n.isSetString)(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},(0,i.isSetObject)(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,n)=>(e[n.name]=t[n.name]??n.getDefaultValue(),e),{}):{})}async function f(e,t){let[n,i,a]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return(0,r.default)(d(e,process.env),n,i,a)}exports.loadEnv=f,exports.loadEnvFromContext=d;
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`./source-file-env.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`defu`);r=e.__toESM(r);let i=require(`@stryke/type-checks/is-set-object`),a=require(`@stryke/path/join-paths`),o=require(`c12`),s=require(`@stryke/env/load-env`),c=require(`@stryke/string-format/kebab-case`);async function l(e,n,i){let a=await(0,s.loadEnv)(i,n);if(e.additionalFiles&&e.additionalFiles?.length>0){let t=await Promise.all(e.additionalFiles.map(async e=>(0,s.loadEnvFile)(e,i)));for(let e of t)a=(0,r.default)(e,a)}return t.removeEnvPrefix(a)}async function u(e,t,n,i,s,c){let[u,d]=await Promise.all([l(e,n,t),(0,o.loadConfig)({cwd:t,name:`storm`,envName:n,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:n,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:(0,a.joinPaths)(i,`jiti`),moduleCache:!0}})]);return(0,r.default)(u,d.config,c)}function d(e,t){return(0,r.default)({APP_NAME:(0,c.kebabCase)(e.config.name||e.packageJson.name?.replace(`/${e.workspaceConfig.namespace}`,``)),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${(0,c.kebabCase)(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:(0,n.isSetString)(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},(0,i.isSetObject)(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,n)=>(e[n.name]=t[n.name]??n.getDefaultValue(),e),{}):{})}async function f(e,t){let[n,i,a]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return(0,r.default)(d(e,process.env),n,i,a)}exports.loadEnv=f,exports.loadEnvFromContext=d;
@@ -1 +1 @@
1
- import{removeEnvPrefix as e}from"./source-file-env.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import n from"defu";import{isSetObject as r}from"@stryke/type-checks/is-set-object";import{joinPaths as i}from"@stryke/path/join-paths";import{loadEnv as a,loadEnvFile as o}from"@stryke/env/load-env";import{kebabCase as s}from"@stryke/string-format/kebab-case";import{loadConfig as c}from"c12";async function l(t,r,i){let s=await a(i,r);if(t.additionalFiles&&t.additionalFiles?.length>0){let e=await Promise.all(t.additionalFiles.map(async e=>o(e,i)));for(let t of e)s=n(t,s)}return e(s)}async function u(e,t,r,a,o,s){let[u,d]=await Promise.all([l(e,r,t),c({cwd:t,name:`storm`,envName:r,defaults:{NAME:o.name?.replace(`@${s.namespace}/`,``),MODE:r,ORG:s.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:i(a,`jiti`),moduleCache:!0}})]);return n(u,d.config,s)}function d(e,i){return n({APP_NAME:s(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:`${s(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:t(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},r(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,t)=>(e[t.name]=i[t.name]??t.getDefaultValue(),e),{}):{})}async function f(e,t){let[r,i,a]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return n(d(e,process.env),r,i,a)}export{f as loadEnv,d as loadEnvFromContext};
1
+ import{removeEnvPrefix as e}from"./source-file-env.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import n from"defu";import{isSetObject as r}from"@stryke/type-checks/is-set-object";import{joinPaths as i}from"@stryke/path/join-paths";import{loadConfig as a}from"c12";import{loadEnv as o,loadEnvFile as s}from"@stryke/env/load-env";import{kebabCase as c}from"@stryke/string-format/kebab-case";async function l(t,r,i){let a=await o(i,r);if(t.additionalFiles&&t.additionalFiles?.length>0){let e=await Promise.all(t.additionalFiles.map(async e=>s(e,i)));for(let t of e)a=n(t,a)}return e(a)}async function u(e,t,r,o,s,c){let[u,d]=await Promise.all([l(e,r,t),a({cwd:t,name:`storm`,envName:r,defaults:{NAME:s.name?.replace(`@${c.namespace}/`,``),MODE:r,ORG:c.organization},globalRc:!0,packageJson:!0,dotenv:!0,jitiOptions:{fsCache:i(o,`jiti`),moduleCache:!0}})]);return n(u,d.config,c)}function d(e,i){return n({APP_NAME:c(e.config.name||e.packageJson.name?.replace(`/${e.workspaceConfig.namespace}`,``)),APP_VERSION:e.packageJson.version,BUILD_ID:e.meta.buildId,BUILD_TIMESTAMP:new Date(e.meta.timestamp).toISOString(),BUILD_CHECKSUM:e.meta.checksum,RELEASE_ID:e.meta.releaseId,RELEASE_TAG:`${c(e.config.name)}@${e.packageJson.version}`,DEFAULT_LOCALE:e.workspaceConfig.locale,DEFAULT_TIMEZONE:e.workspaceConfig.timezone,LOG_LEVEL:e.config.logLevel,ERROR_URL:e.workspaceConfig.error?.url,ORGANIZATION:t(e.workspaceConfig.organization)?e.workspaceConfig.organization:e.workspaceConfig.organization?.name,PLATFORM:e.config.build.platform,MODE:e.workspaceConfig.mode,DEBUG:e.workspaceConfig.mode===`development`,STACKTRACE:e.workspaceConfig.mode===`development`,ENVIRONMENT:e.environment},r(e?.env?.types?.env)?e.env.types.env?.getProperties().reduce((e,t)=>(e[t.name]=i[t.name]??t.getDefaultValue(),e),{}):{})}async function f(e,t){let[r,i,a]=await Promise.all([u(t,e.config.projectRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.workspaceConfig.workspaceRoot,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig),u(t,e.envPaths.config,e.config.mode,e.cachePath,e.packageJson,e.workspaceConfig)]);return n(d(e,process.env),r,i,a)}export{f as loadEnv,d as loadEnvFromContext};
@@ -1 +1 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../deepkit/src/vendor/type.cjs`),n=require(`../../../deepkit/src/capnp.cjs`),r=require(`../../../deepkit/schemas/reflection2.cjs`),i=require(`../../../deepkit/src/resolve-reflections.cjs`),a=require(`./reflect.cjs`);let o=require(`@stryke/capnp`);o=e.__toESM(o);let s=require(`@stryke/fs/buffer`),c=require(`node:fs`),l=require(`@stryke/path/join-paths`),u=require(`@stryke/fs/resolve`),d=require(`@stryke/type-checks/is-empty-object`);async function f(e){return(0,u.resolvePackage)(`@powerlines/plugin-env/types/runtime`,{paths:[e.workspaceConfig.workspaceRoot,(0,l.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot)]})}async function p(e){return{file:await f(e),name:`EnvInterface`}}async function m(e){return{file:await f(e),name:`SecretsInterface`}}function h(e,t=`env`){return(0,l.joinPaths)(i.getReflectionsPath(e),`env`,`${t}-types.bin`)}async function g(e,i=`env`){let l=h(e,i);if(!(0,c.existsSync)(l)){if(!e.env.types.env||(0,d.isEmptyObject)(e.env.types.env)){let t=a.createEnvReflection(e),n=new o.Message;t.messageRoot=n.initRoot(r.SerializedTypes),t.dataBuffer=n.toArrayBuffer(),e.env.types.env=t,await _(e,e.env.types.env,i)}return e.env.types.env}let u=await(0,s.readFileBuffer)(l),f=new o.Message(u,!1).getRoot(r.SerializedTypes),p=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(f.types)));return e.env.types[i]=p,e.env.types[i].messageRoot=f,e.env.types[i].dataBuffer=u,p}async function _(e,t,i=`env`){let a=t.serializeType(),c=new o.Message;n.convertToCapnp(a,c.initRoot(r.SerializedTypes)._initTypes(a.length)),await(0,s.writeFileBuffer)(h(e,i),c.toArrayBuffer())}function v(e,t){return(0,l.joinPaths)(i.getReflectionsPath(e),`env`,`${t}.bin`)}async function y(e){let i=v(e,`env`);if(!(0,c.existsSync)(i)){if(e.env.types.env||(e.env.types.env=await g(e,`env`)),!e.env.used.env||(0,d.isEmptyObject)(e.env.used.env)){let n=a.createEnvReflection(e,{type:{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.env});n.name=`Env`;let i=new o.Message;n.messageRoot=i.initRoot(r.SerializedTypes),n.dataBuffer=i.toArrayBuffer(),e.env.used.env=n,await x(e,e.env.used.env,`env`)}return e.env.used.env}let l=await(0,s.readFileBuffer)(i),u=new o.Message(l,!1).getRoot(r.SerializedTypes),f=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(u.types)));return e.env.used.env=f,e.env.used.env.messageRoot=u,e.env.used.env.dataBuffer=l,f}async function b(e){let i=v(e,`secrets`);if(!(0,c.existsSync)(i)){if(e.env.types.secrets||(e.env.types.secrets=await g(e,`secrets`)),!e.env.used.secrets||(0,d.isEmptyObject)(e.env.used.secrets)){let n=a.createEnvReflection(e,{type:{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.secrets});n.name=`Secrets`;let i=new o.Message;n.messageRoot=i.initRoot(r.SerializedTypes),n.dataBuffer=i.toArrayBuffer(),e.env.used.secrets=n,await x(e,e.env.used.secrets,`secrets`)}return e.env.used.secrets}let l=await(0,s.readFileBuffer)(i),u=new o.Message(l,!1).getRoot(r.SerializedTypes),f=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(u.types)));return e.env.used.secrets=f,e.env.used.secrets.messageRoot=u,e.env.used.secrets.dataBuffer=l,f}async function x(e,t,i=`env`){let a=t.serializeType(),c=new o.Message;n.convertToCapnp(a,c.initRoot(r.SerializedTypes)._initTypes(a.length)),await(0,s.writeFileBuffer)(v(e,i),c.toArrayBuffer())}exports.getEnvDefaultTypeDefinition=p,exports.getEnvReflectionsPath=v,exports.getEnvTypeReflectionsPath=h,exports.getSecretsDefaultTypeDefinition=m,exports.readEnvReflection=y,exports.readEnvTypeReflection=g,exports.readSecretsReflection=b,exports.resolveRuntimeTypeFile=f,exports.writeEnvReflection=x,exports.writeEnvTypeReflection=_;
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../deepkit/src/vendor/type.cjs`),n=require(`../../../deepkit/src/capnp.cjs`),r=require(`../../../deepkit/schemas/reflection2.cjs`),i=require(`../../../deepkit/src/resolve-reflections.cjs`),a=require(`./reflect.cjs`);let o=require(`@stryke/path/join-paths`),s=require(`@stryke/capnp`);s=e.__toESM(s);let c=require(`@stryke/fs/buffer`),l=require(`node:fs`),u=require(`@stryke/fs/resolve`),d=require(`@stryke/type-checks/is-empty-object`);async function f(e){return(0,u.resolvePackage)(`@powerlines/plugin-env/types/runtime`,{paths:[e.workspaceConfig.workspaceRoot,(0,o.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot)]})}async function p(e){return{file:await f(e),name:`EnvInterface`}}async function m(e){return{file:await f(e),name:`SecretsInterface`}}function h(e,t=`env`){return(0,o.joinPaths)(i.getReflectionsPath(e),`env`,`${t}-types.bin`)}async function g(e,i=`env`){let o=h(e,i);if(!(0,l.existsSync)(o)){if(!e.env.types.env||(0,d.isEmptyObject)(e.env.types.env)){let t=a.createEnvReflection(e),n=new s.Message;t.messageRoot=n.initRoot(r.SerializedTypes),t.dataBuffer=n.toArrayBuffer(),e.env.types.env=t,await _(e,e.env.types.env,i)}return e.env.types.env}let u=await(0,c.readFileBuffer)(o),f=new s.Message(u,!1).getRoot(r.SerializedTypes),p=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(f.types)));return e.env.types[i]=p,e.env.types[i].messageRoot=f,e.env.types[i].dataBuffer=u,p}async function _(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n.convertToCapnp(a,o.initRoot(r.SerializedTypes)._initTypes(a.length)),await(0,c.writeFileBuffer)(h(e,i),o.toArrayBuffer())}function v(e,t){return(0,o.joinPaths)(i.getReflectionsPath(e),`env`,`${t}.bin`)}async function y(e){let i=v(e,`env`);if(!(0,l.existsSync)(i)){if(e.env.types.env||(e.env.types.env=await g(e,`env`)),!e.env.used.env||(0,d.isEmptyObject)(e.env.used.env)){let n=a.createEnvReflection(e,{type:{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.env});n.name=`Env`;let i=new s.Message;n.messageRoot=i.initRoot(r.SerializedTypes),n.dataBuffer=i.toArrayBuffer(),e.env.used.env=n,await x(e,e.env.used.env,`env`)}return e.env.used.env}let o=await(0,c.readFileBuffer)(i),u=new s.Message(o,!1).getRoot(r.SerializedTypes),f=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(u.types)));return e.env.used.env=f,e.env.used.env.messageRoot=u,e.env.used.env.dataBuffer=o,f}async function b(e){let i=v(e,`secrets`);if(!(0,l.existsSync)(i)){if(e.env.types.secrets||(e.env.types.secrets=await g(e,`secrets`)),!e.env.used.secrets||(0,d.isEmptyObject)(e.env.used.secrets)){let n=a.createEnvReflection(e,{type:{kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:`application`}.`,types:[]},superReflection:e.env.types.secrets});n.name=`Secrets`;let i=new s.Message;n.messageRoot=i.initRoot(r.SerializedTypes),n.dataBuffer=i.toArrayBuffer(),e.env.used.secrets=n,await x(e,e.env.used.secrets,`secrets`)}return e.env.used.secrets}let o=await(0,c.readFileBuffer)(i),u=new s.Message(o,!1).getRoot(r.SerializedTypes),f=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(n.convertFromCapnp(u.types)));return e.env.used.secrets=f,e.env.used.secrets.messageRoot=u,e.env.used.secrets.dataBuffer=o,f}async function x(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n.convertToCapnp(a,o.initRoot(r.SerializedTypes)._initTypes(a.length)),await(0,c.writeFileBuffer)(v(e,i),o.toArrayBuffer())}exports.getEnvDefaultTypeDefinition=p,exports.getEnvReflectionsPath=v,exports.getEnvTypeReflectionsPath=h,exports.getSecretsDefaultTypeDefinition=m,exports.readEnvReflection=y,exports.readEnvTypeReflection=g,exports.readSecretsReflection=b,exports.resolveRuntimeTypeFile=f,exports.writeEnvReflection=x,exports.writeEnvTypeReflection=_;
@@ -1 +1 @@
1
- import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{convertFromCapnp as t,convertToCapnp as n}from"../../../deepkit/src/capnp.mjs";import{SerializedTypes as r}from"../../../deepkit/schemas/reflection2.mjs";import{getReflectionsPath as i}from"../../../deepkit/src/resolve-reflections.mjs";import{createEnvReflection as a}from"./reflect.mjs";import*as o from"@stryke/capnp";import{readFileBuffer as s,writeFileBuffer as c}from"@stryke/fs/buffer";import{existsSync as l}from"node:fs";import{joinPaths as u}from"@stryke/path/join-paths";import{resolvePackage as d}from"@stryke/fs/resolve";import{isEmptyObject as f}from"@stryke/type-checks/is-empty-object";async function p(e){return d(`@powerlines/plugin-env/types/runtime`,{paths:[e.workspaceConfig.workspaceRoot,u(e.workspaceConfig.workspaceRoot,e.config.projectRoot)]})}async function m(e){return{file:await p(e),name:`EnvInterface`}}async function h(e){return{file:await p(e),name:`SecretsInterface`}}function g(e,t=`env`){return u(i(e),`env`,`${t}-types.bin`)}async function _(n,i=`env`){let c=g(n,i);if(!l(c)){if(!n.env.types.env||f(n.env.types.env)){let e=a(n),t=new o.Message;e.messageRoot=t.initRoot(r),e.dataBuffer=t.toArrayBuffer(),n.env.types.env=e,await v(n,n.env.types.env,i)}return n.env.types.env}let u=await s(c),d=new o.Message(u,!1).getRoot(r),p=(0,e.resolveClassType)((0,e.deserializeType)(t(d.types)));return n.env.types[i]=p,n.env.types[i].messageRoot=d,n.env.types[i].dataBuffer=u,p}async function v(e,t,i=`env`){let a=t.serializeType(),s=new o.Message;n(a,s.initRoot(r)._initTypes(a.length)),await c(g(e,i),s.toArrayBuffer())}function y(e,t){return u(i(e),`env`,`${t}.bin`)}async function b(n){let i=y(n,`env`);if(!l(i)){if(n.env.types.env||(n.env.types.env=await _(n,`env`)),!n.env.used.env||f(n.env.used.env)){let t=a(n,{type:{kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${n.config.name?`${n.config.name} application`:`application`}.`,types:[]},superReflection:n.env.types.env});t.name=`Env`;let i=new o.Message;t.messageRoot=i.initRoot(r),t.dataBuffer=i.toArrayBuffer(),n.env.used.env=t,await S(n,n.env.used.env,`env`)}return n.env.used.env}let c=await s(i),u=new o.Message(c,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(u.types)));return n.env.used.env=d,n.env.used.env.messageRoot=u,n.env.used.env.dataBuffer=c,d}async function x(n){let i=y(n,`secrets`);if(!l(i)){if(n.env.types.secrets||(n.env.types.secrets=await _(n,`secrets`)),!n.env.used.secrets||f(n.env.used.secrets)){let t=a(n,{type:{kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${n.config.name?`${n.config.name} application`:`application`}.`,types:[]},superReflection:n.env.types.secrets});t.name=`Secrets`;let i=new o.Message;t.messageRoot=i.initRoot(r),t.dataBuffer=i.toArrayBuffer(),n.env.used.secrets=t,await S(n,n.env.used.secrets,`secrets`)}return n.env.used.secrets}let c=await s(i),u=new o.Message(c,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(u.types)));return n.env.used.secrets=d,n.env.used.secrets.messageRoot=u,n.env.used.secrets.dataBuffer=c,d}async function S(e,t,i=`env`){let a=t.serializeType(),s=new o.Message;n(a,s.initRoot(r)._initTypes(a.length)),await c(y(e,i),s.toArrayBuffer())}export{m as getEnvDefaultTypeDefinition,y as getEnvReflectionsPath,g as getEnvTypeReflectionsPath,h as getSecretsDefaultTypeDefinition,b as readEnvReflection,_ as readEnvTypeReflection,x as readSecretsReflection,p as resolveRuntimeTypeFile,S as writeEnvReflection,v as writeEnvTypeReflection};
1
+ import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{convertFromCapnp as t,convertToCapnp as n}from"../../../deepkit/src/capnp.mjs";import{SerializedTypes as r}from"../../../deepkit/schemas/reflection2.mjs";import{getReflectionsPath as i}from"../../../deepkit/src/resolve-reflections.mjs";import{createEnvReflection as a}from"./reflect.mjs";import{joinPaths as o}from"@stryke/path/join-paths";import*as s from"@stryke/capnp";import{readFileBuffer as c,writeFileBuffer as l}from"@stryke/fs/buffer";import{existsSync as u}from"node:fs";import{resolvePackage as d}from"@stryke/fs/resolve";import{isEmptyObject as f}from"@stryke/type-checks/is-empty-object";async function p(e){return d(`@powerlines/plugin-env/types/runtime`,{paths:[e.workspaceConfig.workspaceRoot,o(e.workspaceConfig.workspaceRoot,e.config.projectRoot)]})}async function m(e){return{file:await p(e),name:`EnvInterface`}}async function h(e){return{file:await p(e),name:`SecretsInterface`}}function g(e,t=`env`){return o(i(e),`env`,`${t}-types.bin`)}async function _(n,i=`env`){let o=g(n,i);if(!u(o)){if(!n.env.types.env||f(n.env.types.env)){let e=a(n),t=new s.Message;e.messageRoot=t.initRoot(r),e.dataBuffer=t.toArrayBuffer(),n.env.types.env=e,await v(n,n.env.types.env,i)}return n.env.types.env}let l=await c(o),d=new s.Message(l,!1).getRoot(r),p=(0,e.resolveClassType)((0,e.deserializeType)(t(d.types)));return n.env.types[i]=p,n.env.types[i].messageRoot=d,n.env.types[i].dataBuffer=l,p}async function v(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n(a,o.initRoot(r)._initTypes(a.length)),await l(g(e,i),o.toArrayBuffer())}function y(e,t){return o(i(e),`env`,`${t}.bin`)}async function b(n){let i=y(n,`env`);if(!u(i)){if(n.env.types.env||(n.env.types.env=await _(n,`env`)),!n.env.used.env||f(n.env.used.env)){let t=a(n,{type:{kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters that are used (at least once) by the ${n.config.name?`${n.config.name} application`:`application`}.`,types:[]},superReflection:n.env.types.env});t.name=`Env`;let i=new s.Message;t.messageRoot=i.initRoot(r),t.dataBuffer=i.toArrayBuffer(),n.env.used.env=t,await S(n,n.env.used.env,`env`)}return n.env.used.env}let o=await c(i),l=new s.Message(o,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(l.types)));return n.env.used.env=d,n.env.used.env.messageRoot=l,n.env.used.env.dataBuffer=o,d}async function x(n){let i=y(n,`secrets`);if(!u(i)){if(n.env.types.secrets||(n.env.types.secrets=await _(n,`secrets`)),!n.env.used.secrets||f(n.env.used.secrets)){let t=a(n,{type:{kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters that are used (at least once) by the ${n.config.name?`${n.config.name} application`:`application`}.`,types:[]},superReflection:n.env.types.secrets});t.name=`Secrets`;let i=new s.Message;t.messageRoot=i.initRoot(r),t.dataBuffer=i.toArrayBuffer(),n.env.used.secrets=t,await S(n,n.env.used.secrets,`secrets`)}return n.env.used.secrets}let o=await c(i),l=new s.Message(o,!1).getRoot(r),d=(0,e.resolveClassType)((0,e.deserializeType)(t(l.types)));return n.env.used.secrets=d,n.env.used.secrets.messageRoot=l,n.env.used.secrets.dataBuffer=o,d}async function S(e,t,i=`env`){let a=t.serializeType(),o=new s.Message;n(a,o.initRoot(r)._initTypes(a.length)),await l(y(e,i),o.toArrayBuffer())}export{m as getEnvDefaultTypeDefinition,y as getEnvReflectionsPath,g as getEnvTypeReflectionsPath,h as getSecretsDefaultTypeDefinition,b as readEnvReflection,_ as readEnvTypeReflection,x as readSecretsReflection,p as resolveRuntimeTypeFile,S as writeEnvReflection,v as writeEnvTypeReflection};
@@ -1,16 +1,10 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../deepkit/src/vendor/type.cjs`),n=require(`../../alloy/src/create-plugin.cjs`),r=require(`../../plugin-babel/src/index.cjs`),i=require(`./helpers/reflect.cjs`),a=require(`./helpers/persistence.cjs`),o=require(`./babel/plugin.cjs`),s=require(`./helpers/source-file-env.cjs`),c=require(`./helpers/load.cjs`),l=require(`./helpers/create-reflection-resource.cjs`),u=require(`./components/env.cjs`);require(`./babel/index.cjs`),require(`./components/index.cjs`),require(`./helpers/index.cjs`);let d=require(`@alloy-js/core/jsx-runtime`),f=require(`defu`);f=e.__toESM(f);let p=require(`@storm-software/config-tools/types`),m=require(`@stryke/path/is-parent-path`),h=require(`@stryke/convert/parse-type-definition`),g=require(`@stryke/convert/to-array`),_=require(`@stryke/env/types`),v=require(`@stryke/fs/exists`),y=require(`@stryke/fs/helpers`),b=require(`@stryke/path/join`),x=require(`@stryke/string-format/constant-case`);const S=n.createAlloyPlugin((e={})=>({name:`env`,dependsOn:[r.default(e.babel)],async config(){this.log(p.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,f.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[o.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,h.parseTypeDefinition)(t.env.types);else{this.log(p.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await a.getEnvDefaultTypeDefinition(this);t.env.types=(0,h.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,h.parseTypeDefinition)(t.env.secrets);else{let e=await a.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,h.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,g.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,x.constantCase)(t);return e.includes(n)||e.push(n),e},[..._.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(p.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,f.default)({parsed:await c.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,v.existsSync)(a.getEnvTypeReflectionsPath(this,`env`)))this.log(p.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await a.readEnvTypeReflection(this,`env`),(0,v.existsSync)(a.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await a.readEnvReflection(this)),(0,v.existsSync)(a.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await a.readEnvTypeReflection(this,`secrets`)),(0,v.existsSync)(a.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await a.readSecretsReflection(this));else{if(this.env.types.env=await i.reflectEnv(this,this.config.env.types?.file?(0,m.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,b.joinPaths)(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await a.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await i.reflectSecrets(this,this.config.env.secrets?.file?(0,m.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,b.joinPaths)(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await a.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.log(p.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 c.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 a.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await a.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 a.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},render(){let e=this;return this.log(p.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),(0,d.createComponent)(u.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(p.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=(0,b.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,v.existsSync)(e)||await(0,y.createDirectory)(e);let n=await a.readEnvTypeReflection(this,`env`),r=(0,b.joinPaths)(e,`env.md`);this.log(p.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by Powerlines -->
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../deepkit/src/vendor/type.cjs`),n=require(`../../alloy/src/create-plugin.cjs`),r=require(`../../plugin-babel/src/index.cjs`),i=require(`../../plugin-automd/src/index.cjs`),a=require(`./helpers/reflect.cjs`),o=require(`./helpers/persistence.cjs`),s=require(`./babel/plugin.cjs`),c=require(`./helpers/source-file-env.cjs`),l=require(`./helpers/load.cjs`),u=require(`./helpers/create-reflection-resource.cjs`),d=require(`./components/env.cjs`),f=require(`./helpers/automd-generator.cjs`);require(`./babel/index.cjs`),require(`./components/index.cjs`),require(`./helpers/index.cjs`);let p=require(`@alloy-js/core/jsx-runtime`),m=require(`@stryke/string-format/title-case`),h=require(`defu`);h=e.__toESM(h);let g=require(`@storm-software/config-tools/types`),_=require(`@stryke/path/is-parent-path`),v=require(`@stryke/convert/to-array`),y=require(`@stryke/convert/parse-type-definition`),b=require(`@stryke/env/types`),x=require(`@stryke/fs/exists`),S=require(`@stryke/fs/helpers`),C=require(`@stryke/path/join`),w=require(`@stryke/string-format/constant-case`);const T=n.createAlloyPlugin((e={})=>({name:`env`,async config(){this.log(g.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,h.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[s.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,y.parseTypeDefinition)(t.env.types);else{this.log(g.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await o.getEnvDefaultTypeDefinition(this);t.env.types=(0,y.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,y.parseTypeDefinition)(t.env.secrets);else{let e=await o.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,y.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,v.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,w.constantCase)(t);return e.includes(n)||e.push(n),e},[...b.ENV_PREFIXES,`POWERLINES_`]),t.env.prefix=t.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),t},async configResolved(){if(this.log(g.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,h.default)({parsed:await l.loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&(0,x.existsSync)(o.getEnvTypeReflectionsPath(this,`env`)))this.log(g.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await o.readEnvTypeReflection(this,`env`),(0,x.existsSync)(o.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await o.readEnvReflection(this)),(0,x.existsSync)(o.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await o.readEnvTypeReflection(this,`secrets`)),(0,x.existsSync)(o.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await o.readSecretsReflection(this));else{if(this.env.types.env=await a.reflectEnv(this,this.config.env.types?.file?(0,_.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,C.joinPaths)(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await o.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await a.reflectSecrets(this,this.config.env.secrets?.file?(0,_.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,C.joinPaths)(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.log(g.LogLevelLabel.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let e=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await l.loadEnv(this,this.config.env)).forEach(([t,n])=>{let r=this.config.env.prefix.reduce((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,t),i=e.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)}),this.env.used.env=new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await o.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await o.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},render(){let e=this;return this.log(g.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),(0,p.createComponent)(d.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(g.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=(0,C.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,x.existsSync)(e)||await(0,S.createDirectory)(e);let n=await o.readEnvTypeReflection(this,`env`),r=(0,C.joinPaths)(e,`env.md`);this.log(g.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,m.titleCase)(this.config.framework)||`Powerlines`} -->
2
2
 
3
- # Environment variables configuration
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
 
5
- 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.
6
-
7
- ## Environment Configuration
8
-
9
- 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.
10
-
11
- | Name | Description | Type | Default Value | Required |
12
- | ---- | ----------- | ---- | ------------- | :------: |
13
- ${n.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>`| ${e.getNameAsString().trim()} | ${(e.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
5
+ | Name | Description | Type | Default Value | Required |
6
+ | ---- | ----------- | ---- | ------------- | :------: |
7
+ ${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>`| ${e.getNameAsString().trim()} | ${(e.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
14
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(`
15
9
  `)}
16
- `)},async buildEnd(){let e=a.getEnvReflectionsPath(this,`env`);this.log(p.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await a.writeEnvReflection(this,this.env.used.env,`env`)}}));var C=S;exports.default=C;
10
+ `)},async buildEnd(){let e=o.getEnvReflectionsPath(this,`env`);this.log(g.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await o.writeEnvReflection(this,this.env.used.env,`env`)}})),E=(e={})=>[r.default(e.babel),T(e),{name:`env:automd-generator`,config(){return{automd:(0,h.default)(e.automd??{},{generators:{env:f.env(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},i.default(e.automd)];var D=E;exports.default=D;
@@ -1,16 +1,10 @@
1
- import{type_exports as e}from"../../deepkit/src/vendor/type.mjs";import{createAlloyPlugin as t}from"../../alloy/src/create-plugin.mjs";import n from"../../plugin-babel/src/index.mjs";import{BaseEnv as r,BaseSecrets as i,createEnvReflection as a,createSecretsReflection as o,mergeEnvReflections as s,mergeSecretsReflections as c,reflectEnv as l,reflectSecrets as u}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as d,getEnvReflectionsPath as f,getEnvTypeReflectionsPath as p,getSecretsDefaultTypeDefinition as m,readEnvReflection as h,readEnvTypeReflection as g,readSecretsReflection as _,resolveRuntimeTypeFile as v,writeEnvReflection as y,writeEnvTypeReflection as b}from"./helpers/persistence.mjs";import{envBabelPlugin as x}from"./babel/plugin.mjs";import{removeEnvPrefix as S}from"./helpers/source-file-env.mjs";import{loadEnv as C,loadEnvFromContext as w}from"./helpers/load.mjs";import{createReflectionResource as T}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as E,EnvTypeDefinition as D}from"./components/env.mjs";import"./babel/index.mjs";import"./components/index.mjs";import"./helpers/index.mjs";import{createComponent as O}from"@alloy-js/core/jsx-runtime";import k from"defu";import{LogLevelLabel as A}from"@storm-software/config-tools/types";import{isParentPath as j}from"@stryke/path/is-parent-path";import{parseTypeDefinition as M}from"@stryke/convert/parse-type-definition";import{toArray as N}from"@stryke/convert/to-array";import{ENV_PREFIXES as P}from"@stryke/env/types";import{existsSync as F}from"@stryke/fs/exists";import{createDirectory as I}from"@stryke/fs/helpers";import{joinPaths as L}from"@stryke/path/join";import{constantCase as R}from"@stryke/string-format/constant-case";var z=t((t={})=>({name:`env`,dependsOn:[n(t.babel)],async config(){this.log(A.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:k(t,{types:{},prefix:[]}),transform:{babel:{plugins:[x]}}};if(e.env.types)e.env.types=M(e.env.types);else{this.log(A.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await d(this);e.env.types=M(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=M(e.env.secrets);else{let t=await m(this);e.env.secrets=M(`${t.file}#${t.name}`)}return e.env.prefix=N(e.env.prefix??[]).reduce((e,t)=>{let n=R(t);return e.includes(n)||e.push(n),e},[...P,`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(A.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=k({parsed:await C(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&F(p(this,`env`)))this.log(A.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await g(this,`env`),F(f(this,`env`))&&(this.env.used.env=await h(this)),F(p(this,`secrets`))&&(this.env.types.secrets=await g(this,`secrets`)),F(f(this,`secrets`))&&(this.env.used.secrets=await _(this));else{if(this.env.types.env=await l(this,this.config.env.types?.file?j(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:L(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 b(this,this.env.types.env,`env`),this.env.types.secrets=await u(this,this.config.env.secrets?.file?j(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:L(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 b(this,this.env.types.secrets,`secrets`),this.log(A.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 C(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 y(this,this.env.used.env,`env`),this.env.types.secrets&&(await b(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 y(this,this.env.used.secrets,`secrets`))}},render(){let e=this;return this.log(A.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),O(E,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(A.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=L(this.config.projectRoot,`docs`,`generated`);F(t)||await I(t);let n=await g(this,`env`),r=L(t,`env.md`);this.log(A.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by Powerlines -->
1
+ import{type_exports as e}from"../../deepkit/src/vendor/type.mjs";import{createAlloyPlugin as t}from"../../alloy/src/create-plugin.mjs";import n from"../../plugin-babel/src/index.mjs";import r from"../../plugin-automd/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,writeEnvTypeReflection as x}from"./helpers/persistence.mjs";import{envBabelPlugin as S}from"./babel/plugin.mjs";import{removeEnvPrefix as C}from"./helpers/source-file-env.mjs";import{loadEnv as w,loadEnvFromContext as T}from"./helpers/load.mjs";import{createReflectionResource as E}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as D,EnvTypeDefinition as O}from"./components/env.mjs";import{env as k}from"./helpers/automd-generator.mjs";import"./babel/index.mjs";import"./components/index.mjs";import"./helpers/index.mjs";import{createComponent as A}from"@alloy-js/core/jsx-runtime";import{titleCase as j}from"@stryke/string-format/title-case";import M from"defu";import{LogLevelLabel as N}from"@storm-software/config-tools/types";import{isParentPath as P}from"@stryke/path/is-parent-path";import{toArray as F}from"@stryke/convert/to-array";import{parseTypeDefinition as I}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as L}from"@stryke/env/types";import{existsSync as R}from"@stryke/fs/exists";import{createDirectory as z}from"@stryke/fs/helpers";import{joinPaths as B}from"@stryke/path/join";import{constantCase as V}from"@stryke/string-format/constant-case";const H=t((t={})=>({name:`env`,async config(){this.log(N.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:M(t,{types:{},prefix:[]}),transform:{babel:{plugins:[S]}}};if(e.env.types)e.env.types=I(e.env.types);else{this.log(N.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await f(this);e.env.types=I(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=I(e.env.secrets);else{let t=await h(this);e.env.secrets=I(`${t.file}#${t.name}`)}return e.env.prefix=F(e.env.prefix??[]).reduce((e,t)=>{let n=V(t);return e.includes(n)||e.push(n),e},[...L,`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(N.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=M({parsed:await w(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&R(m(this,`env`)))this.log(N.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await _(this,`env`),R(p(this,`env`))&&(this.env.used.env=await g(this)),R(m(this,`secrets`))&&(this.env.types.secrets=await _(this,`secrets`)),R(p(this,`secrets`))&&(this.env.used.secrets=await v(this));else{if(this.env.types.env=await u(this,this.config.env.types?.file?P(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:B(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 x(this,this.env.types.env,`env`),this.env.types.secrets=await d(this,this.config.env.secrets?.file?P(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:B(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 x(this,this.env.types.secrets,`secrets`),this.log(N.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 w(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 x(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`))}},render(){let e=this;return this.log(N.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),A(D,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(N.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=B(this.config.projectRoot,`docs`,`generated`);R(t)||await z(t);let n=await _(this,`env`),r=B(t,`env.md`);this.log(N.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${j(this.config.framework)||`Powerlines`} -->
2
2
 
3
- # Environment variables configuration
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
 
5
- 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.
6
-
7
- ## Environment Configuration
8
-
9
- 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.
10
-
11
- | Name | Description | Type | Default Value | Required |
12
- | ---- | ----------- | ---- | ------------- | :------: |
13
- ${n.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
5
+ | Name | Description | Type | Default Value | Required |
6
+ | ---- | ----------- | ---- | ------------- | :------: |
7
+ ${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
14
8
  `,``)??``).trim()} | ${(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `)} | ${t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``} | ${t.isValueRequired()?``:`✔`} |`).join(`
15
9
  `)}
16
- `)},async buildEnd(){let e=f(this,`env`);this.log(A.TRACE,`Writing env reflection types to ${e}.`),await y(this,this.env.used.env,`env`)}}));export{z as default};
10
+ `)},async buildEnd(){let e=p(this,`env`);this.log(N.TRACE,`Writing env reflection types to ${e}.`),await b(this,this.env.used.env,`env`)}}));var U=(e={})=>[n(e.babel),H(e),{name:`env:automd-generator`,config(){return{automd:M(e.automd??{},{generators:{env:k(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},r(e.automd)];export{U as default};
@@ -1,5 +1,6 @@
1
1
  import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../../../plugin-babel/src/types/plugin.cjs";
2
2
  import { Reflection } from "../../../deepkit/src/types.cjs";
3
+ import { AutoMDPluginOptions } from "../../../plugin-automd/src/types/plugin.cjs";
3
4
  import { EnvInterface, SecretsInterface } from "./runtime.cjs";
4
5
  import { Children } from "@alloy-js/core/jsx-runtime";
5
6
  import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
@@ -45,6 +46,13 @@ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
45
46
  * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
46
47
  */
47
48
  babel?: BabelPluginOptions;
49
+ /**
50
+ * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.
51
+ *
52
+ * @remarks
53
+ * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.
54
+ */
55
+ automd?: AutoMDPluginOptions;
48
56
  };
49
57
  type EnvPluginUserConfig = BabelPluginUserConfig & {
50
58
  env: EnvPluginOptions;
@@ -1,5 +1,6 @@
1
1
  import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../../../plugin-babel/src/types/plugin.mjs";
2
2
  import { Reflection } from "../../../deepkit/src/types.mjs";
3
+ import { AutoMDPluginOptions } from "../../../plugin-automd/src/types/plugin.mjs";
3
4
  import "../../../plugin-babel/src/types/index.mjs";
4
5
  import { EnvInterface, SecretsInterface } from "./runtime.mjs";
5
6
  import { Children } from "@alloy-js/core/jsx-runtime";
@@ -46,6 +47,13 @@ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
46
47
  * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
47
48
  */
48
49
  babel?: BabelPluginOptions;
50
+ /**
51
+ * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.
52
+ *
53
+ * @remarks
54
+ * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.
55
+ */
56
+ automd?: AutoMDPluginOptions;
49
57
  };
50
58
  type EnvPluginUserConfig = BabelPluginUserConfig & {
51
59
  env: EnvPluginOptions;
@@ -1,3 +1,4 @@
1
+ import "../../../powerlines/src/types/build.mjs";
1
2
  import "../../../powerlines/src/types/context.mjs";
2
3
  import "../../../powerlines/src/types/config.mjs";
3
4
  import "../../../powerlines/src/types/resolved.mjs";
@@ -0,0 +1 @@
1
+ import "@stryke/capnp";
@@ -0,0 +1,7 @@
1
+ import "./types/hooks.mjs";
2
+ import "./types/context.mjs";
3
+ import "./types/config.mjs";
4
+ import "./types/resolved.mjs";
5
+ import "./internal/helpers/hooks.mjs";
6
+ import "./types/api.mjs";
7
+ import "./types/index.mjs";
@@ -0,0 +1,12 @@
1
+ import { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileMetadata, VirtualFileSystemInterface, WriteOptions } from "./types/fs.mjs";
2
+ import { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant } from "./types/build.mjs";
3
+ import { CommandType, SUPPORTED_COMMANDS } from "./types/commands.mjs";
4
+ import { BasePluginHookFunctions, BuildPlugin, ConfigResult, Plugin, PluginBuildPlugins, PluginHook, PluginHookObject, PluginHooks, TypesResult } from "./types/plugin.mjs";
5
+ import { DeepkitOptions, ParsedTypeScriptConfig, RawReflectionMode, ReflectionLevel, ReflectionMode, TSCompilerOptions, TSConfig } from "./types/tsconfig.mjs";
6
+ import { BuildPluginContext, Context, EmitEntryOptions, FetchOptions, InitContextOptions, LogLevel, MetaInfo, ParseOptions, PluginContext, Resolver, TransformResult, UnresolvedContext } from "./types/context.mjs";
7
+ import { BabelPluginPass, BabelTransformPlugin, BabelTransformPluginFilter, BabelTransformPluginOptions } from "./types/babel.mjs";
8
+ import { BabelUserConfig, BaseConfig, CommonUserConfig, DeployConfig, EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, ProjectType, UserConfig, WorkspaceConfig } from "./types/config.mjs";
9
+ import { BabelResolvedConfig, EnvironmentResolvedConfig, OutputResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition } from "./types/resolved.mjs";
10
+ import "./types/index.mjs";
11
+ import "./api.mjs";
12
+ import "../schemas/fs.mjs";
@@ -1 +1 @@
1
- require(`../plugin-utils/paths.cjs`);let e=require(`@stryke/helpers/get-unique`),t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/path/append`),i=require(`@stryke/path/replace`),a=require(`@stryke/convert/parse-type-definition`),o=require(`@stryke/convert/to-array`),s=require(`@stryke/path/join-paths`);require(`@stryke/fs/is-file`),require(`@stryke/fs/list-files`),require(`@stryke/hash/murmurhash`);
1
+ require(`../plugin-utils/paths.cjs`);let e=require(`@stryke/helpers/get-unique`),t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/path/append`),i=require(`@stryke/path/replace`),a=require(`@stryke/convert/to-array`),o=require(`@stryke/fs/is-file`),s=require(`@stryke/fs/list-files`),c=require(`@stryke/path/join-paths`),l=require(`@stryke/convert/parse-type-definition`);require(`@stryke/hash/murmurhash`);
@@ -1 +1 @@
1
- import"../plugin-utils/paths.mjs";import{getUniqueBy as e}from"@stryke/helpers/get-unique";import{isString as t}from"@stryke/type-checks/is-string";import{isSetString as n}from"@stryke/type-checks/is-set-string";import{appendPath as r}from"@stryke/path/append";import{replacePath as i}from"@stryke/path/replace";import{parseTypeDefinition as a}from"@stryke/convert/parse-type-definition";import{toArray as o}from"@stryke/convert/to-array";import{joinPaths as s}from"@stryke/path/join-paths";import"@stryke/fs/is-file";import"@stryke/fs/list-files";import"@stryke/hash/murmurhash";export{};
1
+ import"../plugin-utils/paths.mjs";import{getUniqueBy as e}from"@stryke/helpers/get-unique";import{isString as t}from"@stryke/type-checks/is-string";import{isSetString as n}from"@stryke/type-checks/is-set-string";import{appendPath as r}from"@stryke/path/append";import{replacePath as i}from"@stryke/path/replace";import{toArray as a}from"@stryke/convert/to-array";import"@stryke/fs/is-file";import{listFiles as o}from"@stryke/fs/list-files";import{joinPaths as s}from"@stryke/path/join-paths";import{parseTypeDefinition as c}from"@stryke/convert/parse-type-definition";import"@stryke/hash/murmurhash";export{};
@@ -1 +1 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/append`),n=require(`defu`);n=e.__toESM(n);let r=require(`@stryke/fs/exists`),i=require(`@stryke/path/join-paths`),a=require(`typescript`);a=e.__toESM(a),require(`@stryke/fs/json`);function o(e,t,n=[`.ts`,`.tsx`,`.d.ts`]){return t.find(t=>e?.toString().toLowerCase()===t?.toString().toLowerCase()||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}`||`./${e?.toString().toLowerCase()}`===t?.toString().toLowerCase()||n.some(n=>`${e?.toString().toLowerCase()}${n}`===t?.toString().toLowerCase()||`${e?.toString().toLowerCase()}${n}`==`./${t?.toString().toLowerCase()}`||`${t?.toString().toLowerCase()}${n}`==`./${e?.toString().toLowerCase()}`||e?.toString().toLowerCase()===`${t?.toString().toLowerCase()}${n}`||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}${n}`||t?.toString().toLowerCase()===`./${e?.toString().toLowerCase()}${n}`))}function s(e,t){return o(e,t)!==void 0}exports.isMatchFound=s;
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/append`),n=require(`defu`);n=e.__toESM(n);let r=require(`@stryke/path/join-paths`),i=require(`@stryke/fs/exists`),a=require(`typescript`);a=e.__toESM(a),require(`@stryke/fs/json`);function o(e,t,n=[`.ts`,`.tsx`,`.d.ts`]){return t.find(t=>e?.toString().toLowerCase()===t?.toString().toLowerCase()||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}`||`./${e?.toString().toLowerCase()}`===t?.toString().toLowerCase()||n.some(n=>`${e?.toString().toLowerCase()}${n}`===t?.toString().toLowerCase()||`${e?.toString().toLowerCase()}${n}`==`./${t?.toString().toLowerCase()}`||`${t?.toString().toLowerCase()}${n}`==`./${e?.toString().toLowerCase()}`||e?.toString().toLowerCase()===`${t?.toString().toLowerCase()}${n}`||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}${n}`||t?.toString().toLowerCase()===`./${e?.toString().toLowerCase()}${n}`))}function s(e,t){return o(e,t)!==void 0}exports.isMatchFound=s;
@@ -1 +1 @@
1
- import{appendPath as e}from"@stryke/path/append";import t from"defu";import{existsSync as n}from"@stryke/fs/exists";import{joinPaths as r}from"@stryke/path/join-paths";import i from"typescript";import"@stryke/fs/json";function a(e,t,n=[`.ts`,`.tsx`,`.d.ts`]){return t.find(t=>e?.toString().toLowerCase()===t?.toString().toLowerCase()||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}`||`./${e?.toString().toLowerCase()}`===t?.toString().toLowerCase()||n.some(n=>`${e?.toString().toLowerCase()}${n}`===t?.toString().toLowerCase()||`${e?.toString().toLowerCase()}${n}`==`./${t?.toString().toLowerCase()}`||`${t?.toString().toLowerCase()}${n}`==`./${e?.toString().toLowerCase()}`||e?.toString().toLowerCase()===`${t?.toString().toLowerCase()}${n}`||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}${n}`||t?.toString().toLowerCase()===`./${e?.toString().toLowerCase()}${n}`))}function o(e,t){return a(e,t)!==void 0}export{o as isMatchFound};
1
+ import{appendPath as e}from"@stryke/path/append";import t from"defu";import{joinPaths as n}from"@stryke/path/join-paths";import{existsSync as r}from"@stryke/fs/exists";import i from"typescript";import"@stryke/fs/json";function a(e,t,n=[`.ts`,`.tsx`,`.d.ts`]){return t.find(t=>e?.toString().toLowerCase()===t?.toString().toLowerCase()||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}`||`./${e?.toString().toLowerCase()}`===t?.toString().toLowerCase()||n.some(n=>`${e?.toString().toLowerCase()}${n}`===t?.toString().toLowerCase()||`${e?.toString().toLowerCase()}${n}`==`./${t?.toString().toLowerCase()}`||`${t?.toString().toLowerCase()}${n}`==`./${e?.toString().toLowerCase()}`||e?.toString().toLowerCase()===`${t?.toString().toLowerCase()}${n}`||e?.toString().toLowerCase()===`./${t?.toString().toLowerCase()}${n}`||t?.toString().toLowerCase()===`./${e?.toString().toLowerCase()}${n}`))}function o(e,t){return a(e,t)!==void 0}export{o as isMatchFound};
@@ -1,3 +1,5 @@
1
+ import "esbuild";
2
+
1
3
  //#region ../powerlines/src/types/build.d.ts
2
4
 
3
5
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
@@ -1,3 +1,4 @@
1
+ import "./build.mjs";
1
2
  import { BabelUserConfig, EnvironmentConfig, InlineConfig, OutputConfig, UserConfig } from "./config.mjs";
2
3
  import { NonUndefined } from "@stryke/types/base";
3
4
  import { AssetGlob } from "@stryke/types/file";
@@ -1,3 +1,4 @@
1
+ import "./build.mjs";
1
2
  import "./plugin.mjs";
2
3
  import "./context.mjs";
3
4
  import "./config.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-react",
3
- "version": "0.1.100",
3
+ "version": "0.1.101",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for building a React application.",
6
6
  "repository": {
@@ -142,16 +142,16 @@
142
142
  "@stryke/fs": "^0.33.26",
143
143
  "@stryke/path": "^0.24.0",
144
144
  "babel-plugin-react-compiler": "^1.0.0",
145
- "@powerlines/alloy": "^0.12.0",
146
- "@powerlines/plugin-babel": "^0.12.106",
147
- "@powerlines/plugin-env": "^0.13.106",
148
- "@powerlines/plugin-plugin": "^0.12.49",
145
+ "@powerlines/alloy": "^0.12.1",
146
+ "@powerlines/plugin-babel": "^0.12.107",
147
+ "@powerlines/plugin-env": "^0.14.0",
148
+ "@powerlines/plugin-plugin": "^0.12.50",
149
149
  "@vitejs/plugin-react": "^5.1.2",
150
150
  "defu": "^6.1.4",
151
- "powerlines": "^0.36.2"
151
+ "powerlines": "^0.36.3"
152
152
  },
153
153
  "devDependencies": {
154
- "@powerlines/nx": "^0.11.28",
154
+ "@powerlines/nx": "^0.11.29",
155
155
  "@types/node": "^24.10.4",
156
156
  "@types/react": "^19.2.7",
157
157
  "@types/react-dom": "^19.2.3",
@@ -159,5 +159,5 @@
159
159
  "react-dom": "^19.2.3"
160
160
  },
161
161
  "publishConfig": { "access": "public" },
162
- "gitHead": "916e24a276b03bbc9d64349bf85f37ffb43d5e87"
162
+ "gitHead": "0d695fa64043ba14e7c7ae8759e9e0cf5b2a6b38"
163
163
  }