@powerlines/plugin-env 0.1.0 → 0.2.0
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/components/env.cjs +9 -9
- package/dist/components/env.js +10 -10
- 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 +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -2
- package/dist/{runtime-DqvtGYT3.d.ts → runtime-CWg6Y3Nw.d.ts} +32 -23
- package/dist/{runtime-I3P49niA.d.cts → runtime-Cg76ZSEX.d.cts} +32 -23
- 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-Cg76ZSEX.cjs';
|
|
2
2
|
import { EnvPluginContext, EnvPluginResolvedConfig } from '../types/plugin.cjs';
|
|
3
3
|
import '@stryke/env/get-env-paths';
|
|
4
4
|
import '@stryke/types/package-json';
|
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-CWg6Y3Nw.js';
|
|
2
2
|
import { EnvPluginContext, EnvPluginResolvedConfig } from '../types/plugin.js';
|
|
3
3
|
import '@stryke/env/get-env-paths';
|
|
4
4
|
import '@stryke/types/package-json';
|
package/dist/components/env.cjs
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
*
|
|
5
5
|
*****************************************/
|
|
6
6
|
|
|
7
|
-
function Q(s){const[{defaultValue:
|
|
8
|
-
[Key in keyof EnvBase as Key ${
|
|
7
|
+
function Q(s){const[{defaultValue:r,reflection:t}]=core.splitProps(s,["defaultValue","reflection"]),i=context.usePowerlines();return React.createElement(React.Fragment,null,React.createElement(typescriptInterface.TypeScriptInterface,{name:" EnvBase",extends:["EnvInterface"],defaultValue:r,reflection:t,export:true}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(typescript.TypeDeclaration,{name:"Env",export:true},core.code` {
|
|
8
|
+
[Key in keyof EnvBase as Key ${i?.value?.config.env.prefix.map(o=>`| \`${o.replace(/_$/g,"")}_\${Key}\``).join(" ")}]: EnvBase[Key];
|
|
9
9
|
}
|
|
10
|
-
`))}chunkFBBMZ4NC_cjs.a(Q,"EnvTypeDefinition");function l(s){const[{context:
|
|
10
|
+
`))}chunkFBBMZ4NC_cjs.a(Q,"EnvTypeDefinition");function l(s){const[{context:r,name:t}]=core.splitProps(s,["context","name"]);return r?core.code`propertyName === "${t}" || propertyName.replace(/^(${r.config.env.prefix.sort((i,o)=>i.startsWith(o)?-1:o.startsWith(i)?1:i.localeCompare(o)).map(i=>`${i.replace(/_$/,"")}_`).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${t.toLowerCase().replace(/[\s\-_]+/g,"")}"`:null}chunkFBBMZ4NC_cjs.a(l,"ConfigPropertyConditional");function U(s){const[{context:r,property:t,index:i}]=core.splitProps(s,["context","property","index"]);return r?React.createElement(React.Fragment,null,i===0?React.createElement(typescript.IfStatement,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(core.Show,{when:t.getAlias()&&t.getAlias().length>0},core.code` || `,React.createElement(core.For,{each:t.getAlias(),joiner:core.code` || `},o=>React.createElement(l,{name:o,context:r}))))},core.code`return target["${t.getNameAsString()}"];`):React.createElement(typescript.ElseIfClause,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(core.Show,{when:t.getAlias()&&t.getAlias().length>0},core.code` || `,React.createElement(core.For,{each:t.getAlias(),joiner:core.code` || `},o=>React.createElement(l,{name:o,context:r}))))},core.code`return target["${t.getNameAsString()}"];`)):null}chunkFBBMZ4NC_cjs.a(U,"ConfigPropertyGet");function X(s){const[{context:r,property:t,index:i}]=core.splitProps(s,["context","property","index"]);return r?React.createElement(React.Fragment,null,i===0?React.createElement(typescript.IfStatement,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(core.Show,{when:t.getAlias()&&t.getAlias().length>0},core.code` || `,React.createElement(core.For,{each:t.getAlias(),joiner:core.code` || `},o=>React.createElement(l,{name:o,context:r}))))},core.code`
|
|
11
11
|
target["${t.getNameAsString()}"] = newValue;
|
|
12
12
|
return true;
|
|
13
|
-
`):React.createElement(typescript.ElseIfClause,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:
|
|
13
|
+
`):React.createElement(typescript.ElseIfClause,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(core.Show,{when:t.getAlias()&&t.getAlias().length>0},core.code` || `,React.createElement(core.For,{each:t.getAlias(),joiner:core.code` || `},o=>React.createElement(l,{name:o,context:r}))))},core.code`
|
|
14
14
|
target["${t.getNameAsString()}"] = newValue;
|
|
15
15
|
return true;
|
|
16
|
-
`)):null}chunkFBBMZ4NC_cjs.a(X,"ConfigPropertySet");const Y=refkey.refkey("createEnv"),Z=refkey.refkey("env"),ee=refkey.refkey("EnvSerializer");function be(s){const[{defaultConfig:
|
|
16
|
+
`)):null}chunkFBBMZ4NC_cjs.a(X,"ConfigPropertySet");const Y=refkey.refkey("createEnv"),Z=refkey.refkey("env"),ee=refkey.refkey("EnvSerializer");function be(s){const[{defaultConfig:r},t]=core.splitProps(s,["defaultConfig"]),i=context.usePowerlines(),o=core.computed(()=>i&&load.loadEnvFromContext(i.value,process.env)),f=core.createResource(async()=>{if(!i?.value)return new type.ReflectionClass({kind:type.ReflectionKind.objectLiteral,description:"The initial environment configuration state for the Powerlines project.",types:[]});const a=await persistence.readEnvTypeReflection(i?.value,"env");return a.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(h=>{a.addProperty({name:h,optional:e.isOptional()?true:void 0,readonly:e.isReadonly()?true:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(j=>j!==h).concat(e.name),title:e.getTitle()||titleCase.titleCase(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}});});}),a.getProperties().forEach(e=>{e.setDefaultValue(o.value?.[e.getNameAsString()]??e.getAlias().reduce((T,h)=>T??o.value?.[h],void 0)??e.getDefaultValue());}),a}),k=core.computed(()=>new type.ReflectionClass({kind:type.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${titleCase.titleCase(i?.value?.config?.name)} project.`,types:[]},f.data??void 0)),R=core.computed(()=>f.data?.getProperties().filter(a=>!a.isIgnored()).sort((a,e)=>a.getNameAsString().localeCompare(e.getNameAsString()))??[]),N=core.computed(()=>f.data?.getProperties().filter(a=>!a.isIgnored()&&!a.isReadonly()).sort((a,e)=>a.getNameAsString().localeCompare(e.getNameAsString()))??[]);return React.createElement(builtinFile.BuiltinFile,{...t,id:"env",description:"The Powerlines environment configuration module provides an interface to define environment configuration parameters.",imports:W__default.default({"powerlines/deepkit/type":["Type","stringify","serializer","serializeFunction","deserializeFunction","ReflectionKind","TemplateState","Serializer","TypeProperty","TypePropertySignature"],"@powerlines/plugin-env/types/runtime":[{name:"EnvInterface"}]},t.imports??{})},React.createElement(core.Show,{when:!isNull.isNull(f.data)},React.createElement(Q,{defaultValue:o.value,reflection:f.data}),React.createElement("hbr",null),React.createElement("hbr",null)),React.createElement(typescriptObject.TypescriptObject,{name:"initialEnv",type:"Partial<EnvBase>",defaultValue:o,reflection:k,export:true,const:true}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"The environment configuration serializer for the Powerlines application."},React.createElement(tsdoc.TSDocLink,null,"https://deepkit.io/docs/serialization/serializers"),React.createElement(tsdoc.TSDocLink,null,"https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918"),React.createElement(tsdoc.TSDocRemarks,null,"This serializer is used to serialize and deserialize the Powerlines environment configuration.")),React.createElement(typescript.ClassDeclaration,{refkey:ee,name:"EnvSerializer",extends:"Serializer",export:true},React.createElement(typescript.ClassMethod,{name:"constructor",public:true},core.code`
|
|
17
17
|
super("env");
|
|
18
18
|
|
|
19
19
|
this.deserializeRegistry.register(
|
|
@@ -24,17 +24,17 @@ function Q(s){const[{defaultValue:i,reflection:t}]=core.splitProps(s,["defaultVa
|
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
|
-
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application."},React.createElement(tsdoc.TSDocLink,null,"https://deepkit.io/docs/serialization/serializers"),React.createElement(tsdoc.TSDocLink,null,"https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918"),React.createElement(tsdoc.TSDocRemarks,null,"This serializer is used to serialize and deserialize the Powerlines environment configuration.")),React.createElement(typescript.VarDeclaration,{name:"envSerializer",export:false,const:true,initializer:React.createElement(typescript.NewExpression,{args:[],target:"EnvSerializer"})}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"Serialize a environment configuration object to JSON data objects (not a JSON string)."},React.createElement(tsdoc.TSDocRemarks,null,"The resulting JSON object can be stringified using JSON.stringify()."),React.createElement(tsdoc.TSDocExample,null,"const json = serializeEnv(env);"),React.createElement(tsdoc.TSDocThrows,null,"ValidationError when serialization or validation fails.")),React.createElement(typescript.VarDeclaration,{name:"serializeEnv",export:true,const:true,initializer:"serializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators."},React.createElement(tsdoc.TSDocRemarks,null,"Types that are already correct will be used as-is."),React.createElement(tsdoc.TSDocExample,null,"const env = deserializeEnv(json);"),React.createElement(tsdoc.TSDocThrows,null,"ValidationError when deserialization fails.")),React.createElement(typescript.VarDeclaration,{name:"deserializeEnv",export:true,const:true,initializer:"deserializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"Initializes the Powerlines environment configuration module."},React.createElement(tsdoc.TSDocRemarks,null,"This function initializes the Powerlines environment configuration object."),React.createElement(tsdoc.TSDocParam,{name:"environmentConfig"},"The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime."),React.createElement(tsdoc.TSDocReturns,null,"The initialized Powerlines configuration object.")),React.createElement(core.Show,{when:!!
|
|
27
|
+
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application."},React.createElement(tsdoc.TSDocLink,null,"https://deepkit.io/docs/serialization/serializers"),React.createElement(tsdoc.TSDocLink,null,"https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918"),React.createElement(tsdoc.TSDocRemarks,null,"This serializer is used to serialize and deserialize the Powerlines environment configuration.")),React.createElement(typescript.VarDeclaration,{name:"envSerializer",export:false,const:true,initializer:React.createElement(typescript.NewExpression,{args:[],target:"EnvSerializer"})}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"Serialize a environment configuration object to JSON data objects (not a JSON string)."},React.createElement(tsdoc.TSDocRemarks,null,"The resulting JSON object can be stringified using JSON.stringify()."),React.createElement(tsdoc.TSDocExample,null,"const json = serializeEnv(env);"),React.createElement(tsdoc.TSDocThrows,null,"ValidationError when serialization or validation fails.")),React.createElement(typescript.VarDeclaration,{name:"serializeEnv",export:true,const:true,initializer:"serializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators."},React.createElement(tsdoc.TSDocRemarks,null,"Types that are already correct will be used as-is."),React.createElement(tsdoc.TSDocExample,null,"const env = deserializeEnv(json);"),React.createElement(tsdoc.TSDocThrows,null,"ValidationError when deserialization fails.")),React.createElement(typescript.VarDeclaration,{name:"deserializeEnv",export:true,const:true,initializer:"deserializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(tsdoc.TSDoc,{heading:"Initializes the Powerlines environment configuration module."},React.createElement(tsdoc.TSDocRemarks,null,"This function initializes the Powerlines environment configuration object."),React.createElement(tsdoc.TSDocParam,{name:"environmentConfig"},"The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime."),React.createElement(tsdoc.TSDocReturns,null,"The initialized Powerlines configuration object.")),React.createElement(core.Show,{when:!!i?.value?.entryPath},React.createElement(typescript.FunctionDeclaration,{refkey:Y,async:false,export:true,name:"createEnv",parameters:[{name:"environmentConfig",type:"Partial<Env>",optional:false,default:"{}"}],returnType:"Env"},core.code`
|
|
28
28
|
return new Proxy<Env>(
|
|
29
29
|
deserializeEnv({
|
|
30
30
|
...initialEnv,
|
|
31
31
|
...environmentConfig
|
|
32
32
|
}) as Env,
|
|
33
33
|
{
|
|
34
|
-
get: (target: EnvBase, propertyName: string) => { `,React.createElement("hbr",null),React.createElement(core.For,{each:R},(a,e)=>React.createElement(U,{index:e,context:
|
|
34
|
+
get: (target: EnvBase, propertyName: string) => { `,React.createElement("hbr",null),React.createElement(core.For,{each:R},(a,e)=>React.createElement(U,{index:e,context:i?.value,property:a})),core.code`
|
|
35
35
|
return undefined;
|
|
36
|
-
}, `,React.createElement("hbr",null),React.createElement("hbr",null),core.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,React.createElement("hbr",null),React.createElement(core.For,{each:N,ender:core.code` else `},(a,e)=>React.createElement(X,{index:e,context:
|
|
36
|
+
}, `,React.createElement("hbr",null),React.createElement("hbr",null),core.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,React.createElement("hbr",null),React.createElement(core.For,{each:N,ender:core.code` else `},(a,e)=>React.createElement(X,{index:e,context:i?.value,property:a})),React.createElement("hbr",null),core.code`return false;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
|
-
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(typescript.VarDeclaration,{refkey:Z,name:"env",type:"Env",export:true,const:true,initializer:React.createElement(React.Fragment,null,core.code`createEnv(`,
|
|
40
|
+
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(typescript.VarDeclaration,{refkey:Z,name:"env",type:"Env",export:true,const:true,initializer:React.createElement(React.Fragment,null,core.code`createEnv(`,r||"{}",core.code` as Partial<Env>)`)}))}chunkFBBMZ4NC_cjs.a(be,"EnvBuiltin");exports.EnvBuiltin=be;exports.EnvTypeDefinition=Q;
|
package/dist/components/env.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {a}from'../chunk-UCUR73HG.js';import {splitProps,code,Show,For,computed,createResource}from'@alloy-js/core';import {TypeDeclaration,IfStatement,ElseIfClause,ClassDeclaration,ClassMethod,VarDeclaration,NewExpression,FunctionDeclaration}from'@alloy-js/typescript';import {
|
|
1
|
+
import {a}from'../chunk-UCUR73HG.js';import {splitProps,code,Show,For,computed,createResource}from'@alloy-js/core';import {TypeDeclaration,IfStatement,ElseIfClause,ClassDeclaration,ClassMethod,VarDeclaration,NewExpression,FunctionDeclaration}from'@alloy-js/typescript';import {usePowerlines}from'@powerlines/alloy/core/contexts/context';import {refkey}from'@powerlines/alloy/helpers/refkey';import {BuiltinFile}from'@powerlines/alloy/typescript/components/builtin-file';import {TSDoc,TSDocLink,TSDocRemarks,TSDocExample,TSDocThrows,TSDocParam,TSDocReturns}from'@powerlines/alloy/typescript/components/tsdoc';import {TypeScriptInterface}from'@powerlines/alloy/typescript/components/typescript-interface';import {TypescriptObject}from'@powerlines/alloy/typescript/components/typescript-object';import {titleCase}from'@stryke/string-format/title-case';import {isNull}from'@stryke/type-checks/is-null';import W from'defu';import {ReflectionClass,ReflectionKind}from'powerlines/deepkit/type';import {loadEnvFromContext}from'../helpers/load';import {readEnvTypeReflection}from'../helpers/persistence';/*****************************************
|
|
2
2
|
*
|
|
3
3
|
* ⚡ Built by Storm Software
|
|
4
4
|
*
|
|
5
5
|
*****************************************/
|
|
6
6
|
|
|
7
|
-
function Q(s){const[{defaultValue:
|
|
8
|
-
[Key in keyof EnvBase as Key ${
|
|
7
|
+
function Q(s){const[{defaultValue:r,reflection:t}]=splitProps(s,["defaultValue","reflection"]),i=usePowerlines();return React.createElement(React.Fragment,null,React.createElement(TypeScriptInterface,{name:" EnvBase",extends:["EnvInterface"],defaultValue:r,reflection:t,export:true}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TypeDeclaration,{name:"Env",export:true},code` {
|
|
8
|
+
[Key in keyof EnvBase as Key ${i?.value?.config.env.prefix.map(o=>`| \`${o.replace(/_$/g,"")}_\${Key}\``).join(" ")}]: EnvBase[Key];
|
|
9
9
|
}
|
|
10
|
-
`))}a(Q,"EnvTypeDefinition");function l(s){const[{context:
|
|
10
|
+
`))}a(Q,"EnvTypeDefinition");function l(s){const[{context:r,name:t}]=splitProps(s,["context","name"]);return r?code`propertyName === "${t}" || propertyName.replace(/^(${r.config.env.prefix.sort((i,o)=>i.startsWith(o)?-1:o.startsWith(i)?1:i.localeCompare(o)).map(i=>`${i.replace(/_$/,"")}_`).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${t.toLowerCase().replace(/[\s\-_]+/g,"")}"`:null}a(l,"ConfigPropertyConditional");function U(s){const[{context:r,property:t,index:i}]=splitProps(s,["context","property","index"]);return r?React.createElement(React.Fragment,null,i===0?React.createElement(IfStatement,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(Show,{when:t.getAlias()&&t.getAlias().length>0},code` || `,React.createElement(For,{each:t.getAlias(),joiner:code` || `},o=>React.createElement(l,{name:o,context:r}))))},code`return target["${t.getNameAsString()}"];`):React.createElement(ElseIfClause,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(Show,{when:t.getAlias()&&t.getAlias().length>0},code` || `,React.createElement(For,{each:t.getAlias(),joiner:code` || `},o=>React.createElement(l,{name:o,context:r}))))},code`return target["${t.getNameAsString()}"];`)):null}a(U,"ConfigPropertyGet");function X(s){const[{context:r,property:t,index:i}]=splitProps(s,["context","property","index"]);return r?React.createElement(React.Fragment,null,i===0?React.createElement(IfStatement,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(Show,{when:t.getAlias()&&t.getAlias().length>0},code` || `,React.createElement(For,{each:t.getAlias(),joiner:code` || `},o=>React.createElement(l,{name:o,context:r}))))},code`
|
|
11
11
|
target["${t.getNameAsString()}"] = newValue;
|
|
12
12
|
return true;
|
|
13
|
-
`):React.createElement(ElseIfClause,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:
|
|
13
|
+
`):React.createElement(ElseIfClause,{condition:React.createElement(React.Fragment,null,React.createElement(l,{name:t.getNameAsString(),context:r}),React.createElement(Show,{when:t.getAlias()&&t.getAlias().length>0},code` || `,React.createElement(For,{each:t.getAlias(),joiner:code` || `},o=>React.createElement(l,{name:o,context:r}))))},code`
|
|
14
14
|
target["${t.getNameAsString()}"] = newValue;
|
|
15
15
|
return true;
|
|
16
|
-
`)):null}a(X,"ConfigPropertySet");const Y=refkey("createEnv"),Z=refkey("env"),ee=refkey("EnvSerializer");function
|
|
16
|
+
`)):null}a(X,"ConfigPropertySet");const Y=refkey("createEnv"),Z=refkey("env"),ee=refkey("EnvSerializer");function we(s){const[{defaultConfig:r},t]=splitProps(s,["defaultConfig"]),i=usePowerlines(),o=computed(()=>i&&loadEnvFromContext(i.value,process.env)),f=createResource(async()=>{if(!i?.value)return new ReflectionClass({kind:ReflectionKind.objectLiteral,description:"The initial environment configuration state for the Powerlines project.",types:[]});const a=await readEnvTypeReflection(i?.value,"env");return a.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(h=>{a.addProperty({name:h,optional:e.isOptional()?true:void 0,readonly:e.isReadonly()?true:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(j=>j!==h).concat(e.name),title:e.getTitle()||titleCase(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}});});}),a.getProperties().forEach(e=>{e.setDefaultValue(o.value?.[e.getNameAsString()]??e.getAlias().reduce((T,h)=>T??o.value?.[h],void 0)??e.getDefaultValue());}),a}),k=computed(()=>new ReflectionClass({kind:ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${titleCase(i?.value?.config?.name)} project.`,types:[]},f.data??void 0)),R=computed(()=>f.data?.getProperties().filter(a=>!a.isIgnored()).sort((a,e)=>a.getNameAsString().localeCompare(e.getNameAsString()))??[]),N=computed(()=>f.data?.getProperties().filter(a=>!a.isIgnored()&&!a.isReadonly()).sort((a,e)=>a.getNameAsString().localeCompare(e.getNameAsString()))??[]);return React.createElement(BuiltinFile,{...t,id:"env",description:"The Powerlines environment configuration module provides an interface to define environment configuration parameters.",imports:W({"powerlines/deepkit/type":["Type","stringify","serializer","serializeFunction","deserializeFunction","ReflectionKind","TemplateState","Serializer","TypeProperty","TypePropertySignature"],"@powerlines/plugin-env/types/runtime":[{name:"EnvInterface"}]},t.imports??{})},React.createElement(Show,{when:!isNull(f.data)},React.createElement(Q,{defaultValue:o.value,reflection:f.data}),React.createElement("hbr",null),React.createElement("hbr",null)),React.createElement(TypescriptObject,{name:"initialEnv",type:"Partial<EnvBase>",defaultValue:o,reflection:k,export:true,const:true}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"The environment configuration serializer for the Powerlines application."},React.createElement(TSDocLink,null,"https://deepkit.io/docs/serialization/serializers"),React.createElement(TSDocLink,null,"https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918"),React.createElement(TSDocRemarks,null,"This serializer is used to serialize and deserialize the Powerlines environment configuration.")),React.createElement(ClassDeclaration,{refkey:ee,name:"EnvSerializer",extends:"Serializer",export:true},React.createElement(ClassMethod,{name:"constructor",public:true},code`
|
|
17
17
|
super("env");
|
|
18
18
|
|
|
19
19
|
this.deserializeRegistry.register(
|
|
@@ -24,17 +24,17 @@ function Q(s){const[{defaultValue:i,reflection:t}]=splitProps(s,["defaultValue",
|
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
|
-
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application."},React.createElement(TSDocLink,null,"https://deepkit.io/docs/serialization/serializers"),React.createElement(TSDocLink,null,"https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918"),React.createElement(TSDocRemarks,null,"This serializer is used to serialize and deserialize the Powerlines environment configuration.")),React.createElement(VarDeclaration,{name:"envSerializer",export:false,const:true,initializer:React.createElement(NewExpression,{args:[],target:"EnvSerializer"})}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"Serialize a environment configuration object to JSON data objects (not a JSON string)."},React.createElement(TSDocRemarks,null,"The resulting JSON object can be stringified using JSON.stringify()."),React.createElement(TSDocExample,null,"const json = serializeEnv(env);"),React.createElement(TSDocThrows,null,"ValidationError when serialization or validation fails.")),React.createElement(VarDeclaration,{name:"serializeEnv",export:true,const:true,initializer:"serializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators."},React.createElement(TSDocRemarks,null,"Types that are already correct will be used as-is."),React.createElement(TSDocExample,null,"const env = deserializeEnv(json);"),React.createElement(TSDocThrows,null,"ValidationError when deserialization fails.")),React.createElement(VarDeclaration,{name:"deserializeEnv",export:true,const:true,initializer:"deserializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"Initializes the Powerlines environment configuration module."},React.createElement(TSDocRemarks,null,"This function initializes the Powerlines environment configuration object."),React.createElement(TSDocParam,{name:"environmentConfig"},"The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime."),React.createElement(TSDocReturns,null,"The initialized Powerlines configuration object.")),React.createElement(Show,{when:!!
|
|
27
|
+
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application."},React.createElement(TSDocLink,null,"https://deepkit.io/docs/serialization/serializers"),React.createElement(TSDocLink,null,"https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918"),React.createElement(TSDocRemarks,null,"This serializer is used to serialize and deserialize the Powerlines environment configuration.")),React.createElement(VarDeclaration,{name:"envSerializer",export:false,const:true,initializer:React.createElement(NewExpression,{args:[],target:"EnvSerializer"})}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"Serialize a environment configuration object to JSON data objects (not a JSON string)."},React.createElement(TSDocRemarks,null,"The resulting JSON object can be stringified using JSON.stringify()."),React.createElement(TSDocExample,null,"const json = serializeEnv(env);"),React.createElement(TSDocThrows,null,"ValidationError when serialization or validation fails.")),React.createElement(VarDeclaration,{name:"serializeEnv",export:true,const:true,initializer:"serializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators."},React.createElement(TSDocRemarks,null,"Types that are already correct will be used as-is."),React.createElement(TSDocExample,null,"const env = deserializeEnv(json);"),React.createElement(TSDocThrows,null,"ValidationError when deserialization fails.")),React.createElement(VarDeclaration,{name:"deserializeEnv",export:true,const:true,initializer:"deserializeFunction<EnvBase>(envSerializer)"}),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(TSDoc,{heading:"Initializes the Powerlines environment configuration module."},React.createElement(TSDocRemarks,null,"This function initializes the Powerlines environment configuration object."),React.createElement(TSDocParam,{name:"environmentConfig"},"The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime."),React.createElement(TSDocReturns,null,"The initialized Powerlines configuration object.")),React.createElement(Show,{when:!!i?.value?.entryPath},React.createElement(FunctionDeclaration,{refkey:Y,async:false,export:true,name:"createEnv",parameters:[{name:"environmentConfig",type:"Partial<Env>",optional:false,default:"{}"}],returnType:"Env"},code`
|
|
28
28
|
return new Proxy<Env>(
|
|
29
29
|
deserializeEnv({
|
|
30
30
|
...initialEnv,
|
|
31
31
|
...environmentConfig
|
|
32
32
|
}) as Env,
|
|
33
33
|
{
|
|
34
|
-
get: (target: EnvBase, propertyName: string) => { `,React.createElement("hbr",null),React.createElement(For,{each:R},(a,e)=>React.createElement(U,{index:e,context:
|
|
34
|
+
get: (target: EnvBase, propertyName: string) => { `,React.createElement("hbr",null),React.createElement(For,{each:R},(a,e)=>React.createElement(U,{index:e,context:i?.value,property:a})),code`
|
|
35
35
|
return undefined;
|
|
36
|
-
}, `,React.createElement("hbr",null),React.createElement("hbr",null),code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,React.createElement("hbr",null),React.createElement(For,{each:N,ender:code` else `},(a,e)=>React.createElement(X,{index:e,context:
|
|
36
|
+
}, `,React.createElement("hbr",null),React.createElement("hbr",null),code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,React.createElement("hbr",null),React.createElement(For,{each:N,ender:code` else `},(a,e)=>React.createElement(X,{index:e,context:i?.value,property:a})),React.createElement("hbr",null),code`return false;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
|
-
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(VarDeclaration,{refkey:Z,name:"env",type:"Env",export:true,const:true,initializer:React.createElement(React.Fragment,null,code`createEnv(`,
|
|
40
|
+
`)),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement("hbr",null),React.createElement(VarDeclaration,{refkey:Z,name:"env",type:"Env",export:true,const:true,initializer:React.createElement(React.Fragment,null,code`createEnv(`,r||"{}",code` as Partial<Env>)`)}))}a(we,"EnvBuiltin");export{we as EnvBuiltin,Q as EnvTypeDefinition};
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectio
|
|
|
3
3
|
export { CreateEnvReflectionOptions, StormBaseEnv, StormBaseSecrets, __Ω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-Cg76ZSEX.cjs';
|
|
7
7
|
import '@stryke/env/get-env-paths';
|
|
8
8
|
import '@stryke/types/package-json';
|
|
9
9
|
import 'jiti';
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectio
|
|
|
3
3
|
export { CreateEnvReflectionOptions, StormBaseEnv, StormBaseSecrets, __Ω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-CWg6Y3Nw.js';
|
|
7
7
|
import '@stryke/env/get-env-paths';
|
|
8
8
|
import '@stryke/types/package-json';
|
|
9
9
|
import 'jiti';
|
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-Cg76ZSEX.cjs';
|
|
2
2
|
import * as _storm_software_config_tools_types from '@storm-software/config-tools/types';
|
|
3
3
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
4
4
|
import { EnvPluginContext, EnvPluginOptions } from '../types/plugin.cjs';
|
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-CWg6Y3Nw.js';
|
|
2
2
|
import * as _storm_software_config_tools_types from '@storm-software/config-tools/types';
|
|
3
3
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
4
4
|
import { EnvPluginContext, EnvPluginOptions } from '../types/plugin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeDefinition } from '@stryke/types/configuration';
|
|
2
2
|
import { ReflectionClass } from '@deepkit/type';
|
|
3
|
-
import { C as Context } from '../runtime-
|
|
3
|
+
import { C as Context } from '../runtime-Cg76ZSEX.cjs';
|
|
4
4
|
import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.cjs';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
6
|
import '@stryke/types/package-json';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeDefinition } from '@stryke/types/configuration';
|
|
2
2
|
import { ReflectionClass } from '@deepkit/type';
|
|
3
|
-
import { C as Context } from '../runtime-
|
|
3
|
+
import { C as Context } from '../runtime-CWg6Y3Nw.js';
|
|
4
4
|
import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.js';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
6
|
import '@stryke/types/package-json';
|
|
@@ -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-Cg76ZSEX.cjs';
|
|
4
4
|
import '@alloy-js/core/jsx-runtime';
|
|
5
5
|
import '@stryke/env/types';
|
|
6
6
|
import '@stryke/types/configuration';
|
|
@@ -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-CWg6Y3Nw.js';
|
|
4
4
|
import '@alloy-js/core/jsx-runtime';
|
|
5
5
|
import '@stryke/env/types';
|
|
6
6
|
import '@stryke/types/configuration';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReflectionClass } from '@deepkit/type';
|
|
2
2
|
import { EnvPluginContext, EnvType } from '../types/plugin.cjs';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
|
-
import '../runtime-
|
|
4
|
+
import '../runtime-Cg76ZSEX.cjs';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
6
|
import '@stryke/types/package-json';
|
|
7
7
|
import 'jiti';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReflectionClass } from '@deepkit/type';
|
|
2
2
|
import { EnvPluginContext, EnvType } from '../types/plugin.js';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
|
-
import '../runtime-
|
|
4
|
+
import '../runtime-CWg6Y3Nw.js';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
6
|
import '@stryke/types/package-json';
|
|
7
7
|
import 'jiti';
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
*****************************************/
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const W=createPlugin.createAlloyPlugin(b=>({name:"env",dependsOn:[$__default.default()],async config(){this.log(types$1.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");const e={env:u__default.default(b,{types:{},prefix:[]}),transform:{babel:{plugins:[plugin.envBabelPlugin]}}};return e.env.types?e.env.types=parseTypeDefinition.parseTypeDefinition(e.env.types):(this.log(types$1.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected."),e.env.types=parseTypeDefinition.parseTypeDefinition(`${persistence.getEnvDefaultTypeDefinition(this).file}#${persistence.getEnvDefaultTypeDefinition(this).name}`)),e.env.secrets?e.env.secrets=parseTypeDefinition.parseTypeDefinition(e.env.secrets):e.env.secrets=parseTypeDefinition.parseTypeDefinition(`${persistence.getSecretsDefaultTypeDefinition(this).file}#${persistence.getSecretsDefaultTypeDefinition(this).name}`),e.env.prefix=toArray.toArray(e.env.prefix??[]).reduce((i,n)=>{const t=constantCase.constantCase(n);return i.includes(t)||i.push(t),i},[...types$2.ENV_PREFIXES,"POWERLINES_"]),e.env.prefix=e.env.prefix.reduce((i,n)=>(i.includes(n.replace(/_$/g,""))||i.push(n.replace(/_$/g,"")),i),[]),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=u__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(i=>i.getAlias().length>0);Object.entries(await load.loadEnv(this,this.config.env)).forEach(([i,n])=>{const t=this.config.env.prefix.reduce((p,g)=>i.replace(/_$/g,"").startsWith(g)?i.replace(/_$/g,"").slice(g.length):p,i),c=e.find(p=>p?.getAlias().reverse().includes(t));(this.env.types.env?.hasProperty(t)||c)&&this.env.types.env.getProperty(t).setDefaultValue(n);}),this.env.used.env=new type.ReflectionClass({kind:type.ReflectionKind.objectLiteral,typeName:"StormEnv",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:"StormSecrets",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(){return this.log(types$1.LogLevelLabel.TRACE,"Preparing the Environment runtime artifacts for the Powerlines project."),React.createElement(env.EnvBuiltin,{defaultConfig:this.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 i=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
|
|
|
@@ -19,4 +19,4 @@ const O=createPlugin.createAlloyPlugin(T=>({name:"env",dependsOn:[$__default.def
|
|
|
19
19
|
${i.getProperties().filter(t=>t.getNameAsString()!=="__STORM_INJECTED__").sort((t,c)=>t.getNameAsString().localeCompare(c.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll("\r","")?.replaceAll(`
|
|
20
20
|
`,"")??"").trim()} | ${type.stringifyType(t.getType()).trim().replaceAll(" | ",", or ")} | ${t.hasDefault()?String(t.getDefaultValue())?.includes('"')?t.getDefaultValue():`\`${t.getDefaultValue()}\``:""} | ${t.isValueRequired()?"":"\u2714"} |`).join(`
|
|
21
21
|
`)}
|
|
22
|
-
`);},async buildEnd(){const e=persistence.getEnvReflectionsPath(this,"env");this.log(types$1.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await persistence.writeEnvReflection(this,this.env.used.env,"env");}}));var le=
|
|
22
|
+
`);},async buildEnd(){const e=persistence.getEnvReflectionsPath(this,"env");this.log(types$1.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await persistence.writeEnvReflection(this,this.env.used.env,"env");}}));var le=W;exports.default=le;exports.plugin=W;Object.keys(babel).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return babel[k]}})});Object.keys(components).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return components[k]}})});Object.keys(helpers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return helpers[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { EnvPluginContext, EnvPluginResolvedConfig } from './types/plugin.cjs';
|
|
2
2
|
export { EnvPluginOptions, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from './types/plugin.cjs';
|
|
3
|
-
import { B as BabelTransformPluginOptions, P as Plugin } from './runtime-
|
|
4
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from './runtime-
|
|
3
|
+
import { B as BabelTransformPluginOptions, P as Plugin } from './runtime-Cg76ZSEX.cjs';
|
|
4
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from './runtime-Cg76ZSEX.cjs';
|
|
5
5
|
import * as _alloy_js_core from '@alloy-js/core';
|
|
6
6
|
import { PrintTreeOptions } from '@alloy-js/core';
|
|
7
7
|
import * as _stryke_types_configuration from '@stryke/types/configuration';
|
|
8
|
+
import { TypeDefinitionParameter } from '@stryke/types/configuration';
|
|
8
9
|
import * as _babel_core from '@babel/core';
|
|
9
10
|
export { envBabelPlugin } from './babel/plugin.cjs';
|
|
10
11
|
export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from './components/env.cjs';
|
|
@@ -61,8 +62,8 @@ interface AlloyPluginOptions {
|
|
|
61
62
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
62
63
|
*/
|
|
63
64
|
declare const plugin: (options: Omit<_stryke_types_configuration.DotenvConfiguration, "types"> & {
|
|
64
|
-
types?:
|
|
65
|
-
secrets?:
|
|
65
|
+
types?: TypeDefinitionParameter;
|
|
66
|
+
secrets?: TypeDefinitionParameter;
|
|
66
67
|
prefix?: string | string[];
|
|
67
68
|
inject?: boolean;
|
|
68
69
|
defaultConfig?: _alloy_js_core.Children;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { EnvPluginContext, EnvPluginResolvedConfig } from './types/plugin.js';
|
|
2
2
|
export { EnvPluginOptions, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from './types/plugin.js';
|
|
3
|
-
import { B as BabelTransformPluginOptions, P as Plugin } from './runtime-
|
|
4
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from './runtime-
|
|
3
|
+
import { B as BabelTransformPluginOptions, P as Plugin } from './runtime-CWg6Y3Nw.js';
|
|
4
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from './runtime-CWg6Y3Nw.js';
|
|
5
5
|
import * as _alloy_js_core from '@alloy-js/core';
|
|
6
6
|
import { PrintTreeOptions } from '@alloy-js/core';
|
|
7
7
|
import * as _stryke_types_configuration from '@stryke/types/configuration';
|
|
8
|
+
import { TypeDefinitionParameter } from '@stryke/types/configuration';
|
|
8
9
|
import * as _babel_core from '@babel/core';
|
|
9
10
|
export { envBabelPlugin } from './babel/plugin.js';
|
|
10
11
|
export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from './components/env.js';
|
|
@@ -61,8 +62,8 @@ interface AlloyPluginOptions {
|
|
|
61
62
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
62
63
|
*/
|
|
63
64
|
declare const plugin: (options: Omit<_stryke_types_configuration.DotenvConfiguration, "types"> & {
|
|
64
|
-
types?:
|
|
65
|
-
secrets?:
|
|
65
|
+
types?: TypeDefinitionParameter;
|
|
66
|
+
secrets?: TypeDefinitionParameter;
|
|
66
67
|
prefix?: string | string[];
|
|
67
68
|
inject?: boolean;
|
|
68
69
|
defaultConfig?: _alloy_js_core.Children;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import'./chunk-UCUR73HG.js';import {createAlloyPlugin}from'@powerlines/alloy/cre
|
|
|
4
4
|
*
|
|
5
5
|
*****************************************/
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const W=createAlloyPlugin(b=>({name:"env",dependsOn:[$()],async config(){this.log(LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");const e={env:u(b,{types:{},prefix:[]}),transform:{babel:{plugins:[envBabelPlugin]}}};return e.env.types?e.env.types=parseTypeDefinition(e.env.types):(this.log(LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected."),e.env.types=parseTypeDefinition(`${getEnvDefaultTypeDefinition(this).file}#${getEnvDefaultTypeDefinition(this).name}`)),e.env.secrets?e.env.secrets=parseTypeDefinition(e.env.secrets):e.env.secrets=parseTypeDefinition(`${getSecretsDefaultTypeDefinition(this).file}#${getSecretsDefaultTypeDefinition(this).name}`),e.env.prefix=toArray(e.env.prefix??[]).reduce((i,n)=>{const t=constantCase(n);return i.includes(t)||i.push(t),i},[...ENV_PREFIXES,"POWERLINES_"]),e.env.prefix=e.env.prefix.reduce((i,n)=>(i.includes(n.replace(/_$/g,""))||i.push(n.replace(/_$/g,"")),i),[]),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=u({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(i=>i.getAlias().length>0);Object.entries(await loadEnv(this,this.config.env)).forEach(([i,n])=>{const t=this.config.env.prefix.reduce((p,g)=>i.replace(/_$/g,"").startsWith(g)?i.replace(/_$/g,"").slice(g.length):p,i),c=e.find(p=>p?.getAlias().reverse().includes(t));(this.env.types.env?.hasProperty(t)||c)&&this.env.types.env.getProperty(t).setDefaultValue(n);}),this.env.used.env=new ReflectionClass({kind:ReflectionKind.objectLiteral,typeName:"StormEnv",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:"StormSecrets",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(){return this.log(LogLevelLabel.TRACE,"Preparing the Environment runtime artifacts for the Powerlines project."),React.createElement(EnvBuiltin,{defaultConfig:this.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 i=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
|
|
|
@@ -19,4 +19,4 @@ const O=createAlloyPlugin(T=>({name:"env",dependsOn:[$()],async config(){this.lo
|
|
|
19
19
|
${i.getProperties().filter(t=>t.getNameAsString()!=="__STORM_INJECTED__").sort((t,c)=>t.getNameAsString().localeCompare(c.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll("\r","")?.replaceAll(`
|
|
20
20
|
`,"")??"").trim()} | ${stringifyType(t.getType()).trim().replaceAll(" | ",", or ")} | ${t.hasDefault()?String(t.getDefaultValue())?.includes('"')?t.getDefaultValue():`\`${t.getDefaultValue()}\``:""} | ${t.isValueRequired()?"":"\u2714"} |`).join(`
|
|
21
21
|
`)}
|
|
22
|
-
`);},async buildEnd(){const e=getEnvReflectionsPath(this,"env");this.log(LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await writeEnvReflection(this,this.env.used.env,"env");}}));var he=
|
|
22
|
+
`);},async buildEnd(){const e=getEnvReflectionsPath(this,"env");this.log(LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await writeEnvReflection(this,this.env.used.env,"env");}}));var he=W;export{he as default,W as plugin};
|
|
@@ -1989,9 +1989,27 @@ interface OutputConfig {
|
|
|
1989
1989
|
/**
|
|
1990
1990
|
* The path of the generated runtime declaration file relative to the workspace root.
|
|
1991
1991
|
*
|
|
1992
|
-
* @defaultValue "\{projectRoot\}/
|
|
1992
|
+
* @defaultValue "\{projectRoot\}/powerlines.d.ts"
|
|
1993
1993
|
*/
|
|
1994
1994
|
dts?: string | false;
|
|
1995
|
+
/**
|
|
1996
|
+
* A prefix to use for identifying builtin modules
|
|
1997
|
+
*
|
|
1998
|
+
* @remarks
|
|
1999
|
+
* This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
|
|
2000
|
+
*
|
|
2001
|
+
* @defaultValue "powerlines"
|
|
2002
|
+
*/
|
|
2003
|
+
builtinPrefix?: string;
|
|
2004
|
+
/**
|
|
2005
|
+
* The folder where the generated runtime modules/builtins will be located
|
|
2006
|
+
*
|
|
2007
|
+
* @remarks
|
|
2008
|
+
* This folder will contain all runtime modules and builtins generated during the "prepare" phase.
|
|
2009
|
+
*
|
|
2010
|
+
* @defaultValue "\{projectRoot\}/.powerlines"
|
|
2011
|
+
*/
|
|
2012
|
+
runtimeFolder?: string;
|
|
1995
2013
|
/**
|
|
1996
2014
|
* The module format of the output files
|
|
1997
2015
|
*
|
|
@@ -2009,19 +2027,6 @@ interface OutputConfig {
|
|
|
2009
2027
|
*/
|
|
2010
2028
|
assets?: Array<string | AssetGlob>;
|
|
2011
2029
|
}
|
|
2012
|
-
interface TransformConfig {
|
|
2013
|
-
/**
|
|
2014
|
-
* The Babel configuration options to use for the build process
|
|
2015
|
-
*/
|
|
2016
|
-
babel?: BabelUserConfig;
|
|
2017
|
-
/**
|
|
2018
|
-
* Reflection configuration options for the Deepkit TSC custom transformers
|
|
2019
|
-
*
|
|
2020
|
-
* @remarks
|
|
2021
|
-
* These options will be merged with the `tsconfig.json` file and the `tsconfigRaw` options.
|
|
2022
|
-
*/
|
|
2023
|
-
deepkit?: DeepkitOptions;
|
|
2024
|
-
}
|
|
2025
2030
|
interface BaseConfig {
|
|
2026
2031
|
/**
|
|
2027
2032
|
* The name of the project
|
|
@@ -2072,20 +2077,18 @@ interface BaseConfig {
|
|
|
2072
2077
|
/**
|
|
2073
2078
|
* Configuration for the transformation of the source code
|
|
2074
2079
|
*/
|
|
2075
|
-
transform?:
|
|
2080
|
+
transform?: Record<string, any>;
|
|
2076
2081
|
/**
|
|
2077
2082
|
* Options to to provide to the build process
|
|
2078
2083
|
*/
|
|
2079
2084
|
build?: BuildConfig;
|
|
2080
2085
|
/**
|
|
2081
|
-
*
|
|
2086
|
+
* Configuration for documentation generation
|
|
2082
2087
|
*
|
|
2083
2088
|
* @remarks
|
|
2084
|
-
* This
|
|
2085
|
-
*
|
|
2086
|
-
* @defaultValue "storm"
|
|
2089
|
+
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
2087
2090
|
*/
|
|
2088
|
-
|
|
2091
|
+
docs?: Record<string, any>;
|
|
2089
2092
|
/**
|
|
2090
2093
|
* The path to the tsconfig file to be used by the compiler
|
|
2091
2094
|
*
|
|
@@ -2199,6 +2202,12 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
2199
2202
|
* Environment-specific configurations
|
|
2200
2203
|
*/
|
|
2201
2204
|
environments?: Record<string, EnvironmentConfig>;
|
|
2205
|
+
/**
|
|
2206
|
+
* A string identifier that allows a child framework or tool to identify itself when using Powerlines.
|
|
2207
|
+
*
|
|
2208
|
+
* @defaultValue "powerlines"
|
|
2209
|
+
*/
|
|
2210
|
+
framework?: string;
|
|
2202
2211
|
}
|
|
2203
2212
|
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
|
|
2204
2213
|
build?: TBuildConfig & {
|
|
@@ -2243,13 +2252,13 @@ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "
|
|
|
2243
2252
|
};
|
|
2244
2253
|
type LintResolvedConfig = Required<LintConfig>;
|
|
2245
2254
|
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
2246
|
-
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"
|
|
2255
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
2247
2256
|
assets: ResolvedAssetGlob[];
|
|
2248
|
-
}
|
|
2257
|
+
}>;
|
|
2249
2258
|
/**
|
|
2250
2259
|
* The resolved options for the Powerlines project configuration.
|
|
2251
2260
|
*/
|
|
2252
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "build" | "transform" | "override" | "root" | "variant" | "type" | "
|
|
2261
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "build" | "transform" | "override" | "framework">> & {
|
|
2253
2262
|
/**
|
|
2254
2263
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
2255
2264
|
*/
|
|
@@ -1989,9 +1989,27 @@ interface OutputConfig {
|
|
|
1989
1989
|
/**
|
|
1990
1990
|
* The path of the generated runtime declaration file relative to the workspace root.
|
|
1991
1991
|
*
|
|
1992
|
-
* @defaultValue "\{projectRoot\}/
|
|
1992
|
+
* @defaultValue "\{projectRoot\}/powerlines.d.ts"
|
|
1993
1993
|
*/
|
|
1994
1994
|
dts?: string | false;
|
|
1995
|
+
/**
|
|
1996
|
+
* A prefix to use for identifying builtin modules
|
|
1997
|
+
*
|
|
1998
|
+
* @remarks
|
|
1999
|
+
* This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
|
|
2000
|
+
*
|
|
2001
|
+
* @defaultValue "powerlines"
|
|
2002
|
+
*/
|
|
2003
|
+
builtinPrefix?: string;
|
|
2004
|
+
/**
|
|
2005
|
+
* The folder where the generated runtime modules/builtins will be located
|
|
2006
|
+
*
|
|
2007
|
+
* @remarks
|
|
2008
|
+
* This folder will contain all runtime modules and builtins generated during the "prepare" phase.
|
|
2009
|
+
*
|
|
2010
|
+
* @defaultValue "\{projectRoot\}/.powerlines"
|
|
2011
|
+
*/
|
|
2012
|
+
runtimeFolder?: string;
|
|
1995
2013
|
/**
|
|
1996
2014
|
* The module format of the output files
|
|
1997
2015
|
*
|
|
@@ -2009,19 +2027,6 @@ interface OutputConfig {
|
|
|
2009
2027
|
*/
|
|
2010
2028
|
assets?: Array<string | AssetGlob>;
|
|
2011
2029
|
}
|
|
2012
|
-
interface TransformConfig {
|
|
2013
|
-
/**
|
|
2014
|
-
* The Babel configuration options to use for the build process
|
|
2015
|
-
*/
|
|
2016
|
-
babel?: BabelUserConfig;
|
|
2017
|
-
/**
|
|
2018
|
-
* Reflection configuration options for the Deepkit TSC custom transformers
|
|
2019
|
-
*
|
|
2020
|
-
* @remarks
|
|
2021
|
-
* These options will be merged with the `tsconfig.json` file and the `tsconfigRaw` options.
|
|
2022
|
-
*/
|
|
2023
|
-
deepkit?: DeepkitOptions;
|
|
2024
|
-
}
|
|
2025
2030
|
interface BaseConfig {
|
|
2026
2031
|
/**
|
|
2027
2032
|
* The name of the project
|
|
@@ -2072,20 +2077,18 @@ interface BaseConfig {
|
|
|
2072
2077
|
/**
|
|
2073
2078
|
* Configuration for the transformation of the source code
|
|
2074
2079
|
*/
|
|
2075
|
-
transform?:
|
|
2080
|
+
transform?: Record<string, any>;
|
|
2076
2081
|
/**
|
|
2077
2082
|
* Options to to provide to the build process
|
|
2078
2083
|
*/
|
|
2079
2084
|
build?: BuildConfig;
|
|
2080
2085
|
/**
|
|
2081
|
-
*
|
|
2086
|
+
* Configuration for documentation generation
|
|
2082
2087
|
*
|
|
2083
2088
|
* @remarks
|
|
2084
|
-
* This
|
|
2085
|
-
*
|
|
2086
|
-
* @defaultValue "storm"
|
|
2089
|
+
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
2087
2090
|
*/
|
|
2088
|
-
|
|
2091
|
+
docs?: Record<string, any>;
|
|
2089
2092
|
/**
|
|
2090
2093
|
* The path to the tsconfig file to be used by the compiler
|
|
2091
2094
|
*
|
|
@@ -2199,6 +2202,12 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
2199
2202
|
* Environment-specific configurations
|
|
2200
2203
|
*/
|
|
2201
2204
|
environments?: Record<string, EnvironmentConfig>;
|
|
2205
|
+
/**
|
|
2206
|
+
* A string identifier that allows a child framework or tool to identify itself when using Powerlines.
|
|
2207
|
+
*
|
|
2208
|
+
* @defaultValue "powerlines"
|
|
2209
|
+
*/
|
|
2210
|
+
framework?: string;
|
|
2202
2211
|
}
|
|
2203
2212
|
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
|
|
2204
2213
|
build?: TBuildConfig & {
|
|
@@ -2243,13 +2252,13 @@ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "
|
|
|
2243
2252
|
};
|
|
2244
2253
|
type LintResolvedConfig = Required<LintConfig>;
|
|
2245
2254
|
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
2246
|
-
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"
|
|
2255
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
2247
2256
|
assets: ResolvedAssetGlob[];
|
|
2248
|
-
}
|
|
2257
|
+
}>;
|
|
2249
2258
|
/**
|
|
2250
2259
|
* The resolved options for the Powerlines project configuration.
|
|
2251
2260
|
*/
|
|
2252
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "build" | "transform" | "override" | "root" | "variant" | "type" | "
|
|
2261
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "build" | "transform" | "override" | "framework">> & {
|
|
2253
2262
|
/**
|
|
2254
2263
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
2255
2264
|
*/
|
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, b as __ΩSecretsInterface } from '../runtime-
|
|
2
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from '../runtime-Cg76ZSEX.cjs';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import '@stryke/env/types';
|
|
5
5
|
import '@stryke/types/configuration';
|
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, b as __ΩSecretsInterface } from '../runtime-
|
|
2
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from '../runtime-CWg6Y3Nw.js';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
4
|
import '@stryke/env/types';
|
|
5
5
|
import '@stryke/types/configuration';
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
2
|
-
import { c as BabelUserConfig, U as UserConfig, R as ResolvedConfig, d as BabelResolvedConfig, e as PluginContext, f as Reflection, E as EnvInterface, S as SecretsInterface } from '../runtime-
|
|
2
|
+
import { c as BabelUserConfig, U as UserConfig, R as ResolvedConfig, d as BabelResolvedConfig, e as PluginContext, f as Reflection, E as EnvInterface, S as SecretsInterface } from '../runtime-Cg76ZSEX.cjs';
|
|
3
3
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
4
4
|
import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
2
|
-
import { c as BabelUserConfig, U as UserConfig, R as ResolvedConfig, d as BabelResolvedConfig, e as PluginContext, f as Reflection, E as EnvInterface, S as SecretsInterface } from '../runtime-
|
|
2
|
+
import { c as BabelUserConfig, U as UserConfig, R as ResolvedConfig, d as BabelResolvedConfig, e as PluginContext, f as Reflection, E as EnvInterface, S as SecretsInterface } from '../runtime-CWg6Y3Nw.js';
|
|
3
3
|
import { DotenvParseOutput } from '@stryke/env/types';
|
|
4
4
|
import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
|
|
5
5
|
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, b as __ΩSecretsInterface } from '../runtime-
|
|
1
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from '../runtime-Cg76ZSEX.cjs';
|
|
2
2
|
import '@stryke/env/get-env-paths';
|
|
3
3
|
import '@stryke/types/package-json';
|
|
4
4
|
import 'jiti';
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from '../runtime-
|
|
1
|
+
export { E as EnvInterface, S as SecretsInterface, _ as __ΩEnvInterface, b as __ΩSecretsInterface } from '../runtime-CWg6Y3Nw.js';
|
|
2
2
|
import '@stryke/env/get-env-paths';
|
|
3
3
|
import '@stryke/types/package-json';
|
|
4
4
|
import 'jiti';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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": {
|
|
@@ -185,9 +185,9 @@
|
|
|
185
185
|
"@alloy-js/typescript": "^0.20.0",
|
|
186
186
|
"@babel/core": "^7.28.4",
|
|
187
187
|
"@babel/types": "^7.28.4",
|
|
188
|
-
"@powerlines/alloy": "^0.
|
|
189
|
-
"@powerlines/plugin-babel": "^0.
|
|
190
|
-
"@powerlines/plugin-plugin": "^0.
|
|
188
|
+
"@powerlines/alloy": "^0.2.0",
|
|
189
|
+
"@powerlines/plugin-babel": "^0.3.0",
|
|
190
|
+
"@powerlines/plugin-plugin": "^0.3.0",
|
|
191
191
|
"@storm-software/config-tools": "^1.188.6",
|
|
192
192
|
"@stryke/capnp": "^0.11.24",
|
|
193
193
|
"@stryke/env": "^0.19.12",
|
|
@@ -196,18 +196,18 @@
|
|
|
196
196
|
"@stryke/string-format": "^0.12.0",
|
|
197
197
|
"@stryke/type-checks": "^0.3.10",
|
|
198
198
|
"@stryke/types": "^0.10.0",
|
|
199
|
-
"powerlines": "^0.
|
|
199
|
+
"powerlines": "^0.3.0"
|
|
200
200
|
},
|
|
201
201
|
"devDependencies": {
|
|
202
202
|
"@alloy-js/babel-preset": "^0.2.1",
|
|
203
203
|
"@babel/preset-typescript": "^7.27.1",
|
|
204
|
-
"@powerlines/nx": "^0.
|
|
204
|
+
"@powerlines/nx": "^0.3.0",
|
|
205
205
|
"@storm-software/tsup": "^0.2.4",
|
|
206
206
|
"@types/node": "^22.18.11",
|
|
207
207
|
"tsup": "8.4.0",
|
|
208
|
-
"typescript": "5.9.3",
|
|
209
|
-
"vite": "^7.1.
|
|
208
|
+
"typescript": "^5.9.3",
|
|
209
|
+
"vite": "^7.1.11"
|
|
210
210
|
},
|
|
211
211
|
"publishConfig": { "access": "public" },
|
|
212
|
-
"gitHead": "
|
|
212
|
+
"gitHead": "fe5e201169810dd966ee328fa3dabf57077eea36"
|
|
213
213
|
}
|