@powerlines/plugin-env 0.13.44 → 0.13.45
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/index.d.cts +1 -1
- package/dist/babel/index.d.ts +1 -1
- package/dist/babel/plugin.d.cts +1 -1
- package/dist/babel/plugin.d.ts +1 -1
- package/dist/helpers/index.d.cts +1 -1
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers/load.d.cts +1 -1
- package/dist/helpers/load.d.ts +1 -1
- package/dist/helpers/persistence.d.cts +1 -1
- package/dist/helpers/persistence.d.ts +1 -1
- package/dist/helpers/reflect.d.cts +1 -1
- package/dist/helpers/reflect.d.ts +1 -1
- package/dist/helpers/template-helpers.d.cts +1 -1
- package/dist/helpers/template-helpers.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{runtime-hZecACc-.d.ts → runtime-CFbD4kZ8.d.ts} +2 -2
- package/dist/{runtime-BSNiU6jN.d.cts → runtime-CsXZ1vfV.d.cts} +2 -2
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugin.d.cts +1 -1
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/runtime.d.cts +1 -1
- package/dist/types/runtime.d.ts +1 -1
- package/package.json +9 -9
package/dist/babel/index.d.cts
CHANGED
package/dist/babel/index.d.ts
CHANGED
package/dist/babel/plugin.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeclareBabelTransformPluginReturn } from '../runtime-
|
|
1
|
+
import { D as DeclareBabelTransformPluginReturn } from '../runtime-CsXZ1vfV.cjs';
|
|
2
2
|
import { EnvPluginContext, EnvPluginResolvedConfig } from '../types/plugin.cjs';
|
|
3
3
|
import '@stryke/env/get-env-paths';
|
|
4
4
|
import '@stryke/types/base';
|
package/dist/babel/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DeclareBabelTransformPluginReturn } from '../runtime-
|
|
1
|
+
import { D as DeclareBabelTransformPluginReturn } from '../runtime-CFbD4kZ8.js';
|
|
2
2
|
import { EnvPluginContext, EnvPluginResolvedConfig } from '../types/plugin.js';
|
|
3
3
|
import '@stryke/env/get-env-paths';
|
|
4
4
|
import '@stryke/types/base';
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectio
|
|
|
3
3
|
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from './reflect.cjs';
|
|
4
4
|
export { formatEnvField, removeEnvPrefix } from './source-file-env.cjs';
|
|
5
5
|
export { createTemplateReflection } from './template-helpers.cjs';
|
|
6
|
-
import '../runtime-
|
|
6
|
+
import '../runtime-CsXZ1vfV.cjs';
|
|
7
7
|
import '@stryke/env/get-env-paths';
|
|
8
8
|
import '@stryke/types/base';
|
|
9
9
|
import '@stryke/types/package-json';
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectio
|
|
|
3
3
|
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from './reflect.js';
|
|
4
4
|
export { formatEnvField, removeEnvPrefix } from './source-file-env.js';
|
|
5
5
|
export { createTemplateReflection } from './template-helpers.js';
|
|
6
|
-
import '../runtime-
|
|
6
|
+
import '../runtime-CFbD4kZ8.js';
|
|
7
7
|
import '@stryke/env/get-env-paths';
|
|
8
8
|
import '@stryke/types/base';
|
|
9
9
|
import '@stryke/types/package-json';
|
package/dist/helpers/load.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as EnvironmentResolvedConfig } from '../runtime-
|
|
1
|
+
import { a as EnvironmentResolvedConfig } from '../runtime-CsXZ1vfV.cjs';
|
|
2
2
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
3
3
|
import { EnvPluginContext, EnvPluginOptions } from '../types/plugin.cjs';
|
|
4
4
|
import '@stryke/env/get-env-paths';
|
package/dist/helpers/load.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as EnvironmentResolvedConfig } from '../runtime-
|
|
1
|
+
import { a as EnvironmentResolvedConfig } from '../runtime-CFbD4kZ8.js';
|
|
2
2
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
3
3
|
import { EnvPluginContext, EnvPluginOptions } from '../types/plugin.js';
|
|
4
4
|
import '@stryke/env/get-env-paths';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReflectionClass } from '@deepkit/type';
|
|
2
2
|
import { TypeDefinition } from '@stryke/types/configuration';
|
|
3
|
-
import { U as UnresolvedContext, C as Context } from '../runtime-
|
|
3
|
+
import { U as UnresolvedContext, C as Context } from '../runtime-CsXZ1vfV.cjs';
|
|
4
4
|
import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.cjs';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
6
|
import '@stryke/types/base';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReflectionClass } from '@deepkit/type';
|
|
2
2
|
import { TypeDefinition } from '@stryke/types/configuration';
|
|
3
|
-
import { U as UnresolvedContext, C as Context } from '../runtime-
|
|
3
|
+
import { U as UnresolvedContext, C as Context } from '../runtime-CFbD4kZ8.js';
|
|
4
4
|
import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.js';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
6
|
import '@stryke/types/base';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReflectionClass, TypeObjectLiteral, TypeClass } from '@deepkit/type';
|
|
2
2
|
import { EnvPluginContext } from '../types/plugin.cjs';
|
|
3
|
-
import { E as EnvInterface, S as SecretsInterface } from '../runtime-
|
|
3
|
+
import { E as EnvInterface, S as SecretsInterface } from '../runtime-CsXZ1vfV.cjs';
|
|
4
4
|
import '@alloy-js/core/jsx-runtime';
|
|
5
5
|
import '@stryke/capnp';
|
|
6
6
|
import '@stryke/env/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReflectionClass, TypeObjectLiteral, TypeClass } from '@deepkit/type';
|
|
2
2
|
import { EnvPluginContext } from '../types/plugin.js';
|
|
3
|
-
import { E as EnvInterface, S as SecretsInterface } from '../runtime-
|
|
3
|
+
import { E as EnvInterface, S as SecretsInterface } from '../runtime-CFbD4kZ8.js';
|
|
4
4
|
import '@alloy-js/core/jsx-runtime';
|
|
5
5
|
import '@stryke/capnp';
|
|
6
6
|
import '@stryke/env/types';
|
|
@@ -2,7 +2,7 @@ import { ReflectionClass } from '@deepkit/type';
|
|
|
2
2
|
import { EnvPluginContext, EnvType } from '../types/plugin.cjs';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import '@stryke/capnp';
|
|
5
|
-
import '../runtime-
|
|
5
|
+
import '../runtime-CsXZ1vfV.cjs';
|
|
6
6
|
import '@stryke/env/get-env-paths';
|
|
7
7
|
import '@stryke/types/base';
|
|
8
8
|
import '@stryke/types/package-json';
|
|
@@ -2,7 +2,7 @@ import { ReflectionClass } from '@deepkit/type';
|
|
|
2
2
|
import { EnvPluginContext, EnvType } from '../types/plugin.js';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import '@stryke/capnp';
|
|
5
|
-
import '../runtime-
|
|
5
|
+
import '../runtime-CFbD4kZ8.js';
|
|
6
6
|
import '@stryke/env/get-env-paths';
|
|
7
7
|
import '@stryke/types/base';
|
|
8
8
|
import '@stryke/types/package-json';
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('./chunk-FBBMZ4NC.cjs');var jsxRuntime=require('@alloy-js/core/jsx-runtime'),createPlugin=require('@powerlines/alloy/create-plugin'),type=require('@powerlines/deepkit/vendor/type'),A=require('@powerlines/plugin-babel'),types$1=require('@storm-software/config-tools/types'),parseTypeDefinition=require('@stryke/convert/parse-type-definition'),toArray=require('@stryke/convert/to-array'),types$2=require('@stryke/env/types'),exists=require('@stryke/fs/exists'),helpers$1=require('@stryke/fs/helpers'),isParentPath=require('@stryke/path/is-parent-path'),join=require('@stryke/path/join'),constantCase=require('@stryke/string-format/constant-case'),
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('./chunk-FBBMZ4NC.cjs');var jsxRuntime=require('@alloy-js/core/jsx-runtime'),createPlugin=require('@powerlines/alloy/create-plugin'),type=require('@powerlines/deepkit/vendor/type'),A=require('@powerlines/plugin-babel'),types$1=require('@storm-software/config-tools/types'),parseTypeDefinition=require('@stryke/convert/parse-type-definition'),toArray=require('@stryke/convert/to-array'),types$2=require('@stryke/env/types'),exists=require('@stryke/fs/exists'),helpers$1=require('@stryke/fs/helpers'),isParentPath=require('@stryke/path/is-parent-path'),join=require('@stryke/path/join'),constantCase=require('@stryke/string-format/constant-case'),w=require('defu'),writeFile=require('powerlines/lib/utilities/write-file'),plugin=require('./babel/plugin'),env=require('./components/env'),load=require('./helpers/load'),persistence=require('./helpers/persistence'),reflect=require('./helpers/reflect'),babel=require('./babel'),components=require('./components'),helpers=require('./helpers'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);var w__default=/*#__PURE__*/_interopDefault(w);/*****************************************
|
|
2
2
|
*
|
|
3
3
|
* ⚡ Built by Storm Software
|
|
4
4
|
*
|
|
5
5
|
*****************************************/
|
|
6
6
|
|
|
7
|
-
const O=createPlugin.createAlloyPlugin(
|
|
7
|
+
const O=createPlugin.createAlloyPlugin((g={})=>({name:"env",dependsOn:[A__default.default(g.babel)],async config(){this.log(types$1.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");const e={env:w__default.default(g,{types:{},prefix:[]}),transform:{babel:{plugins:[plugin.envBabelPlugin]}}};if(e.env.types)e.env.types=parseTypeDefinition.parseTypeDefinition(e.env.types);else {this.log(types$1.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");const t=await persistence.getEnvDefaultTypeDefinition(this);e.env.types=parseTypeDefinition.parseTypeDefinition(`${t.file}#${t.name}`);}if(e.env.secrets)e.env.secrets=parseTypeDefinition.parseTypeDefinition(e.env.secrets);else {const t=await persistence.getSecretsDefaultTypeDefinition(this);e.env.secrets=parseTypeDefinition.parseTypeDefinition(`${t.file}#${t.name}`);}return e.env.prefix=toArray.toArray(e.env.prefix??[]).reduce((t,n)=>{const i=constantCase.constantCase(n);return t.includes(i)||t.push(i),t},[...types$2.ENV_PREFIXES,"POWERLINES_"]),e.env.prefix=e.env.prefix.reduce((t,n)=>(t.includes(n.replace(/_$/g,""))||t.push(n.replace(/_$/g,"")),t),[]),e},async configResolved(){if(this.log(types$1.LogLevelLabel.TRACE,"Environment plugin configuration has been resolved for the Powerlines project."),this.config.env.inject??=this.config.projectType==="application",this.env=w__default.default({parsed:await load.loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!=="prepare"&&this.persistedMeta?.checksum===this.meta.checksum&&exists.existsSync(persistence.getEnvTypeReflectionsPath(this,"env")))this.log(types$1.LogLevelLabel.TRACE,"Skipping reflection initialization as the meta checksum has not changed."),this.env.types.env=await persistence.readEnvTypeReflection(this,"env"),exists.existsSync(persistence.getEnvReflectionsPath(this,"env"))&&(this.env.used.env=await persistence.readEnvReflection(this)),exists.existsSync(persistence.getEnvTypeReflectionsPath(this,"secrets"))&&(this.env.types.secrets=await persistence.readEnvTypeReflection(this,"secrets")),exists.existsSync(persistence.getEnvReflectionsPath(this,"secrets"))&&(this.env.used.secrets=await persistence.readSecretsReflection(this));else {if(this.env.types.env=await reflect.reflectEnv(this,this.config.env.types?.file?isParentPath.isParentPath(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:join.joinPaths(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw new Error("Failed to find the environment configuration type reflection in the context.");if(await persistence.writeEnvTypeReflection(this,this.env.types.env,"env"),this.env.types.secrets=await reflect.reflectSecrets(this,this.config.env.secrets?.file?isParentPath.isParentPath(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:join.joinPaths(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw new Error("Failed to find the secrets configuration type reflection in the context.");await persistence.writeEnvTypeReflection(this,this.env.types.secrets,"secrets"),this.log(types$1.LogLevelLabel.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);const e=this.env.types.env.getProperties().filter(t=>t.getAlias().length>0);Object.entries(await load.loadEnv(this,this.config.env)).forEach(([t,n])=>{const i=this.config.env.prefix.reduce((f,m)=>t.replace(/_$/g,"").startsWith(m)?t.replace(/_$/g,"").slice(m.length):f,t),c=e.find(f=>f?.getAlias().reverse().includes(i));(this.env.types.env?.hasProperty(i)||c)&&this.env.types.env.getProperty(i).setDefaultValue(n);}),this.env.used.env=new type.ReflectionClass({kind:type.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 persistence.writeEnvReflection(this,this.env.used.env,"env"),this.env.types.secrets&&(await persistence.writeEnvTypeReflection(this,this.env.types.secrets,"secrets"),this.env.used.secrets=new type.ReflectionClass({kind:type.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 persistence.writeEnvReflection(this,this.env.used.secrets,"secrets"));}},render(){const e=this;return this.log(types$1.LogLevelLabel.TRACE,"Preparing the Environment runtime artifacts for the Powerlines project."),jsxRuntime.createComponent(env.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(types$1.LogLevelLabel.TRACE,"Writing Environment documentation for the Powerlines project artifacts.");const e=join.joinPaths(this.config.projectRoot,"docs","generated");exists.existsSync(e)||await helpers$1.createDirectory(e);const t=await persistence.readEnvTypeReflection(this,"env"),n=join.joinPaths(e,"env.md");this.log(types$1.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${n}"`),await writeFile.writeFile(this.log,n,`<!-- Generated by Powerlines -->
|
|
8
8
|
|
|
9
9
|
# Environment variables configuration
|
|
10
10
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PluginContext, b as Plugin } from './runtime-
|
|
2
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-
|
|
1
|
+
import { P as PluginContext, b as Plugin } from './runtime-CsXZ1vfV.cjs';
|
|
2
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-CsXZ1vfV.cjs';
|
|
3
3
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import { PrintTreeOptions } from '@alloy-js/core';
|
|
5
5
|
import { EnvPluginContext, EnvPluginResolvedConfig } from './types/plugin.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PluginContext, b as Plugin } from './runtime-
|
|
2
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-
|
|
1
|
+
import { P as PluginContext, b as Plugin } from './runtime-CFbD4kZ8.js';
|
|
2
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from './runtime-CFbD4kZ8.js';
|
|
3
3
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import { PrintTreeOptions } from '@alloy-js/core';
|
|
5
5
|
import { EnvPluginContext, EnvPluginResolvedConfig } from './types/plugin.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import'./chunk-UCUR73HG.js';import {createComponent}from'@alloy-js/core/jsx-runtime';import {createAlloyPlugin}from'@powerlines/alloy/create-plugin';import {stringifyType,ReflectionClass,ReflectionKind}from'@powerlines/deepkit/vendor/type';import A from'@powerlines/plugin-babel';import {LogLevelLabel}from'@storm-software/config-tools/types';import {parseTypeDefinition}from'@stryke/convert/parse-type-definition';import {toArray}from'@stryke/convert/to-array';import {ENV_PREFIXES}from'@stryke/env/types';import {existsSync}from'@stryke/fs/exists';import {createDirectory}from'@stryke/fs/helpers';import {isParentPath}from'@stryke/path/is-parent-path';import {joinPaths}from'@stryke/path/join';import {constantCase}from'@stryke/string-format/constant-case';import
|
|
1
|
+
import'./chunk-UCUR73HG.js';import {createComponent}from'@alloy-js/core/jsx-runtime';import {createAlloyPlugin}from'@powerlines/alloy/create-plugin';import {stringifyType,ReflectionClass,ReflectionKind}from'@powerlines/deepkit/vendor/type';import A from'@powerlines/plugin-babel';import {LogLevelLabel}from'@storm-software/config-tools/types';import {parseTypeDefinition}from'@stryke/convert/parse-type-definition';import {toArray}from'@stryke/convert/to-array';import {ENV_PREFIXES}from'@stryke/env/types';import {existsSync}from'@stryke/fs/exists';import {createDirectory}from'@stryke/fs/helpers';import {isParentPath}from'@stryke/path/is-parent-path';import {joinPaths}from'@stryke/path/join';import {constantCase}from'@stryke/string-format/constant-case';import w from'defu';import {writeFile}from'powerlines/lib/utilities/write-file';import {envBabelPlugin}from'./babel/plugin';import {EnvBuiltin}from'./components/env';import {loadEnv}from'./helpers/load';import {getEnvReflectionsPath,writeEnvReflection,readEnvTypeReflection,getEnvTypeReflectionsPath,readEnvReflection,readSecretsReflection,writeEnvTypeReflection,getEnvDefaultTypeDefinition,getSecretsDefaultTypeDefinition}from'./helpers/persistence';import {reflectEnv,reflectSecrets}from'./helpers/reflect';export*from'./babel';export*from'./components';export*from'./helpers';export*from'./types';/*****************************************
|
|
2
2
|
*
|
|
3
3
|
* ⚡ Built by Storm Software
|
|
4
4
|
*
|
|
5
5
|
*****************************************/
|
|
6
6
|
|
|
7
|
-
const O=createAlloyPlugin(
|
|
7
|
+
const O=createAlloyPlugin((g={})=>({name:"env",dependsOn:[A(g.babel)],async config(){this.log(LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");const e={env:w(g,{types:{},prefix:[]}),transform:{babel:{plugins:[envBabelPlugin]}}};if(e.env.types)e.env.types=parseTypeDefinition(e.env.types);else {this.log(LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");const t=await getEnvDefaultTypeDefinition(this);e.env.types=parseTypeDefinition(`${t.file}#${t.name}`);}if(e.env.secrets)e.env.secrets=parseTypeDefinition(e.env.secrets);else {const t=await getSecretsDefaultTypeDefinition(this);e.env.secrets=parseTypeDefinition(`${t.file}#${t.name}`);}return e.env.prefix=toArray(e.env.prefix??[]).reduce((t,n)=>{const i=constantCase(n);return t.includes(i)||t.push(i),t},[...ENV_PREFIXES,"POWERLINES_"]),e.env.prefix=e.env.prefix.reduce((t,n)=>(t.includes(n.replace(/_$/g,""))||t.push(n.replace(/_$/g,"")),t),[]),e},async configResolved(){if(this.log(LogLevelLabel.TRACE,"Environment plugin configuration has been resolved for the Powerlines project."),this.config.env.inject??=this.config.projectType==="application",this.env=w({parsed:await loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!=="prepare"&&this.persistedMeta?.checksum===this.meta.checksum&&existsSync(getEnvTypeReflectionsPath(this,"env")))this.log(LogLevelLabel.TRACE,"Skipping reflection initialization as the meta checksum has not changed."),this.env.types.env=await readEnvTypeReflection(this,"env"),existsSync(getEnvReflectionsPath(this,"env"))&&(this.env.used.env=await readEnvReflection(this)),existsSync(getEnvTypeReflectionsPath(this,"secrets"))&&(this.env.types.secrets=await readEnvTypeReflection(this,"secrets")),existsSync(getEnvReflectionsPath(this,"secrets"))&&(this.env.used.secrets=await readSecretsReflection(this));else {if(this.env.types.env=await reflectEnv(this,this.config.env.types?.file?isParentPath(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:joinPaths(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw new Error("Failed to find the environment configuration type reflection in the context.");if(await writeEnvTypeReflection(this,this.env.types.env,"env"),this.env.types.secrets=await reflectSecrets(this,this.config.env.secrets?.file?isParentPath(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:joinPaths(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw new Error("Failed to find the secrets configuration type reflection in the context.");await writeEnvTypeReflection(this,this.env.types.secrets,"secrets"),this.log(LogLevelLabel.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);const e=this.env.types.env.getProperties().filter(t=>t.getAlias().length>0);Object.entries(await loadEnv(this,this.config.env)).forEach(([t,n])=>{const i=this.config.env.prefix.reduce((f,m)=>t.replace(/_$/g,"").startsWith(m)?t.replace(/_$/g,"").slice(m.length):f,t),c=e.find(f=>f?.getAlias().reverse().includes(i));(this.env.types.env?.hasProperty(i)||c)&&this.env.types.env.getProperty(i).setDefaultValue(n);}),this.env.used.env=new ReflectionClass({kind: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 writeEnvReflection(this,this.env.used.env,"env"),this.env.types.secrets&&(await writeEnvTypeReflection(this,this.env.types.secrets,"secrets"),this.env.used.secrets=new ReflectionClass({kind: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 writeEnvReflection(this,this.env.used.secrets,"secrets"));}},render(){const e=this;return this.log(LogLevelLabel.TRACE,"Preparing the Environment runtime artifacts for the Powerlines project."),createComponent(EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}})},async docs(){this.log(LogLevelLabel.TRACE,"Writing Environment documentation for the Powerlines project artifacts.");const e=joinPaths(this.config.projectRoot,"docs","generated");existsSync(e)||await createDirectory(e);const t=await readEnvTypeReflection(this,"env"),n=joinPaths(e,"env.md");this.log(LogLevelLabel.TRACE,`Documenting environment variables configuration in "${n}"`),await writeFile(this.log,n,`<!-- Generated by Powerlines -->
|
|
8
8
|
|
|
9
9
|
# Environment variables configuration
|
|
10
10
|
|
|
@@ -466,7 +466,7 @@ interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginC
|
|
|
466
466
|
* @param other - The other plugin to compare against.
|
|
467
467
|
* @returns `true` if the two plugins are the same, `false` otherwise.
|
|
468
468
|
*/
|
|
469
|
-
dedupe?: false | ((other: Plugin<
|
|
469
|
+
dedupe?: false | ((other: Plugin<TContext>) => boolean);
|
|
470
470
|
/**
|
|
471
471
|
* A list of pre-requisite plugins that must be loaded before this plugin can be used.
|
|
472
472
|
*/
|
|
@@ -477,7 +477,7 @@ interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginC
|
|
|
477
477
|
* @param environment - The environment to check.
|
|
478
478
|
* @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
|
|
479
479
|
*/
|
|
480
|
-
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => MaybePromise<boolean | Plugin<
|
|
480
|
+
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => MaybePromise<boolean | Plugin<TContext>>;
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
type ReflectionMode = "default" | "explicit" | "never";
|
|
@@ -466,7 +466,7 @@ interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginC
|
|
|
466
466
|
* @param other - The other plugin to compare against.
|
|
467
467
|
* @returns `true` if the two plugins are the same, `false` otherwise.
|
|
468
468
|
*/
|
|
469
|
-
dedupe?: false | ((other: Plugin<
|
|
469
|
+
dedupe?: false | ((other: Plugin<TContext>) => boolean);
|
|
470
470
|
/**
|
|
471
471
|
* A list of pre-requisite plugins that must be loaded before this plugin can be used.
|
|
472
472
|
*/
|
|
@@ -477,7 +477,7 @@ interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginC
|
|
|
477
477
|
* @param environment - The environment to check.
|
|
478
478
|
* @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
|
|
479
479
|
*/
|
|
480
|
-
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => MaybePromise<boolean | Plugin<
|
|
480
|
+
applyToEnvironment?: (environment: EnvironmentResolvedConfig) => MaybePromise<boolean | Plugin<TContext>>;
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
type ReflectionMode = "default" | "explicit" | "never";
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from './plugin.cjs';
|
|
2
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-
|
|
2
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-CsXZ1vfV.cjs';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import '@deepkit/type';
|
|
5
5
|
import '@stryke/capnp';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from './plugin.js';
|
|
2
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-
|
|
2
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-CFbD4kZ8.js';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import '@deepkit/type';
|
|
5
5
|
import '@stryke/capnp';
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
2
2
|
import { ReflectionClass } from '@deepkit/type';
|
|
3
3
|
import * as $ from '@stryke/capnp';
|
|
4
|
-
import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-
|
|
4
|
+
import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-CsXZ1vfV.cjs';
|
|
5
5
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
6
6
|
import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
|
|
7
7
|
import '@stryke/env/get-env-paths';
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
2
2
|
import { ReflectionClass } from '@deepkit/type';
|
|
3
3
|
import * as $ from '@stryke/capnp';
|
|
4
|
-
import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-
|
|
4
|
+
import { B as BabelUserConfig, d as UserConfig, R as ResolvedConfig, e as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-CFbD4kZ8.js';
|
|
5
5
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
6
6
|
import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
|
|
7
7
|
import '@stryke/env/get-env-paths';
|
package/dist/types/runtime.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-
|
|
1
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-CsXZ1vfV.cjs';
|
|
2
2
|
import '@stryke/env/get-env-paths';
|
|
3
3
|
import '@stryke/types/base';
|
|
4
4
|
import '@stryke/types/package-json';
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-
|
|
1
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, c as __ΩSecretsInterface } from '../runtime-CFbD4kZ8.js';
|
|
2
2
|
import '@stryke/env/get-env-paths';
|
|
3
3
|
import '@stryke/types/base';
|
|
4
4
|
import '@stryke/types/package-json';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.45",
|
|
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": {
|
|
@@ -179,10 +179,10 @@
|
|
|
179
179
|
"@alloy-js/typescript": "^0.20.0",
|
|
180
180
|
"@babel/core": "^7.28.5",
|
|
181
181
|
"@babel/types": "^7.28.5",
|
|
182
|
-
"@powerlines/alloy": "^0.11.
|
|
183
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
184
|
-
"@powerlines/plugin-plugin": "^0.11.
|
|
185
|
-
"@storm-software/config-tools": "^1.188.
|
|
182
|
+
"@powerlines/alloy": "^0.11.48",
|
|
183
|
+
"@powerlines/plugin-babel": "^0.12.48",
|
|
184
|
+
"@powerlines/plugin-plugin": "^0.11.47",
|
|
185
|
+
"@storm-software/config-tools": "^1.188.49",
|
|
186
186
|
"@stryke/capnp": "^0.12.28",
|
|
187
187
|
"@stryke/env": "^0.20.21",
|
|
188
188
|
"@stryke/fs": "^0.33.4",
|
|
@@ -190,18 +190,18 @@
|
|
|
190
190
|
"@stryke/string-format": "^0.12.8",
|
|
191
191
|
"@stryke/type-checks": "^0.3.18",
|
|
192
192
|
"@stryke/types": "^0.10.8",
|
|
193
|
-
"powerlines": "^0.25.
|
|
193
|
+
"powerlines": "^0.25.1"
|
|
194
194
|
},
|
|
195
195
|
"devDependencies": {
|
|
196
196
|
"@alloy-js/babel-preset": "^0.2.1",
|
|
197
197
|
"@babel/preset-typescript": "^7.28.5",
|
|
198
|
-
"@powerlines/nx": "^0.10.
|
|
199
|
-
"@storm-software/tsup": "^0.2.
|
|
198
|
+
"@powerlines/nx": "^0.10.39",
|
|
199
|
+
"@storm-software/tsup": "^0.2.47",
|
|
200
200
|
"@types/node": "^24.10.1",
|
|
201
201
|
"tsup": "8.4.0",
|
|
202
202
|
"typescript": "^5.9.3",
|
|
203
203
|
"vite": "^7.2.4"
|
|
204
204
|
},
|
|
205
205
|
"publishConfig": { "access": "public" },
|
|
206
|
-
"gitHead": "
|
|
206
|
+
"gitHead": "de1daa466d1524b287e2748490c1e56ab9002b07"
|
|
207
207
|
}
|